wpcom.ex v0.3.0 Wpcom View Source
wpcom.ex is the official Elixir library for the WordPress.com REST API
Link to this section Summary
Functions
Builds api base URL.
Builds a full API url using the supplied path and optional api version.
Fetches api version config value if it exists and valid; default if not.
Generate a WP.com OAuth authorize URL with the given arguments
Retrieve an WP.com OAuth token
Switches wpcom.ex to the supplied api version.
Link to this section Types
grant_type()
View Sourcegrant_type() :: :authorization_code | :client_credentials | :password | :wpcom_exchange_token
Link to this section Functions
api_base(version)
View Sourceapi_base(:restV1 | :restV11 | :wpV2 | :wpcomV2) :: String.t()
Builds api base URL.
Builds a full API url using the supplied path and optional api version.
get_api_version()
View Sourceget_api_version() :: :restV1 | :restV11 | :wpV2 | :wpcomV2
Fetches api version config value if it exists and valid; default if not.
oauth_authorize_url(client_id, redirect_uri, scope \\ :auth, blog \\ nil)
View Sourceoauth_authorize_url(pos_integer(), String.t(), scope(), blog_id()) :: String.t()
Generate a WP.com OAuth authorize URL with the given arguments
Response type is forced to "code" as implicit OAuth is bad practice, particularly serverside like this library.
retrieve_oauth_token(client_id, client_secret, oauth_code, redirect_uri, grant_type \\ :authorization_code)
View Sourceretrieve_oauth_token( pos_integer(), String.t(), String.t(), String.t(), grant_type() ) :: Wpcom.Req.http_response()
Retrieve an WP.com OAuth token
Requires a previously returned auth code.
switch_api_version(new_version)
View Sourceswitch_api_version(:restV1 | :restV11 | :wpV2 | :wpcomV2) :: :ok
Switches wpcom.ex to the supplied api version.