Resty v0.12.0 Resty.Repo View Source

This module is the one that will issue requests to the rest API and map responses to resource structs.

Link to this section Summary

Functions

Same as all/1 but raise in case of error

Return all the resources returned by the api

Same as delete/1 but raise in case of error

Same as delete/2 but raise in case of error

Same as delete/3 but raise in case of error

Delete the given resource

Delete the given resource

Delete the resource matching the given module and id

Does this resource exist on the remote api?

Does this resource exist on the remote api?

Does a resource of the given type and id exist on the remote api?

Same as find/2 but raise in case of error

Return the matching resource for the given module and id or nil

Same as first/1 but raise in case of error

Return the first result returned by all/1 or nil

Same as last/1 but raise in case of error

Return the last result returned by all/1 or nil

Same as reload/1 but raise in case of error

Refresh the given resource with the latest data found on the remote api

Same as save/1 but raise in case of error

Persist the given resource, this will perform an UPDATE request if the resource already has an id, a POST request will be sent otherwise

Update the given resource’s attribute

Update the given resource with the given list of attributes

Link to this section Types

Link to this section Functions

Same as all/1 but raise in case of error.

Link to this function all(module, url_parameters \\ []) View Source

Return all the resources returned by the api.

Link to this function delete!(resource) View Source
delete!(Resty.Resource.t()) :: true

Same as delete/1 but raise in case of error.

Link to this function delete!(resource, url_parameters) View Source
delete!(Resty.Resource.t(), id_or_params()) :: true

Same as delete/2 but raise in case of error.

Same as delete/3 but raise in case of error.

Link to this function delete(resource) View Source
delete(Resty.Resource.t()) :: {:ok, true} | {:error, Exception.t()}

Delete the given resource.

Link to this function delete(resource, url_parameters) View Source
delete(Resty.Resource.t(), id_or_params()) ::
  {:ok, true} | {:error, Exception.t()}

Delete the given resource.

Link to this function delete(module, id, url_parameters) View Source

Delete the resource matching the given module and id.

Link to this function exists?(resource) View Source
exists?(Resty.Resource.t()) :: {:ok, boolean()} | {:error, Exception.t()}

Does this resource exist on the remote api?

Link to this function exists?(resource, url_parameters) View Source
exists?(Resty.Resource.t(), id_or_params()) ::
  {:ok, boolean()} | {:error, Exception.t()}

Does this resource exist on the remote api?

Link to this function exists?(module, resource_id, url_parameters) View Source

Does a resource of the given type and id exist on the remote api?

Same as find/2 but raise in case of error.

Link to this function find(module, id, url_parameters \\ []) View Source

Return the matching resource for the given module and id or nil.

Same as first/1 but raise in case of error.

Link to this function first(module, url_parameters \\ []) View Source
first(Resty.Resource.mod(), Resty.Resource.url_parameters()) ::
  {:ok, nil} | {:ok, Resty.Resource.t()} | {:error, Exception.t()}

Return the first result returned by all/1 or nil.

Same as last/1 but raise in case of error.

Link to this function last(module, url_parameters \\ []) View Source
last(Resty.Resource.mod(), Resty.Resource.url_parameters()) ::
  {:ok, nil} | {:ok, Resty.Resource.t()} | {:error, Exception.t()}

Return the last result returned by all/1 or nil.

Same as reload/1 but raise in case of error.

Link to this function reload(resource, url_parameters \\ []) View Source

Refresh the given resource with the latest data found on the remote api.

Same as save/1 but raise in case of error.

Link to this function save(resource, url_parameters \\ []) View Source

Persist the given resource, this will perform an UPDATE request if the resource already has an id, a POST request will be sent otherwise.

Link to this function update_attribute!(resource, key, value, url_parameters \\ []) View Source

Same as update_attribute/3 but raise in case of error.

Link to this function update_attribute(resource, key, value, url_parameters \\ []) View Source
update_attribute(
  Resty.Resource.t(),
  atom(),
  any(),
  Resty.Resource.url_parameters()
) :: {:ok, Resty.Resource.t()} | {:error, Exception.t()}

Update the given resource’s attribute.

Link to this function update_attributes!(resource, attributes, url_parameters \\ []) View Source

Same as update_attributes/2 but raise in case of error.

Link to this function update_attributes(resource, new_attributes, url_parameters \\ []) View Source
update_attributes(
  Resty.Resource.t(),
  Keyword.t(),
  Resty.Resource.url_parameters()
) :: {:ok, Resty.Resource.t()} | {:error, Exception.t()}

Update the given resource with the given list of attributes.