# Collaborator

This class defines a Collaborator of a [[Book]].

A Collaborator represents a user that has been granted access to a Book with specific permissions.

## Extends

- `Resource`\<`bkper.Collaborator`\>

### Constructor

```ts
new Collaborator(book, payload?): Collaborator;
```

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `book` | [`Book`](https://bkper.com/docs/api/bkper-js/classes/book.md) |
| `payload?` | `Collaborator` |

#### Returns

`Collaborator`

#### Overrides

```ts
Resource<bkper.Collaborator>.constructor
```

### payload

```ts
payload: Collaborator;
```

The underlying payload data for this resource

#### Inherited from

```ts
Resource.payload
```

### create()

```ts
create(message?): Promise;
```

Performs create new Collaborator.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `message?` | `string` |

#### Returns

`Promise`\<`Collaborator`\>

Promise with the created Collaborator

***

### getAvatarUrl()

```ts
getAvatarUrl(): string | undefined;
```

Gets the public avatar url of the Collaborator.

#### Returns

`string` \| `undefined`

The Collaborator's public avatar url

***

### getEmail()

```ts
getEmail(): string | undefined;
```

Gets the Collaborator email address.

#### Returns

`string` \| `undefined`

The Collaborator email address

***

### getId()

```ts
getId(): string | undefined;
```

Gets the Collaborator internal id.

#### Returns

`string` \| `undefined`

The Collaborator internal id

***

### getPermission()

```ts
getPermission(): Permission | undefined;
```

Gets the permission level of the Collaborator.

#### Returns

[`Permission`](https://bkper.com/docs/api/bkper-js/enumerations/permission.md) \| `undefined`

The permission level

***

### json()

```ts
json(): Collaborator;
```

Gets an immutable copy of the JSON payload for this resource.

#### Returns

`Collaborator`

An immutable copy of the json payload

#### Inherited from

```ts
Resource.json
```

***

### remove()

```ts
remove(): Promise;
```

Performs remove Collaborator.

#### Returns

`Promise`\<`Collaborator`\>

Promise with the removed Collaborator

***

### setEmail()

```ts
setEmail(email): Collaborator;
```

Sets the email address of the Collaborator.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `email` | `string` | The email address to set |

#### Returns

`Collaborator`

This Collaborator, for chaining

***

### setPermission()

```ts
setPermission(permission): Collaborator;
```

Sets the permission level of the Collaborator.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `permission` | [`Permission`](https://bkper.com/docs/api/bkper-js/enumerations/permission.md) | The permission level to set |

#### Returns

`Collaborator`

This Collaborator, for chaining

***

### update()

```ts
update(): Promise;
```

Performs update Collaborator.

#### Returns

`Promise`\<`Collaborator`\>

Promise with the updated Collaborator
