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
Same as update_attribute/3
but raise in case of error
Update the given resource’s attribute
Same as update_attributes/2
but raise in case of error
Update the given resource with the given list of attributes
Link to this section Types
id_or_params() :: Resty.Resource.url_parameters() | Resty.Resource.primary_key()
Link to this section Functions
all!(Resty.Resource.mod(), Resty.Resource.url_parameters()) :: [ Resty.Resource.t() ]
Same as all/1
but raise in case of error.
all(Resty.Resource.mod(), Resty.Resource.url_parameters()) :: {:ok, [Resty.Resource.t()]} | {:error, Exception.t()}
Return all the resources returned by the api.
Same as delete/1
but raise in case of error.
delete!(Resty.Resource.t(), id_or_params()) :: true
Same as delete/2
but raise in case of error.
delete!( Resty.Resource.mod(), Resty.Resource.primary_key(), Resty.Resource.url_parameters() ) :: true
Same as delete/3
but raise in case of error.
delete(Resty.Resource.t()) :: {:ok, true} | {:error, Exception.t()}
Delete the given resource.
delete(Resty.Resource.t(), id_or_params()) :: {:ok, true} | {:error, Exception.t()}
Delete the given resource.
delete( Resty.Resource.mod(), Resty.Resource.primary_key(), Resty.Resource.url_parameters() ) :: {:ok, true} | {:error, Exception.t()}
Delete the resource matching the given module and id.
exists?(Resty.Resource.t()) :: {:ok, boolean()} | {:error, Exception.t()}
Does this resource exist on the remote api?
exists?(Resty.Resource.t(), id_or_params()) :: {:ok, boolean()} | {:error, Exception.t()}
Does this resource exist on the remote api?
exists?( Resty.Resource.mod(), Resty.Resource.primary_key(), Resty.Resource.url_parameters() ) :: {:ok, boolean()} | {:error, Exception.t()}
Does a resource of the given type and id exist on the remote api?
find!( Resty.Resource.mod(), Resty.Resource.primary_key(), Resty.Resource.url_parameters() ) :: Resty.Resource.t() | nil
Same as find/2
but raise in case of error.
find( Resty.Resource.mod(), Resty.Resource.primary_key(), Resty.Resource.url_parameters() ) :: {:ok, nil} | {:ok, Resty.Resource.t()} | {:error, Exception.t()}
Return the matching resource for the given module and id or nil.
first!(Resty.Resource.mod(), Resty.Resource.url_parameters()) :: Resty.Resource.t() | nil
Same as first/1
but raise in case of error.
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.
last!(Resty.Resource.mod(), Resty.Resource.url_parameters()) :: Resty.Resource.t() | nil
Same as last/1
but raise in case of error.
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.
reload!(Resty.Resource.t(), Resty.Resource.url_parameters()) :: Resty.Resource.t()
Same as reload/1
but raise in case of error.
reload(Resty.Resource.t(), Resty.Resource.url_parameters()) :: {:ok, Resty.Resource.t()} | {:error, Exception.t()}
Refresh the given resource with the latest data found on the remote api.
save!(Resty.Resource.t(), Resty.Resource.url_parameters()) :: Resty.Resource.t()
Same as save/1
but raise in case of error.
save(Resty.Resource.t(), Resty.Resource.url_parameters()) :: {:ok, Resty.Resource.t()} | {:error, Exception.t()}
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_attribute!( Resty.Resource.t(), atom(), any(), Resty.Resource.url_parameters() ) :: Resty.Resource.t()
Same as update_attribute/3
but raise in case of error.
update_attribute( Resty.Resource.t(), atom(), any(), Resty.Resource.url_parameters() ) :: {:ok, Resty.Resource.t()} | {:error, Exception.t()}
Update the given resource’s attribute.
update_attributes!( Resty.Resource.t(), Keyword.t(), Resty.Resource.url_parameters() ) :: Resty.Resource.t()
Same as update_attributes/2
but raise in case of error.
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.