# User

This class defines a User on the Bkper platform.

Users can own and collaborate on [[Books]], manage [[Collections]], and connect to external services through [[Connections]].

Each User has a unique identity, subscription plan details, and access permissions across the platform.

## Extends

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

### Constructor

```ts
new User(payload?, config?): User;
```

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `payload?` | `User` |
| `config?` | [`Config`](https://bkper.com/docs/api/bkper-js/interfaces/config.md) |

#### Returns

`User`

#### Overrides

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

### payload

```ts
payload: User;
```

The underlying payload data for this resource

#### Inherited from

```ts
Resource.payload
```

### getAvatarUrl()

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

Gets the avatar url of the User.

#### Returns

`string` \| `undefined`

The User's avatar url

***

### getBilling()

```ts
getBilling(): Promise;
```

Gets the billing information for this User.

#### Returns

`Promise`\<[`Billing`](https://bkper.com/docs/api/bkper-js/classes/billing.md)\>

The User's billing information

***

### getConnection()

```ts
getConnection(id): Promise;
```

Gets a [[Connection]] of the User.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `id` | `string` | The Connection's id |

#### Returns

`Promise`\<[`Connection`](https://bkper.com/docs/api/bkper-js/classes/connection.md)\>

The retrieved Connection object

***

### getConnections()

```ts
getConnections(): Promise;
```

Gets the [[Connections]] of the User.

#### Returns

`Promise`\<[`Connection`](https://bkper.com/docs/api/bkper-js/classes/connection.md)[]\>

The retrieved Connection objects

***

### getEmail()

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

Gets the email of the User.

#### Returns

`string` \| `undefined`

The User's email

***

### getFullName()

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

Gets the full name of the User.

#### Returns

`string` \| `undefined`

The User's full name

***

### getGivenName()

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

Gets the given name of the User.

#### Returns

`string` \| `undefined`

The User's given name

***

### getHostedDomain()

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

Gets the hosted domain of the User.

#### Returns

`string` \| `undefined`

The User's hosted domain

***

### getId()

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

Gets the id of the User.

#### Returns

`string` \| `undefined`

The User's id

***

### getName()

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

Gets the name of the User.

#### Returns

`string` \| `undefined`

The User's name

***

### getPlanCycle()

```ts
getPlanCycle(): "MONTHLY" | "YEARLY" | undefined;
```

Gets the billing cycle of the User's current plan.

#### Returns

`"MONTHLY"` \| `"YEARLY"` \| `undefined`

The User's plan billing cycle

***

### getUsername()

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

Gets the username of the User.

#### Returns

`string` \| `undefined`

The User's username

***

### hasUsedConnections()

```ts
hasUsedConnections(): boolean | undefined;
```

Tells if the User has already used [[Connections]].

#### Returns

`boolean` \| `undefined`

True if the User has already used Connections

***

### json()

```ts
json(): User;
```

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

#### Returns

`User`

An immutable copy of the json payload

#### Inherited from

```ts
Resource.json
```
