Polyjuice Client v0.4.4 Polyjuice.Client.Endpoint.HttpSpec View Source

Link to this section Summary

Types

t()

The description of how to handle the endpoint.

Functions

Headers for endpoints that accept JSON.

Create a DELETE request.

Create a GET request.

Create a POST request.

The r0 media URL prefix

The r0 client URL prefix

The unstable client URL prefix

Create a PUT request.

Headers for endpoints that send and accept JSON.

Link to this section Types

Link to this type

t()

View Source
t() :: %Polyjuice.Client.Endpoint.HttpSpec{
  auth_required: boolean(),
  body: iodata() | {:file, String.t()} | {Enumerable.t(), integer()},
  headers: [{String.t(), String.t()}],
  method: atom(),
  path: String.t(),
  query: Keyword.t() | nil,
  stream_response: boolean()
}

The description of how to handle the endpoint.

  • method is the HTTP verb
  • headers is a list of the HTTP headers
  • path is the path of the endpoint, relative to the homeserver's base URL
  • query is an enumerable of {key, value} tuples giving the query parameters
  • body is the HTTP body (if any) as a binary, or {:file, filename}
  • transform is a function to transform the result (status code, headers, content) to a return value
  • auth_required indicates whether the end point requires authentication

Link to this section Functions

Headers for endpoints that accept JSON.

Link to this function

delete(prefix, path, opts \\ [])

View Source

Create a DELETE request.

See get/3.

Link to this function

get(prefix, path, opts \\ [])

View Source

Create a GET request.

prefix is a prefix for the path. It can be one of r0 (indicating _matrix/client/r0), unstable (indicating _matrix/client/unstable), media_r0 (indicating _matrix/media/r0), or a string giving any other prefix.

opts is a keyword list giving any of the other parameters for Polyjuice.Client.Endpoint.HttpSpec.t().

Link to this function

post(prefix, path, opts \\ [])

View Source

Create a POST request.

See get/3.

The r0 media URL prefix

The r0 client URL prefix

The unstable client URL prefix

Link to this function

put(prefix, path, opts \\ [])

View Source

Create a PUT request.

See get/3.

Headers for endpoints that send and accept JSON.