Directus / @directus/sdk / rest / readRole
Function: readRole() ​
readRole<
Schema,TQuery>(key,query?):RestCommand<IfAny<Schema,Record<string,any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { children: (...) | (...); description: (...) | (...); icon: string; id: string; name: string; parent: (...) | (...); policies: (...) | (...); users: (...) | (...) }, "directus_roles" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { children: (...) | (...); description: (...) | (...); icon: string; id: string; name: string; parent: (...) | (...); policies: (...) | (...); users: (...) | (...) }, "directus_roles" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }, (...) 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/roles.ts:35
List an existing Role by primary key.
Type Parameters ​
• Schema
• TQuery extends Query<Schema, DirectusRole<Schema>>
Parameters ​
key ​
DirectusRole<Schema>["id"]
The primary key of the role
query? ​
TQuery
The query parameters
Returns ​
RestCommand<IfAny<Schema, Record<string, any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { children: (...) | (...); description: (...) | (...); icon: string; id: string; name: string; parent: (...) | (...); policies: (...) | (...); users: (...) | (...) }, "directus_roles" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { children: (...) | (...); description: (...) | (...); icon: string; id: string; name: string; parent: (...) | (...); policies: (...) | (...); users: (...) | (...) }, "directus_roles" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { children: ...; description: ...; icon: ...; id: ...; name: ...; parent: ...; policies: ...; users: ... }, (...) 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 a Role object if a valid primary key was provided.
Throws ​
Will throw if key is empty