ApiB attempt.

This commit is contained in:
Paul
2021-07-10 23:11:03 +01:00
parent 05721a0873
commit 3c55c7b0c6
11 changed files with 278 additions and 13 deletions
+137 -5
View File
@@ -5,27 +5,159 @@ HOST: https://api.revolt.chat
# Data Structures
## RelationshipStatus (enum)
+ None
+ User
+ Friend
+ Outgoing
+ Incoming
+ Blocked
+ BlockedOther
## Relationship (object)
+ _id: 01AN4Z07BY79KA1307SR9X4MV3 (string, required)
+ status (RelationshipStatus, required) - Explain in TODO.
## Presence (enum)
+ Online
+ Idle
+ Busy
+ Invisible
## UserStatus (object)
+ text (string)
+ presence (Presence)
## User (object)
+ _id: 01AN4Z07BY79KA1307SR9X4MV3 (string, required)
+ username: insert (string, required)
+ avatar (File)
+ avatar (File)
+ relations (array[Relationship])
+ badges (number) - This is a bitfield, see TODO.
+ status (UserStatus) - User's status and presence.
+ relationship (RelationshipStatus, required) - Explain in TODO.
+ online (boolean)
# Group Users
### Fetch User [GET /users/{id}]
Fetch a user by their ID.
+ Parameters
+ id: - User ID
+ id - User ID
+ Request
+ Headers
x-user-id: 01AN4Z07BY79KA1307SR9X4MV3
x-session-token: 01AN4Z07BY79KA1307SR9X4MV3
x-user-id: 01AN4Z07BY79KA1307SR9X4MV3
x-session-token: L305OPR7FkGu28WUSEygHiHW6L7wiiU_EFu8IkvEwlZQ7Y_jkJSfr_z6Sc6_hjns
+ Response 200 (application/json)
+ Attributes (User)
## sussy balls
### Edit User [PATCH /users/@me]
Edit your user object.
+ Request (application/json)
+ Attributes
+ status (UserStatus)
+ profile (object)
+ content (string) - Profile content, has a maximum length of 2000.
+ background (string) - TODO
+ avatar (string) - TODO
+ remove (enum)
+ ProfileContent
+ ProfileBackground
+ StatusText
+ Avatar
+ Headers
x-user-id: 01AN4Z07BY79KA1307SR9X4MV3
x-session-token: L305OPR7FkGu28WUSEygHiHW6L7wiiU_EFu8IkvEwlZQ7Y_jkJSfr_z6Sc6_hjns
+ Response 200
### Change Username [PATCH /users/@me/username]
Change your username.
+ Request (application/json)
+ Attributes
+ username (string)
+ password (string)
+ Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string",
"minLength": 2,
"maxLength": 32,
"pattern": "^[a-zA-Z0-9_.]+$"
},
"password": {
"type": "string",
"minLength": 8,
"maxLength": 72
}
}
}
+ Headers
x-user-id: 01AN4Z07BY79KA1307SR9X4MV3
x-session-token: L305OPR7FkGu28WUSEygHiHW6L7wiiU_EFu8IkvEwlZQ7Y_jkJSfr_z6Sc6_hjns
+ Response 200
### Fetch profile [GET /users/{id}/profile]
Returns a user's profile.
Requires `ViewProfile`.
+ Parameters
+ id - User ID
+ Response 200 (image/png)
### Fetch default avatar [GET /users/{id}/default_avatar]
Returns a default avatar based on given id.
+ Parameters
+ id - User ID
+ Response 200 (image/png)
# Data Structures
## SavedMessagesChannel (object)
+ _id: 01AN4Z07BY79KA1307SR9X4MV3 (string, required)
+ channel_type: SavedMessages (enum, required)
+ user (string, required)
## DirectMessageChannel (object)
+ _id: 01AN4Z07BY79KA1307SR9X4MV3 (string, required)
+ channel_type: DirectMessage (enum, required)
+ active (boolean, required)
# Group Channels
### Fetch Channel [GET /channels/{id}]
Fetch a channel by its ID.
+ Parameters
+ id - Channel ID
+ Request
+ Headers
x-user-id: 01AN4Z07BY79KA1307SR9X4MV3
x-session-token: L305OPR7FkGu28WUSEygHiHW6L7wiiU_EFu8IkvEwlZQ7Y_jkJSfr_z6Sc6_hjns
+ Response 200 (application/json)
+ Attributes (enum[SavedMessagesChannel, DirectMessageChannel])
# Data Structures
## File (object)
+1
View File
@@ -0,0 +1 @@
Need to change empty response requests to 204.
+3
View File
@@ -0,0 +1,3 @@
+ Headers
x-user-id: :[ULID](../templates/ulid.md)
x-session-token: :[Token](../templates/token.md)
+2 -1
View File
@@ -4,4 +4,5 @@ HOST: https://api.revolt.chat
# Revolt
:[Users](resources/users.md)
:[sussy](resources/autumn.md)
:[Channels](resources/channels.md)
:[Autumn](resources/autumn.md)
-2
View File
@@ -1,5 +1,3 @@
## sussy balls
# Data Structures
## File (object)
+25
View File
@@ -0,0 +1,25 @@
# Data Structures
## SavedMessagesChannel (object)
:[_id](../fields/_id.md)
+ channel_type: SavedMessages (enum, required)
+ user (string, required)
## DirectMessageChannel (object)
:[_id](../fields/_id.md)
+ channel_type: DirectMessage (enum, required)
+ active (boolean, required)
# Group Channels
### Fetch Channel [GET /channels/{id}]
Fetch a channel by its ID.
+ Parameters
+ id - Channel ID
+ Request
:[rAuth](../auth/headers.md)
+ Response 200 (application/json)
+ Attributes (enum[SavedMessagesChannel, DirectMessageChannel])
+97 -5
View File
@@ -1,21 +1,113 @@
# Data Structures
## RelationshipStatus (enum)
+ None
+ User
+ Friend
+ Outgoing
+ Incoming
+ Blocked
+ BlockedOther
## Relationship (object)
:[_id](../fields/_id.md)
+ status (RelationshipStatus, required) - Explain in TODO.
## Presence (enum)
+ Online
+ Idle
+ Busy
+ Invisible
## UserStatus (object)
+ text (string)
+ presence (Presence)
## User (object)
:[_id](../fields/_id.md)
+ username: insert (string, required)
+ avatar (File)
+ avatar (File)
+ relations (array[Relationship])
+ badges (number) - This is a bitfield, see TODO.
+ status (UserStatus) - User's status and presence.
+ relationship (RelationshipStatus, required) - Explain in TODO.
+ online (boolean)
# Group Users
### Fetch User [GET /users/{id}]
Fetch a user by their ID.
+ Parameters
+ id: - User ID
+ id - User ID
+ Request
+ Headers
x-user-id: :[ULID](../templates/ulid.md)
x-session-token: :[ULID](../templates/ulid.md)
:[rAuth](../auth/headers.md)
+ Response 200 (application/json)
+ Attributes (User)
### Edit User [PATCH /users/@me]
Edit your user object.
+ Request (application/json)
+ Attributes
+ status (UserStatus)
+ profile (object)
+ content (string) - Profile content, has a maximum length of 2000.
+ background (string) - TODO
+ avatar (string) - TODO
+ remove (enum)
+ ProfileContent
+ ProfileBackground
+ StatusText
+ Avatar
:[rAuth](../auth/headers.md)
+ Response 200
### Change Username [PATCH /users/@me/username]
Change your username.
+ Request (application/json)
+ Attributes
+ username (string)
+ password (string)
+ Schema
{
:[schema](../schema/$schema.md),
"type": "object",
"properties": {
:[username](../schema/username.md),
:[password](../schema/password.md)
}
}
:[rAuth](../auth/headers.md)
+ Response 200
### Fetch profile [GET /users/{id}/profile]
Returns a user's profile.
Requires `ViewProfile`.
+ Parameters
+ id - User ID
+ Response 200 (image/png)
### Fetch default avatar [GET /users/{id}/default_avatar]
Returns a default avatar based on given id.
+ Parameters
+ id - User ID
+ Response 200 (image/png)
+1
View File
@@ -0,0 +1 @@
"$schema": "http://json-schema.org/draft-04/schema#"
+5
View File
@@ -0,0 +1,5 @@
"password": {
"type": "string",
"minLength": 8,
"maxLength": 72
}
+6
View File
@@ -0,0 +1,6 @@
"username": {
"type": "string",
"minLength": 2,
"maxLength": 32,
"pattern": "^[a-zA-Z0-9_.]+$"
}
+1
View File
@@ -0,0 +1 @@
L305OPR7FkGu28WUSEygHiHW6L7wiiU_EFu8IkvEwlZQ7Y_jkJSfr_z6Sc6_hjns