From b08d867e8fa69d3a86a805b40139eef3d89fa94d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 09:16:25 +0200 Subject: [PATCH] chore(docs): Generated API Reference (v2) (#8252) Co-authored-by: kodiakhq Co-authored-by: Shahed Nasser --- .../Shell/admin_products_import/post.sh | 2 + .../schemas/AdminImportProductRequest.yaml | 3 + .../schemas/AdminImportProductResponse.yaml | 10 ++ .../specs/admin/openapi.full.yaml | 104 ++++++++++++++++++ .../api-reference/specs/admin/openapi.yaml | 2 + .../admin/paths/admin_products_import.yaml | 94 ++++++++++++++++ .../schemas/AdminImportProductRequest.yaml | 3 + .../schemas/AdminImportProductResponse.yaml | 10 ++ .../specs/store/openapi.full.yaml | 15 +++ .../admin/post_admin_products_import.ts | 96 ++++++++++++++++ .../schemas/AdminImportProductRequest.ts | 8 ++ .../schemas/AdminImportProductResponse.ts | 15 +++ 12 files changed, 362 insertions(+) create mode 100644 www/apps/api-reference/specs/admin/code_samples/Shell/admin_products_import/post.sh create mode 100644 www/apps/api-reference/specs/admin/components/schemas/AdminImportProductRequest.yaml create mode 100644 www/apps/api-reference/specs/admin/components/schemas/AdminImportProductResponse.yaml create mode 100644 www/apps/api-reference/specs/admin/paths/admin_products_import.yaml create mode 100644 www/apps/api-reference/specs/store/components/schemas/AdminImportProductRequest.yaml create mode 100644 www/apps/api-reference/specs/store/components/schemas/AdminImportProductResponse.yaml create mode 100644 www/utils/generated/oas-output/operations/admin/post_admin_products_import.ts create mode 100644 www/utils/generated/oas-output/schemas/AdminImportProductRequest.ts create mode 100644 www/utils/generated/oas-output/schemas/AdminImportProductResponse.ts diff --git a/www/apps/api-reference/specs/admin/code_samples/Shell/admin_products_import/post.sh b/www/apps/api-reference/specs/admin/code_samples/Shell/admin_products_import/post.sh new file mode 100644 index 0000000000..a6221273e6 --- /dev/null +++ b/www/apps/api-reference/specs/admin/code_samples/Shell/admin_products_import/post.sh @@ -0,0 +1,2 @@ +curl -X POST '{backend_url}/admin/products/import' \ +-H 'x-medusa-access-token: {api_token}' \ No newline at end of file diff --git a/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductRequest.yaml b/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductRequest.yaml new file mode 100644 index 0000000000..449eb51e5c --- /dev/null +++ b/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductRequest.yaml @@ -0,0 +1,3 @@ +type: object +description: SUMMARY +x-schemaName: AdminImportProductRequest diff --git a/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductResponse.yaml b/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductResponse.yaml new file mode 100644 index 0000000000..5cc51a92b7 --- /dev/null +++ b/www/apps/api-reference/specs/admin/components/schemas/AdminImportProductResponse.yaml @@ -0,0 +1,10 @@ +type: object +description: SUMMARY +x-schemaName: AdminImportProductResponse +required: + - workflow_id +properties: + workflow_id: + type: string + title: workflow_id + description: The product's workflow id. diff --git a/www/apps/api-reference/specs/admin/openapi.full.yaml b/www/apps/api-reference/specs/admin/openapi.full.yaml index 19c8033311..66fca0f0c1 100644 --- a/www/apps/api-reference/specs/admin/openapi.full.yaml +++ b/www/apps/api-reference/specs/admin/openapi.full.yaml @@ -25734,6 +25734,95 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /admin/products/import: + post: + operationId: PostProductsImport + summary: Create Product + description: Create a product. + x-authenticated: true + parameters: + - name: expand + in: query + description: Comma-separated relations that should be expanded in the returned data. + required: false + schema: + type: string + title: expand + description: Comma-separated relations that should be expanded in the returned data. + - name: fields + in: query + description: |- + Comma-separated fields that should be included in the returned data. + * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * without prefix it will replace the entire default fields. + required: false + schema: + type: string + title: fields + description: |- + Comma-separated fields that should be included in the returned data. + * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * without prefix it will replace the entire default fields. + - name: offset + in: query + description: The number of items to skip when retrieving a list. + required: false + schema: + type: number + title: offset + description: The number of items to skip when retrieving a list. + - name: limit + in: query + description: Limit the number of items returned in the list. + required: false + schema: + type: number + title: limit + description: Limit the number of items returned in the list. + - name: order + in: query + description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`. + required: false + schema: + type: string + title: order + description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`. + security: + - api_token: [] + - cookie_auth: [] + - jwt_token: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminImportProductRequest' + x-codeSamples: + - lang: Shell + label: cURL + source: |- + curl -X POST '{backend_url}/admin/products/import' \ + -H 'x-medusa-access-token: {api_token}' + tags: + - Products + responses: + '202': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminImportProductResponse' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /admin/products/{id}: get: operationId: GetProductsId @@ -41473,6 +41562,21 @@ components: type: string title: fields description: The upload's fields. + AdminImportProductRequest: + type: object + description: SUMMARY + x-schemaName: AdminImportProductRequest + AdminImportProductResponse: + type: object + description: SUMMARY + x-schemaName: AdminImportProductResponse + required: + - workflow_id + properties: + workflow_id: + type: string + title: workflow_id + description: The product's workflow id. AdminOrderCancelFulfillment: type: object description: SUMMARY diff --git a/www/apps/api-reference/specs/admin/openapi.yaml b/www/apps/api-reference/specs/admin/openapi.yaml index 49bcef5735..05e0b67862 100644 --- a/www/apps/api-reference/specs/admin/openapi.yaml +++ b/www/apps/api-reference/specs/admin/openapi.yaml @@ -245,6 +245,8 @@ paths: $ref: paths/admin_products_batch.yaml /admin/products/export: $ref: paths/admin_products_export.yaml + /admin/products/import: + $ref: paths/admin_products_import.yaml /admin/products/{id}: $ref: paths/admin_products_{id}.yaml /admin/products/{id}/options: diff --git a/www/apps/api-reference/specs/admin/paths/admin_products_import.yaml b/www/apps/api-reference/specs/admin/paths/admin_products_import.yaml new file mode 100644 index 0000000000..d305f2c96f --- /dev/null +++ b/www/apps/api-reference/specs/admin/paths/admin_products_import.yaml @@ -0,0 +1,94 @@ +post: + operationId: PostProductsImport + summary: Create Product + description: Create a product. + x-authenticated: true + parameters: + - name: expand + in: query + description: Comma-separated relations that should be expanded in the returned data. + required: false + schema: + type: string + title: expand + description: >- + Comma-separated relations that should be expanded in the returned + data. + - name: fields + in: query + description: |- + Comma-separated fields that should be included in the returned data. + * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * without prefix it will replace the entire default fields. + required: false + schema: + type: string + title: fields + description: |- + Comma-separated fields that should be included in the returned data. + * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * without prefix it will replace the entire default fields. + - name: offset + in: query + description: The number of items to skip when retrieving a list. + required: false + schema: + type: number + title: offset + description: The number of items to skip when retrieving a list. + - name: limit + in: query + description: Limit the number of items returned in the list. + required: false + schema: + type: number + title: limit + description: Limit the number of items returned in the list. + - name: order + in: query + description: >- + The field to sort the data by. By default, the sort order is ascending. + To change the order to descending, prefix the field name with `-`. + required: false + schema: + type: string + title: order + description: >- + The field to sort the data by. By default, the sort order is + ascending. To change the order to descending, prefix the field name + with `-`. + security: + - api_token: [] + - cookie_auth: [] + - jwt_token: [] + requestBody: + content: + application/json: + schema: + $ref: ../components/schemas/AdminImportProductRequest.yaml + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/admin_products_import/post.sh + tags: + - Products + responses: + '202': + description: OK + content: + application/json: + schema: + $ref: ../components/schemas/AdminImportProductResponse.yaml + '400': + $ref: ../components/responses/400_error.yaml + '401': + $ref: ../components/responses/unauthorized.yaml + '404': + $ref: ../components/responses/not_found_error.yaml + '409': + $ref: ../components/responses/invalid_state_error.yaml + '422': + $ref: ../components/responses/invalid_request_error.yaml + '500': + $ref: ../components/responses/500_error.yaml diff --git a/www/apps/api-reference/specs/store/components/schemas/AdminImportProductRequest.yaml b/www/apps/api-reference/specs/store/components/schemas/AdminImportProductRequest.yaml new file mode 100644 index 0000000000..449eb51e5c --- /dev/null +++ b/www/apps/api-reference/specs/store/components/schemas/AdminImportProductRequest.yaml @@ -0,0 +1,3 @@ +type: object +description: SUMMARY +x-schemaName: AdminImportProductRequest diff --git a/www/apps/api-reference/specs/store/components/schemas/AdminImportProductResponse.yaml b/www/apps/api-reference/specs/store/components/schemas/AdminImportProductResponse.yaml new file mode 100644 index 0000000000..5cc51a92b7 --- /dev/null +++ b/www/apps/api-reference/specs/store/components/schemas/AdminImportProductResponse.yaml @@ -0,0 +1,10 @@ +type: object +description: SUMMARY +x-schemaName: AdminImportProductResponse +required: + - workflow_id +properties: + workflow_id: + type: string + title: workflow_id + description: The product's workflow id. diff --git a/www/apps/api-reference/specs/store/openapi.full.yaml b/www/apps/api-reference/specs/store/openapi.full.yaml index 0fbed33194..be120c372a 100644 --- a/www/apps/api-reference/specs/store/openapi.full.yaml +++ b/www/apps/api-reference/specs/store/openapi.full.yaml @@ -5477,6 +5477,21 @@ components: type: string title: fields description: The upload's fields. + AdminImportProductRequest: + type: object + description: SUMMARY + x-schemaName: AdminImportProductRequest + AdminImportProductResponse: + type: object + description: SUMMARY + x-schemaName: AdminImportProductResponse + required: + - workflow_id + properties: + workflow_id: + type: string + title: workflow_id + description: The product's workflow id. AdminOrderCancelFulfillment: type: object description: SUMMARY diff --git a/www/utils/generated/oas-output/operations/admin/post_admin_products_import.ts b/www/utils/generated/oas-output/operations/admin/post_admin_products_import.ts new file mode 100644 index 0000000000..6554140535 --- /dev/null +++ b/www/utils/generated/oas-output/operations/admin/post_admin_products_import.ts @@ -0,0 +1,96 @@ +/** + * @oas [post] /admin/products/import + * operationId: PostProductsImport + * summary: Create Product + * description: Create a product. + * x-authenticated: true + * parameters: + * - name: expand + * in: query + * description: Comma-separated relations that should be expanded in the returned data. + * required: false + * schema: + * type: string + * title: expand + * description: Comma-separated relations that should be expanded in the returned data. + * - name: fields + * in: query + * description: >- + * Comma-separated fields that should be included in the returned data. + * * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * * without prefix it will replace the entire default fields. + * required: false + * schema: + * type: string + * title: fields + * description: >- + * Comma-separated fields that should be included in the returned data. + * * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. + * * without prefix it will replace the entire default fields. + * - name: offset + * in: query + * description: The number of items to skip when retrieving a list. + * required: false + * schema: + * type: number + * title: offset + * description: The number of items to skip when retrieving a list. + * - name: limit + * in: query + * description: Limit the number of items returned in the list. + * required: false + * schema: + * type: number + * title: limit + * description: Limit the number of items returned in the list. + * - name: order + * in: query + * description: The field to sort the data by. By default, the sort order is + * ascending. To change the order to descending, prefix the field name with + * `-`. + * required: false + * schema: + * type: string + * title: order + * description: The field to sort the data by. By default, the sort order is + * ascending. To change the order to descending, prefix the field name with + * `-`. + * security: + * - api_token: [] + * - cookie_auth: [] + * - jwt_token: [] + * requestBody: + * content: + * application/json: + * schema: + * $ref: "#/components/schemas/AdminImportProductRequest" + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: |- + * curl -X POST '{backend_url}/admin/products/import' \ + * -H 'x-medusa-access-token: {api_token}' + * tags: + * - Products + * responses: + * "202": + * description: OK + * content: + * application/json: + * schema: + * $ref: "#/components/schemas/AdminImportProductResponse" + * "400": + * $ref: "#/components/responses/400_error" + * "401": + * $ref: "#/components/responses/unauthorized" + * "404": + * $ref: "#/components/responses/not_found_error" + * "409": + * $ref: "#/components/responses/invalid_state_error" + * "422": + * $ref: "#/components/responses/invalid_request_error" + * "500": + * $ref: "#/components/responses/500_error" + * +*/ + diff --git a/www/utils/generated/oas-output/schemas/AdminImportProductRequest.ts b/www/utils/generated/oas-output/schemas/AdminImportProductRequest.ts new file mode 100644 index 0000000000..aa7a484dca --- /dev/null +++ b/www/utils/generated/oas-output/schemas/AdminImportProductRequest.ts @@ -0,0 +1,8 @@ +/** + * @schema AdminImportProductRequest + * type: object + * description: SUMMARY + * x-schemaName: AdminImportProductRequest + * +*/ + diff --git a/www/utils/generated/oas-output/schemas/AdminImportProductResponse.ts b/www/utils/generated/oas-output/schemas/AdminImportProductResponse.ts new file mode 100644 index 0000000000..0307d5957f --- /dev/null +++ b/www/utils/generated/oas-output/schemas/AdminImportProductResponse.ts @@ -0,0 +1,15 @@ +/** + * @schema AdminImportProductResponse + * type: object + * description: SUMMARY + * x-schemaName: AdminImportProductResponse + * required: + * - workflow_id + * properties: + * workflow_id: + * type: string + * title: workflow_id + * description: The product's workflow id. + * +*/ +