New build.
This commit is contained in:
parent
c4921b645a
commit
d0c8156519
BIN
dist/devranta-1.1.0-py3-none-any.whl
vendored
BIN
dist/devranta-1.1.0-py3-none-any.whl
vendored
Binary file not shown.
BIN
dist/devranta-1.1.0.tar.gz
vendored
BIN
dist/devranta-1.1.0.tar.gz
vendored
Binary file not shown.
@ -12,68 +12,40 @@ Requires-Dist: aiohttp
|
|||||||
Requires-Dist: dataset
|
Requires-Dist: dataset
|
||||||
|
|
||||||
# devRanta
|
# devRanta
|
||||||
|
|
||||||
devRanta is the best async devRant client written in Python. Authentication is only needed for half of the functionality; thus, the username and password are optional parameters when constructing the main class of this package (Api). You can find the latest packages in tar and wheel format [here](https://retoor.molodetz.nl/retoor/devranta/packages).
|
devRanta is the best async devRant client written in Python. Authentication is only needed for half of the functionality; thus, the username and password are optional parameters when constructing the main class of this package (Api). You can find the latest packages in tar and wheel format [here](https://retoor.molodetz.nl/retoor/devranta/packages).
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
```
|
```
|
||||||
make run
|
make run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
Tests are only made for methods not requireing authentication.
|
Tests are only made for methods not requireing authentication.
|
||||||
I do not see value in mocking requests.
|
I do not see value in mocking requests.
|
||||||
```
|
```
|
||||||
make test
|
make test
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
Implementation:
|
Implementation:
|
||||||
```
|
```
|
||||||
from devranta.api import Api
|
from devranta.api import Api
|
||||||
|
|
||||||
api = Api(username="optional!", password="optional!")
|
api = Api(username="optional!", password="optional!")
|
||||||
|
|
||||||
async def list_rants():
|
async def list_rants():
|
||||||
async for rant in api.get_rants():
|
async for rant in api.get_rants():
|
||||||
print(rant["user_username"], ":", rant["text"])
|
print(rant["user_username"], ":", rant["text"])
|
||||||
```
|
```
|
||||||
See [tests](src/devranta/tests.py) for [examples](src/devranta/tests.py) on how to use.
|
See [tests](src/devranta/tests.py) for [examples](src/devranta/tests.py) on how to use.
|
||||||
|
|
||||||
|
|
||||||
# devRant API Documentation
|
# devRant API Documentation
|
||||||
|
|
||||||
For people wanting to build their own client.
|
For people wanting to build their own client.
|
||||||
|
|
||||||
TODO: document responses.
|
TODO: document responses.
|
||||||
|
|
||||||
## Base URL
|
## Base URL
|
||||||
`https://devrant.com/api`
|
`https://devrant.com/api`
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
- Uses `dr_token` cookie with `token_id`, `token_key`, and `user_id`.
|
- Uses `dr_token` cookie with `token_id`, `token_key`, and `user_id`.
|
||||||
- Required for endpoints needing user authentication.
|
- Required for endpoints needing user authentication.
|
||||||
- `guid`, `plat`, `sid`, `seid` included in requests for session tracking.
|
- `guid`, `plat`, `sid`, `seid` included in requests for session tracking.
|
||||||
|
|
||||||
## Endpoints
|
## Endpoints
|
||||||
|
|
||||||
### User Management
|
### User Management
|
||||||
1. **Register User**
|
1. **Registering user**
|
||||||
- **URL**: `/api/users`
|
- Ommitted, you know why.
|
||||||
- **Method**: POST
|
|
||||||
- **Parameters**:
|
|
||||||
- `app`: 3 (constant)
|
|
||||||
- `type`: 1 (constant)
|
|
||||||
- `email`: User email
|
|
||||||
- `username`: User username
|
|
||||||
- `password`: User password
|
|
||||||
- `guid`: Unique identifier (from `getMyGuid`)
|
|
||||||
- `plat`: 3 (constant)
|
|
||||||
- `sid`: Session start time (from `getSessionStartTime`)
|
|
||||||
- `seid`: Session event ID (from `getSessionEventId`)
|
|
||||||
- **Response**: JSON with `success`, `auth_token`, or `error` and `error_field`
|
|
||||||
- **Description**: Creates a new user account.
|
|
||||||
|
|
||||||
2. **Login User**
|
2. **Login User**
|
||||||
- **URL**: `/api/users/auth-token`
|
- **URL**: `/api/users/auth-token`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -86,8 +58,26 @@ TODO: document responses.
|
|||||||
- `sid`: Session start time
|
- `sid`: Session start time
|
||||||
- `seid`: Session event ID
|
- `seid`: Session event ID
|
||||||
- **Response**: JSON with `success`, `auth_token`, or `error`
|
- **Response**: JSON with `success`, `auth_token`, or `error`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"auth_token": {
|
||||||
|
"id": 18966518,
|
||||||
|
"key": "z6uXRZrQ_Ekx59wfYEjpbnS!fDeVznVqmmKujhT8",
|
||||||
|
"expire_time": 1756765587,
|
||||||
|
"user_id": 18959632
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "Invalid login credentials entered. Please try again."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Authenticates user and returns auth token.
|
- **Description**: Authenticates user and returns auth token.
|
||||||
|
|
||||||
3. **Edit Profile**
|
3. **Edit Profile**
|
||||||
- **URL**: `/api/users/me/edit-profile`
|
- **URL**: `/api/users/me/edit-profile`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -103,8 +93,13 @@ TODO: document responses.
|
|||||||
- `profile_website`: User website
|
- `profile_website`: User website
|
||||||
- `profile_github`: GitHub username
|
- `profile_github`: GitHub username
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Updates user profile information.
|
- **Description**: Updates user profile information.
|
||||||
|
|
||||||
4. **Forgot Password**
|
4. **Forgot Password**
|
||||||
- **URL**: `/api/users/forgot-password`
|
- **URL**: `/api/users/forgot-password`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -113,8 +108,13 @@ TODO: document responses.
|
|||||||
- `username`: User username
|
- `username`: User username
|
||||||
- `guid`, `plat`, `sid`, `seid`
|
- `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Initiates password reset process.
|
- **Description**: Initiates password reset process.
|
||||||
|
|
||||||
5. **Resend Confirmation Email**
|
5. **Resend Confirmation Email**
|
||||||
- **URL**: `/api/users/me/resend-confirm`
|
- **URL**: `/api/users/me/resend-confirm`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -122,8 +122,13 @@ TODO: document responses.
|
|||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Resends account confirmation email.
|
- **Description**: Resends account confirmation email.
|
||||||
|
|
||||||
6. **Delete Account**
|
6. **Delete Account**
|
||||||
- **URL**: `/api/users/me`
|
- **URL**: `/api/users/me`
|
||||||
- **Method**: DELETE
|
- **Method**: DELETE
|
||||||
@ -132,7 +137,6 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
- **Description**: Deletes user account.
|
- **Description**: Deletes user account.
|
||||||
|
|
||||||
7. **Mark News as Read**
|
7. **Mark News as Read**
|
||||||
- **URL**: `/api/users/me/mark-news-read`
|
- **URL**: `/api/users/me/mark-news-read`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -141,8 +145,13 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `news_id`: News item ID
|
- `news_id`: News item ID
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Marks a news item as read for logged-in users.
|
- **Description**: Marks a news item as read for logged-in users.
|
||||||
|
|
||||||
### Rants
|
### Rants
|
||||||
1. **Get Rant**
|
1. **Get Rant**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}`
|
- **URL**: `/api/devrant/rants/{rant_id}`
|
||||||
@ -152,9 +161,45 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `last_comment_id`: 999999999999 (optional)
|
- `last_comment_id`: 999999999999 (optional)
|
||||||
- `links`: 0 (optional)
|
- `links`: 0 (optional)
|
||||||
- **Response**: JSON with `rant` (text, tags)
|
- **Response**: JSON with `rant` (text, tags), `comments`, `success`, `subscribed`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"rant": {
|
||||||
|
"id": 18960811,
|
||||||
|
"text": "You know, I'm getting tired of this HR-speak in job applications, specifically this:\n\n- [tech] has no secrets for you\n\nWhat, really? So I am the undisputed and absolute expert of - let's say - JavaScript? Do you know how long it takes to master that so that it holds no secrets? It even holds secrets to decade-long experts! The same goes for most other technologies in software development.\n\nSigh. Hhhhh. Ree.",
|
||||||
|
"score": 3,
|
||||||
|
"created_time": 1754065322,
|
||||||
|
"attached_image": "",
|
||||||
|
"num_comments": 10,
|
||||||
|
"tags": [
|
||||||
|
"too-much",
|
||||||
|
"qualifications",
|
||||||
|
"job-hunting"
|
||||||
|
],
|
||||||
|
"vote_state": 0,
|
||||||
|
"edited": false,
|
||||||
|
"link": "rants/18960811/you-know-im-getting-tired-of-this-hr-speak-in-job-applications-specifically-this",
|
||||||
|
"rt": 1,
|
||||||
|
"rc": 1,
|
||||||
|
"user_id": 1366654,
|
||||||
|
"user_username": "CaptainRant",
|
||||||
|
"user_score": 4179,
|
||||||
|
"user_avatar": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-3_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.jpg"
|
||||||
|
},
|
||||||
|
"user_avatar_lg": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-1_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comments": [],
|
||||||
|
"success": true,
|
||||||
|
"subscribed": 0
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Retrieves a specific rant by ID.
|
- **Description**: Retrieves a specific rant by ID.
|
||||||
|
|
||||||
2. **Post Rant**
|
2. **Post Rant**
|
||||||
- **URL**: `/api/devrant/rants`
|
- **URL**: `/api/devrant/rants`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -166,8 +211,14 @@ TODO: document responses.
|
|||||||
- `type`: Rant type ID
|
- `type`: Rant type ID
|
||||||
- `image`: Optional image file (img/gif)
|
- `image`: Optional image file (img/gif)
|
||||||
- **Response**: JSON with `success`, `rant_id`, or `error`
|
- **Response**: JSON with `success`, `rant_id`, or `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "It looks like you just posted this same rant! Your connection might have timed out while posting so you might have seen an error, but sometimes the rant still gets posted and in this case it seems it did, so please check :) If this was not the case please contact info@devrant.io. Thanks!"
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Creates a new rant.
|
- **Description**: Creates a new rant.
|
||||||
|
|
||||||
3. **Edit Rant**
|
3. **Edit Rant**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}`
|
- **URL**: `/api/devrant/rants/{rant_id}`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -178,17 +229,29 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`
|
- `token_id`, `token_key`, `user_id`
|
||||||
- `image`: Optional image file
|
- `image`: Optional image file
|
||||||
- **Response**: JSON with `success` or `fail_reason`
|
- **Response**: JSON with `success` or `fail_reason`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"fail_reason": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Updates an existing rant.
|
- **Description**: Updates an existing rant.
|
||||||
|
|
||||||
4. **Delete Rant**
|
4. **Delete Rant**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}`
|
- **URL**: `/api/devrant/rants/{rant_id}`
|
||||||
- **Method**: DELETE
|
- **Method**: DELETE
|
||||||
- **Parameters**:
|
- **Parameters**:
|
||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success` or `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "An unknown error occurred and this rant can't be deleted. Please contact support@devrant.com for help with this."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Deletes a rant.
|
- **Description**: Deletes a rant.
|
||||||
|
|
||||||
5. **Vote on Rant**
|
5. **Vote on Rant**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}/vote`
|
- **URL**: `/api/devrant/rants/{rant_id}/vote`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -197,9 +260,43 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `vote`: 1 (upvote), -1 (downvote), 0 (remove vote)
|
- `vote`: 1 (upvote), -1 (downvote), 0 (remove vote)
|
||||||
- `reason`: Downvote reason ID (required for downvote)
|
- `reason`: Downvote reason ID (required for downvote)
|
||||||
- **Response**: JSON with `success` or `confirmed` (false if unverified)
|
- **Response**: JSON with `success`, `rant`, or `confirmed` (false if unverified)
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"rant": {
|
||||||
|
"id": 18960811,
|
||||||
|
"text": "You know, I'm getting tired of this HR-speak in job applications, specifically this:\n\n- [tech] has no secrets for you\n\nWhat, really? So I am the undisputed and absolute expert of - let's say - JavaScript? Do you know how long it takes to master that so that it holds no secrets? It even holds secrets to decade-long experts! The same goes for most other technologies in software development.\n\nSigh. Hhhhh. Ree.",
|
||||||
|
"score": 3,
|
||||||
|
"created_time": 1754065322,
|
||||||
|
"attached_image": "",
|
||||||
|
"num_comments": 10,
|
||||||
|
"tags": [
|
||||||
|
"rant",
|
||||||
|
"too-much",
|
||||||
|
"qualifications",
|
||||||
|
"job-hunting"
|
||||||
|
],
|
||||||
|
"vote_state": -1,
|
||||||
|
"edited": false,
|
||||||
|
"rt": 1,
|
||||||
|
"rc": 1,
|
||||||
|
"user_id": 1366654,
|
||||||
|
"user_username": "CaptainRant",
|
||||||
|
"user_score": 4180,
|
||||||
|
"user_avatar": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-3_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.jpg"
|
||||||
|
},
|
||||||
|
"user_avatar_lg": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-1_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Votes on a rant.
|
- **Description**: Votes on a rant.
|
||||||
|
|
||||||
6. **Favorite/Unfavorite Rant**
|
6. **Favorite/Unfavorite Rant**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}/{favorite|unfavorite}`
|
- **URL**: `/api/devrant/rants/{rant_id}/{favorite|unfavorite}`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -207,8 +304,13 @@ TODO: document responses.
|
|||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Favorites or unfavorites a rant.
|
- **Description**: Favorites or unfavorites a rant.
|
||||||
|
|
||||||
7. **Get Rant Feed**
|
7. **Get Rant Feed**
|
||||||
- **URL**: `/api/devrant/rants`
|
- **URL**: `/api/devrant/rants`
|
||||||
- **Method**: GET
|
- **Method**: GET
|
||||||
@ -216,9 +318,66 @@ TODO: document responses.
|
|||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `ids`: JSON string of IDs (optional)
|
- `ids`: JSON string of IDs (optional)
|
||||||
- **Response**: JSON with `success`, `num_notifs`
|
- **Response**: JSON with `success`, `rants`, `settings`, `set`, `wrw`, `dpp`, `num_notifs`, `unread`, `news`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"rants": [
|
||||||
|
{
|
||||||
|
"id": 18960811,
|
||||||
|
"text": "You know, I'm getting tired of this HR-speak in job applications, specifically this:\n\n- [tech] has no secrets for you\n\nWhat, really? So I am the undisputed and absolute expert of - let's say - JavaScript? Do you know how long it takes to master that so that it holds no secrets? It even holds secrets to decade-long experts! The same goes for most other technologies in software development.\n\nSigh. Hhhhh. Ree.",
|
||||||
|
"score": 3,
|
||||||
|
"created_time": 1754065322,
|
||||||
|
"attached_image": "",
|
||||||
|
"num_comments": 9,
|
||||||
|
"tags": [
|
||||||
|
"rant",
|
||||||
|
"too-much",
|
||||||
|
"qualifications",
|
||||||
|
"job-hunting"
|
||||||
|
],
|
||||||
|
"vote_state": 0,
|
||||||
|
"edited": false,
|
||||||
|
"rt": 1,
|
||||||
|
"rc": 1,
|
||||||
|
"user_id": 1366654,
|
||||||
|
"user_username": "CaptainRant",
|
||||||
|
"user_score": 4179,
|
||||||
|
"user_avatar": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-3_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.jpg"
|
||||||
|
},
|
||||||
|
"user_avatar_lg": {
|
||||||
|
"b": "2a8b9d",
|
||||||
|
"i": "v-37_c-1_b-4_g-m_9-1_1-2_16-6_3-1_8-1_7-1_5-2_12-2_6-3_10-1_2-10_22-2_11-2_18-1_19-3_4-2_20-1_21-2.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ... more rants
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"notif_state": -1,
|
||||||
|
"notif_token": ""
|
||||||
|
},
|
||||||
|
"set": "688e90b7cf77f",
|
||||||
|
"wrw": 385,
|
||||||
|
"dpp": 0,
|
||||||
|
"num_notifs": 0,
|
||||||
|
"unread": {
|
||||||
|
"total": 0
|
||||||
|
},
|
||||||
|
"news": {
|
||||||
|
"id": 356,
|
||||||
|
"type": "intlink",
|
||||||
|
"headline": "Weekly Group Rant",
|
||||||
|
"body": "Tips for staying productive?",
|
||||||
|
"footer": "Add tag 'wk247' to your rant",
|
||||||
|
"height": 100,
|
||||||
|
"action": "grouprant"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Retrieves rant feed with notification count.
|
- **Description**: Retrieves rant feed with notification count.
|
||||||
|
|
||||||
### Comments
|
### Comments
|
||||||
1. **Get Comment**
|
1. **Get Comment**
|
||||||
- **URL**: `/api/comments/{comment_id}`
|
- **URL**: `/api/comments/{comment_id}`
|
||||||
@ -227,9 +386,15 @@ TODO: document responses.
|
|||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `links`: 0 (optional)
|
- `links`: 0 (optional)
|
||||||
- **Response**: JSON with `comment` (body)
|
- **Response**: JSON with `comment` (body), or `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "Invalid comment specified in path."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Retrieves a specific comment by ID.
|
- **Description**: Retrieves a specific comment by ID.
|
||||||
|
|
||||||
2. **Post Comment**
|
2. **Post Comment**
|
||||||
- **URL**: `/api/devrant/rants/{rant_id}/comments`
|
- **URL**: `/api/devrant/rants/{rant_id}/comments`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -239,8 +404,13 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`
|
- `token_id`, `token_key`, `user_id`
|
||||||
- `image`: Optional image file (img/gif)
|
- `image`: Optional image file (img/gif)
|
||||||
- **Response**: JSON with `success` or `confirmed` (false if unverified)
|
- **Response**: JSON with `success` or `confirmed` (false if unverified)
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Posts a comment on a rant.
|
- **Description**: Posts a comment on a rant.
|
||||||
|
|
||||||
3. **Edit Comment**
|
3. **Edit Comment**
|
||||||
- **URL**: `/api/comments/{comment_id}`
|
- **URL**: `/api/comments/{comment_id}`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -249,17 +419,29 @@ TODO: document responses.
|
|||||||
- `comment`: Comment text
|
- `comment`: Comment text
|
||||||
- `token_id`, `token_key`, `user_id`
|
- `token_id`, `token_key`, `user_id`
|
||||||
- **Response**: JSON with `success` or `fail_reason`
|
- **Response**: JSON with `success` or `fail_reason`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "Invalid comment specified in path."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Updates an existing comment.
|
- **Description**: Updates an existing comment.
|
||||||
|
|
||||||
4. **Delete Comment**
|
4. **Delete Comment**
|
||||||
- **URL**: `/api/comments/{comment_id}`
|
- **URL**: `/api/comments/{comment_id}`
|
||||||
- **Method**: DELETE
|
- **Method**: DELETE
|
||||||
- **Parameters**:
|
- **Parameters**:
|
||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success` or `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "Invalid comment specified in path."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Deletes a comment.
|
- **Description**: Deletes a comment.
|
||||||
|
|
||||||
5. **Vote on Comment**
|
5. **Vote on Comment**
|
||||||
- **URL**: `/api/comments/{comment_id}/vote`
|
- **URL**: `/api/comments/{comment_id}/vote`
|
||||||
- **Method**: POST
|
- **Method**: POST
|
||||||
@ -268,9 +450,15 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `vote`: 1 (upvote), -1 (downvote), 0 (remove vote)
|
- `vote`: 1 (upvote), -1 (downvote), 0 (remove vote)
|
||||||
- `reason`: Downvote reason ID (required for downvote)
|
- `reason`: Downvote reason ID (required for downvote)
|
||||||
- **Response**: JSON with `success` or `confirmed` (false if unverified)
|
- **Response**: JSON with `success` or `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error": "Invalid comment specified in path."
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Votes on a comment.
|
- **Description**: Votes on a comment.
|
||||||
|
|
||||||
### Notifications
|
### Notifications
|
||||||
1. **Get Notification Feed**
|
1. **Get Notification Feed**
|
||||||
- **URL**: `/api/users/me/notif-feed`
|
- **URL**: `/api/users/me/notif-feed`
|
||||||
@ -280,9 +468,28 @@ TODO: document responses.
|
|||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- `ext_prof`: 1 (optional)
|
- `ext_prof`: 1 (optional)
|
||||||
- `last_time`: Last notification check time
|
- `last_time`: Last notification check time
|
||||||
- **Response**: JSON with `success`, `data` (items, check_time, username_map)
|
- **Response**: JSON with `success`, `data` (items, check_time, username_map, unread, num_unread)
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"items": [],
|
||||||
|
"check_time": 1754173634,
|
||||||
|
"username_map": [],
|
||||||
|
"unread": {
|
||||||
|
"all": 0,
|
||||||
|
"upvotes": 0,
|
||||||
|
"mentions": 0,
|
||||||
|
"comments": 0,
|
||||||
|
"subs": 0,
|
||||||
|
"total": 0
|
||||||
|
},
|
||||||
|
"num_unread": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Retrieves user notifications.
|
- **Description**: Retrieves user notifications.
|
||||||
|
|
||||||
2. **Clear Notifications**
|
2. **Clear Notifications**
|
||||||
- **URL**: `/api/users/me/notif-feed`
|
- **URL**: `/api/users/me/notif-feed`
|
||||||
- **Method**: DELETE
|
- **Method**: DELETE
|
||||||
@ -290,9 +497,14 @@ TODO: document responses.
|
|||||||
- `app`: 3
|
- `app`: 3
|
||||||
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
- `token_id`, `token_key`, `user_id`, `guid`, `plat`, `sid`, `seid`
|
||||||
- **Response**: JSON with `success`
|
- **Response**: JSON with `success`
|
||||||
|
- **Success Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Clears user notifications.
|
- **Description**: Clears user notifications.
|
||||||
|
### External API
|
||||||
## External API
|
|
||||||
- **Beta List Signup**
|
- **Beta List Signup**
|
||||||
- **URL**: `https://www.hexicallabs.com/api/beta-list`
|
- **URL**: `https://www.hexicallabs.com/api/beta-list`
|
||||||
- **Method**: GET (JSONP)
|
- **Method**: GET (JSONP)
|
||||||
@ -300,8 +512,14 @@ TODO: document responses.
|
|||||||
- `email`: User email
|
- `email`: User email
|
||||||
- `platform`: Platform name
|
- `platform`: Platform name
|
||||||
- `app`: 3
|
- `app`: 3
|
||||||
|
- **Response**: JSON with `error`
|
||||||
|
- **Error Example**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Expecting value: line 1 column 1 (char 0)"
|
||||||
|
}
|
||||||
|
```
|
||||||
- **Description**: Signs up user for beta list (external service).
|
- **Description**: Signs up user for beta list (external service).
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
- All endpoints expect `app=3` for identification.
|
- All endpoints expect `app=3` for identification.
|
||||||
- Authenticated endpoints require `dr_token` cookie with `token_id`, `token_key`, `user_id`.
|
- Authenticated endpoints require `dr_token` cookie with `token_id`, `token_key`, `user_id`.
|
||||||
@ -310,5 +528,3 @@ TODO: document responses.
|
|||||||
- Downvotes require a reason ID, prompting a modal if not provided.
|
- Downvotes require a reason ID, prompting a modal if not provided.
|
||||||
- Responses typically include `success` boolean; errors include `error` or `fail_reason`.
|
- Responses typically include `success` boolean; errors include `error` or `fail_reason`.
|
||||||
- Cookies (`dr_token`, `dr_guid`, `dr_session_start`, `dr_event_id`, `dr_feed_sort`, `dr_theme`, `dr_rants_viewed`, `dr_stickers_seen`, `rant_type_filters`, `news_seen`) manage state and preferences.
|
- Cookies (`dr_token`, `dr_guid`, `dr_session_start`, `dr_event_id`, `dr_feed_sort`, `dr_theme`, `dr_rants_viewed`, `dr_stickers_seen`, `rant_type_filters`, `news_seen`) manage state and preferences.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user