Adds nullability information to entities (#189)

It helps developers building applications and libraries.
This commit is contained in:
Ornithologist Coder 2017-05-09 02:45:42 +02:00 committed by Darius Kazemi
parent 7e02b1f83f
commit 1591adb863
1 changed files with 105 additions and 104 deletions

View File

@ -545,146 +545,147 @@ ___
### Account ### Account
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ---------------------------------------------------------------------------------- | -------- |
| `id` | The ID of the account | | `id` | The ID of the account | no |
| `username` | The username of the account | | `username` | The username of the account | no |
| `acct` | Equals `username` for local users, includes `@domain` for remote ones | | `acct` | Equals `username` for local users, includes `@domain` for remote ones | no |
| `display_name` | The account's display name | | `display_name` | The account's display name | no |
| `locked` | Boolean for when the account cannot be followed without waiting for approval first | | `locked` | Boolean for when the account cannot be followed without waiting for approval first | no |
| `created_at` | The time the account was created | | `created_at` | The time the account was created | no |
| `followers_count` | The number of followers for the account | | `followers_count` | The number of followers for the account | no |
| `following_count` | The number of accounts the given account is following | | `following_count` | The number of accounts the given account is following | no |
| `statuses_count` | The number of statuses the account has made | | `statuses_count` | The number of statuses the account has made | no |
| `note` | Biography of user | | `note` | Biography of user | no |
| `url` | URL of the user's profile page (can be remote) | | `url` | URL of the user's profile page (can be remote) | no |
| `avatar` | URL to the avatar image | | `avatar` | URL to the avatar image | no |
| `avatar_static` | URL to the avatar static image (gif) | | `avatar_static` | URL to the avatar static image (gif) | no |
| `header` | URL to the header image | | `header` | URL to the header image | no |
| `header_static` | URL to the header static image (gif) | | `header_static` | URL to the header static image (gif) | no |
### Application ### Application
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ----------------------- | -------- |
| `name` | Name of the app | | `name` | Name of the app | no |
| `website` | Homepage URL of the app | | `website` | Homepage URL of the app | yes |
### Attachment ### Attachment
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | --------------------------------------------------------------------------------- | -------- |
| `id` | ID of the attachment | | `id` | ID of the attachment | no |
| `type` | One of: "image", "video", "gifv" | | `type` | One of: "image", "video", "gifv" | no |
| `url` | URL of the locally hosted version of the image | | `url` | URL of the locally hosted version of the image | no |
| `remote_url` | For remote images, the remote URL of the original image | | `remote_url` | For remote images, the remote URL of the original image | yes |
| `preview_url` | URL of the preview image | | `preview_url` | URL of the preview image | no |
| `text_url` | Shorter URL for the image, for insertion into text (only present on local images) | | `text_url` | Shorter URL for the image, for insertion into text (only present on local images) | no |
### Card ### Card
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ------------------------------------------ | -------- |
| `url` | The url associated with the card | | `url` | The url associated with the card | no |
| `title` | The title of the card | | `title` | The title of the card | no |
| `description` | The card description | | `description` | The card description | no |
| `image` | The image associated with the card, if any | | `image` | The image associated with the card, if any | yes |
### Context ### Context
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ----------------------------------------------------------------------------------- | -------- |
| `ancestors` | The ancestors of the status in the conversation, as a list of [Statuses](#status) | | `ancestors` | The ancestors of the status in the conversation, as a list of [Statuses](#status) | no |
| `descendants` | The descendants of the status in the conversation, as a list of [Statuses](#status) | | `descendants` | The descendants of the status in the conversation, as a list of [Statuses](#status) | no |
### Error ### Error
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ---------------------------------- | -------- |
| `error` | A textual description of the error | | `error` | A textual description of the error | no |
### Instance ### Instance
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ------------------------------------------------------------------------ | -------- |
| `uri` | URI of the current instance | | `uri` | URI of the current instance | no |
| `title` | The instance's title | | `title` | The instance's title | no |
| `description` | A description for the instance | | `description` | A description for the instance | no |
| `email` | An email address which can be used to contact the instance administrator | | `email` | An email address which can be used to contact the instance administrator | no |
| `version` | The Mastodon version used by instance (as of version 1.3). | yes |
### Mention ### Mention
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | --------------------------------------------------------------------- | -------- |
| `url` | URL of user's profile (can be remote) | | `url` | URL of user's profile (can be remote) | no |
| `username` | The username of the account | | `username` | The username of the account | no |
| `acct` | Equals `username` for local users, includes `@domain` for remote ones | | `acct` | Equals `username` for local users, includes `@domain` for remote ones | no |
| `id` | Account ID | | `id` | Account ID | no |
### Notification ### Notification
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | --------------------------------------------------------------------- | -------- |
| `id` | The notification ID | | `id` | The notification ID | no |
| `type` | One of: "mention", "reblog", "favourite", "follow" | | `type` | One of: "mention", "reblog", "favourite", "follow" | no |
| `created_at` | The time the notification was created | | `created_at` | The time the notification was created | no |
| `account` | The [Account](#account) sending the notification to the user | | `account` | The [Account](#account) sending the notification to the user | no |
| `status` | The [Status](#status) associated with the notification, if applicable | | `status` | The [Status](#status) associated with the notification, if applicable | yes |
### Relationship ### Relationship
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ----------------------------------------------------------- | -------- |
| `id` | Target account id | | `id` | Target account id | no |
| `following` | Whether the user is currently following the account | | `following` | Whether the user is currently following the account | no |
| `followed_by` | Whether the user is currently being followed by the account | | `followed_by` | Whether the user is currently being followed by the account | no |
| `blocking` | Whether the user is currently blocking the account | | `blocking` | Whether the user is currently blocking the account | no |
| `muting` | Whether the user is currently muting the account | | `muting` | Whether the user is currently muting the account | no |
| `requested` | Whether the user has requested to follow the account | | `requested` | Whether the user has requested to follow the account | no |
### Report ### Report
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ------------------------------------------ | -------- |
| `id` | The ID of the report | | `id` | The ID of the report | no |
| `action_taken` | The action taken in response to the report | | `action_taken` | The action taken in response to the report | no |
### Results ### Results
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ---------------------------------------- | -------- |
| `accounts` | An array of matched [Accounts](#account) | | `accounts` | An array of matched [Accounts](#account) | yes |
| `statuses` | An array of matchhed [Statuses](#status) | | `statuses` | An array of matchhed [Statuses](#status) | yes |
| `hashtags` | An array of matched hashtags, as strings | | `hashtags` | An array of matched hashtags, as strings | yes |
### Status ### Status
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | ----------------------------------------------------------------------------- | -------- |
| `id` | The ID of the status | | `id` | The ID of the status | no |
| `uri` | A Fediverse-unique resource ID | | `uri` | A Fediverse-unique resource ID | no |
| `url` | URL to the status page (can be remote) | | `url` | URL to the status page (can be remote) | no |
| `account` | The [Account](#account) which posted the status | | `account` | The [Account](#account) which posted the status | no |
| `in_reply_to_id` | `null` or the ID of the status it replies to | | `in_reply_to_id` | `null` or the ID of the status it replies to | yes |
| `in_reply_to_account_id` | `null` or the ID of the account it replies to | | `in_reply_to_account_id` | `null` or the ID of the account it replies to | yes |
| `reblog` | `null` or the reblogged [Status](#status) | | `reblog` | `null` or the reblogged [Status](#status) | yes |
| `content` | Body of the status; this will contain HTML (remote HTML already sanitized) | | `content` | Body of the status; this will contain HTML (remote HTML already sanitized) | no |
| `created_at` | The time the status was created | | `created_at` | The time the status was created | no |
| `reblogs_count` | The number of reblogs for the status | | `reblogs_count` | The number of reblogs for the status | no |
| `favourites_count` | The number of favourites for the status | | `favourites_count` | The number of favourites for the status | no |
| `reblogged` | Whether the authenticated user has reblogged the status | | `reblogged` | Whether the authenticated user has reblogged the status | yes |
| `favourited` | Whether the authenticated user has favourited the status | | `favourited` | Whether the authenticated user has favourited the status | yes |
| `sensitive` | Whether media attachments should be hidden by default | | `sensitive` | Whether media attachments should be hidden by default | yes |
| `spoiler_text` | If not empty, warning text that should be displayed before the actual content | | `spoiler_text` | If not empty, warning text that should be displayed before the actual content | no |
| `visibility` | One of: `public`, `unlisted`, `private`, `direct` | | `visibility` | One of: `public`, `unlisted`, `private`, `direct` | no |
| `media_attachments` | An array of [Attachments](#attachment) | | `media_attachments` | An array of [Attachments](#attachment) | no |
| `mentions` | An array of [Mentions](#mention) | | `mentions` | An array of [Mentions](#mention) | no |
| `tags` | An array of [Tags](#tag) | | `tags` | An array of [Tags](#tag) | no |
| `application` | [Application](#application) from which the status was posted | | `application` | [Application](#application) from which the status was posted | yes |
### Tag ### Tag
| Attribute | Description | | Attribute | Description | Nullable |
| ------------------------ | ----------- | | ------------------------ | -------------------------------------------- | -------- |
| `name` | The hashtag, not including the preceding `#` | | `name` | The hashtag, not including the preceding `#` | no |
| `url` | The URL of the hashtag | | `url` | The URL of the hashtag | no |