From 4479ecdc7bdc23e08a82e2cbf873b1b3010bd602 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:41:22 +0000 Subject: [PATCH] chore(docs): Updated API Reference (automated) (#10641) Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com> --- .../schemas/StoreShippingOptionResponse.yaml | 8 ++ .../specs/admin/openapi.full.yaml | 9 ++ .../post.sh | 6 ++ .../schemas/StoreShippingOptionResponse.yaml | 8 ++ .../specs/store/openapi.full.yaml | 85 +++++++++++++++++++ .../api-reference/specs/store/openapi.yaml | 2 + ...store_shipping-options_{id}_calculate.yaml | 80 +++++++++++++++++ ...t_store_shipping-options_[id]_calculate.ts | 80 +++++++++++++++++ .../schemas/StoreShippingOptionResponse.ts | 13 +++ 9 files changed, 291 insertions(+) create mode 100644 www/apps/api-reference/specs/admin/components/schemas/StoreShippingOptionResponse.yaml create mode 100644 www/apps/api-reference/specs/store/code_samples/Shell/store_shipping-options_{id}_calculate/post.sh create mode 100644 www/apps/api-reference/specs/store/components/schemas/StoreShippingOptionResponse.yaml create mode 100644 www/apps/api-reference/specs/store/paths/store_shipping-options_{id}_calculate.yaml create mode 100644 www/utils/generated/oas-output/operations/store/post_store_shipping-options_[id]_calculate.ts create mode 100644 www/utils/generated/oas-output/schemas/StoreShippingOptionResponse.ts diff --git a/www/apps/api-reference/specs/admin/components/schemas/StoreShippingOptionResponse.yaml b/www/apps/api-reference/specs/admin/components/schemas/StoreShippingOptionResponse.yaml new file mode 100644 index 0000000000000..1a7aec06bbfbe --- /dev/null +++ b/www/apps/api-reference/specs/admin/components/schemas/StoreShippingOptionResponse.yaml @@ -0,0 +1,8 @@ +type: object +description: The shipping option's details. +x-schemaName: StoreShippingOptionResponse +required: + - shipping_option +properties: + shipping_option: + $ref: ./StoreCartShippingOption.yaml diff --git a/www/apps/api-reference/specs/admin/openapi.full.yaml b/www/apps/api-reference/specs/admin/openapi.full.yaml index 50cc874694e7b..0b49b9a5d458b 100644 --- a/www/apps/api-reference/specs/admin/openapi.full.yaml +++ b/www/apps/api-reference/specs/admin/openapi.full.yaml @@ -69233,6 +69233,15 @@ components: description: The shipping option's shipping options. items: $ref: '#/components/schemas/StoreCartShippingOption' + StoreShippingOptionResponse: + type: object + description: The shipping option's details. + x-schemaName: StoreShippingOptionResponse + required: + - shipping_option + properties: + shipping_option: + $ref: '#/components/schemas/StoreCartShippingOption' StoreShippingOptionType: type: object description: The shipping option type's details. diff --git a/www/apps/api-reference/specs/store/code_samples/Shell/store_shipping-options_{id}_calculate/post.sh b/www/apps/api-reference/specs/store/code_samples/Shell/store_shipping-options_{id}_calculate/post.sh new file mode 100644 index 0000000000000..4fc94a1de2a0c --- /dev/null +++ b/www/apps/api-reference/specs/store/code_samples/Shell/store_shipping-options_{id}_calculate/post.sh @@ -0,0 +1,6 @@ +curl -X POST '{backend_url}/store/shipping-options/{id}/calculate' \ +-H 'x-publishable-api-key: {your_publishable_api_key}' \ +-H 'Content-Type: application/json' \ +--data-raw '{ + "cart_id": "{value}" +}' \ No newline at end of file diff --git a/www/apps/api-reference/specs/store/components/schemas/StoreShippingOptionResponse.yaml b/www/apps/api-reference/specs/store/components/schemas/StoreShippingOptionResponse.yaml new file mode 100644 index 0000000000000..1a7aec06bbfbe --- /dev/null +++ b/www/apps/api-reference/specs/store/components/schemas/StoreShippingOptionResponse.yaml @@ -0,0 +1,8 @@ +type: object +description: The shipping option's details. +x-schemaName: StoreShippingOptionResponse +required: + - shipping_option +properties: + shipping_option: + $ref: ./StoreCartShippingOption.yaml diff --git a/www/apps/api-reference/specs/store/openapi.full.yaml b/www/apps/api-reference/specs/store/openapi.full.yaml index 1decbdc88ca7a..53c416e791342 100644 --- a/www/apps/api-reference/specs/store/openapi.full.yaml +++ b/www/apps/api-reference/specs/store/openapi.full.yaml @@ -5758,6 +5758,82 @@ paths: '500': $ref: '#/components/responses/500_error' x-workflow: listShippingOptionsForCartWorkflow + /store/shipping-options/{id}/calculate: + post: + operationId: PostShippingOptionsIdCalculate + summary: Calculate Shipping Option Price + description: Calculate the price of a shipping option in a cart. + x-authenticated: false + parameters: + - name: id + in: path + description: The shipping option's ID. + required: true + schema: + type: string + - 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. + externalDocs: + url: '#select-fields-and-relations' + requestBody: + content: + application/json: + schema: + type: object + description: The calculation's details. + required: + - cart_id + properties: + cart_id: + type: string + title: cart_id + description: The ID of the cart the shipping option is used in. + data: + type: object + description: Custom data that's useful for the fulfillment provider to calculate the price. + externalDocs: + url: https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property + x-codeSamples: + - lang: Shell + label: cURL + source: |- + curl -X POST '{backend_url}/store/shipping-options/{id}/calculate' \ + -H 'x-publishable-api-key: {your_publishable_api_key}' \ + -H 'Content-Type: application/json' \ + --data-raw '{ + "cart_id": "{value}" + }' + tags: + - Shipping Options + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreShippingOptionResponse' + '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' + x-workflow: calculateShippingOptionsPricesWorkflow components: schemas: AdminApiKey: @@ -31431,6 +31507,15 @@ components: description: The shipping option's shipping options. items: $ref: '#/components/schemas/StoreCartShippingOption' + StoreShippingOptionResponse: + type: object + description: The shipping option's details. + x-schemaName: StoreShippingOptionResponse + required: + - shipping_option + properties: + shipping_option: + $ref: '#/components/schemas/StoreCartShippingOption' StoreShippingOptionType: type: object description: The shipping option type's details. diff --git a/www/apps/api-reference/specs/store/openapi.yaml b/www/apps/api-reference/specs/store/openapi.yaml index 8209c7e0f0a39..88e280ddb3c3e 100644 --- a/www/apps/api-reference/specs/store/openapi.yaml +++ b/www/apps/api-reference/specs/store/openapi.yaml @@ -275,6 +275,8 @@ paths: $ref: paths/store_return-reasons_{id}.yaml /store/shipping-options: $ref: paths/store_shipping-options.yaml + /store/shipping-options/{id}/calculate: + $ref: paths/store_shipping-options_{id}_calculate.yaml components: securitySchemes: jwt_token: diff --git a/www/apps/api-reference/specs/store/paths/store_shipping-options_{id}_calculate.yaml b/www/apps/api-reference/specs/store/paths/store_shipping-options_{id}_calculate.yaml new file mode 100644 index 0000000000000..95380229f8c96 --- /dev/null +++ b/www/apps/api-reference/specs/store/paths/store_shipping-options_{id}_calculate.yaml @@ -0,0 +1,80 @@ +post: + operationId: PostShippingOptionsIdCalculate + summary: Calculate Shipping Option Price + description: Calculate the price of a shipping option in a cart. + x-authenticated: false + parameters: + - name: id + in: path + description: The shipping option's ID. + required: true + schema: + type: string + - 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. + externalDocs: + url: '#select-fields-and-relations' + requestBody: + content: + application/json: + schema: + type: object + description: The calculation's details. + required: + - cart_id + properties: + cart_id: + type: string + title: cart_id + description: The ID of the cart the shipping option is used in. + data: + type: object + description: >- + Custom data that's useful for the fulfillment provider to + calculate the price. + externalDocs: + url: >- + https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property + x-codeSamples: + - lang: Shell + label: cURL + source: + $ref: ../code_samples/Shell/store_shipping-options_{id}_calculate/post.sh + tags: + - Shipping Options + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ../components/schemas/StoreShippingOptionResponse.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 + x-workflow: calculateShippingOptionsPricesWorkflow diff --git a/www/utils/generated/oas-output/operations/store/post_store_shipping-options_[id]_calculate.ts b/www/utils/generated/oas-output/operations/store/post_store_shipping-options_[id]_calculate.ts new file mode 100644 index 0000000000000..4a405bb80f19d --- /dev/null +++ b/www/utils/generated/oas-output/operations/store/post_store_shipping-options_[id]_calculate.ts @@ -0,0 +1,80 @@ +/** + * @oas [post] /store/shipping-options/{id}/calculate + * operationId: PostShippingOptionsIdCalculate + * summary: Calculate Shipping Option Price + * description: Calculate the price of a shipping option in a cart. + * x-authenticated: false + * parameters: + * - name: id + * in: path + * description: The shipping option's ID. + * required: true + * schema: + * type: string + * - 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. + * externalDocs: + * url: "#select-fields-and-relations" + * requestBody: + * content: + * application/json: + * schema: + * type: object + * description: The calculation's details. + * required: + * - cart_id + * properties: + * cart_id: + * type: string + * title: cart_id + * description: The ID of the cart the shipping option is used in. + * data: + * type: object + * description: Custom data that's useful for the fulfillment provider to calculate the price. + * externalDocs: + * url: https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property + * x-codeSamples: + * - lang: Shell + * label: cURL + * source: |- + * curl -X POST '{backend_url}/store/shipping-options/{id}/calculate' \ + * -H 'x-publishable-api-key: {your_publishable_api_key}' \ + * -H 'Content-Type: application/json' \ + * --data-raw '{ + * "cart_id": "{value}" + * }' + * tags: + * - Shipping Options + * responses: + * "200": + * description: OK + * content: + * application/json: + * schema: + * $ref: "#/components/schemas/StoreShippingOptionResponse" + * "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" + * x-workflow: calculateShippingOptionsPricesWorkflow + * +*/ + diff --git a/www/utils/generated/oas-output/schemas/StoreShippingOptionResponse.ts b/www/utils/generated/oas-output/schemas/StoreShippingOptionResponse.ts new file mode 100644 index 0000000000000..7364546cd7de5 --- /dev/null +++ b/www/utils/generated/oas-output/schemas/StoreShippingOptionResponse.ts @@ -0,0 +1,13 @@ +/** + * @schema StoreShippingOptionResponse + * type: object + * description: The shipping option's details. + * x-schemaName: StoreShippingOptionResponse + * required: + * - shipping_option + * properties: + * shipping_option: + * $ref: "#/components/schemas/StoreCartShippingOption" + * +*/ +