hunter v0.5.1 Hunter.Account View Source
Account entity
This module defines a Hunter.Account
struct and the main functions
for working with Accounts.
Fields
id
- the id of the accountusername
- the username of the accountacct
- equalsusername
for local users, includes@domain
for remote onesdisplay_name
- the account's display namelocked
- boolean for when the account cannot be followed without waiting for approval firstcreated_at
- the time the account was createdfollowers_count
- the number of followers for the accountfollowing_count
- the number of accounts the given account is followingstatuses_count
- the number of statuses the account has madenote
- biography of userurl
- URL of the user's profile page (can be remote)avatar
- URL to the avatar imageavatar_static
- URL to the avatar static image (gif)header
- URL to the header imageheader_static
- URL to the header static image (gif)emojis
- list of emojismoved
- moved from accountbot
- whether this account is a bot or not
Link to this section Summary
Functions
Accepts a follow request
Retrieve account
Retrieve user's blocks
Fetch the list of users who favourited the status
Follow a remote user
Retrieve a list of follow requests
Get a list of followers
Get a list of followed accounts
Retrieve user's mutes
Fetch the list of users who reblogged the status
Rejects a follow request
Search for accounts
Make changes to the authenticated user
Retrieve account of authenticated user
Link to this section Types
t()
View Source
t() :: %Hunter.Account{
acct: String.t(),
avatar: String.t(),
avatar_static: String.t(),
bot: boolean(),
created_at: String.t(),
display_name: String.t(),
emojis: [Hunter.Emoji.t()],
fields: [any()],
followers_count: non_neg_integer(),
following_count: non_neg_integer(),
header: String.t(),
header_static: String.t(),
id: non_neg_integer(),
locked: String.t(),
moved: t(),
note: String.t(),
statuses_count: non_neg_integer(),
url: String.t(),
username: String.t()
}
t() :: %Hunter.Account{ acct: String.t(), avatar: String.t(), avatar_static: String.t(), bot: boolean(), created_at: String.t(), display_name: String.t(), emojis: [Hunter.Emoji.t()], fields: [any()], followers_count: non_neg_integer(), following_count: non_neg_integer(), header: String.t(), header_static: String.t(), id: non_neg_integer(), locked: String.t(), moved: t(), note: String.t(), statuses_count: non_neg_integer(), url: String.t(), username: String.t() }
Link to this section Functions
accept_follow_request(conn, id)
View Source
accept_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
accept_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
Accepts a follow request
Parameters
conn
- connection credentialsid
- follow request id
account(conn, id)
View Source
account(Hunter.Client.t(), non_neg_integer()) :: Hunter.Account.t()
account(Hunter.Client.t(), non_neg_integer()) :: Hunter.Account.t()
Retrieve account
Parameters
conn
- connection credentialsid
- account id
blocks(conn, options \\ [])
View Source
blocks(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
blocks(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
Retrieve user's blocks
Parameters
conn
- connection credentials
Options
max_id
- get a list of blocks with id less than or equal this valuesince_id
- get a list of blocks with id greater than this valuelimit
- maximum number of blocks to get, default: 40, max: 80
favourited_by(conn, id, options \\ [])
View Source
favourited_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
favourited_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
Fetch the list of users who favourited the status
Parameters
conn
- connection credentialsid
- status identifieroptions
- option list
Options
max_id
- get a list of favourited by ids less than or equal this valuesince_id
- get a list of favourited by ids greater than this valuelimit
- maximum number of favourited by to get, default: 40, max: 80
follow_by_uri(conn, uri)
View Source
follow_by_uri(Hunter.Client.t(), String.t()) :: Hunter.Account.t()
follow_by_uri(Hunter.Client.t(), String.t()) :: Hunter.Account.t()
Follow a remote user
Parameters
conn
- connection credentialsuri
- URI of the remote user, in the format ofusername@domain
follow_requests(conn, options \\ [])
View Source
follow_requests(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
follow_requests(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
Retrieve a list of follow requests
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of follow requests with id less than or equal this valuesince_id
- get a list of follow requests with id greater than this valuelimit
- maximum number of requests to get, default: 40, max: 80
followers(conn, id, options \\ [])
View Source
followers(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
followers(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
Get a list of followers
Parameters
conn
- connection credentialsid
- account idoptions
- options list
Options
max_id
- get a list of followers with id less than or equal this valuesince_id
- get a list of followers with id greater than this valuelimit
- 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.
following(conn, id, options \\ [])
View Source
following(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
following(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
Get a list of followed accounts
Parameters
conn
- connection credentialsid
- account idoptions
- options list
Options
max_id
- get a list of followings with id less than or equal this valuesince_id
- get a list of followings with id greater than this valuelimit
- 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.
mutes(conn, options \\ [])
View Source
mutes(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
mutes(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
Retrieve user's mutes
Parameters
conn
- connection credentialsoptions
- option list
Options
max_id
- get a list of mutes with id less than or equal this valuesince_id
- get a list of mutes with id greater than this valuelimit
- maximum number of mutes to get, default: 40, max: 80
reblogged_by(conn, id, options \\ [])
View Source
reblogged_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [
Hunter.Account.t()
]
reblogged_by(Hunter.Client.t(), non_neg_integer(), Keyword.t()) :: [ Hunter.Account.t() ]
Fetch the list of users who reblogged the status.
Parameters
conn
- connection credentialsid
- status identifieroptions
- option list
Options
max_id
- get a list of reblogged by ids less than or equal this valuesince_id
- get a list of reblogged by ids greater than this valuelimit
- maximum number of reblogged by to get, default: 40, max: 80
reject_follow_request(conn, id)
View Source
reject_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
reject_follow_request(Hunter.Client.t(), non_neg_integer()) :: boolean()
Rejects a follow request
Parameters
conn
- connection credentialsid
- follow request id
search_account(conn, options)
View Source
search_account(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
search_account(Hunter.Client.t(), Keyword.t()) :: [Hunter.Account.t()]
Search for accounts
Parameters
conn
- connection credentialsoptions
- option list
Options
q
: what to search forlimit
: maximum number of matching accounts to return, default: 40
update_credentials(conn, data)
View Source
update_credentials(Hunter.Client.t(), map()) :: Hunter.Account.t()
update_credentials(Hunter.Client.t(), map()) :: Hunter.Account.t()
Make changes to the authenticated user
Parameters
conn
- connection credentialsdata
- data payload
Possible keys for payload
display_name
- name to display in the user's profilenote
- new biography for the useravatar
- base64 encoded image to display as the user's avatar (e.g.data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...
)header
- base64 encoded image to display as the user's header image (e.g.data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...
)
verify_credentials(conn)
View Source
verify_credentials(Hunter.Client.t()) :: Hunter.Account.t()
verify_credentials(Hunter.Client.t()) :: Hunter.Account.t()
Retrieve account of authenticated user
Parameters
conn
- connection credentials
Examples
iex> conn = Hunter.new([base_url: "https://social.lou.lt", bearer_token: "123456"])
%Hunter.Client{base_url: "https://social.lou.lt", bearer_token: "123456"}
iex> Hunter.Account.verify_credentials(conn)
%Hunter.Account{acct: "milmazz",
avatar: "https://social.lou.lt/avatars/original/missing.png",
avatar_static: "https://social.lou.lt/avatars/original/missing.png",
created_at: "2017-04-06T17:43:55.325Z",
display_name: "Milton Mazzarri", followers_count: 4,
following_count: 4,
header: "https://social.lou.lt/headers/original/missing.png",
header_static: "https://social.lou.lt/headers/original/missing.png",
id: 8039, locked: false, note: "", statuses_count: 3,
url: "https://social.lou.lt/@milmazz", username: "milmazz"}