Improve API documentation

This commit is contained in:
Eugen Rochko 2018-10-06 01:28:20 +02:00
parent b2023264a2
commit 320d51a4d9
5 changed files with 32 additions and 17 deletions

View File

@ -44,6 +44,16 @@ menu:
| `value` | String (HTML) |{{< no >}}|2.4.0|
| `verified_at` | String (Datetime) |{{< yes >}}|2.6.0|
### Source
|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `privacy` | String |{{< yes >}}|1.5.0|
| `sensitive` | Boolean |{{< yes >}}|1.5.0|
| `language` | String (ISO6391) |{{< yes >}}|2.4.2|
| `note` | String |{{< no >}}|1.5.0|
| `fields` | Array of Hash |{{< no >}}|2.4.0|
## Application
|Attribute|Type|Nullable|Added in|
@ -251,9 +261,7 @@ Please check `app/javascript/mastodon/selectors/index.js` and `app/lib/feed_mana
|---------|-----------|:------:|:------:|
| `accounts` | Array of [Account](#account) |{{< no >}}|1.1.0|
| `statuses` | Array of [Status](#status) |{{< no >}}|1.1.0|
| `hashtags` | Array of String |{{< no >}}|1.1.0|
> **Note:** The v2 API returns an array of [Tag](#tag) for the `hashtags` attribute.
| `hashtags` | Array of [Tag](#tag) |{{< no >}}|1.1.0|
## Status

View File

@ -18,7 +18,7 @@ Returns [Account]({{< relref "entities.md#account" >}})
User's own account.
Returns [Account]({{< relref "entities.md#account" >}}) with an extra `source` attribute.
Returns [Account]({{< relref "entities.md#account" >}}) with an extra [`source` attribute]({{< relref "entities.md#source" >}}).
### Resource information
@ -43,8 +43,10 @@ Returns [Account]({{< relref "entities.md#account" >}})
| `avatar` | Avatar encoded using `multipart/form-data` | Optional |
| `header` | Header image encoded using `multipart/form-data` | Optional |
| `locked` | Enable follow requests | Optional |
| `source` | Extra preferences | Optional |
| `fields_attributes` | Profile metadata | Optional |
| `source[privacy]` | Default post privacy preference | Optional |
| `source[sensitive]`| Whether to mark statuses as sensitive by default | Optional |
| `source[language]` | Override language on statuses by default (ISO6391) | Optional |
| `fields_attributes` | Profile metadata (max. 4) | Optional |
## GET /api/v1/accounts/:id/followers
@ -105,6 +107,7 @@ Returns array of [Status]({{< relref "entities.md#status" >}})
| `exclude_replies` | Skip statuses that reply to other statuses | Optional |false|
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
### Pagination

View File

@ -22,6 +22,7 @@ Returns array of [Notification]({{< relref "entities.md#notification" >}})
|----|-----------|:------:|:-----:|
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
| `exclude_types` | Array of types to exclude (e.g. `follow`, `favourite`, `reblog`, `mention`) | Optional ||

View File

@ -22,6 +22,7 @@ Returns array of [Status]({{< relref "entities.md#status" >}})
|----|-----------|:------:|:-----:|
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
### Pagination
@ -46,6 +47,7 @@ Returns array of [Status]({{< relref "entities.md#status" >}})
| `only_media` | Only statuses with media attachments | Optional |false|
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
### Pagination
@ -70,6 +72,7 @@ Returns array of [Status]({{< relref "entities.md#status" >}})
| `only_media` | Only statuses with media attachments | Optional |false|
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
### Pagination
@ -90,9 +93,10 @@ Returns array of [Status]({{< relref "entities.md#status" >}})
|Name|Description|Required|Default|
|----|-----------|:------:|:-----:|
| `max_id` | Get a list of statuses with ID less than this value | Optional ||
| `since_id` | Get a list of statuses with ID greater than this value | Optional ||
| `limit` | Maximum number of statuses to return | Optional | 20 |
| `max_id` | Return results older than ID | Optional ||
| `since_id` | Return results newer than ID | Optional ||
| `min_id` | Return results immediately newer than ID | Optional ||
| `limit` | Maximum number of results | Optional | 20 |
### Pagination

View File

@ -13,32 +13,31 @@ Alternatively, a WebSocket connection can also be established.
## Server-sent events (HTTP)
### Endpoints
GET /api/v1/streaming/user
#### GET /api/v1/streaming/user
Returns events that are relevant to the authorized user, i.e. home timeline and notifications
GET /api/v1/streaming/public
#### GET /api/v1/streaming/public
Returns all public statuses
GET /api/v1/streaming/public/local
#### GET /api/v1/streaming/public/local
Returns all local statuses
GET /api/v1/streaming/hashtag?tag={id}
#### GET /api/v1/streaming/hashtag?tag=:hashtag
Returns all public statuses for a particular hashtag
GET /api/v1/streaming/hashtag/local?tag={id}
#### GET /api/v1/streaming/hashtag/local?tag=:hashtag
Returns all local statuses for a particular hashtag
GET /api/v1/streaming/list?list={id}
#### GET /api/v1/streaming/list?list=:list_id
Returns statuses for a list
GET /api/v1/streaming/direct
#### GET /api/v1/streaming/direct
Returns all direct messages