1 /**
2 * @oas [post] /admin/invites
3 * operationId: PostInvites
4 * summary: Create Invite
5 * description: Create a invite.
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 * requestBody:
21 * content:
22 * application/json:
23 * schema:
24 * type: object
25 * description: The invite's details.
26 * required:
27 * - email
28 * properties:
29 * email:
30 * type: string
31 * title: email
32 * description: The email of the user to invite.
33 * format: email
34 * metadata:
35 * type: object
36 * description: The invite's metadata. Can be custom data in key-value pairs.
37 * roles:
38 * type: array
39 * description: The invited user's roles.
40 * x-featureFlag: rbac
41 * items:
42 * type: string
43 * title: roles
44 * description: The invited user's role.
45 * x-codeSamples:
46 * - lang: JavaScript
47 * label: JS SDK
48 * source: |-
49 * import Medusa from "@medusajs/js-sdk"
50 *
51 * export const sdk = new Medusa({
52 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
53 * debug: import.meta.env.DEV,
54 * auth: {
55 * type: "session",
56 * },
57 * })
58 *
59 * sdk.admin.invite.create({
60 * email: "user@gmail.com",
61 * })
62 * .then(({ invite }) => {
63 * console.log(invite)
64 * })
65 * - lang: Shell
66 * label: cURL
67 * source: |-
68 * curl -X POST '{backend_url}/admin/invites' \
69 * -H 'Content-Type: application/json' \
70 * --data-raw '{
71 * "email": "Whitney_Schultz@gmail.com"
72 * }'
73 * tags:
74 * - Invites
75 * responses:
76 * "200":
77 * description: OK
78 * content:
79 * application/json:
80 * schema:
81 * $ref: "#/components/schemas/AdminInviteResponse"
82 * "400":
83 * $ref: "#/components/responses/400_error"
84 * "401":
85 * $ref: "#/components/responses/unauthorized"
86 * "404":
87 * $ref: "#/components/responses/not_found_error"
88 * "409":
89 * $ref: "#/components/responses/invalid_state_error"
90 * "422":
91 * $ref: "#/components/responses/invalid_request_error"
92 * "500":
93 * $ref: "#/components/responses/500_error"
94 * x-workflow: createInvitesWorkflow
95 * security:
96 * - api_token: []
97 * - cookie_auth: []
98 * - jwt_token: []
99 * x-events:
100 * - name: invite.created
101 * payload: |-
102 * ```ts
103 * {
104 * id, // The ID of the invite
105 * }
106 * ```
107 * description: |-
108 * Emitted when invites are created. You can listen to this event
109 * to send an email to the invited users, for example.
110 * deprecated: false
111 *
112 */
113