1 /**
2 * @oas [post] /admin/tax-regions
3 * operationId: PostTaxRegions
4 * summary: Create Tax Region
5 * description: Create a tax region.
6 * x-authenticated: true
7 * parameters:
8 * - name: fields
9 * in: query
10 * 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
11 * fields. without prefix it will replace the entire default fields.
12 * required: false
13 * schema:
14 * type: string
15 * title: fields
16 * 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
17 * fields. without prefix it will replace the entire default fields.
18 * externalDocs:
19 * url: "#select-fields-and-relations"
20 * security:
21 * - api_token: []
22 * - cookie_auth: []
23 * - jwt_token: []
24 * requestBody:
25 * content:
26 * application/json:
27 * schema:
28 * $ref: "#/components/schemas/AdminCreateTaxRegion"
29 * x-codeSamples:
30 * - lang: JavaScript
31 * label: JS SDK
32 * source: |-
33 * import Medusa from "@medusajs/js-sdk"
34 *
35 * export const sdk = new Medusa({
36 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
37 * debug: import.meta.env.DEV,
38 * auth: {
39 * type: "session",
40 * },
41 * })
42 *
43 * sdk.admin.taxRegion.create({
44 * country_code: "us",
45 * province_code: "ca",
46 * default_tax_rate: {
47 * code: "VAT",
48 * name: "VAT",
49 * rate: 20, // 20%
50 * is_combinable: true,
51 * },
52 * })
53 * .then(({ tax_region }) => {
54 * console.log(tax_region)
55 * })
56 * - lang: Shell
57 * label: cURL
58 * source: |-
59 * curl -X POST '{backend_url}/admin/tax-regions' \
60 * -H 'Authorization: Bearer {jwt_token}' \
61 * -H 'Content-Type: application/json' \
62 * --data-raw '{
63 * "country_code": "{value}",
64 * "province_code": "us-ca",
65 * "parent_id": "{value}",
66 * "metadata": {}
67 * }'
68 * tags:
69 * - Tax Regions
70 * responses:
71 * "200":
72 * description: OK
73 * content:
74 * application/json:
75 * schema:
76 * $ref: "#/components/schemas/AdminTaxRegionResponse"
77 * "400":
78 * $ref: "#/components/responses/400_error"
79 * "401":
80 * $ref: "#/components/responses/unauthorized"
81 * "404":
82 * $ref: "#/components/responses/not_found_error"
83 * "409":
84 * $ref: "#/components/responses/invalid_state_error"
85 * "422":
86 * $ref: "#/components/responses/invalid_request_error"
87 * "500":
88 * $ref: "#/components/responses/500_error"
89 * x-workflow: createTaxRegionsWorkflow
90 * x-events: []
91 *
92 */
93