diff --git a/.nx/version-plans/version-plan-1779246751432.md b/.nx/version-plans/version-plan-1779246751432.md new file mode 100644 index 0000000..e46ff94 --- /dev/null +++ b/.nx/version-plans/version-plan-1779246751432.md @@ -0,0 +1,5 @@ +--- +portal-sdk: major +--- + +Fix Developer Portal OpenAPI metadata and request body types. diff --git a/packages/portal-sdk/openapi.yaml b/packages/portal-sdk/openapi.yaml index 4efcdf7..b130ea3 100644 --- a/packages/portal-sdk/openapi.yaml +++ b/packages/portal-sdk/openapi.yaml @@ -1,7 +1,22 @@ openapi: 3.0.1 info: title: API7 Enterprise Developer Portal APIs - description: "API7 Enterprise Developer Portal APIs are RESTful APIs that allow you to create and manage developer portal resources. " + description: |- + API7 Enterprise Developer Portal APIs are RESTful APIs that allow you to create and manage developer portal resources. + + ## Base URL + + All API paths are relative to your API7 Developer Portal address, e.g. `https://your-api7-developer-portal`. + + ## Authentication + + Every request must include a Developer Portal token: + + - **Bearer Token**: Pass a valid Developer Portal token in the `Authorization` HTTP header. + + Most developer resource requests must also include the active developer ID: + + - **Developer ID**: Pass the active developer ID in the `X-Portal-Developer-ID` HTTP header where required by the operation. version: 0.11.0 servers: [] security: @@ -13,6 +28,8 @@ paths: - Developer summary: List Developers operationId: listDevelopers + security: + - BearerAuth: [] parameters: - $ref: "#/components/parameters/Page" - $ref: "#/components/parameters/PageSize" @@ -33,7 +50,10 @@ paths: - Developer summary: Create a developer operationId: createDeveloper + security: + - BearerAuth: [] requestBody: + required: true content: application/json: schema: @@ -53,6 +73,8 @@ paths: - Developer summary: Delete a developer operationId: deleteDeveloper + security: + - BearerAuth: [] parameters: - $ref: "#/components/parameters/DeveloperID" responses: @@ -72,6 +94,8 @@ paths: - API Product summary: List all API products operationId: listAPIProducts + security: + - BearerAuth: [] parameters: - $ref: "#/components/parameters/Page" - $ref: "#/components/parameters/PageSize" @@ -95,6 +119,8 @@ paths: - API Product summary: Get an API Product for Developer Portal operationId: getAPIProduct + security: + - BearerAuth: [] parameters: - $ref: "#/components/parameters/APIProductID" responses: @@ -114,9 +140,13 @@ paths: - API Product summary: Create a subscription for an API Product. operationId: createAPIProductSubscription + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/APIProductID" requestBody: + required: true content: application/json: schema: @@ -136,6 +166,9 @@ paths: - Subscription summary: List subscriptions. operationId: listSubscriptions + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/APIProductIDInQuery" - $ref: "#/components/parameters/ApplicationIDInQuery" @@ -159,7 +192,11 @@ paths: - Subscription summary: Create a subscription for an API Product operationId: createSubscription + security: + - BearerAuth: [] + DeveloperIDHeader: [] requestBody: + required: true content: application/json: schema: @@ -179,6 +216,9 @@ paths: - Subscription summary: Unsubscribe an API product for the given application operationId: deleteSubscription + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/SubscriptionID" responses: @@ -198,7 +238,11 @@ paths: - Application summary: Create an application by the logged in developer. operationId: createDeveloperApplication + security: + - BearerAuth: [] + DeveloperIDHeader: [] requestBody: + required: true content: application/json: schema: @@ -217,6 +261,9 @@ paths: - Application summary: List all applications for the logged in developer. operationId: listDeveloperApplications + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/APIProductIDInQuery" - $ref: "#/components/parameters/Search" @@ -240,6 +287,9 @@ paths: - Application summary: Get an application for the logged in developer. operationId: getDeveloperApplication + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" responses: @@ -258,9 +308,13 @@ paths: - Application summary: Update an application basic information by the logged in developer. operationId: updateDeveloperApplication + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" requestBody: + required: true content: application/json: schema: @@ -281,6 +335,9 @@ paths: - Application summary: Delete an application by the logged in developer. operationId: deleteDeveloperApplication + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" responses: @@ -300,9 +357,13 @@ paths: - Credential summary: Create an application credential operationId: createApplicationCredential + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" requestBody: + required: true content: application/json: schema: @@ -321,6 +382,9 @@ paths: - Credential summary: List all credentials for the logged in developer operationId: listApplicationCredentials + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" - $ref: "#/components/parameters/AuthMethod" @@ -346,6 +410,9 @@ paths: - Credential summary: Get an application credential for Developer Portal operationId: getApplicationCredential + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" - $ref: "#/components/parameters/ApplicationCredentialID" @@ -365,10 +432,14 @@ paths: - Credential summary: Update an application credential for Developer Portal operationId: upsertApplicationCredential + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" - $ref: "#/components/parameters/ApplicationCredentialID" requestBody: + required: true content: application/json: schema: @@ -389,6 +460,9 @@ paths: - Credential summary: Delete an application credential for Developer Portal operationId: deleteApplicationCredential + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" - $ref: "#/components/parameters/ApplicationCredentialID" @@ -409,10 +483,14 @@ paths: - Credential summary: Regenerate an application credential auth conf operationId: regenerateApplicationCredential + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationID" - $ref: "#/components/parameters/ApplicationCredentialID" requestBody: + required: true content: application/json: schema: @@ -435,6 +513,9 @@ paths: summary: Get API Calls description: Retrieve a list of API calls made by the user. operationId: getApiCalls + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationsIDs" - $ref: "#/components/parameters/APIProductIDs" @@ -456,6 +537,9 @@ paths: - Credential summary: List all Credentials operationId: listCredentials + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/ApplicationsIDs" - $ref: "#/components/parameters/AuthMethod" @@ -481,6 +565,9 @@ paths: - Label summary: Get all labels of a resource type operationId: listLabels + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/DeveloperPortalLabelResourceType" responses: @@ -498,6 +585,9 @@ paths: - System Settings summary: Get SMTP server settings status operationId: getSMTPServerStatus + security: + - BearerAuth: [] + DeveloperIDHeader: [] description: Get SMTP server settings status. responses: "200": @@ -514,6 +604,8 @@ paths: - System Settings summary: Get public access settings operationId: getPublicAccessSettings + security: + - BearerAuth: [] responses: "200": $ref: "#/components/responses/PortalPublicAccessResponse" @@ -529,6 +621,9 @@ paths: - DCR Provider summary: List all DCR providers operationId: listDCRProviders + security: + - BearerAuth: [] + DeveloperIDHeader: [] parameters: - $ref: "#/components/parameters/Page" - $ref: "#/components/parameters/PageSize" @@ -549,6 +644,10 @@ components: BearerAuth: type: http scheme: bearer + DeveloperIDHeader: + type: apiKey + in: header + name: X-Portal-Developer-ID schemas: ID: description: The object ID. @@ -615,7 +714,6 @@ components: required: - id - name - - status - created_at - updated_at properties: @@ -1364,7 +1462,7 @@ components: enum: - created_at - updated_at - description: "Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`." + description: "Field used to order resources, either `created_at` or `updated_at`." Search: name: search in: query diff --git a/packages/portal-sdk/src/generated/sdk.gen.ts b/packages/portal-sdk/src/generated/sdk.gen.ts index e40a214..d4d3f12 100644 --- a/packages/portal-sdk/src/generated/sdk.gen.ts +++ b/packages/portal-sdk/src/generated/sdk.gen.ts @@ -32,14 +32,14 @@ export const listDevelopers = (options?: O /** * Create a developer */ -export const createDeveloper = (options?: Options) => (options?.client ?? client).post({ +export const createDeveloper = (options: Options) => (options.client ?? client).post({ responseTransformer: createDeveloperResponseTransformer, responseType: 'json', url: '/api/developers', ...options, headers: { 'Content-Type': 'application/json', - ...options?.headers + ...options.headers } }); @@ -91,12 +91,12 @@ export const listSubscriptions = (options? /** * Create a subscription for an API Product */ -export const createSubscription = (options?: Options) => (options?.client ?? client).post({ +export const createSubscription = (options: Options) => (options.client ?? client).post({ url: '/api/subscriptions', ...options, headers: { 'Content-Type': 'application/json', - ...options?.headers + ...options.headers } }); @@ -118,14 +118,14 @@ export const listDeveloperApplications = ( /** * Create an application by the logged in developer. */ -export const createDeveloperApplication = (options?: Options) => (options?.client ?? client).post({ +export const createDeveloperApplication = (options: Options) => (options.client ?? client).post({ responseTransformer: createDeveloperApplicationResponseTransformer, responseType: 'json', url: '/api/applications', ...options, headers: { 'Content-Type': 'application/json', - ...options?.headers + ...options.headers } }); diff --git a/packages/portal-sdk/src/generated/types.gen.ts b/packages/portal-sdk/src/generated/types.gen.ts index da168a5..0237c92 100644 --- a/packages/portal-sdk/src/generated/types.gen.ts +++ b/packages/portal-sdk/src/generated/types.gen.ts @@ -574,12 +574,12 @@ export const Direction = { ASC: 'asc', DESC: 'desc' } as const; export type Direction = typeof Direction[keyof typeof Direction]; /** - * Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`. + * Field used to order resources, either `created_at` or `updated_at`. */ export const OrderBy = { CREATED_AT: 'created_at', UPDATED_AT: 'updated_at' } as const; /** - * Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`. + * Field used to order resources, either `created_at` or `updated_at`. */ export type OrderBy = typeof OrderBy[keyof typeof OrderBy]; @@ -774,7 +774,7 @@ export type ListDevelopersResponses = { export type ListDevelopersResponse = ListDevelopersResponses[keyof ListDevelopersResponses]; export type CreateDeveloperData = { - body?: CreateDeveloperReq; + body: CreateDeveloperReq; path?: never; query?: never; url: '/api/developers'; @@ -907,7 +907,7 @@ export type ListApiProductsData = { */ direction?: 'asc' | 'desc'; /** - * Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`. + * Field used to order resources, either `created_at` or `updated_at`. */ order_by?: 'created_at' | 'updated_at'; /** @@ -1034,7 +1034,7 @@ export type GetApiProductResponses = { export type GetApiProductResponse = GetApiProductResponses[keyof GetApiProductResponses]; export type CreateApiProductSubscriptionData = { - body?: CreateApiProductSubscriptionReq; + body: CreateApiProductSubscriptionReq; path: { /** * The unique identifier of the API product. @@ -1166,7 +1166,7 @@ export type ListSubscriptionsResponses = { export type ListSubscriptionsResponse = ListSubscriptionsResponses[keyof ListSubscriptionsResponses]; export type CreateSubscriptionData = { - body?: CreateSubscriptionReq; + body: CreateSubscriptionReq; path?: never; query?: never; url: '/api/subscriptions'; @@ -1297,7 +1297,7 @@ export type ListDeveloperApplicationsData = { */ labels?: string; /** - * Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`. + * Field used to order resources, either `created_at` or `updated_at`. */ order_by?: 'created_at' | 'updated_at'; /** @@ -1364,7 +1364,7 @@ export type ListDeveloperApplicationsResponses = { export type ListDeveloperApplicationsResponse = ListDeveloperApplicationsResponses[keyof ListDeveloperApplicationsResponses]; export type CreateDeveloperApplicationData = { - body?: CreateDeveloperApplicationReq; + body: CreateDeveloperApplicationReq; path?: never; query?: never; url: '/api/applications'; @@ -1541,7 +1541,7 @@ export type GetDeveloperApplicationResponses = { export type GetDeveloperApplicationResponse = GetDeveloperApplicationResponses[keyof GetDeveloperApplicationResponses]; export type UpdateDeveloperApplicationData = { - body?: CreateDeveloperApplicationReq; + body: CreateDeveloperApplicationReq; path: { application_id: Id; }; @@ -1695,7 +1695,7 @@ export type ListApplicationCredentialsResponses = { export type ListApplicationCredentialsResponse = ListApplicationCredentialsResponses[keyof ListApplicationCredentialsResponses]; export type CreateApplicationCredentialData = { - body?: CreateApplicationCredentialReq; + body: CreateApplicationCredentialReq; path: { application_id: Id; }; @@ -1882,7 +1882,7 @@ export type GetApplicationCredentialResponses = { export type GetApplicationCredentialResponse = GetApplicationCredentialResponses[keyof GetApplicationCredentialResponses]; export type UpsertApplicationCredentialData = { - body?: UpdateApplicationCredentialReq; + body: UpdateApplicationCredentialReq; path: { application_id: Id; /** @@ -1949,7 +1949,7 @@ export type UpsertApplicationCredentialResponses = { export type UpsertApplicationCredentialResponse = UpsertApplicationCredentialResponses[keyof UpsertApplicationCredentialResponses]; export type RegenerateApplicationCredentialData = { - body?: RegenerateApplicationCredentialReq; + body: RegenerateApplicationCredentialReq; path: { application_id: Id; /** @@ -2331,7 +2331,7 @@ export type ListDcrProvidersData = { */ direction?: 'asc' | 'desc'; /** - * Ascending or descending order to list the resources, by `created_at` or `updated_by` configured in `order_by`. + * Field used to order resources, either `created_at` or `updated_at`. */ order_by?: 'created_at' | 'updated_at'; /**