bokun v0.0.4 Bokun

An HTTP client for Bokun.

Summary

Functions

Perform a DELETE request. See request/1 or request/2 for options definition

Perform a DELETE request. See request/1 or request/2 for options definition

Perform a DELETE request. See request/1 or request/2 for options definition

Perform a GET request. See request/1 or request/2 for options definition

Perform a GET request. See request/1 or request/2 for options definition

Perform a GET request. See request/1 or request/2 for options definition

Perform a HEAD request. See request/1 or request/2 for options definition

Perform a HEAD request. See request/1 or request/2 for options definition

Perform a HEAD request. See request/1 or request/2 for options definition

Perform a OPTIONS request. See request/1 or request/2 for options definition

Perform a OPTIONS request. See request/1 or request/2 for options definition

Perform a OPTIONS request. See request/1 or request/2 for options definition

Perform a PATCH request. See request/1 or request/2 for options definition

Perform a PATCH request. See request/1 or request/2 for options definition

Perform a PATCH request. See request/1 or request/2 for options definition

Perform a POST request. See request/1 or request/2 for options definition

Perform a POST request. See request/1 or request/2 for options definition

Perform a POST request. See request/1 or request/2 for options definition

Perform a PUT request. See request/1 or request/2 for options definition

Perform a PUT request. See request/1 or request/2 for options definition

Perform a PUT request. See request/1 or request/2 for options definition

Perform a request. See request/2 for available options

Perform a request using client function

Callback implementation for Application.start/2

Perform a TRACE request. See request/1 or request/2 for options definition

Perform a TRACE request. See request/1 or request/2 for options definition

Perform a TRACE request. See request/1 or request/2 for options definition

Types

option ::
  {:method, Tesla.Env.method} |
  {:url, Tesla.Env.url} |
  {:query, Tesla.Env.query} |
  {:headers, Tesla.Env.headers} |
  {:body, Tesla.Env.body} |
  {:opts, Tesla.Env.opts}

Functions

access_key()
delete(url)

Specs

delete(Tesla.Env.url) :: Tesla.Env.t

Perform a DELETE request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.delete("/users")
delete(client, url)

Specs

delete(Tesla.Env.client, Tesla.Env.url) :: Tesla.Env.t
delete(Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a DELETE request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.delete("/users")
iex> ExampleApi.delete("/users", query: [page: 1])
delete(client, url, options)

Specs

delete(Tesla.Env.client, Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a DELETE request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.delete("/users", query: [page: 1])
get(url)

Specs

get(Tesla.Env.url) :: Tesla.Env.t

Perform a GET request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.get("/users")
get(client, url)

Specs

get(Tesla.Env.client, Tesla.Env.url) :: Tesla.Env.t
get(Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a GET request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.get("/users")
iex> ExampleApi.get("/users", query: [page: 1])
get(client, url, options)

Specs

get(Tesla.Env.client, Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a GET request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.get("/users", query: [page: 1])
get_request(endpoint, params \\ %{})
head(url)

Specs

head(Tesla.Env.url) :: Tesla.Env.t

Perform a HEAD request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.head("/users")
head(client, url)

Specs

head(Tesla.Env.client, Tesla.Env.url) :: Tesla.Env.t
head(Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a HEAD request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.head("/users")
iex> ExampleApi.head("/users", query: [page: 1])
head(client, url, options)

Specs

head(Tesla.Env.client, Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a HEAD request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.head("/users", query: [page: 1])
options(url)

Specs

options(Tesla.Env.url) :: Tesla.Env.t

Perform a OPTIONS request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.options("/users")
options(client, url)

Specs

options(Tesla.Env.client, Tesla.Env.url) :: Tesla.Env.t
options(Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a OPTIONS request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.options("/users")
iex> ExampleApi.options("/users", query: [page: 1])
options(client, url, options)

Specs

options(Tesla.Env.client, Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a OPTIONS request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.options("/users", query: [page: 1])
parse_path(url, params)
patch(url, body)

Specs

patch(Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t

Perform a PATCH request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.patch("/users", %{name: "Jon"})
patch(client, url, body)

Specs

patch(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t
patch(Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a PATCH request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.patch("/users", %{name: "Jon"})
iex> ExampleApi.patch("/users", %{name: "Jon"}, query: [scope: "admin"])
patch(client, url, body, options)

Specs

patch(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a PATCH request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.patch("/users", %{name: "Jon"}, query: [scope: "admin"])
post(url, body)

Specs

post(Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t

Perform a POST request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.post("/users", %{name: "Jon"})
post(client, url, body)

Specs

post(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t
post(Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a POST request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.post("/users", %{name: "Jon"})
iex> ExampleApi.post("/users", %{name: "Jon"}, query: [scope: "admin"])
post(client, url, body, options)

Specs

post(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a POST request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.post("/users", %{name: "Jon"}, query: [scope: "admin"])
post_request(endpoint, body \\ %{}, params \\ %{})
put(url, body)

Specs

put(Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t

Perform a PUT request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.put("/users", %{name: "Jon"})
put(client, url, body)

Specs

put(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body) :: Tesla.Env.t
put(Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a PUT request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.put("/users", %{name: "Jon"})
iex> ExampleApi.put("/users", %{name: "Jon"}, query: [scope: "admin"])
put(client, url, body, options)

Specs

put(Tesla.Env.client, Tesla.Env.url, Tesla.Env.body, [option]) :: Tesla.Env.t

Perform a PUT request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.put("/users", %{name: "Jon"}, query: [scope: "admin"])
request(options)

Specs

request([option]) :: Tesla.Env.t

Perform a request. See request/2 for available options.

request(client, options)

Specs

request(Tesla.Env.client, [option]) :: Tesla.Env.t

Perform a request using client function

Options:

  • :method - the request method, one of [:head, :get, :delete, :trace, :options, :post, :put, :patch]
  • :url - either full url e.g. “http://example.com/some/path” or just “/some/path” if using Tesla.Middleware.BaseUrl
  • :query - a keyword list of query params, e.g. [page: 1, per_page: 100]
  • :headers - a keyworld list of headers, e.g. [{"content-type", "text/plain"}]
  • :body - depends on used middleware:

    • by default it can be a binary
    • if using e.g. JSON encoding middleware it can be a nested map
    • if adapter supports it it can be a Stream with any of the above
  • :opts - custom, per-request middleware or adapter options

Examples:

iex> ExampleApi.request(method: :get, url: "/users/path")

You can also use shortcut methods like:

iex> ExampleApi.get("/users/1")

or

iex> myclient |> ExampleApi.post("/users", %{name: "Jon"})
secret_key()
start(type, args)

Callback implementation for Application.start/2.

trace(url)

Specs

trace(Tesla.Env.url) :: Tesla.Env.t

Perform a TRACE request. See request/1 or request/2 for options definition.

Example

iex> ExampleApi.trace("/users")
trace(client, url)

Specs

trace(Tesla.Env.client, Tesla.Env.url) :: Tesla.Env.t
trace(Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a TRACE request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.trace("/users")
iex> ExampleApi.trace("/users", query: [page: 1])
trace(client, url, options)

Specs

trace(Tesla.Env.client, Tesla.Env.url, [option]) :: Tesla.Env.t

Perform a TRACE request. See request/1 or request/2 for options definition.

Example

iex> myclient |> ExampleApi.trace("/users", query: [page: 1])