View Source Petstore (openapi_compiler v1.0.0-beta.18)

Swagger Petstore - 1.0.0

License: MIT

Link to this section Summary

Link to this section Types

@type get_pets_config() :: %{
  optional(:body) => any(),
  optional(:query) => get_pets_config_query(),
  optional(:headers) => get_pets_config_header(),
  optional(:opts) => Tesla.Env.opts()
}
Link to this type

get_pets_config_header()

View Source
@type get_pets_config_header() :: %{optional(String.t()) => any()}
Link to this type

get_pets_config_query()

View Source
@type get_pets_config_query() :: %{
  optional(:limit) => integer(),
  optional(String.t()) => any()
}
Link to this type

get_pets_pet_id_config()

View Source
@type get_pets_pet_id_config() :: %{
  optional(:body) => any(),
  :path => get_pets_pet_id_config_path(),
  optional(:query) => get_pets_pet_id_config_query(),
  optional(:headers) => get_pets_pet_id_config_header(),
  optional(:opts) => Tesla.Env.opts()
}
Link to this type

get_pets_pet_id_config_header()

View Source
@type get_pets_pet_id_config_header() :: %{optional(String.t()) => any()}
Link to this type

get_pets_pet_id_config_path()

View Source
@type get_pets_pet_id_config_path() :: %{
  :petId => String.t(),
  optional(String.t()) => any()
}
Link to this type

get_pets_pet_id_config_query()

View Source
@type get_pets_pet_id_config_query() :: %{optional(String.t()) => any()}
Link to this type

get_pets_pet_id_response()

View Source
@type get_pets_pet_id_response() :: response(get_pets_pet_id_response_options())
Link to this type

get_pets_pet_id_response_options()

View Source
@type get_pets_pet_id_response_options() ::
  {Tesla.Env.status(), Petstore.Schema.Read.error(), Tesla.Env.t()}
  | {200, Petstore.Schema.Read.pet(), Tesla.Env.t()}
@type get_pets_response() :: response(get_pets_response_options())
Link to this type

get_pets_response_options()

View Source
@type get_pets_response_options() ::
  {Tesla.Env.status(), Petstore.Schema.Read.error(), Tesla.Env.t()}
  | {200, Petstore.Schema.Read.pets(), Tesla.Env.t()}
@type 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()}

Options that may be passed to a request function. See request/2 for detailed descriptions.

@type post_pets_config() :: %{
  optional(:body) => any(),
  optional(:query) => post_pets_config_query(),
  optional(:headers) => post_pets_config_header(),
  optional(:opts) => Tesla.Env.opts()
}
Link to this type

post_pets_config_header()

View Source
@type post_pets_config_header() :: %{optional(String.t()) => any()}
Link to this type

post_pets_config_query()

View Source
@type post_pets_config_query() :: %{optional(String.t()) => any()}
@type post_pets_response() :: response(post_pets_response_options())
Link to this type

post_pets_response_options()

View Source
@type post_pets_response_options() ::
  {Tesla.Env.status(), Petstore.Schema.Read.error(), Tesla.Env.t()}
  | {201, any(), Tesla.Env.t()}
Link to this type

response(possible_responses)

View Source
@type response(possible_responses) ::
  {:ok, possible_responses}
  | {:error, {:unexpected_response, Tesla.Env.t()} | any()}
@type server_parameters() :: %{}

Link to this section Functions

Link to this function

create_pets(client \\ %Tesla.Client{}, config)

View Source

See Petstore.post_pets/2.

Link to this function

delete!(client, url, opts)

View Source
@spec delete!(Tesla.Env.client(), Tesla.Env.url(), [option()]) ::
  Tesla.Env.t() | no_return()

Perform a DELETE request.

See request!/1 or request!/2 for options definition.

delete!("/users")
delete!("/users", query: [scope: "admin"])
delete!(client, "/users")
delete!(client, "/users", query: [scope: "admin"])
delete!(client, "/users", body: %{name: "Jon"})
Link to this function

delete(client, url, opts)

View Source
@spec delete(Tesla.Env.client(), Tesla.Env.url(), [option()]) :: Tesla.Env.result()

Perform a DELETE request.

See request/1 or request/2 for options definition.

delete("/users")
delete("/users", query: [scope: "admin"])
delete(client, "/users")
delete(client, "/users", query: [scope: "admin"])
delete(client, "/users", body: %{name: "Jon"})
@spec get!(Tesla.Env.client(), Tesla.Env.url(), [option()]) ::
  Tesla.Env.t() | no_return()

Perform a GET request.

See request!/1 or request!/2 for options definition.

get!("/users")
get!("/users", query: [scope: "admin"])
get!(client, "/users")
get!(client, "/users", query: [scope: "admin"])
get!(client, "/users", body: %{name: "Jon"})

Perform a GET request.

See request/1 or request/2 for options definition.

get("/users")
get("/users", query: [scope: "admin"])
get(client, "/users")
get(client, "/users", query: [scope: "admin"])
get(client, "/users", body: %{name: "Jon"})
Link to this function

get_pets(client \\ %Tesla.Client{}, config)

View Source
@spec get_pets(client :: Tesla.Client.t(), config :: get_pets_config()) ::
  get_pets_response()

GET /pets

Link to this function

get_pets_pet_id(client \\ %Tesla.Client{}, config)

View Source
@spec get_pets_pet_id(client :: Tesla.Client.t(), config :: get_pets_pet_id_config()) ::
  get_pets_pet_id_response()

GET /pets/{petId}

Link to this function

head!(client, url, opts)

View Source
@spec head!(Tesla.Env.client(), Tesla.Env.url(), [option()]) ::
  Tesla.Env.t() | no_return()

Perform a HEAD request.

See request!/1 or request!/2 for options definition.

head!("/users")
head!("/users", query: [scope: "admin"])
head!(client, "/users")
head!(client, "/users", query: [scope: "admin"])
head!(client, "/users", body: %{name: "Jon"})

Perform a HEAD request.

See request/1 or request/2 for options definition.

head("/users")
head("/users", query: [scope: "admin"])
head(client, "/users")
head(client, "/users", query: [scope: "admin"])
head(client, "/users", body: %{name: "Jon"})
Link to this function

list_pets(client \\ %Tesla.Client{}, config)

View Source

See Petstore.get_pets/2.

Link to this function

options!(client, url, opts)

View Source
@spec options!(Tesla.Env.client(), Tesla.Env.url(), [option()]) ::
  Tesla.Env.t() | no_return()

Perform a OPTIONS request.

See request!/1 or request!/2 for options definition.

options!("/users")
options!("/users", query: [scope: "admin"])
options!(client, "/users")
options!(client, "/users", query: [scope: "admin"])
options!(client, "/users", body: %{name: "Jon"})
Link to this function

options(client, url, opts)

View Source
@spec options(Tesla.Env.client(), Tesla.Env.url(), [option()]) :: Tesla.Env.result()

Perform a OPTIONS request.

See request/1 or request/2 for options definition.

options("/users")
options("/users", query: [scope: "admin"])
options(client, "/users")
options(client, "/users", query: [scope: "admin"])
options(client, "/users", body: %{name: "Jon"})
Link to this function

patch!(client, url, body, opts)

View Source

Perform a PATCH request.

See request!/1 or request!/2 for options definition.

patch!("/users", %{name: "Jon"})
patch!("/users", %{name: "Jon"}, query: [scope: "admin"])
patch!(client, "/users", %{name: "Jon"})
patch!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

patch(client, url, body, opts)

View Source

Perform a PATCH request.

See request/1 or request/2 for options definition.

patch("/users", %{name: "Jon"})
patch("/users", %{name: "Jon"}, query: [scope: "admin"])
patch(client, "/users", %{name: "Jon"})
patch(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

post!(client, url, body, opts)

View Source

Perform a POST request.

See request!/1 or request!/2 for options definition.

post!("/users", %{name: "Jon"})
post!("/users", %{name: "Jon"}, query: [scope: "admin"])
post!(client, "/users", %{name: "Jon"})
post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

post(client, url, body, opts)

View Source

Perform a POST request.

See request/1 or request/2 for options definition.

post("/users", %{name: "Jon"})
post("/users", %{name: "Jon"}, query: [scope: "admin"])
post(client, "/users", %{name: "Jon"})
post(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

post_pets(client \\ %Tesla.Client{}, config)

View Source
@spec post_pets(client :: Tesla.Client.t(), config :: post_pets_config()) ::
  post_pets_response()

POST /pets

Link to this function

put!(client, url, body, opts)

View Source

Perform a PUT request.

See request!/1 or request!/2 for options definition.

put!("/users", %{name: "Jon"})
put!("/users", %{name: "Jon"}, query: [scope: "admin"])
put!(client, "/users", %{name: "Jon"})
put!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

put(client, url, body, opts)

View Source

Perform a PUT request.

See request/1 or request/2 for options definition.

put("/users", %{name: "Jon"})
put("/users", %{name: "Jon"}, query: [scope: "admin"])
put(client, "/users", %{name: "Jon"})
put(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
Link to this function

request!(client \\ %Tesla.Client{}, options)

View Source
@spec request!(Tesla.Env.client(), [option()]) :: Tesla.Env.t() | no_return()

Perform request and raise in case of error.

This is similar to request/2 behaviour from Tesla 0.x

See request/2 for list of available options.

Link to this function

request(client \\ %Tesla.Client{}, options)

View Source
@spec request(Tesla.Env.client(), [option()]) :: Tesla.Env.result()

Perform a request.

options

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

Examples

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

# use shortcut methods
ExampleApi.get("/users/1")
ExampleApi.post(client, "/users", %{name: "Jon"})
Link to this function

show_pet_by_id(client \\ %Tesla.Client{}, config)

View Source

See Petstore.get_pets_pet_id/2.

Link to this function

trace!(client, url, opts)

View Source
@spec trace!(Tesla.Env.client(), Tesla.Env.url(), [option()]) ::
  Tesla.Env.t() | no_return()

Perform a TRACE request.

See request!/1 or request!/2 for options definition.

trace!("/users")
trace!("/users", query: [scope: "admin"])
trace!(client, "/users")
trace!(client, "/users", query: [scope: "admin"])
trace!(client, "/users", body: %{name: "Jon"})
Link to this function

trace(client, url, opts)

View Source

Perform a TRACE request.

See request/1 or request/2 for options definition.

trace("/users")
trace("/users", query: [scope: "admin"])
trace(client, "/users")
trace(client, "/users", query: [scope: "admin"])
trace(client, "/users", body: %{name: "Jon"})