Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Added chat/history and rooms/users endpoints #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/endpoints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Some methods however, are white listed such as chat deleting, this is in order t
| Booth Skip Me | "[booth/skip/me](/api/endpoints/booth_skip_me.md)" |
| Booth Waitlist Ban | "[booth/waitlistban](/api/endpoints/booth_waitlistban.md)" |
| Chat Delete | "[chat/:cid](/api/endpoints/chat_cid.md)" |
| Chat History | "[chat/history](/api/endpoints/chat_history.md)" |
| Friends | "[friends](/api/endpoints/friends.md)" |
| Friends Ignore | "[friends/ignore](/api/endpoints/friends_ignore.md)" |
| Friends Invites | "[friends/invites](/api/endpoints/friends_invites.md)" |
Expand All @@ -59,6 +60,7 @@ Some methods however, are white listed such as chat deleting, this is in order t
| Rooms SOS | "[rooms/sos](/api/endpoints/rooms_sos.md)" |
| Rooms State | "[rooms/state](/api/endpoints/rooms_state.md)" |
| Rooms Update | "[rooms/update](/api/endpoints/rooms_update.md)" |
| Rooms Users | "[rooms/users](/api/endpoints/rooms_users.md)" |
| Rooms Validate | "[rooms/validate](/api/endpoints/rooms_validate.md)" |
| Staff | "[staff](/api/endpoints/staff.md)" |
| Staff Update | "[staff/update](/api/endpoints/staff_update.md)" |
Expand All @@ -75,7 +77,7 @@ Some methods however, are white listed such as chat deleting, this is in order t
| Users Me History | "[users/me/history](/api/endpoints/users_me_history.md)" |
| Users Me Transactions | "[users/me/transactions](/api/endpoints/users_me_transactions.md)" |
| Users Settings | "[users/settings](/api/endpoints/users_settings.md)" |
| Users Signup | "[users/signup](/api/endpoints/users_signup.md)" |
| Users Signup | "[users/signup](/api/endpoints/users_signup.md)" |
| Users Validate | "[users/validate](/api/endpoints/users_validate.md)" |
| Votes | "[votes](/api/endpoints/votes.md)" |

Expand Down
58 changes: 58 additions & 0 deletions api/endpoints/chat_history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# chat/history Endpoint

The chat/history endpoint retrieves the last 30 messages that were sent in the room and the users object from the different authors.
If a message gets deleted, the list is updated accordingly.

### Endpoint

**chat/history**

### Method

_GET_

### Possible error messages

Insufficient permissions (not being logged in)
```json
{
"data": [
"You are not authorized to access this resource."
],
"status": "notAuthorized",
}
```

### Data returned

```js
{
'data': [{ // Contains the requested data
'history': [{
'cid': 'xxx', // Internal ID of the message
'message': 'xxx', // The content of the message
'sub': 0, // Is the user a subscriber? (0 = false; 1 = true)
'timestamp': 'xxx', // String representation of the time the message was sent (e.g.: '2018-01-23 06:45:23.000000')
'uid': -1, // Author's ID
'un': 'xxx' // Author's username
}],
'users': [{ // Contains the requested data
'avatarID': 'xxx', // Their AvatarID (e.g.: 'base01')
'badge': 'xxx', // Their badge (e.g.: '80sb01')
'gRole': 0, // Their service wide role (0 = None; 3000 = Brand Ambassador (BA); 5000 = Admin)
'guest': false, // Is the user a guest?
'id': -1, // Their ID
'joined': 'xxx', // String representation of the time they joined plug (e.g.: '2014-07-23 22:47:00.573000')
'language': 'xx', // ISO 639-1 representation of their used language
'level': 1, // Their level
'silver': false // Is the user a silver subscriber?
'slug': 'xxx', // URL conform representation of their name (also used for the profile page)
'sub': 0, // Is the user a subscriber? (0 = false; 1 = true)
'username': 'xxx', // Their username
}]
}],
'meta': {},
'status': 'ok',
'time': 'xx.xxxxxxxxxxx'
}
```
38 changes: 38 additions & 0 deletions api/endpoints/room_users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# rooms/users Endpoint

The rooms/users endpoint lets you retrieve a list of up to 250 users currently in the room (this includes guests).
Anyone with a role superior than 0 will be excluded, this also applies on gRole.

### Endpoint

**rooms/users**

### Method

_GET_

### Possible error messages

Insufficient permissions (not being logged in)
```json
{
"data": [
"You are not authorized to access this resource."
],
"status": "notAuthorized",
}
```

### Data returned

```js
{
'data': [{ // Contains the requested data
'id': -1, // Their ID
'username': 'xxx', // Their username
}],
'meta': {},
'status': 'ok',
'time': 'xx.xxxxxxxxxxx'
}
```