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

Swagger Petstore - 1.0.0

A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification

Terms of Service: http://swagger.io/terms/

License: Apache 2.0

Swagger API Team - apiteam@swagger.io - http://swagger.io

Link to this section Summary

Functions

Perform a DELETE request.

Perform a DELETE request.

Perform a GET request.

Perform a GET request.

Perform a HEAD request.

Perform a HEAD request.

Perform a OPTIONS request.

Perform a OPTIONS request.

Perform a PATCH request.

Perform a PATCH request.

Perform a POST request.

Perform a POST request.

Perform a PUT request.

Perform a PUT request.

Perform request and raise in case of error.

Perform a TRACE request.

Perform a TRACE request.

Link to this section Types

Link to this type

delete_pets_id_config()

View Source
@type delete_pets_id_config() :: %{
  optional(:body) => any(),
  :path => delete_pets_id_config_path(),
  optional(:query) => delete_pets_id_config_query(),
  optional(:headers) => delete_pets_id_config_header(),
  optional(:opts) => Tesla.Env.opts()
}
Link to this type

delete_pets_id_config_header()

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

delete_pets_id_config_path()

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

delete_pets_id_config_query()

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

delete_pets_id_response()

View Source
@type delete_pets_id_response() :: response(delete_pets_id_response_options())
Link to this type

delete_pets_id_response_options()

View Source
@type delete_pets_id_response_options() ::
  {Tesla.Env.status(), PetstoreExpanded.Schema.Read.error(), Tesla.Env.t()}
  | {204, any(), Tesla.Env.t()}
@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(:tags) => [String.t()],
  optional(:limit) => integer(),
  optional(String.t()) => any()
}
@type get_pets_id_config() :: %{
  optional(:body) => any(),
  :path => get_pets_id_config_path(),
  optional(:query) => get_pets_id_config_query(),
  optional(:headers) => get_pets_id_config_header(),
  optional(:opts) => Tesla.Env.opts()
}
Link to this type

get_pets_id_config_header()

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

get_pets_id_config_path()

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

get_pets_id_config_query()

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

get_pets_id_response()

View Source
@type get_pets_id_response() :: response(get_pets_id_response_options())
Link to this type

get_pets_id_response_options()

View Source
@type get_pets_id_response_options() ::
  {Tesla.Env.status(), PetstoreExpanded.Schema.Read.error(), Tesla.Env.t()}
  | {200, PetstoreExpanded.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 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() :: %{
  :body => post_pets_config_request_body(),
  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()}
Link to this type

post_pets_config_request_body()

View Source
@type post_pets_config_request_body() :: PetstoreExpanded.Schema.Write.new_pet()
@type post_pets_response() :: response(post_pets_response_options())
Link to this type

post_pets_response_options()

View Source
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

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

View Source

See PetstoreExpanded.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"})
Link to this function

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

View Source

See PetstoreExpanded.delete_pets_id/2.

Link to this function

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

View Source
@spec delete_pets_id(client :: Tesla.Client.t(), config :: delete_pets_id_config()) ::
  delete_pets_id_response()

DELETE /pets/{id}

deletes a single pet based on the ID supplied

Link to this function

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

View Source

See PetstoreExpanded.get_pets_id/2.

Link to this function

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

View Source

See PetstoreExpanded.get_pets/2.

@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

Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.

Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.

Link to this function

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

View Source
@spec get_pets_id(client :: Tesla.Client.t(), config :: get_pets_id_config()) ::
  get_pets_id_response()

GET /pets/{id}

Returns a user based on a single ID, if the user does not have access to the pet

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

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

Creates a new pet in the store. Duplicates are allowed

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

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"})