OrganizationMembership
Members
The OrganizationApi
that this object was created with.
organizationId : number
organizationId : number
The organization id that this membership is associated with.
membershipId : string
membershipId : string
The id of this membership.
userId : string
userId : string
The id of the user that this membership is associated with.
Methods
constructor(api, membership)
constructor(api, membership)
Create a new Membership object using the Organization API.
api
must be an instance ofOrganizationApi
;membership
must implement theOrganizationMembershipReference
interface.
const details = await organizationApi.organizationInfo(organizationId)
const [membershipData] = details.memberships
const membership = new OrganizationMembership(organizationApi, membershipData)
async addRole(name)
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()
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()
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()
reference()
Create a UserReference
object that is associated with this membership's user.
const ref = membership.reference()
async organizationProfile()
async organizationProfile()
Get this membership's organization profile.
The result of this function implements the OrganizationProfileInfo
interface.
const organizatonProfile = await membership.organizationProfile()
async remove()
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