user notes and custom thumbnails (#792)

* AnnouncementReactions and examples

* add `note` to Relationship entity

* normalize entity filenames

* add user note to api

* add user note to api

* add thumbnail param to media api

* add icon as thumbnail
This commit is contained in:
trwnh 2020-07-10 05:28:00 -05:00 committed by GitHub
parent dc87541c92
commit 864610c67e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 176 additions and 94 deletions

View File

@ -20,43 +20,49 @@ menu:
"muting_notifications": false,
"requested": false,
"domain_blocking": false,
"endorsed": false
"endorsed": false,
"note": ""
}
```
## Required attributes {#relationship}
## Required attributes
### `id` {#id}
### `id`
**Description:** The account id.\
**Type:** String \(cast from an integer, but not guaranteed to be a number\)\
**Version history:** Added in 0.6.0
**Version history:**\
0.6.0 - added
### `following` {#following}
### `following`
**Description:** Are you following this user?\
**Type:** Boolean\
**Version history:** Added in 0.6.0
**Version history:**\
0.6.0 - added
### `requested` {#requested}
### `requested`
**Description:** Do you have a pending follow request for this user?\
**Type:** Boolean\
**Version history:** Added in 0.9.9
**Version history:**\
0.9.9 - added
### `endorsed` {#endorsed}
### `endorsed`
**Description:** Are you featuring this user on your profile?\
**Type:** Boolean\
**Version history:** Added in 2.5.0
**Version history:**\
2.5.0 - added
### `followed_by` {#followed_by}
**Description:** Are you followed by this user?\
**Type:** Boolean\
**Version history:** Added in 0.6.0
**Version history:**\
0.6.0 - added
### `muting` {#muting}
### `muting`
**Description:** Are you muting this user?\
**Type:** Boolean\
@ -66,31 +72,43 @@ menu:
**Description:** Are you muting notifications from this user?\
**Type:** Boolean\
**Version history:** Added in 2.1.0
**Version history:**\
2.1.0 - added
### `showing_reblogs` {#showing_reblogs}
**Description:** Are you receiving this user's boosts in your home timeline?\
**Type:** Boolean\
**Version history:** Added in 2.1.0
**Version history:**\
2.1.0 - added
### `blocking` {#blocking}
### `blocking`
**Description:** Are you blocking this user?\
**Type:** Boolean\
**Version history:** Added in 0.6.0
**Version history:**\
0.6.0 - added
### `domain_blocking` {#domain_blocking}
**Description:** Are you blocking this user's domain?\
**Type:** Boolean\
**Version history:** Added in 1.4.0
**Version history:**\
1.4.0 - added
### `blocked_by` {#blocked_by}
**Description:** Is this user blocking you?\
**Type:** Boolean\
**Version history:** Added in 2.8.0
**Version history:**\
2.8.0 - added
### `note`
**Description:** Is this user blocking you?\
**Type:** String\
**Version history:**\
3.2.0 - added
## See also

View File

@ -17,10 +17,9 @@ Creates a user and account records. Returns an account access token for the app
**Returns:** Token\
**OAuth:** App token + `write:accounts`\
**Version:**
- 2.7.0 - added
- 3.0.0 - added `reason` parameter
**Version history:**\
2.7.0 - added\
3.0.0 - added `reason` parameter
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -80,9 +79,8 @@ Test to make sure that the user token works.
**Returns:** the user's own Account with Source\
**OAuth**: User token + `read:accounts`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -238,12 +236,11 @@ Update the user's display and preferences.
**Returns:** the user's own Account with Source\
**OAuth:** User token + `write:accounts`\
**Version history:**
- 1.1.1 - added
- 2.3.0 - added `locked` parameter
- 2.4.0 - added `source[privacy,sensitive]` parameters
- 2.7.0 - added `discoverable` parameter
**Version history:**\
1.1.1 - added\
2.3.0 - added `locked` parameter\
2.4.0 - added `source[privacy,sensitive]` parameters\
2.7.0 - added `discoverable` parameter
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -403,10 +400,9 @@ View information about a profile.
**Returns:** Account\
**OAuth:** Public\
**Version history:**
- 0.0.0 - added
- 2.4.0 - returns 410 if account is suspended
**Version history:**\
0.0.0 - added\
2.4.0 - returns 410 if account is suspended
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -577,12 +573,11 @@ Statuses posted to the given account.
**Returns:** Array of Status\
**OAuth:** Public \(for public statuses only\), or user token + `read:statuses` \(for private statuses the user is authorized to see\)\
**Version history:**
- 0.0.0 - added
- 2.6.0 - add min_id
- 2.7.0 - add exclude_reblogs and allow unauthed use
- 2.8.0 - add tagged parameter
**Version history:**\
0.0.0 - added\
2.6.0 - add `min_id`\
2.7.0 - add `exclude_reblogs` and allow unauthed use\
2.8.0 - add `tagged` parameter
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -667,9 +662,8 @@ Accounts which follow the given account, if network is not hidden by the account
**Returns:** Array of Account\
**OAuth:** App token + `read:accounts`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -809,9 +803,8 @@ Accounts which the given account is following, if network is not hidden by the a
**Returns:** Array of Account\
**OAuth:** App token + `read:accounts`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -963,9 +956,8 @@ User lists that you have added this account to.
**Returns:** Array of List\
**OAuth:** User token + `read:lists`\
**Version history:**
- 2.1.0 - added
**Version history:**\
2.1.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1053,9 +1045,8 @@ Account with given id is suspended
**Returns:** Array of IdentityProof\
**OAuth:** User token\
**Version history:**
- 2.8.0 - added
**Version history:**\
2.8.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1133,9 +1124,8 @@ Follow the given account.
**Returns:** Relationship\
**OAuth:** User token + `write:follows` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1203,9 +1193,8 @@ Unfollow the given account.
**Returns:** Relationship\
**OAuth:** User token + `write:follows` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1268,9 +1257,8 @@ Block the given account. Clients should filter statuses from this account if rec
**Returns:** Relationship\
**OAuth:** User token + `write:blocks` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1333,9 +1321,8 @@ Unblock the given account.
**Returns:** Relationship\
**OAuth:** User token + `write:blocks` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1398,9 +1385,8 @@ Mute the given account. Clients should filter statuses and notifications from th
**Returns:** Relationship\
**OAuth:** User token + `write:mutes` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1468,9 +1454,8 @@ Unmute the given account.
**Returns:** Relationship\
**OAuth:** User token + `write:mutes` or `follow`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1533,9 +1518,8 @@ Add the given account to the user's featured profiles. \(Featured profiles are c
**Returns:** Relationship\
**OAuth:** User token + `write:accounts`\
**Version history:**
- 2.5.0 - added
**Version history:**\
2.5.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1635,9 +1619,8 @@ Remove the given account from the user's featured profiles.
**Returns:** Relationship\
**OAuth:** User + `write:accounts`\
**Version history:**
- 2.5.0 - added
**Version history:**\
2.5.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1693,6 +1676,83 @@ Successfully unendorsed, or account was already not endorsed
{{< endapi-method-response-example-description >}}
```
```
{{< endapi-method-response-example >}}
{{< endapi-method-response >}}
{{< endapi-method-spec >}}
{{< endapi-method >}}
{{< api-method method="post" host="https://mastodon.example" path="/api/v1/accounts/:id/note" title="User note" >}}
{{< api-method-description >}}
Sets a private note on a user.
**Returns:** Relationship\
**OAuth:** User + `write:accounts`\
**Version history:**\
3.2.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
{{< api-method-request >}}
{{< api-method-path-parameters >}}
{{< api-method-parameter name=":id" type="string" required=true >}}
The id of the account in the database
{{< endapi-method-parameter >}}
{{< endapi-method-path-parameters >}}
{{< api-method-headers >}}
{{< api-method-parameter name="Authorization" type="string" required=true >}}
Bearer &lt;user token&gt;
{{< endapi-method-parameter >}}
{{< endapi-method-headers >}}
{{< api-method-form-data-parameters >}}
{{< api-method-parameter name="comment" type="string" required=false >}}
The comment to be set on that user. Provide an empty string or leave out this parameter to clear the currently set note.
{{< endapi-method-parameter >}}
{{< endapi-method-form-data-parameters >}}
{{< endapi-method-request >}}
{{< api-method-response >}}
{{< api-method-response-example httpCode=200 >}}
{{< api-method-response-example-description >}}
Successfully updated user note
{{< endapi-method-response-example-description >}}
```javascript
{
"id": "1",
"following": true,
"showing_reblogs": true,
"followed_by": true,
"blocking": false,
"blocked_by": false,
"muting": false,
"muting_notifications": false,
"requested": false,
"domain_blocking": false,
"endorsed": false,
"note": "this is a comment"
}
```
{{< endapi-method-response-example >}}
{{< api-method-response-example httpCode=401 >}}
{{< api-method-response-example-description >}}
{{< endapi-method-response-example-description >}}
```javascript
{
"error": "The access token is invalid"
}
```
{{< endapi-method-response-example >}}
{{< api-method-response-example httpCode=422 >}}
{{< api-method-response-example-description >}}
{{< endapi-method-response-example-description >}}
```
```
@ -1711,9 +1771,8 @@ Find out whether a given account is followed, blocked, muted, etc.
**Returns:** Array of Relationship\
**OAuth:** User token + `read:follows`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -1804,9 +1863,8 @@ Search for matching accounts by username or display name.
**Returns:** Array of Account\
**OAuth:** User token + `read:accounts`\
**Version history:**
- 0.0.0 - added
**Version history:**\
0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}

View File

@ -16,11 +16,11 @@ Creates an attachment to be used with a new status.
**Returns:** Attachment\
**OAuth:** User token + `write:media`\
**Version history:**
- 0.0.0 - added
- 2.3.0 - add `focus` parameter
- 3.1.3 - deprecated in favor of `POST /api/v2/media`, which is equal to v1 in all aspects, except it returns HTTP 202, and the returned JSON object has a url of null, because while the thumbnail is prepared synchronously, the full version of the media attachment will be processed in the background
**Version history:**\
0.0.0 - added\
2.3.0 - add `focus` parameter\
3.1.3 - deprecated in favor of `POST /api/v2/media`, which is equal to v1 in all aspects, except it returns HTTP 202, and the returned JSON object has a url of null, because while the thumbnail is prepared synchronously, the full version of the media attachment will be processed in the background\
3.2.0 - add `thumbnail` parameter
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -34,6 +34,9 @@ Bearer &lt;user token&gt;
{{< api-method-parameter name="file" type="object" required=true >}}
The file to be attached, using multipart form data.
{{< endapi-method-parameter >}}
{{< api-method-parameter name="thumbnail" type="object" required=false >}}
The custom thumbnail of the media to be attached, using multipart form data.
{{< endapi-method-parameter >}}
{{< api-method-parameter name="description" type="string" required=false >}}
A plain-text description of the media, for accessibility purposes.
{{< endapi-method-parameter >}}
@ -144,9 +147,8 @@ Get an Attachment, before it is attached to a status and posted, but after it is
**Returns:** Attachment\
**OAuth:** User token + `write:media`\
**Version history:**
- 3.1.3 - added
**Version history:**\
3.1.3 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -273,9 +275,10 @@ Update an Attachment, before it is attached to a status and posted.
**Returns:** Attachment\
**OAuth:** User token + `write:media`\
**Version history:**
**Version history:**\
0.0.0 - added\
3.2.0 - added `thumbnail`
- 0.0.0 - added
{{< endapi-method-description >}}
{{< api-method-spec >}}
@ -294,6 +297,9 @@ Bearer &lt;user token&gt;
{{< api-method-parameter name="file" type="object" required=false >}}
The file to be attached, using multipart form data.
{{< endapi-method-parameter >}}
{{< api-method-parameter name="thumbnail" type="object" required=false >}}
The custom thumbnail of the media to be attached, using multipart form data.
{{< endapi-method-parameter >}}
{{< api-method-parameter name="description" type="string" required=false >}}
A plain-text description of the media, for accessibility purposes.
{{< endapi-method-parameter >}}

View File

@ -32,7 +32,7 @@ The first-class Object types supported by Mastodon are `Note` and `Question`.
* Notes are transformed into regular statuses.
* Questions are transformed into a poll status.
Some other Object types are converted as best as possible. The transformer uses `content` if available, or `name` if not, in order to generate status text. The `url` will be appended. The `summary` property will be used as the CW text.
Some other Object types are converted as best as possible. The transformer uses `content` if available, or `name` if not, in order to generate status text. The `url` will be appended. The `summary` property will be used as the CW text. The `icon` will be used as a thumbnail.
* Article
* Page