sendgrid v2.0.0 SendGrid View Source

Interface to SendGrid’s API.

Configuration

An API key can be set in your application’s config.

# Compile-time configured key.
config :sendgrid,
  api_key: "sendgrid_api_key"

# Run-time configured key
config :sendgrid,
  api_key: {:system, "ENV_KEY"}

Optionally you can supply an API key as a keyword option in the last argument of any API call to override and set the API key to use for the request.

SendGrid.Mail.send(..., api_key: "API_KEY")

Usage

Most usage with this library will be with composing transactional emails. Refer to SendGrid.Email for full documentation and usage.

Link to this section Summary

Types

Optional arguments to use when performing a request

Functions

Performs a DELETE request

Performs a GET request

Performs a PATCH request

Performs a POST request

Link to this section Types

Link to this type api_key() View Source
api_key() :: {:api_key, String.t()}
Link to this type options() View Source
options() :: [query() | api_key()]

Optional arguments to use when performing a request.

Link to this type page_size() View Source
page_size() :: {:page_size, pos_integer()}
Link to this type query() View Source
query() :: {:query, Keyword.t()}

Link to this section Functions

Link to this function delete(path, opts \\ []) View Source
delete(path :: String.t(), options :: options()) ::
  {:ok, SendGrid.Response.t()} | {:error, any()}

Performs a DELETE request.

Options

  • :api_key - API key to use with the request.
  • :query - Keyword list of query params to use with the request.
Link to this function get(path, opts \\ []) View Source
get(path :: String.t(), options :: options()) ::
  {:ok, SendGrid.Response.t()} | {:error, any()}

Performs a GET request.

Options

  • :api_key - API key to use with the request.
  • :query - Keyword list of query params to use with the request.
Link to this function patch(path, body, opts \\ []) View Source
patch(path :: String.t(), body :: map(), options :: options()) ::
  {:ok, SendGrid.Response.t()} | {:error, any()}

Performs a PATCH request.

Options

  • :api_key - API key to use with the request.
  • :query - Keyword list of query params to use with the request.
Link to this function post(path, body, opts \\ []) View Source
post(path :: String.t(), body :: map(), options :: options()) ::
  {:ok, SendGrid.Response.t()} | {:error, any()}

Performs a POST request.

Options

  • :api_key - API key to use with the request.
  • :query - Keyword list of query params to use with the request.