# Room

## Create Room

```typescript
public createRoom(properties: RoomCreateOptions = {}): Promise<string>
```

Input params：`RoomCreateOptions`

| Name   | Type         | Description                 | Required |
| ------ | ------------ | --------------------------- | -------- |
| name   | string       | room name                   | true     |
| topic  | string       | room topic                  | false    |
| invite | string array | array of user ids to invite | false    |

Output params:

| Name   | Type   | Description        | Required |
| ------ | ------ | ------------------ | -------- |
| roomId | string | id of the new room | true     |

## Invite User

```typescript
public inviteUser(userId, roomId)
```

Input params:

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomId | string | room id     | true     |
| userId | string | user id     | true     |

Output params: N/A

## **Revoke invitation**

```typescript
public revoke(userId, roomId)
```

Input params:

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomId | string | room id     | true     |
| userId | string | user id     | true     |

Output params: N/A

## Kick User

```typescript
public kickUser(userId, roomId, reason = null)
```

Input params:

| Name   | Type   | Description   | Required |
| ------ | ------ | ------------- | -------- |
| roomId | string | room id       | true     |
| userId | string | user id       | true     |
| reason | string | invite reason | false    |

Output params: N/A

## Join Room

```typescript
public joinRoom(roomId: string): Promise<string>
```

Input params：

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomId | string | room id     | true     |

Output params: N/A

## Leave Room

```typescript
public leaveRoom(roomId: string, reason?: string)
```

Input params：

| Name   | Type   | Description  | Required |
| ------ | ------ | ------------ | -------- |
| roomId | string | room id      | true     |
| reason | string | leave reason | false    |

Output params: N/A

## Get Room Memebers

```typescript
 public getAllRoomMembers(roomId: string, atToken?: string): Promise<MembershipEvent[]>
```

Input params:

| Name    | Type   | Description                          | Required |
| ------- | ------ | ------------------------------------ | -------- |
| roomId  | string | room id                              | true     |
| atToken | string | optional batch token, null for "now" | true     |

Output params:

| Name               | Type                     | Description           | Required |
| ------------------ | ------------------------ | --------------------- | -------- |
| MembershipEvent\[] | array of MembershipEvent | membership event data | true     |
