From edf1603ea26a4c64c13d4dc50e6dd9331a238dff Mon Sep 17 00:00:00 2001 From: chashikajw Date: Mon, 9 Oct 2023 17:45:20 +0530 Subject: [PATCH] Revamp backoffice-api yaml with new scopes --- .../backoffice/resources/backoffice-api.yaml | 555 ++---------------- .../ballerina/types.bal | 216 ++----- 2 files changed, 94 insertions(+), 677 deletions(-) diff --git a/backoffice/backoffice-domain-service/ballerina/modules/backoffice/resources/backoffice-api.yaml b/backoffice/backoffice-domain-service/ballerina/modules/backoffice/resources/backoffice-api.yaml index 6b8c15ab2..96064e0f6 100644 --- a/backoffice/backoffice-domain-service/ballerina/modules/backoffice/resources/backoffice-api.yaml +++ b/backoffice/backoffice-domain-service/ballerina/modules/backoffice/resources/backoffice-api.yaml @@ -104,6 +104,7 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view x-code-samples: - lang: Curl @@ -161,6 +162,7 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view x-code-samples: - lang: Curl @@ -225,8 +227,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_publish - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -280,72 +282,14 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:api_definition_view x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://api.am.wso2.com:9095/api/backoffice/v1/apis/01234567-0123-0123-0123-012345678901/definition"' operationId: getAPIDefinition - /apis/{apiId}/resource-paths: - get: - tags: - - APIs - summary: Get Resource Paths of an API - description: | - This operation can be used to retrieve resource paths defined for a specific API. - parameters: - - $ref: '#/components/parameters/apiId' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. - ResourcePaths returned. - headers: - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in the future). - schema: - type: string - Last-Modified: - description: | - Date and time the resource has been modified the last time. - Used by caches, or in conditional requests (Will be supported in the future). - schema: - type: string - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ResourcePathList' - 304: - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in the future). - content: {} - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:api_view - - apk:api_manage - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://api.am.wso2.com:9095/api/backoffice/v1/apis/01234567-0123-0123-0123-012345678901/resource-paths"' - operationId: getAPIResourcePaths - /apis/{apiId}/thumbnail: get: tags: @@ -392,9 +336,8 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:api_publish - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -463,8 +406,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_publish - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -515,8 +458,8 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:document_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -571,7 +514,8 @@ paths: $ref: '#/components/responses/UnsupportedMediaType' security: - OAuth2Security: - - apk:api_view + - apk:backoffice_admin + - apk:api_publish - apk:document_manage x-code-samples: - lang: Curl @@ -629,8 +573,8 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:document_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -694,7 +638,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: - - apk:api_view + - apk:backoffice_admin + - apk:api_publish - apk:document_manage x-code-samples: - lang: Curl @@ -724,7 +669,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: - - apk:api_view + - apk:backoffice_admin + - apk:api_publish - apk:document_manage x-code-samples: - lang: Curl @@ -801,8 +747,8 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:document_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -876,7 +822,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: - - apk:api_view + - apk:backoffice_admin + - apk:api_publish - apk:document_manage x-code-samples: - lang: Curl @@ -912,9 +859,8 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:comment_view - - apk:comment_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -984,8 +930,9 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin + - apk:api_publish - apk:comment_write - - apk:comment_manage x-code-samples: - lang: Curl source: 'curl -k -X POST -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1038,15 +985,14 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:comment_view - - apk:comment_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://localhost:9443/api/apk/backoffice/v1/apis/01234567-0123-0123-0123-012345678901/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4"' - patch: + put: tags: - Comments summary: Edit a comment @@ -1111,8 +1057,9 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:comment_write - - apk:comment_manage + - apk:api_publish x-code-samples: - lang: Curl source: 'curl -k -X PATCH -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1150,8 +1097,9 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:comment_write - - apk:comment_manage + - apk:api_publish x-code-samples: - lang: Curl source: curl -k -X DELETE -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1204,9 +1152,8 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:comment_view - - apk:comment_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1270,9 +1217,8 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:subscription_view - - apk:subscription_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1301,9 +1247,8 @@ paths: $ref: '#/components/responses/NotFound' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:subscription_view - - apk:subscription_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1360,7 +1305,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: - - apk:subscription_block + - apk:backoffice_admin + - apk:api_publish - apk:subscription_manage x-code-samples: - lang: Curl @@ -1405,7 +1351,8 @@ paths: $ref: '#/components/responses/PreconditionFailed' security: - OAuth2Security: - - apk:subscription_block + - apk:backoffice_admin + - apk:api_publish - apk:subscription_manage x-code-samples: - lang: Curl @@ -1413,58 +1360,6 @@ paths: "https://api.am.wso2.com:9095/api/backoffice/v1/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809"' operationId: unBlockSubscription - - ###################################################### - # The "Thorttling Tier Collection" resource APIs - ###################################################### - /usage-plans: - get: - tags: - - Usage Plan - summary: Get All Usage Plans - description: | - This operation can be used to list the available usage plans. - operationId: getAllUsagePlans - parameters: - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. - List of policies returned. - headers: - ETag: - description: | - Entity Tag of the response resource. - Used by caches, or in conditional requests (Will be supported in the future). - schema: - type: string - Content-Type: - description: The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/UsagePlanList' - 304: - description: | - Not Modified. - Empty body because the client has already the latest version of the requested resource (Will be supported in the future). - content: {} - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:api_view - - apk:tier_view - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://api.am.wso2.com:9095/api/backoffice/v1/usage-plans"' - ###################################################### # The "Content Search Results" resource APIs ###################################################### @@ -1516,45 +1411,14 @@ paths: $ref: '#/components/responses/NotAcceptable' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://api.am.wso2.com:9095/api/backoffice/v1/search?query=pizza"' operationId: search - ###################################################### - # The BackOffice settings resource APIs - ###################################################### - /settings: - get: - tags: - - Settings - summary: Retrieve BackOffice Settings - description: | - Retrieve BackOffice settings - responses: - 200: - description: | - OK. - Settings returned - content: - application/json: - schema: - $ref: '#/components/schemas/Settings' - 404: - $ref: '#/components/responses/NotFound' - security: - - OAuth2Security: - - apk:api_view - - apk:backoffice_settings - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://api.am.wso2.com:9095/api/backoffice/v1/settings"' - operationId: getSettings - ###################################################### # The "API Category Collection" resource API ###################################################### @@ -1576,8 +1440,8 @@ paths: $ref: '#/components/schemas/APICategoryList' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_view - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1632,8 +1496,8 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: + - apk:backoffice_admin - apk:api_publish - - apk:api_manage x-code-samples: - lang: Curl source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1667,8 +1531,8 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apk:api_publish - - apk:api_manage + - apk:backoffice_admin + - apk:api_view x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" @@ -1702,51 +1566,14 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apk:api_publish - - apk:api_create - - apk:api_manage + - apk:backoffice_admin + - apk:api_view x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://api.am.wso2.com:9095/api/backoffice/v1/apis/01234567-0123-0123-0123-012345678901/lifecycle-state"' operationId: getAPILifecycleState -###################################################### -# The "Business Plans Collection" resource API -###################################################### - /business-plans: - get: - tags: - - Business Plan (Collection) - summary: Get all Business Plans - description: | - This operation can be used to retrieve all Business Plans - parameters: - - $ref: '#/components/parameters/Accept' - responses: - 200: - description: | - OK. - Plans returned - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/BusinessPlanList' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:tier_view - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://api.am.wso2.com:9095/api/backoffice/v1/business-plans"' - operationId: getAllBusinessPlans + components: schemas: APIDefinition: @@ -1920,6 +1747,21 @@ components: minLength: 1 type: string example: pizza + organization: + maxLength: 232 + minLength: 1 + type: string + example: org1 + lifeCycleStatus: + maxLength: 232 + minLength: 1 + type: string + example: CREATED + provider: + maxLength: 232 + minLength: 1 + type: string + example: user1 version: maxLength: 30 minLength: 1 @@ -2038,91 +1880,7 @@ components: items: $ref: '#/components/schemas/APIDeployment' - BusinessPlanList: - title: Business Plan List - type: object - properties: - count: - type: integer - description: | - Number of Business Plans returned. - example: 1 - list: - type: array - items: - $ref: '#/components/schemas/BusinessPlan' - BusinessPlan: - title: Business Plan - allOf: - - required: - - defaultLimit - type: object - properties: - defaultLimit: - $ref: '#/components/schemas/ThrottleLimit' - rateLimitCount: - type: integer - description: Burst control request count - example: 10 - rateLimitTimeUnit: - type: string - description: Burst control time unit - example: min - subscriberCount: - type: integer - description: Number of subscriptions allowed - example: 10 - customAttributes: - type: array - description: | - Custom attributes added to the Subscription Throttling Policy - example: [] - items: - $ref: '#/components/schemas/CustomAttribute' - permissions: - $ref: '#/components/schemas/BusinessPlanPermission' - BusinessPlanPermission: - title: Business Plan Permission - required: - - permissionType - - roles - type: object - properties: - permissionType: - type: string - example: deny - enum: - - ALLOW - - DENY - roles: - type: array - example: - - Internal/everyone - items: - type: string - ThrottleLimit: - title: Throttle Limit - required: - - type - type: object - properties: - type: - type: string - description: | - Type of the throttling limit. Allowed values are "REQUESTCOUNTLIMIT" and "BANDWIDTHLIMIT". - Please see schemas of "RequestCountLimit" and "BandwidthLimit" throttling limit types in - Definitions section. - example: REQUESTCOUNTLIMIT - enum: - - REQUESTCOUNTLIMIT - - BANDWIDTHLIMIT - - EVENTCOUNTLIMIT - requestCount: - $ref: '#/components/schemas/RequestCountLimit' - bandwidth: - $ref: '#/components/schemas/BandwidthLimit' - eventCount: - $ref: '#/components/schemas/EventCountLimit' + #----------------------------------------------------- # The API Revision resource #----------------------------------------------------- @@ -2406,23 +2164,6 @@ components: type: string readOnly: true example: admin - UsagePlanList: - title: Usage Plan list - type: object - properties: - count: - type: integer - description: | - Number of Usage Plans returned. - example: 1 - list: - type: array - description: | - Array of Usage Policies - items: - $ref: '#/components/schemas/UsagePlan' - pagination: - $ref: '#/components/schemas/Pagination' SubscriptionList: title: Subscription List type: object @@ -2466,159 +2207,7 @@ components: - REJECTED - TIER_UPDATE_PENDING - DELETE_PENDING - UsageLimitBase: - title: Throttle Limit Base - required: - - timeUnit - - unitTime - type: object - properties: - timeUnit: - type: string - description: Unit of the time. Allowed values are "sec", "min", "hour", - "day" - example: min - unitTime: - type: integer - description: Time limit that the usage limit applies. - example: 10 - UsageLimit: - title: Usage Limit - required: - - type - type: object - properties: - type: - type: string - description: | - Type of the usage limit. Allowed values are "REQUESTCOUNTLIMIT" and "BANDWIDTHLIMIT". - Please see schemas of "RequestCountLimit" and "BandwidthLimit" usage limit types in - Definitions section. - example: REQUESTCOUNTLIMIT - enum: - - REQUESTCOUNTLIMIT - - BANDWIDTHLIMIT - - EVENTCOUNTLIMIT - requestCount: - $ref: '#/components/schemas/RequestCountLimit' - bandwidth: - $ref: '#/components/schemas/BandwidthLimit' - eventCount: - $ref: '#/components/schemas/EventCountLimit' - BandwidthLimit: - title: Bandwidth Limit object - allOf: - - $ref: '#/components/schemas/UsageLimitBase' - - required: - - dataAmount - - dataUnit - type: object - properties: - dataAmount: - type: integer - description: Amount of data allowed to be transferred - format: int64 - example: 1000 - dataUnit: - type: string - description: Unit of data allowed to be transferred. Allowed values are - "KB", "MB" and "GB" - example: KB - RequestCountLimit: - title: Request Count Limit object - allOf: - - $ref: '#/components/schemas/UsageLimitBase' - - required: - - requestCount - type: object - properties: - requestCount: - type: integer - description: Maximum number of requests allowed - format: int64 - example: 30 - EventCountLimit: - title: Event Count Limit object - allOf: - - $ref: '#/components/schemas/UsageLimitBase' - - required: - - eventCount - type: object - properties: - eventCount: - type: integer - description: Maximum number of events allowed - format: int64 - example: 3000 - UsagePlan: - title: Usage Plan - allOf: - - required: - - defaultLimit - type: object - properties: - policyId: - type: integer - description: Id of policy - example: 1 - uuid: - type: string - description: policy uuid - example: 0c6439fd-9b16-3c2e-be6e-1086e0b9aa93 - policyName: - maxLength: 60 - minLength: 1 - type: string - description: Name of policy - example: 30PerMin - displayName: - type: string - description: Display name of the policy - example: 30PerMin - maxLength: 512 - description: - maxLength: 1024 - type: string - description: Description of the policy - example: Allows 30 request per minute - organization: - type: string - description: Usage policy organization - example: wso2 - defaultLimit: - $ref: '#/components/schemas/UsageLimit' - rateLimitCount: - type: integer - description: Burst control request count - example: 10 - rateLimitTimeUnit: - type: string - description: Burst control time unit - example: min - subscriberCount: - type: integer - description: Number of subscriptions allowed - example: 10 - customAttributes: - type: array - description: | - Custom attributes added to the Usage plan - example: [ ] - items: - $ref: '#/components/schemas/CustomAttribute' - stopOnQuotaReach: - type: boolean - description: | - This indicates the action to be taken when a user goes beyond the allocated quota. If checked, the user's requests will be dropped. If unchecked, the requests will be allowed to pass through. - default: false - billingPlan: - type: string - description: | - define whether this is Paid or a Free plan. Allowed values are FREE or COMMERCIAL. - example: FREE - permissions: - $ref: '#/components/schemas/SubscriptionThrottlePolicyPermission' CustomAttribute: title: Name-Value pair required: @@ -2653,24 +2242,6 @@ components: - Internal/everyone items: type: string - APIMonetizationUsage: - title: API monetization usage object - type: object - properties: - properties: - type: object - additionalProperties: - type: string - description: Map of custom properties related to monetization usage - APIRevenue: - title: API revenue data object - type: object - properties: - properties: - type: object - additionalProperties: - type: string - description: Map of custom properties related to API revenue Error: title: Error object returned with 4XX HTTP Status required: @@ -3679,17 +3250,9 @@ components: tokenUrl: https://localhost:9443/oauth2/token scopes: openid: Authorize access to user details + apk:backoffice_admin: Manage all admin operations apk:api_view: View API - apk:api_publish: Publish API - apk:api_manage: Manage all API related operations - apk:api_definition_view: View, Retrieve API definition + apk:api_publish: Manage all API related operations apk:document_manage: Create, update and delete API documents - apk:comment_view: Read permission to comments - apk:comment_manage: Read and Write comments apk:comment_write: Write permission to comments - apk:subscription_view: View Subscription apk:subscription_manage: Manage all Subscription related operations - apk:subscription_block: Block Subscription - apk:tier_view: View throttling policies - apk:backoffice_settings: Retrieve store settings - apk:api_create: Create API \ No newline at end of file diff --git a/backoffice/backoffice-domain-service/ballerina/types.bal b/backoffice/backoffice-domain-service/ballerina/types.bal index c802bda53..6fbe54a0b 100644 --- a/backoffice/backoffice-domain-service/ballerina/types.bal +++ b/backoffice/backoffice-domain-service/ballerina/types.bal @@ -1,5 +1,8 @@ -import ballerina/http; +// AUTO-GENERATED FILE. +// This file is auto-generated by the Ballerina OpenAPI tool. + import ballerina/constraint; +import ballerina/http; public type NotAcceptableError record {| *http:NotAcceptable; @@ -11,6 +14,11 @@ public type UnsupportedMediaTypeError record {| Error body; |}; +public type OkLifecycleState record {| + *http:Ok; + LifecycleState body; +|}; + public type ForbiddenError record {| *http:Forbidden; Error body; @@ -31,18 +39,13 @@ public type PreconditionFailedError record {| Error body; |}; -public type CreatedComment record {| - *http:Created; - Comment body; -|}; - public type NotFoundError record {| *http:NotFound; Error body; |}; -public type CreatedDocument record {| - *http:Created; +public type OkDocument record {| + *http:Ok; Document body; |}; @@ -63,13 +66,6 @@ public type DocumentList record { Pagination pagination?; }; -public type UsageLimitBase record { - # Unit of the time. Allowed values are "sec", "min", "hour", "day" - string timeUnit; - # Time limit that the usage limit applies. - int unitTime; -}; - public type APIScope record { Scope scope; }; @@ -78,15 +74,15 @@ public type Document record { string documentId?; @constraint:String {maxLength: 60, minLength: 1} string name; - string documentType; + "HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER" documentType?; @constraint:String {maxLength: 32766, minLength: 1} string summary?; - string sourceType; + "INLINE"|"MARKDOWN"|"URL"|"FILE" sourceType; string sourceUrl?; string fileName?; string inlineContent?; string otherTypeName?; - string visibility; + "OWNER_ONLY"|"PRIVATE"|"API_LEVEL" visibility; string createdTime?; string createdBy?; string lastUpdatedTime?; @@ -116,12 +112,6 @@ public type Pagination record { string previous?; }; -public type EventCountLimit record { - *UsageLimitBase; - # Maximum number of events allowed - int eventCount; -}; - public type ResourcePath record { int id; string resourcePath?; @@ -135,7 +125,7 @@ public type API_additionalProperties record { }; public type FileInfo record { - # relative location of the file (excluding the base context and host of the Publisher API) + # name of the file string fileName?; # media-type of the file string mediaType?; @@ -151,67 +141,21 @@ public type APIOperations record { public type APIList record { # Number of APIs returned. int count?; - API[] list?; + APIInfo[] list?; Pagination pagination?; }; -public type BusinessPlan record { - *Policy; - *GraphQLQuery; - ThrottleLimit defaultLimit; - # Burst control request count - int rateLimitCount?; - # Burst control time unit - string rateLimitTimeUnit?; - # Number of subscriptions allowed - int subscriberCount?; - # Custom attributes added to the Subscription Throttling Policy - CustomAttribute[] customAttributes?; - BusinessPlanPermission permissions?; -}; - -public type Policy record { - # Id of plan - string planId?; - # Name of plan - @constraint:String {maxLength: 60, minLength: 1} - string planName; - # Display name of the policy - @constraint:String {maxLength: 512} - string displayName?; - # Description of the policy - @constraint:String {maxLength: 1024} - string description?; - # Indicates whether the policy is deployed successfully or not. - boolean isDeployed = false; - # Indicates the type of throttle policy - string 'type?; -}; - -public type GraphQLQuery record { - # Maximum Complexity of the GraphQL query - int graphQLMaxComplexity?; - # Maximum Depth of the GraphQL query - int graphQLMaxDepth?; -}; - -public type APIMonetizationUsage record { - # Map of custom properties related to monetization usage - record {} properties?; -}; - public type Subscription record { string subscriptionId; ApplicationInfo applicationInfo; string usagePlan; - string subscriptionStatus; + "BLOCKED"|"PROD_ONLY_BLOCKED"|"UNBLOCKED"|"ON_HOLD"|"REJECTED"|"TIER_UPDATE_PENDING"|"DELETE_PENDING" subscriptionStatus; }; public type Settings record { # The Developer Portal URL string devportalUrl?; Environment[] environment?; - string[] scopes?; MonetizationAttribute[] monetizationAttributes?; # Is Document Visibility configuration enabled boolean docVisibilityEnabled?; @@ -227,12 +171,6 @@ public type APIRevision record { string createdTime?; }; -public type BusinessPlanList record { - # Number of Business Plans returned. - int count?; - BusinessPlan[] list?; -}; - public type APIExternalStoreList record { # Number of external stores returned. int count?; @@ -259,17 +197,7 @@ public type APIMonetizationInfo record { # Flag to indicate the monetization status boolean enabled; # Map of custom properties related to monetization - record {} properties?; -}; - -public type ThrottleLimit record { - # Type of the throttling limit. Allowed values are "REQUESTCOUNTLIMIT" and "BANDWIDTHLIMIT". - # Please see schemas of "RequestCountLimit" and "BandwidthLimit" throttling limit types in - # Definitions section. - string 'type; - RequestCountLimit requestCount?; - BandwidthLimit bandwidth?; - EventCountLimit eventCount?; + record {|string...;|} properties?; }; public type LifecycleHistoryItem record { @@ -279,14 +207,6 @@ public type LifecycleHistoryItem record { string updatedTime?; }; -public type UsagePlanList record { - # Number of Usage Plans returned. - int count?; - # Array of Usage Policies - UsagePlan[] list?; - Pagination pagination?; -}; - public type APIDeployment record { @constraint:String {maxLength: 255, minLength: 1} string name?; @@ -309,7 +229,7 @@ public type MonetizationAttribute record { }; public type APIDefinition record { - string 'type; + "swagger"|"graphql"|"wsdl"|"async" 'type; string schemaDefinition?; }; @@ -338,11 +258,6 @@ public type CommentList record { Pagination pagination?; }; -public type BusinessPlanPermission record { - string permissionType; - string[] roles; -}; - public type CustomAttribute record { # Name of the custom attribute string name; @@ -358,11 +273,6 @@ public type ErrorListItem record { string description?; }; -public type APIRevenue record { - # Map of custom properties related to API revenue - record {} properties?; -}; - public type APICategoryList record { # Number of API categories returned. int count?; @@ -371,7 +281,7 @@ public type APICategoryList record { public type DocumentId_content_body record { # Document to upload - string file?; + record {byte[] fileContent; string fileName;} file?; # Inline content of the document string inlineContent?; }; @@ -396,9 +306,9 @@ public type ModifiableAPI record { string description?; boolean hasThumbnail?; # State of the API. Only published APIs are visible on the Developer Portal - string state = "CREATED"; + "CREATED"|"PUBLISHED" state = "CREATED"; string[] tags?; - record {} additionalProperties?; + record {|API_additionalProperties...;|} additionalProperties?; APIMonetizationInfo monetization?; APIBusinessInformation businessInformation?; # API categories @@ -415,11 +325,11 @@ public type LifecycleState record { public type ApiId_thumbnail_body record { # Image to upload - string file; + record {byte[] fileContent; string fileName;} file; }; public type SubscriptionThrottlePolicyPermission record { - string permissionType; + "ALLOW"|"DENY" permissionType; string[] roles; }; @@ -446,38 +356,6 @@ public type ExternalStoreList record { ExternalStore[] list?; }; -public type UsagePlan record { - # Id of policy - int policyId?; - # policy uuid - string uuid?; - # Name of policy - @constraint:String {maxLength: 60, minLength: 1} - string policyName?; - # Display name of the policy - @constraint:String {maxLength: 512} - string displayName?; - # Description of the policy - @constraint:String {maxLength: 1024} - string description?; - # Usage policy organization - string organization?; - UsageLimit defaultLimit; - # Burst control request count - int rateLimitCount?; - # Burst control time unit - string rateLimitTimeUnit?; - # Number of subscriptions allowed - int subscriberCount?; - # Custom attributes added to the Usage plan - CustomAttribute[] customAttributes?; - # This indicates the action to be taken when a user goes beyond the allocated quota. If checked, the user's requests will be dropped. If unchecked, the requests will be allowed to pass through. - boolean stopOnQuotaReach = false; - # define whether this is Paid or a Free plan. Allowed values are FREE or COMMERCIAL. - string billingPlan?; - SubscriptionThrottlePolicyPermission permissions?; -}; - public type Comment record { string id?; @constraint:String {maxLength: 512} @@ -487,17 +365,11 @@ public type Comment record { string updatedTime?; string category = "general"; string parentCommentId?; - string entryPoint?; + "devPortal"|"publisher" entryPoint?; CommenterInfo commenterInfo?; CommentList replies?; }; -public type RequestCountLimit record { - *UsageLimitBase; - # Maximum number of requests allowed - int requestCount; -}; - public type ThreatProtectionPolicy record { # Policy ID string uuid?; @@ -514,13 +386,13 @@ public type APIInfo record { string name?; string description?; string context?; - string 'version?; + string version?; string 'type?; string createdTime?; string updatedTime?; boolean hasThumbnail?; # State of the API. Only published APIs are visible on the Developer Portal - string state?; + "CREATED"|"PUBLISHED" state?; }; public type APIExternalStore record { @@ -546,7 +418,7 @@ public type Error record { public type SearchResult record { string id?; string name; - string 'type?; + "DOC"|"API" 'type?; # Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL string transportType?; }; @@ -556,16 +428,6 @@ public type GatewayEnvironmentProtocolURI record { string endpointURI; }; -public type UsageLimit record { - # Type of the usage limit. Allowed values are "REQUESTCOUNTLIMIT" and "BANDWIDTHLIMIT". - # Please see schemas of "RequestCountLimit" and "BandwidthLimit" usage limit types in - # Definitions section. - string 'type; - RequestCountLimit requestCount?; - BandwidthLimit bandwidth?; - EventCountLimit eventCount?; -}; - public type Scope record { # UUID of the Scope. Valid only for shared scopes. string id?; @@ -609,7 +471,7 @@ public type SubscriptionList record { public type WorkflowResponse record { # This attribute declares whether this workflow task is approved or rejected. - string workflowStatus; + "CREATED"|"APPROVED"|"REJECTED"|"REGISTERED" workflowStatus; # Attributes that returned after the workflow execution string jsonPayload?; LifecycleState lifecycleState?; @@ -625,24 +487,24 @@ public type API record { @constraint:String {maxLength: 232, minLength: 1} string context; @constraint:String {maxLength: 30, minLength: 1} - string 'version; + string version; string organization; + string lifeCycleStatus; + string provider; # The api creation type to be used. Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL, WEBSUB, SSE, WEBHOOK, ASYNC - string 'type = "HTTP"; + "HTTP"|"WS"|"SOAPTOREST"|"SOAP"|"GRAPHQL"|"WEBSUB"|"SSE"|"WEBHOOK"|"ASYNC" 'type = "HTTP"; # Supported transports for the API (http and/or https). string[] transport?; boolean hasThumbnail?; # State of the API. Only published APIs are visible on the Developer Portal - string state = "CREATED"; + "CREATED"|"PUBLISHED" state = "CREATED"; string[] tags?; # API categories string[] categories?; # Supported SDK string[] sdk?; string[] policies?; - string provider?; - string lifeCycleStatus?; - record {} additionalProperties?; + record {|API_additionalProperties...;|} additionalProperties?; string createdTime?; string lastUpdatedTime?; APIOperations[] operations?; @@ -668,11 +530,3 @@ public type APICategory record { public type SubscriberInfo record { string name?; }; - -public type BandwidthLimit record { - *UsageLimitBase; - # Amount of data allowed to be transfered - int dataAmount; - # Unit of data allowed to be transfered. Allowed values are "KB", "MB" and "GB" - string dataUnit; -};