Include new attributes in some Entities

master
Milton Mazzarri 2017-10-26 14:39:42 -05:00
parent 605a062c86
commit f578833eef
No known key found for this signature in database
GPG Key ID: CF3DE6E356E17F1E
5 changed files with 28 additions and 9 deletions

View File

@ -7,7 +7,7 @@ defmodule Hunter.Account do
## Fields ## Fields
* `id` - the account id * `id` - the id of the account
* `username` - the username of the account * `username` - the username of the account
* `acct` - equals `username` for local users, includes `@domain` for remote ones * `acct` - equals `username` for local users, includes `@domain` for remote ones
* `display_name` - the account's display name * `display_name` - the account's display name
@ -142,6 +142,11 @@ defmodule Hunter.Account do
* `since_id` - get a list of followers with id greater than this value * `since_id` - get a list of followers with id greater than this value
* `limit` - maximum number of followers to get, default: 40, maximum: 80 * `limit` - maximum number of followers to get, default: 40, maximum: 80
**Note:** `max_id` and `since_id` for next and previous pages are provided in
the `Link` header. It is **not** possible to use the `id` of the returned
objects to construct your own URLs, because the results are sorted by an
internal key.
""" """
@spec followers(Hunter.Client.t(), non_neg_integer, Keyword.t()) :: [Hunter.Account.t()] @spec followers(Hunter.Client.t(), non_neg_integer, Keyword.t()) :: [Hunter.Account.t()]
def followers(conn, id, options \\ []) do def followers(conn, id, options \\ []) do
@ -163,6 +168,11 @@ defmodule Hunter.Account do
* `since_id` - get a list of followings with id greater than this value * `since_id` - get a list of followings with id greater than this value
* `limit` - maximum number of followings to get, default: 40, maximum: 80 * `limit` - maximum number of followings to get, default: 40, maximum: 80
**Note:** `max_id` and `since_id` for next and previous pages are provided in
the `Link` header. It is **not** possible to use the `id` of the returned
objects to construct your own URLs, because the results are sorted by an
internal key.
""" """
@spec following(Hunter.Client.t(), non_neg_integer, Keyword.t()) :: [Hunter.Account.t()] @spec following(Hunter.Client.t(), non_neg_integer, Keyword.t()) :: [Hunter.Account.t()]
def following(conn, id, options \\ []) do def following(conn, id, options \\ []) do

View File

@ -8,12 +8,14 @@ defmodule Hunter.Attachment do
## Fields ## Fields
* `id` - ID of the attachment * `id` - ID of the attachment
* `type` - One of: "image", "video", "gifv" * `type` - One of: "image", "video", "gifv", "unknown"
* `url` - URL of the locally hosted version of the image * `url` - URL of the locally hosted version of the image
* `remote_url` - For remote images, the remote URL of the original image * `remote_url` - For remote images, the remote URL of the original image
* `preview_url` - URL of the preview image * `preview_url` - URL of the preview image
* `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)
* `meta` - Specifies `width`, `height`, `size` (width x height), `aspect` * `meta` - `small` and `original` containing: `width`, `height`, `size`, `aspect`
**Note**: When the type is "unknown", it is likely only `remote_url` is available and local `url` is missing
""" """
@hunter_api Hunter.Config.hunter_api() @hunter_api Hunter.Config.hunter_api()

View File

@ -7,10 +7,10 @@ defmodule Hunter.Card do
## Fields ## Fields
* `url`- The url associated with the card * `url`- the url associated with the card
* `title` - The title of the card * `title` - the title of the card
* `description` - The card description * `description` - the card description
* `image` - The image associated with the card, if any * `image` - the image associated with the card, if any
* `type` - `link`, `photo`, `video`, or `rich` * `type` - `link`, `photo`, `video`, or `rich`
* `author_name` - name of the author/owner of the resource * `author_name` - name of the author/owner of the resource
* `author_url` - URL for the author/owner of the resource * `author_url` - URL for the author/owner of the resource

View File

@ -12,6 +12,7 @@ defmodule Hunter.Instance do
* `description` - A description for the instance * `description` - A description for the instance
* `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
* `version` - The Mastodon version used by instance. * `version` - The Mastodon version used by instance.
* `urls` - `streaming_api`
""" """
@hunter_api Hunter.Config.hunter_api() @hunter_api Hunter.Config.hunter_api()
@ -21,11 +22,12 @@ defmodule Hunter.Instance do
title: String.t(), title: String.t(),
description: String.t(), description: String.t(),
email: String.t(), email: String.t(),
version: String.t() version: String.t(),
urls: String.t()
} }
@derive [Poison.Encoder] @derive [Poison.Encoder]
defstruct [:uri, :title, :description, :email, :version] defstruct [:uri, :title, :description, :email, :version, :urls]
@doc """ @doc """
Retrieve instance information Retrieve instance information

View File

@ -17,6 +17,7 @@ defmodule Hunter.Status do
* `favourites_count` - number of favourites for the status * `favourites_count` - number of favourites for the status
* `reblogged` - whether the authenticated user has reblogged the status * `reblogged` - whether the authenticated user has reblogged the status
* `favourited` - whether the authenticated user has favourited the status * `favourited` - whether the authenticated user has favourited the status
* `muted` - whether the authenticated user has muted the conversation this status from
* `sensitive` - whether media attachments should be hidden by default * `sensitive` - whether media attachments should be hidden by default
* `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
* `visibility` - one of: `public`, `unlisted`, `private`, `direct` * `visibility` - one of: `public`, `unlisted`, `private`, `direct`
@ -26,6 +27,8 @@ defmodule Hunter.Status do
* `application` - `Hunter.Application` from which the status was posted * `application` - `Hunter.Application` from which the status was posted
* `language` - detected language for the status, default: en * `language` - detected language for the status, default: en
**NOTE**: When `spoiler_text` is present, `sensitive` is true
""" """
@hunter_api Hunter.Config.hunter_api() @hunter_api Hunter.Config.hunter_api()
@ -42,6 +45,7 @@ defmodule Hunter.Status do
favourites_count: non_neg_integer, favourites_count: non_neg_integer,
reblogged: boolean, reblogged: boolean,
favourited: boolean, favourited: boolean,
muted: boolean,
sensitive: boolean, sensitive: boolean,
spoiler_text: String.t(), spoiler_text: String.t(),
media_attachments: [Hunter.Attachment.t()], media_attachments: [Hunter.Attachment.t()],
@ -68,6 +72,7 @@ defmodule Hunter.Status do
:favourites_count, :favourites_count,
:reblogged, :reblogged,
:favourited, :favourited,
:muted,
:sensitive, :sensitive,
:spoiler_text, :spoiler_text,
:visibility, :visibility,