Organization
The Organization object describes a user created organization structure.
Overview
The Organization
object is the model around the organization entity.
Attributes
Name | Type | Description |
---|---|---|
id | string | A unique identifier for this organization. |
logoUrl | string | The full URL for the organization logo. |
name | string | The organization name. |
publicMetadata | object | Additional information about the organization that can be read through the Frontend API, but written only from the Backend API. |
slug | string | The organization slug. If supplied, it must be unique for the instance. |
createdAt | Date | Date of the time the organization was created. |
updatedAt | Date | Date of the last time the user was updated. |
Methods
addMember(params)
addMember(params: AddMemberParams) => Promise<OrganizationMembershipResource>
Adds a user as a member to an organization. A user can only be added to an organization if they are not already members of it and if they already exist in the same instance as the organization.
Please note that only administrators can add members to an organization.
Parameters
Name | Type | Description |
---|---|---|
userId | string | The id of the user that will be added as a member to the organization. |
role | string | The role that the user will have in the organization. Valid values are |
Returns
Type | Description |
---|---|
Promise<OrganizationMembershipResource> | This method returns a |
destroy()
destroy() => Promise<void>
Deletes the organization. Only administrators can delete an organization.
Please note that deleting an organization will also delete all memberships and invitations. This is not reversible.
Returns
Type | Description |
---|---|
Promise<void> | This method returns a |
getMemberships(params)
getMemberships(params?:
GetMembershipsParams)=>Promise<
OrganizationMembershipResource[]>
Retrieve the members of the selected
Parameters
Name | Type | Description |
---|---|---|
limit? | number | Limit of the results returned. |
offset? | number | The offset of results to start the retrieval. |
Returns
Type | Description |
---|---|
Promise<OrganizationMembershipResource> | This method returns a |
getPendingInvitations()
getPendingInvitations()=>Promise<
OrganizationInvitationResource[]>
Retrieve the members of the selected organization.
Returns
Type | Description |
---|---|
Promise<OrganizationMembershipResource> | This method returns a |
inviteMember(params)
inviteMember(params: InviteMemberParams) =>Promise<
OrganizationInvitationResource>
Creates and sends an invitation to the target email address for becoming a member with the role passed on the function parameters.
Parameters
Name | Type | Description |
---|---|---|
emailAddress | string | The email address to invite. |
role | MembershipRole | The role of the new member. |
redirectUrl? | string | A URL to redirect the user after accepting the invitation. |
Returns
Type | Description |
---|---|
Promise<OrganizationMembershipResource> | This method returns a |
setLogo(params)
setLogo(params: SetOrganizationLogoParams) => Promise<OrganizationResource>
Sets or replaces an organization's logo. Accept the logo as a file or blob. The logo must be an image and its size cannot exceed 10MB.
Parameters
Name | Type | Description |
---|---|---|
file | File | Blob | null | An image file which cannot exceed 10MB. Passing `null` will delete the organization's current logo. |
Returns
Type | Description |
---|---|
Promise<OrganizationResource> | This method returns a |
update(params)
update(params: UpdateOrganizationParams) => Promise<OrganizationResource>
Updates an organization's attributes.
Parameters
Name | Type | Description |
---|---|---|
name | string | The organization name. |
Returns
Type | Description |
---|---|
Promise<OrganizationResource> | This method returns a |
updateMember(params)
updateMember(params: UpdateMembershipParams) =>Promise<
OrganizationMembershipResource>
Updates a member based on the userId. For now only role can be changed.
Parameters
Name | Type | Description |
---|---|---|
role | MembershipRole | The role of the new member. |
userId | string | The user identifier. |
Returns
Type | Description |
---|---|
Promise<OrganizationResource> | This method returns a |
removeMember(params)
removeMember(userId: string) =>Promise<
OrganizationMembershipResource>
Removes a member from the organization based on the userId.
Parameters
Name | Type | Description |
---|---|---|
userId | string | The user identifier. |
Returns
Type | Description |
---|---|
Promise<OrganizationMembershipResource> | This method returns a |