1 /**
2 * @oas [post] /admin/regions
3 * operationId: PostRegions
4 * summary: Create Region
5 * description: Create a 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/AdminCreateRegion"
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.region.create({
44 * name: "United States",
45 * currency_code: "usd",
46 * })
47 * .then(({ region }) => {
48 * console.log(region)
49 * })
50 * - lang: Shell
51 * label: cURL
52 * source: |-
53 * curl -X POST '{backend_url}/admin/regions' \
54 * -H 'Authorization: Bearer {jwt_token}' \
55 * -H 'Content-Type: application/json' \
56 * --data-raw '{
57 * "name": "Heloise",
58 * "currency_code": "{value}",
59 * "metadata": {}
60 * }'
61 * tags:
62 * - Regions
63 * responses:
64 * "200":
65 * description: OK
66 * content:
67 * application/json:
68 * schema:
69 * $ref: "#/components/schemas/AdminRegionResponse"
70 * "400":
71 * $ref: "#/components/responses/400_error"
72 * "401":
73 * $ref: "#/components/responses/unauthorized"
74 * "404":
75 * $ref: "#/components/responses/not_found_error"
76 * "409":
77 * $ref: "#/components/responses/invalid_state_error"
78 * "422":
79 * $ref: "#/components/responses/invalid_request_error"
80 * "500":
81 * $ref: "#/components/responses/500_error"
82 * x-workflow: createRegionsWorkflow
83 * x-events:
84 * - name: region.created
85 * payload: |-
86 * ```ts
87 * {
88 * id, // The ID of the region
89 * }
90 * ```
91 * description: Emitted when regions are created.
92 * deprecated: false
93 *
94 */
95