# Organization

## Members

### `memberships :` [`OrganizationMembership`](https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizations/organizationmembership)`[]`

All the memberships that this organization has.

### `api :` [`OrganizationApi`](https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizations/organizationapi)

The `OrganizationAPI` that this object was created with.

### `created : Date`

The date that the organization was created at.

### `id : number`

The ID of this organization.

### `name : string`

The name of this organization.

### `website : string`

The website URL of this organization.

### `address : string`

The address of this organization.

### `uniqueId : string`

The unique ID of this organization.

### `taxNumber : string`

The tax number of this organization.

### `city : string`

The city where this organization is based.

### `state : string`

The state where this organization is based.

### `verified : boolean`

The verification status of this organization.

### `zipCode : string`

The zip code where this organization is located.

### `counry : string`

The country where this organization is based.

## Methods

### `constructor(api, organization)`

Create a new Organization object using the [Organization API](https://dev.vulos.io/reference/organization-api).

* `api` must be an instance of [`OrganizationApi`](https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizations/organizationapi);
* `organization` must implement the [`OrganizationInfo`](https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizationapi#organizationinfo) interface.

```javascript
const details = await organizationApi.organizationInfo(organizationId)
const organization = new Organization(organizationApi, details)
```

### `async update(details)`

Update this organization's details.

The `details` object must implement the interface [`OrganizationUpdateDetails`](https://dev.vulos.io/reference/identity-javascript-sdk/the-base-package/organizationapi#organizationupdatedetails).

The result is a boolean that indicates success.

```javascript
if (await organization.update({name: 'New Name'})) {
    // the organization's name was updated successfully 
}
```

### `async invite(email)`

Invite a user to this organization by email.

The result is a boolean that indicates success.

```javascript
if (await organization.invite(email)) {
    // the user was invited successfully
}
```

### `async remove()`

Delete this organization.

The result is a boolean that indicates success.

```javascript
if (await organization.remove()) {
    // the organization was deleted successfully
}
```
