From 279de2dfff65c5fd045eaba55c29028d6112d8ec Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 30 Apr 2023 00:42:23 +1000 Subject: [PATCH] Completing OpenAPI documentation for clients --- openapi/api-docs.yaml | 47 ++++++++++++++++--- .../schemas/product_bulk_action.yaml | 37 +++++++++++++++ openapi/paths/products.yaml | 10 ++-- 3 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 openapi/components/schemas/product_bulk_action.yaml diff --git a/openapi/api-docs.yaml b/openapi/api-docs.yaml index cb4ba204d6d6..b875dd9f0716 100644 --- a/openapi/api-docs.yaml +++ b/openapi/api-docs.yaml @@ -9923,23 +9923,19 @@ paths: tags: - products summary: "Bulk product actions" - description: "Archive / Restore / Delete in bulk" + description: "Archive / Restore / Delete / Set tax id in bulk" operationId: bulkProducts parameters: - $ref: "#/components/parameters/X-API-TOKEN" - $ref: "#/components/parameters/X-Requested-With" - $ref: "#/components/parameters/index" requestBody: - description: "Hashed IDs" + description: 'Bulk action array' required: true content: application/json: schema: - type: array - items: - description: "Array of hashed IDs to be bulk 'actioned" - type: integer - example: "[0,1,2,3]" + $ref: '#/components/schemas/ProductBulkAction' responses: 200: description: "The Product response" @@ -17448,6 +17444,43 @@ components: token: $ref: '#/components/schemas/CompanyToken' type: object + + ProductBulkAction: + required: + - action + - ids + properties: + action: + type: string + example: archive + description: 'The action to perform ie. archive / restore / delete / set_tax_id' + ids: + type: array + items: + format: string + type: string + example: 2J234DFA,D2J234DFA,D2J234DFA + description: string array of client hashed ids + tax_id: + type: string + example: '1' + description: | + The tax rate id to set on the list of products + + The following constants are available (default = '1') + + ``` + PRODUCT_TYPE_PHYSICAL = '1' + PRODUCT_TYPE_SERVICE = '2' + PRODUCT_TYPE_DIGITAL = '3' + PRODUCT_TYPE_SHIPPING = '4' + PRODUCT_TYPE_EXEMPT = '5' + PRODUCT_TYPE_REDUCED_TAX = '6' + PRODUCT_TYPE_OVERRIDE_TAX = '7' + PRODUCT_TYPE_ZERO_RATED = '8' + PRODUCT_TYPE_REVERSE_TAX = '9' + ``` + type: object Document: properties: id: diff --git a/openapi/components/schemas/product_bulk_action.yaml b/openapi/components/schemas/product_bulk_action.yaml new file mode 100644 index 000000000000..ce73cdd47590 --- /dev/null +++ b/openapi/components/schemas/product_bulk_action.yaml @@ -0,0 +1,37 @@ + + ProductBulkAction: + required: + - action + - ids + properties: + action: + type: string + example: archive + description: 'The action to perform ie. archive / restore / delete / set_tax_id' + ids: + type: array + items: + format: string + type: string + example: 2J234DFA,D2J234DFA,D2J234DFA + description: string array of client hashed ids + tax_id: + type: string + example: '1' + description: | + The tax rate id to set on the list of products + + The following constants are available (default = '1') + + ``` + PRODUCT_TYPE_PHYSICAL = '1' + PRODUCT_TYPE_SERVICE = '2' + PRODUCT_TYPE_DIGITAL = '3' + PRODUCT_TYPE_SHIPPING = '4' + PRODUCT_TYPE_EXEMPT = '5' + PRODUCT_TYPE_REDUCED_TAX = '6' + PRODUCT_TYPE_OVERRIDE_TAX = '7' + PRODUCT_TYPE_ZERO_RATED = '8' + PRODUCT_TYPE_REVERSE_TAX = '9' + ``` + type: object \ No newline at end of file diff --git a/openapi/paths/products.yaml b/openapi/paths/products.yaml index 1cbbfc8c5a18..c107ee6cf44a 100644 --- a/openapi/paths/products.yaml +++ b/openapi/paths/products.yaml @@ -333,23 +333,19 @@ tags: - products summary: "Bulk product actions" - description: "Archive / Restore / Delete in bulk" + description: "Archive / Restore / Delete / Set tax id in bulk" operationId: bulkProducts parameters: - $ref: "#/components/parameters/X-API-TOKEN" - $ref: "#/components/parameters/X-Requested-With" - $ref: "#/components/parameters/index" requestBody: - description: "Hashed IDs" + description: 'Bulk action array' required: true content: application/json: schema: - type: array - items: - description: "Array of hashed IDs to be bulk 'actioned" - type: integer - example: "[0,1,2,3]" + $ref: '#/components/schemas/ProductBulkAction' responses: 200: description: "The Product response"