# API

## Hooks

### useMatrix

### useRoomList

### useTimeline

### useReactions

## Methods

### createRoom

`createRoom(options)`

Returns `{ id, name }` where those values are from the created room.

```javascript
// Example
import rnm from '@rn-matrix/core'
...
rnm.createRoom({name: 'wow cool', invite: ['@test:ditto.chat']}).then(result => {
  console.log(result) // { id: '...', name: 'wow cool' }
})
```

```javascript
const optionDefaults = {
    visibility: 'private',
    invite: [], // list of user IDs
    room_topic: '',
};
```

| Argument    | Default   | Description                                                        |
| ----------- | --------- | ------------------------------------------------------------------ |
| name        | undefined | Will be automatically generated from the member list if not given. |
| visibility  | private   | 'private' or 'public'                                              |
| invite      | \[]       | An array of user IDs you want to immediately invite                |
| room\_topic | ''        |                                                                    |

### editMessage

`editMessage(roomId, messageId, newMessageContent)`

Only available for text messages.

| Argument          | Type   | Description                            |
| ----------------- | ------ | -------------------------------------- |
| roomId            | string | The ID of the room this message is in  |
| messageId         | string | The ID of the message you want to edit |
| newMessageContent | string | The new message body                   |
