Overview
The Organizations API allows you to manage organizations, their members, and roles within the Wacht platform.fetchOrganizations(options?: ListOrganizationsOptions)
Lists all organizations.
Parameters
options(optional): An object containing pagination and filtering options.page(number): The page number to retrieve.per_page(number): The number of items per page.search(string): Search term for organizations.
Returns
Promise<OrganizationListResponse>: A promise that resolves to a list of organizations and pagination information.
createOrganization(request: CreateOrganizationRequest)
Creates a new organization.
Parameters
request(CreateOrganizationRequest): The request body containing the details of the new organization.
Returns
Promise<Organization>: A promise that resolves to the newly created organization object.
fetchOrganization(organizationId: string)
Retrieves a specific organization by its ID.
Parameters
organizationId(string): The unique identifier of the organization.
Returns
Promise<Organization>: A promise that resolves to the organization object.
updateOrganization(organizationId: string, request: UpdateOrganizationRequest)
Updates an existing organization.
Parameters
organizationId(string): The unique identifier of the organization to update.request(UpdateOrganizationRequest): The request body containing the updated details of the organization.
Returns
Promise<Organization>: A promise that resolves to the updated organization object.
deleteOrganization(organizationId: string)
Deletes an organization by its ID.
Parameters
organizationId(string): The unique identifier of the organization to delete.
Returns
Promise<void>: A promise that resolves when the organization is successfully deleted.
addOrganizationMember(organizationId: string, request: AddOrganizationMemberRequest)
Adds a member to an organization.
Parameters
organizationId(string): The unique identifier of the organization.request(AddOrganizationMemberRequest): The request body containing the member details.
Returns
Promise<OrganizationMember>: A promise that resolves to the newly added organization member object.
updateOrganizationMember(organizationId: string, membershipId: string, request: UpdateOrganizationMemberRequest)
Updates an organization member’s role.
Parameters
organizationId(string): The unique identifier of the organization.membershipId(string): The unique identifier of the membership to update.request(UpdateOrganizationMemberRequest): The request body containing the updated member details.
Returns
Promise<OrganizationMember>: A promise that resolves to the updated organization member object.
removeOrganizationMember(organizationId: string, membershipId: string)
Removes a member from an organization.
Parameters
organizationId(string): The unique identifier of the organization.membershipId(string): The unique identifier of the membership to remove.
Returns
Promise<void>: A promise that resolves when the member is successfully removed.
fetchOrganizationRoles()
Lists all available organization roles.
Returns
Promise<OrganizationRoleListResponse>: A promise that resolves to a list of organization roles.
createOrganizationRole(organizationId: string, request: CreateRoleRequest)
Creates a new organization role.
Parameters
organizationId(string): The unique identifier of the organization.request(CreateRoleRequest): The request body containing the details of the new role.
Returns
Promise<OrganizationRole>: A promise that resolves to the newly created organization role object.
updateOrganizationRole(organizationId: string, roleId: string, request: UpdateRoleRequest)
Updates an existing organization role.
Parameters
organizationId(string): The unique identifier of the organization.roleId(string): The unique identifier of the role to update.request(UpdateRoleRequest): The request body containing the updated details of the role.
Returns
Promise<OrganizationRole>: A promise that resolves to the updated organization role object.
deleteOrganizationRole(organizationId: string, roleId: string)
Deletes an organization role.
Parameters
organizationId(string): The unique identifier of the organization.roleId(string): The unique identifier of the role to delete.
Returns
Promise<void>: A promise that resolves when the role is successfully deleted.