Vulos Documentation
  • Identity
    • Welcome to the Vulos Identity Documentation!
    • Quick Start
    • Organizations
    • Scopes and Claims
  • Reference
    • Identity JavaScript SDK
      • The Base Package
        • KYC
          • KycStatus
          • KycInstance
          • KycDetails
          • KycApi
        • Profile
          • UserReference
          • ProfileApi
        • Cache
        • Authentication
          • Application
          • BaseAuth
          • User
          • UserInfo
          • BaseApi
        • Organizations
          • Organization
          • OrganizationMembership
            • OrganizationMembershipWithMetadata
          • OrganizationRole
          • OrganizationApi
      • The Backend Auth Package
        • CodeVerifier
        • BackendAuth
      • The Frontend Auth Package
        • IFrameRefresh
        • StateVerifier
        • FrontendAuth
    • Organization API
      • Organizations
      • Memberships
        • Roles
    • Profile API
    • KYC API
Powered by GitBook
On this page
  • Interfaces
  • RoleReference
  • MembershipInfo
  • OrganizationCreateDetails
  • OrganizationUpdateDetails
  • OrganizationInfo
  • OrganizationMembershipReference
  • Methods
  • constructor(user, endpoint)
  • async organizationList()
  • async organizationInfo(id)
  • async organizationUpdate(id, details)
  • async organizationDelete(id)
  • async organizationCreate(details)
  • async memberInfo(id, member)
  • async memberDelete(id, member)
  • async memberInvite(id, email)
  • async roleList(id, member)
  • async roleCreate(id, member, name)
  • async roleDelete(id, member, role)
  1. Reference
  2. Identity JavaScript SDK
  3. The Base Package
  4. Organizations

OrganizationApi

PreviousOrganizationRoleNextThe Backend Auth Package

Last updated 3 years ago

This class implements .

You need the scope to access this API.

This is a JavaScript implementation of the .

For ease of use we recommend using the object for interaction instead.

Interfaces

RoleReference

interface RoleReference {
    name: string,
    id: string
}

MembershipInfo

interface MembershipInfo {
    roles: RoleReference[],
    firstName: string,
    lastName: string,
    email: string,
    organizationId: number,
    membershipId: string,
    userId: string
}

OrganizationCreateDetails

interface OrganizationCreateDetails {
    name: string,
    website: string,
    address: string,
    uniqueId: string,
    taxNumber: string,
    city: string,
    countryCode: string,
    zipCode: string,
    state?: string
}

OrganizationUpdateDetails

interface OrganizationUpdateDetails {
    name?: string,
    website?: string,
    address?: string,
    uniqueId?: string,
    taxNumber?: string,
    city?: string,
    countryCode?: string,
    zipCode?: string,
    state?: string
}

OrganizationInfo

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
}

OrganizationMembershipReference

interface OrganizationMembershipReference {
    organizationId: number,
    membershipId: string,
    userId: string
}

Methods

constructor(user, endpoint)

Create an Organization API object.

  • endpoint should be the Vulos Identity endpoint.

const organizationApi = new OrganizationApi(user, endpoint)

async organizationList()

Get a list of all the organizations that the user is in.

for (const membership of await organizationApi.organizationList()) {
    // do something with the membership
}

async organizationInfo(id)

Get information of an organization by the organization's ID.

const info = await organizationApi.organizationInfo(organizationId)

async organizationUpdate(id, details)

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
}

async organizationDelete(id)

Delete an organization.

const response = await organizationApi.organizationDelete(organizationId)
if (response.success) {
    // successfully deleted the organization
}

async organizationCreate(details)

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'
})

async memberInfo(id, member)

Get information about a specific member.

  • id is the organization id;

  • member is the membership id;

const memberInfo = await organizationApi.memberInfo(organizationId, membershipId)

async memberDelete(id, member)

Remove a member from an organization.

const response = await organizationApi.memberDelete(organizationId, membershipId)
if (response.success) {
    // successfully deleted the membership
}

async memberInvite(id, email)

Invite a user to an organization by email.

const response = await organizationApi.memberInvite(organizationId, email)
if (response.success) {
    // successfully invited the member
}

async roleList(id, 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
}

async roleCreate(id, member, name)

Add a new role to a user.

const role = await organizationApi.roleCreate(organizationId, membershipId, "Admin")

async roleDelete(id, member, role)

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
}

user should be an instance of the object.

The result is an array of objects that implement the .

This method's response has the organization:list prefix.

The result implements the interface.

This method's response has the organization:info prefix.

The details object implements the interface.

The result implements the interface.

This method's response has the organization:update prefix.

The result implements the interface.

This method's response has the organization:delete prefix.

The details object implements the interface.

The result implements the interface.

This method's response has the organization:create prefix.

The result implements the interface.

This method's response has the organization:member:info prefix.

The result implements the interface.

This method's response has the organization:member:delete prefix.

The result implements the interface.

This method's response has the organization:member:invite prefix.

The result is an array of objects that implement the interface.

This method's response has the organization:role:list prefix.

The result implements the interface.

This method's response has the organization:role:create prefix.

The result implements the interface.

This method's response has the organization:role:delete prefix.

User
OrganizationMembershipReference
OrganizationInfo
OrganizationUpdateDetails
OrganizationCreateDetails
OrganizationMembershipReference
MembershipInfo
RoleReference
RoleReference
BaseApi
Organization API
User
SuccessResponse
SuccessResponse
SuccessResponse
SuccessResponse
SuccessResponse
cache
cache
cache
cache
cache
cache
cache
cache
cache
cache
cache
organization:manage