Add Emoji entity, add new fields on Account entity

master
Milton Mazzarri 2019-03-19 11:02:33 -05:00
parent eed75942b1
commit 5b8585af45
No known key found for this signature in database
GPG Key ID: 9F4193F2B5A558FE
5 changed files with 37 additions and 12 deletions

View File

@ -777,5 +777,5 @@ defmodule Hunter do
Returns Hunter version
"""
@spec version() :: String.t()
def version(), do: @hunter_version
def version, do: @hunter_version
end

View File

@ -11,17 +11,20 @@ defmodule Hunter.Account do
* `username` - the username of the account
* `acct` - equals `username` for local users, includes `@domain` for remote ones
* `display_name` - the account's display name
* `locked` - boolean for when the account cannot be followed without waiting for approval first
* `created_at` - the time the account was created
* `followers_count` - the number of followers for the account
* `following_count` - the number of accounts the given account is following
* `statuses_count` - the number of statuses the account has made
* `note` - biography of user
* `url` - URL of the user's profile page (can be remote)
* `avatar` - URL to the avatar image
* `avatar_static` - URL to the avatar static image (gif)
* `header` - URL to the header image
* `header_static` - URL to the header static image (gif)
* `locked` - boolean for when the account cannot be followed without waiting for approval first
* `created_at` - the time the account was created
* `followers_count` - the number of followers for the account
* `following_count` - the number of accounts the given account is following
* `statuses_count` - the number of statuses the account has made
* `emojis` - list of emojis
* `moved` - moved from account
* `bot` - whether this account is a bot or not
"""
@hunter_api Hunter.Config.hunter_api()
@ -41,7 +44,11 @@ defmodule Hunter.Account do
created_at: String.t(),
followers_count: non_neg_integer,
following_count: non_neg_integer,
statuses_count: non_neg_integer
statuses_count: non_neg_integer,
emojis: [Emoji.t()],
moved: Account.t(),
fields: [Hash.t()],
bot: boolean
}
@derive [Poison.Encoder]
@ -60,7 +67,11 @@ defmodule Hunter.Account do
:created_at,
:followers_count,
:following_count,
:statuses_count
:statuses_count,
:emojis,
:moved,
:fields,
:bot
]
@doc """

View File

@ -31,7 +31,7 @@ defmodule Hunter.Client do
User agent of the client
"""
@spec user_agent() :: String.t()
def user_agent() do
def user_agent do
"Hunter.Elixir/#{Hunter.version()}"
end

View File

@ -4,15 +4,15 @@ defmodule Hunter.Config do
@hunter_api Application.get_env(:hunter, :hunter_api, Hunter.Api.HTTPClient)
@api_base_url "https://mastodon.social"
def hunter_api() do
def hunter_api do
@hunter_api
end
def api_base_url() do
def api_base_url do
@api_base_url
end
def home() do
def home do
Path.expand(System.get_env("HUNTER_HOME") || "~/.hunter")
end
end

14
lib/hunter/emoji.ex Normal file
View File

@ -0,0 +1,14 @@
defmodule Hunter.Emoji do
@moduledoc """
Emoji entity
"""
@type t :: %__MODULE__{
shortcode: String.t(),
static_url: String.t(),
url: String.t(),
visible_in_picker: boolean()
}
@derive [Poison.Encoder]
defstruct [:shortcode, :static_url, :url, :visible_in_picker]
end