bungee v1.0.0-alpha2 Bungee

Supervisor for Bungee

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

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

ASYNC We should do something with ?op_type=create

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

Start a Bungee GenServer

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

Link to this section Types

Link to this type option()
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()}

Link to this section Functions

Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

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

Example

ExampleApi.delete("/users")
Link to this function delete(client, url)

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

Example

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

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

Example

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

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

Example

ExampleApi.get("/users")

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

Example

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

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

Example

myclient |> ExampleApi.get("/users", query: [page: 1])
Link to this function handle_call(msg, from, state)
handle_call(
  {:save, atom(), map(), binary(), map(), binary() | nil, map()},
  pid(),
  map()
) :: {:reply, :ok, map()}
handle_call({:fetch, atom() | nil, map()}, pid(), map()) ::
  {:reply, :ok, map()}
handle_call({:query, atom() | nil, map()}, pid(), map()) ::
  {:reply, :ok, map()}
Link to this function handle_cast(msg, state)
handle_cast(
  {:save, atom(), map(), binary(), map(), binary() | nil, map()},
  map()
) :: {:noreply, map()}

ASYNC We should do something with ?op_type=create

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

Example

ExampleApi.head("/users")

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

Example

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

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

Example

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

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

Example

ExampleApi.options("/users")
Link to this function options(client, url)
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

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

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

Example

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

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

Example

ExampleApi.patch("/users", %{name: "Jon"})

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

Example

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

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

Example

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

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

Example

ExampleApi.post("/users", %{name: "Jon"})

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

Example

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

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

Example

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

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

Example

ExampleApi.put("/users", %{name: "Jon"})

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

Example

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

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

Example

myclient |> ExampleApi.put("/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function request(options)
request([option()]) :: Tesla.Env.t()

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

Link to this function request(client, options)
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:

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

You can also use shortcut methods like:

ExampleApi.get("/users/1")

or

myclient |> ExampleApi.post("/users", %{name: "Jon"})
Link to this function start_link(otp_app \\ :bungee)

Start a Bungee GenServer

config :bungee, :config, %{
  uri: "http://localhost:9200",
  index: "bungee_index"
}

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

Example

ExampleApi.trace("/users")

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

Example

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

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

Example

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