Comment on page
OrganizationApi
interface RoleReference {
name: string,
id: string
}
interface MembershipInfo {
roles: RoleReference[],
firstName: string,
lastName: string,
email: string,
organizationId: number,
membershipId: string,
userId: string
}
interface OrganizationCreateDetails {
name: string,
website: string,
address: string,
uniqueId: string,
taxNumber: string,
city: string,
countryCode: string,
zipCode: string,
state?: string
}
interface OrganizationUpdateDetails {
name?: string,
website?: string,
address?: string,
uniqueId?: string,
taxNumber?: string,
city?: string,
countryCode?: string,
zipCode?: string,
state?: string
}
interface OrganizationInfo {
memberships: OrganizationMembershipReference[],
id: number,
name: string,
website: string,
address: string,
uniqueId?: string,
taxNumber: string,
city: string,
country: {
alpha2: string,
name: string
},
zipCode: string,
state: string,
verified: boolean,
created: number
}
interface OrganizationMembershipReference {
organizationId: number,
membershipId: string,
userId: string
}
Create an Organization API object.
endpoint
should be the Vulos Identity endpoint.
const organizationApi = new OrganizationApi(user, endpoint)
Get a list of all the organizations that the user is in.
for (const membership of await organizationApi.organizationList()) {
// do something with the membership
}
Get information of an organization by the organization's ID.
const info = await organizationApi.organizationInfo(organizationId)
Update an organization's details.
const response = await organizationApi.organizationUpdate(organizationId, {name: 'New Organization Name'})
if (response.success) {
// the organization's name was updated successfully
}
Delete an organization.
const response = await organizationApi.organizationDelete(organizationId)
if (response.success) {
// successfully deleted the organization
}
Create a new organization.
const membership = await organizationApi.organizationCreate({
name: 'My Organization',
website: 'https://example.com',
address: 'Example St. 1234',
uniqueId: '1234-567-89',
city: 'Example City',
countryCode: 'AQ',
zipCode: '1234',
// state: 'Optional State'
})
Get information about a specific member.
id
is the organization id;member
is the membership id;
const memberInfo = await organizationApi.memberInfo(organizationId, membershipId)
Remove a member from an organization.
const response = await organizationApi.memberDelete(organizationId, membershipId)
if (response.success) {
// successfully deleted the membership
}
Invite a user to an organization by email.
const response = await organizationApi.memberInvite(organizationId, email)
if (response.success) {
// successfully invited the member
}
Get all the roles for a member.
const roles = await organizationApi.roleList(organizationId, membershipId)
for(const role of roles) {
// do something with the role
}
Add a new role to a user.
const role = await organizationApi.roleCreate(organizationId, membershipId, "Admin")
Remove a role from a member.
role
is the role id;
const response = await organizationApi.roleDelete(organizationId, membershipId, roleId)
if (response.success) {
// successfully deleted the role
}
Last modified 1yr ago