View Source PatreonEx (PatreonEx v0.1.1)

This module contains functions that access the Patreon API V2 endpoints and functions that generate OAuth URLs and authenticate responses.

Link to this section Summary

Functions

This function is the same as authorize_url/3 but generates a URL that asks users for permission for all scopes.

This function generates a OAuth2 redirect URL that takes your users to a Patreon login page. After logging in your users will be redirected to a page of your choosing.

This function is wraps a request to the identity endpoint.

This function is wraps a request to the identity endpoint.

This function is validates the URL parameter code that the user is redirected to after logging in. Your application needs to retrieve the code from the URL and pass it to this command.

Link to this section Functions

Link to this function

authorize_url(redirect_uri, client_id)

View Source

This function is the same as authorize_url/3 but generates a URL that asks users for permission for all scopes.

Returns string

examples

Examples

authorize_url("https://google.com", "your_client_id")
Link to this function

authorize_url(scope, redirect_uri, client_id)

View Source
@spec authorize_url([binary()], binary(), binary()) :: binary()
@spec authorize_url([binary()], binary(), binary()) :: binary()

This function generates a OAuth2 redirect URL that takes your users to a Patreon login page. After logging in your users will be redirected to a page of your choosing.

Returns string

examples

Examples

authorize_url([identity, campaigns], "https://google.com", "your_client_id")
Link to this function

get_campaigns(token, params)

View Source
@spec get_campaigns(binary(), map()) :: map()

This function is wraps a request to the identity endpoint.

Returns map

examples

Examples

get_campaigns(
  "access_token_here",
  %{
    "include" => "tiers",
    "fields[campaign]" => Enum.join(["vanity", "creation_name", "discord_server_id", "image_url", "is_nsfw", "url"], ","),
    "fields[tier]" => Enum.join(["title", "description"], ",")
  }
  )
@spec get_user(binary(), map()) :: map()

This function is wraps a request to the identity endpoint.

Returns map

examples

Examples

get_user(
  "access_token_here",
  %{
    "include" => "memberships.currently_entitled_tiers",
    "fields[user]" => Enum.join(["about", "hide_pledges", "full_name", "image_url", "thumb_url", "url"], ","),
    "fields[tier]" => Enum.join(["title", "description"], ",")
  }
  )
Link to this function

validate_code(validation_code, redirect_uri, client_id, client_secret)

View Source
@spec validate_code(binary(), binary(), binary(), binary()) :: map()

This function is validates the URL parameter code that the user is redirected to after logging in. Your application needs to retrieve the code from the URL and pass it to this command.

If validation is successful, then Patreon will return an access token that you can use to make API calls.

Returns map

examples

Examples

validate_code("your code param from url", "https://google.com", "your client id", "your client secret")