OrganizationMembership

Members

The OrganizationApi that this object was created with.

organizationId : number

The organization id that this membership is associated with.

membershipId : string

The id of this membership.

userId : string

The id of the user that this membership is associated with.

Methods

constructor(api, membership)

Create a new Membership object using the Organization API.

const details = await organizationApi.organizationInfo(organizationId)
const [membershipData] = details.memberships
const membership = new OrganizationMembership(organizationApi, membershipData)

async addRole(name)

Add a new role to this membership.

The result is an OrganizationRole object or false if it failed.

const role = await membership.addRole('Admin')

async getRoles()

Get all the roles associated with this membership.

The result is an array of OrganizationRole objects or false if it failed.

const roles = await membership.getRoles()

async getOrganization()

Get the organization associated with this membership.

The result is an Organization object or false if it failed.

const organization = await membership.getOrganization()

reference()

Create a UserReference object that is associated with this membership's user.

const ref = membership.reference()

async organizationProfile()

Get this membership's organization profile.

The result of this function implements the OrganizationProfileInfo interface.

const organizatonProfile = await membership.organizationProfile()

async remove()

Remove this membership from the organization.

The result is a boolean that indicates success.

if (await membership.remove()) {
    // the membership was successfully removed from the organization
}

Last updated