Directus / @directus/sdk / rest / createRole
Function: createRole()
createRole<
Schema
,TQuery
>(item
,query
?):RestCommand
<IfAny
<Schema
,Record
<string
,any
>,Merge
<MappedFunctionFields
<Schema
,UnpackList
<MergeCoreCollection
<Schema
,"directus_roles"
,Object
>>> extendsFF
?MapFlatFields
<UnpackList
<MergeCoreCollection
<Schema
,"directus_roles"
,Object
>>,FieldsWildcard
<UnpackList
<MergeCoreCollection
<Schema
,"directus_roles"
,Object
>>,Exclude
<UnpackList
<Mutable
<TQuery
["fields"
]>>,PickRelationalFields
<UnpackList
<Mutable
<...>>> extendsnever
?never
:AllKeys
<UnpackList
<...> extendsField
? ... extends ... ? ... : ... :never
>>>,FF
extendsRecord
<string
,string
> ?FF
:Record
<string
,string
>> :never
,PickRelationalFields
<UnpackList
<Mutable
<TQuery
["fields"
]>>> extendsnever
?never
:{ [Field in string | number | symbol]: Field extends keyof UnpackList<MergeCoreCollection<Schema, "directus_roles", Object>> ? Extract<UnpackList<MergeCoreCollection<(...), (...), (...)>>[Field], ItemType<Schema>> extends RelatedCollection ? IsNullable<UnpackList<MergeCoreCollection<(...), (...), (...)>>[Field], null | (RelatedCollection extends (...)[] ? (...) extends (...) ? (...) : (...) : ApplyNestedQueryFields<(...), (...), (...)>), RelatedCollection extends any[] ? HasManyToAnyRelation<(...)> extends never ? (...) | (...) : (...)[] : ApplyNestedQueryFields<Schema, RelatedCollection, (...)[(...)]>> : never : never }
>>,Schema
>
Create a new role.
Type parameters
• Schema extends object
• TQuery extends Query
<Schema
, DirectusRole
<Schema
>>
Parameters
• item: Partial
<DirectusRole
<Schema
>>
The role to create
• query?: TQuery
Optional return data query
Returns
RestCommand
<IfAny
<Schema
, Record
<string
, any
>, Merge
<MappedFunctionFields
<Schema
, UnpackList
<MergeCoreCollection
<Schema
, "directus_roles"
, Object
>>> extends FF
? MapFlatFields
<UnpackList
<MergeCoreCollection
<Schema
, "directus_roles"
, Object
>>, FieldsWildcard
<UnpackList
<MergeCoreCollection
<Schema
, "directus_roles"
, Object
>>, Exclude
<UnpackList
<Mutable
<TQuery
["fields"
]>>, PickRelationalFields
<UnpackList
<Mutable
<...>>> extends never
? never
: AllKeys
<UnpackList
<...> extends Field
? ... extends ... ? ... : ... : never
>>>, FF
extends Record
<string
, string
> ? FF
: Record
<string
, string
>> : never
, PickRelationalFields
<UnpackList
<Mutable
<TQuery
["fields"
]>>> extends never
? never
: { [Field in string | number | symbol]: Field extends keyof UnpackList<MergeCoreCollection<Schema, "directus_roles", Object>> ? Extract<UnpackList<MergeCoreCollection<(...), (...), (...)>>[Field], ItemType<Schema>> extends RelatedCollection ? IsNullable<UnpackList<MergeCoreCollection<(...), (...), (...)>>[Field], null | (RelatedCollection extends (...)[] ? (...) extends (...) ? (...) : (...) : ApplyNestedQueryFields<(...), (...), (...)>), RelatedCollection extends any[] ? HasManyToAnyRelation<(...)> extends never ? (...) | (...) : (...)[] : ApplyNestedQueryFields<Schema, RelatedCollection, (...)[(...)]>> : never : never }
>>, Schema
>
Returns the role object for the created role.