# OrganizationMembershipWithMetadata

{% hint style="info" %}
This class implements [`OrganizationMembership`](/reference/identity-javascript-sdk/the-base-package/organizations/organizationmembership.md).
{% endhint %}

## Members

### `roles :` [`OrganizationRole[]`](/reference/identity-javascript-sdk/the-base-package/organizations/organizationrole.md)

The roles associated with this membership.

### `firstName : string`

The first name of the user associated with this membership.

### `lastName : string`

The last name of the user associated with this membership.

### `email : string`

The email of the user associated with this membership.

## Methods

### `constructor(api, membership)`

Create a new Membership object using the [Organization API](/reference/organization-api.md).

* `api` must be an instance of [`OrganizationApi`](/reference/identity-javascript-sdk/the-base-package/organizations/organizationapi.md);
* `membership` must implement the [`MembershipInfo`](/reference/identity-javascript-sdk/the-base-package/organizations/organizationapi.md#membershipinfo) interface;

```javascript
const info = await organizationApi.memberInfo(organizationId, membershipId)
const membership = new OrganizationMembershipWithMetadata(organizationApi, info)
```

### `static async fromMembership(membership)`

Create a membership with metadata object from a normal membership.

```javascript
const membership = await OrganizationMembershipWithMetadata.fromMembership(normalMembershipObject)
```

### `override async getRoles()`

An override of [`OrganizationMembership.getRoles()`](/reference/identity-javascript-sdk/the-base-package/organizations/organizationmembership.md#async-getroles) that doesn't send a request to get the roles.

```javascript
const roles = await membership.getRoles()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizations/organizationmembership/organizationmembershipwithmetadata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
