View Source Contentful.Request (Contentful SDK v0.6.0)

Encapsulates functions invloved in making a request towards the Contentful APIs.

Link to this section Summary

Functions

parses the options for retrieving a collection, usually triggered by a Contentful.Query.fetch_all/4. It will drop any option that is not in an allowed set of parameter options.

Builds the request headers for a request against the CDA, taking api access tokens into account

Link to this section Functions

Link to this function

collection_query_params(options)

View Source
@spec collection_query_params(
  limit: pos_integer(),
  skip: non_neg_integer(),
  include: non_neg_integer(),
  content_type: String.t(),
  query: String.t(),
  select_params: map()
) :: list()

parses the options for retrieving a collection, usually triggered by a Contentful.Query.fetch_all/4. It will drop any option that is not in an allowed set of parameter options.

examples

Examples

[limit: 50, skip: 25, order: "foobar"]
  = collection_query_params(limit: 50, baz: "foo", skip: 25, order: "foobar", bar: 42)

Also provides support for mapping out some of the API specific syntax in field handling.

examples-1

Examples

[{:"sys.id[ne]", "foobar"}] = collection_query_params(select_params: [id: [ne: "foobar"]])
@spec headers(String.t()) :: keyword()

Builds the request headers for a request against the CDA, taking api access tokens into account

examples

Examples

my_access_token = "foobarfoob4z"
[
   "Authorization": "Bearer foobarfoob4z",
   "User-Agent": "Contentful Elixir SDK",
   "Accept": "application/json"
 ] = my_access_token |> headers()