1 /**
2 * @oas [get] /admin/users/{id}
3 * operationId: GetUsersId
4 * summary: Get a User
5 * description: Retrieve a user by its ID. You can expand the user's relations or select the fields that should be returned.
6 * x-authenticated: true
7 * parameters:
8 * - name: id
9 * in: path
10 * description: The user's ID.
11 * required: true
12 * schema:
13 * type: string
14 * - name: fields
15 * in: query
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 * required: false
19 * schema:
20 * type: string
21 * title: fields
22 * 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
23 * fields. without prefix it will replace the entire default fields.
24 * externalDocs:
25 * url: "#select-fields-and-relations"
26 * x-codeSamples:
27 * - lang: JavaScript
28 * label: JS SDK
29 * source: |-
30 * import Medusa from "@medusajs/js-sdk"
31 *
32 * export const sdk = new Medusa({
33 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
34 * debug: import.meta.env.DEV,
35 * auth: {
36 * type: "session",
37 * },
38 * })
39 *
40 * sdk.admin.user.retrieve("user_123")
41 * .then(({ user }) => {
42 * console.log(user)
43 * })
44 * - lang: Shell
45 * label: cURL
46 * source: curl '{backend_url}/admin/users/{id}'
47 * tags:
48 * - Users
49 * responses:
50 * "200":
51 * description: OK
52 * content:
53 * application/json:
54 * schema:
55 * $ref: "#/components/schemas/AdminUserResponse"
56 * "400":
57 * $ref: "#/components/responses/400_error"
58 * "401":
59 * $ref: "#/components/responses/unauthorized"
60 * "404":
61 * $ref: "#/components/responses/not_found_error"
62 * "409":
63 * $ref: "#/components/responses/invalid_state_error"
64 * "422":
65 * $ref: "#/components/responses/invalid_request_error"
66 * "500":
67 * $ref: "#/components/responses/500_error"
68 * security:
69 * - cookie_auth: []
70 * - jwt_token: []
71 *
72 */
73