Directus / @directus/sdk / rest / readUser
Function: readUser() ​
readUser<
Schema,TQuery>(key,query?):RestCommand<IfAny<Schema,Record<string,any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { appearance: (...) | (...); auth_data: (...) | (...); avatar: (...) | (...) | (...); description: (...) | (...); email: (...) | (...); email_notifications: (...) | (...) | (...); external_identifier: (...) | (...); first_name: (...) | (...); id: string; language: (...) | (...); last_access: (...) | (...); last_name: (...) | (...); last_page: (...) | (...); location: (...) | (...); password: (...) | (...); policies: (...) | (...); provider: string; role: (...) | (...) | (...); status: string; tags: (...) | (...); tfa_secret: (...) | (...); theme: (...) | (...); theme_dark: (...) | (...); theme_dark_overrides: (...) | (...); theme_light: (...) | (...); theme_light_overrides: (...) | (...); title: (...) | (...); token: (...) | (...) }, "directus_users" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { appearance: (...) | (...); auth_data: (...) | (...); avatar: (...) | (...) | (...); description: (...) | (...); email: (...) | (...); email_notifications: (...) | (...) | (...); external_identifier: (...) | (...); first_name: (...) | (...); id: string; language: (...) | (...); last_access: (...) | (...); last_name: (...) | (...); last_page: (...) | (...); location: (...) | (...); password: (...) | (...); policies: (...) | (...); provider: string; role: (...) | (...) | (...); status: string; tags: (...) | (...); tfa_secret: (...) | (...); theme: (...) | (...); theme_dark: (...) | (...); theme_dark_overrides: (...) | (...); theme_light: (...) | (...); theme_light_overrides: (...) | (...); title: (...) | (...); token: (...) | (...) }, "directus_users" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }, (...) extends (...) ? (...) : (...)>>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof UnpackList<IfAny<(...), (...), (...)>> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>,Schema>
Defined in: rest/commands/read/users.ts:39
List an existing user by primary key.
Type Parameters ​
• Schema
• TQuery extends Query<Schema, DirectusUser<Schema>>
Parameters ​
key ​
DirectusUser<Schema>["id"]
The primary key of the user
query? ​
TQuery
The query parameters
Returns ​
RestCommand<IfAny<Schema, Record<string, any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { appearance: (...) | (...); auth_data: (...) | (...); avatar: (...) | (...) | (...); description: (...) | (...); email: (...) | (...); email_notifications: (...) | (...) | (...); external_identifier: (...) | (...); first_name: (...) | (...); id: string; language: (...) | (...); last_access: (...) | (...); last_name: (...) | (...); last_page: (...) | (...); location: (...) | (...); password: (...) | (...); policies: (...) | (...); provider: string; role: (...) | (...) | (...); status: string; tags: (...) | (...); tfa_secret: (...) | (...); theme: (...) | (...); theme_dark: (...) | (...); theme_dark_overrides: (...) | (...); theme_light: (...) | (...); theme_light_overrides: (...) | (...); title: (...) | (...); token: (...) | (...) }, "directus_users" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { appearance: (...) | (...); auth_data: (...) | (...); avatar: (...) | (...) | (...); description: (...) | (...); email: (...) | (...); email_notifications: (...) | (...) | (...); external_identifier: (...) | (...); first_name: (...) | (...); id: string; language: (...) | (...); last_access: (...) | (...); last_name: (...) | (...); last_page: (...) | (...); location: (...) | (...); password: (...) | (...); policies: (...) | (...); provider: string; role: (...) | (...) | (...); status: string; tags: (...) | (...); tfa_secret: (...) | (...); theme: (...) | (...); theme_dark: (...) | (...); theme_dark_overrides: (...) | (...); theme_light: (...) | (...); theme_light_overrides: (...) | (...); title: (...) | (...); token: (...) | (...) }, "directus_users" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { appearance: ...; auth_data: ...; avatar: ...; description: ...; email: ...; email_notifications: ...; external_identifier: ...; first_name: ...; id: ...; language: ...; last_access: ...; last_name: ...; last_page: ...; location: ...; password: ...; policies: ...; provider: ...; role: ...; status: ...; tags: ...; tfa_secret: ...; theme: ...; theme_dark: ...; theme_dark_overrides: ...; theme_light: ...; theme_light_overrides: ...; title: ...; token: ... }, (...) extends (...) ? (...) : (...)>>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof UnpackList<IfAny<(...), (...), (...)>> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema>
Returns the requested user object.
Throws ​
Will throw if key is empty