weebpotion v0.2.1 WeebPotion.Struct.Client View Source

Link to this section Summary

Types

t()

This type represents the client needed to authenticate requests and hold small pieces of information. The keys are as follows

Functions

Constructs a new client struct using the options passed in via the opts key-word list

Link to this section Types

Link to this type t() View Source
t() :: %WeebPotion.Struct.Client{
  application_name: term(),
  environment: term(),
  headers: term(),
  token: term(),
  token_type: term(),
  version: term()
}

This type represents the client needed to authenticate requests and hold small pieces of information. The keys are as follows:

  • :token_type - An atom that can be either :Wolke or :Bearer. All modern weeb.sh tokens are of the :Wolke type.
  • :token - A binary string equal to your weeb.sh token used to authenticate requests.
  • :application_name - A binary string equal to the name of the application.
  • :version - A binary string equal to the version of the application.
  • :environment - A binary string representing the environment of the application, such as dev or alpha.
  • :headers - A key-word list containing the HTTP Headers, used to avoid re-creating constant information.

Link to this section Functions

Constructs a new client struct using the options passed in via the opts key-word list.

Parameters

  • opts: A key-word list containing options to construct a client with.

Examples

iex>WeebPotion.Struct.Client.new(token: "redacted", name: "test", version: "0.1.0")
%WeebPotion.Struct.Client{
  application_name: "test",
  auth_header: [
    Authorization: "Wolke redacted",
    "User-Agent": "test/0.1.0/dev"
  ],
  environment: "dev",
  token: "redacted",
  token_type: :Wolke,
  version: "0.1.0"
}