hunter v0.5.1 Hunter.Application View Source
Application entity
This module defines a Hunter.Application
struct and the main functions
for working with Applications.
Fields
id
- identifierclient_id
- client idclient_secret
- client secret
Link to this section Summary
Functions
Register a new OAuth client app on the target instance
Load persisted application's credentials
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: %Hunter.Application{
client_id: String.t(),
client_secret: String.t(),
id: non_neg_integer()
}
t() :: %Hunter.Application{ client_id: String.t(), client_secret: String.t(), id: non_neg_integer() }
Link to this section Functions
Link to this function
create_app(client_name, redirect_uris \\ "urn:ietf:wg:oauth:2.0:oob", scopes \\ ["read"], website \\ nil, options \\ []) View Source
Register a new OAuth client app on the target instance
Parameters
client_name
- name of your applicationredirect_uris
- where the user should be redirected after authorization, default:urn:ietf:wg:oauth:2.0:oob
(no redirect)scopes
- scope list, see the scope section for more details, default:read
website
- URL to the homepage of your app, default:nil
options
- option list
Scopes
read
- read datawrite
- post statuses and upload media for statusesfollow
- follow, unfollow, block, unblock
Multiple scopes can be requested during the authorization phase with the
scope
query param
Options
save?
- persists your application information to a file, so, you can use them later. default:false
api_base_url
- specifies if you want to register an application on a different instance. default:https://mastodon.social
Examples
iex> Hunter.Application.create_app("hunter", "urn:ietf:wg:oauth:2.0:oob", ["read", "write", "follow"], nil, [save?: true, api_base_url: "https://example.com"])
%Hunter.Application{client_id: "1234567890",
client_secret: "1234567890",
id: 1234}
Link to this function
load_credentials(name)
View Source
load_credentials(name)
View Source
load_credentials(String.t()) :: Hunter.Application.t() | no_return()
load_credentials(String.t()) :: Hunter.Application.t() | no_return()
Load persisted application's credentials
Parameters
name
- application name