Packages

Reference spec for interacting with Foyer API services

Current section

Files

Jump to
foyer_api_sdk lib foyer_api api favorite.ex
Raw

lib/foyer_api/api/favorite.ex

# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule FoyerAPI.Api.Favorite do
@moduledoc """
API calls for all endpoints tagged `Favorite`.
"""
alias FoyerAPI.Connection
import FoyerAPI.RequestBuilder
@doc """
Delete Favorite
Delete specific Favorite with unique id
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- id (integer()):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec delete_favorite_by_id(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def delete_favorite_by_id(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/Favorite/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 401, false}
])
end
@doc """
Find One Favorite
Find a single Favorite according to defined filter criteria
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- filter (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, FoyerAPI.Model.Favorite.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec find_one_favorite(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, FoyerAPI.Model.Favorite.t} | {:error, Tesla.Env.t}
def find_one_favorite(connection, filter, _opts \\ []) do
%{}
|> method(:get)
|> url("/Favorite/findOne")
|> add_param(:headers, :filter, filter)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %FoyerAPI.Model.Favorite{}},
{ 401, false}
])
end
@doc """
Get Favorite By Id
Get a specific Favorite with unique id
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- id (integer()):
- opts (KeywordList): [optional] Optional parameters
- :filter (String.t):
## Returns
{:ok, FoyerAPI.Model.Favorite.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_favorite_by_id(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:ok, FoyerAPI.Model.Favorite.t} | {:error, Tesla.Env.t}
def get_favorite_by_id(connection, id, opts \\ []) do
optional_params = %{
:filter => :headers
}
%{}
|> method(:get)
|> url("/Favorite/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %FoyerAPI.Model.Favorite{}},
{ 401, false}
])
end
@doc """
Get Favorites
Find Favorites according to defined filter criteria
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :filter (String.t):
## Returns
{:ok, [%Favorite{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_favorites(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, list(FoyerAPI.Model.Favorite.t)} | {:error, Tesla.Env.t}
def get_favorites(connection, opts \\ []) do
optional_params = %{
:filter => :headers
}
%{}
|> method(:get)
|> url("/Favorite")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%FoyerAPI.Model.Favorite{}]},
{ 401, false}
])
end
@doc """
Patch Favorite By Id
Patch specific Favorite with unique id
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- id (integer()):
- opts (KeywordList): [optional] Optional parameters
- :body ([FoyerAPI.Model.PatchDocument.t]):
## Returns
{:ok, FoyerAPI.Model.Favorite.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec patch_favorite_by_id(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:ok, FoyerAPI.Model.Favorite.t} | {:error, Tesla.Env.t}
def patch_favorite_by_id(connection, id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:patch)
|> url("/Favorite/#{id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %FoyerAPI.Model.Favorite{}},
{ 401, false}
])
end
@doc """
Post Favorites
Post an array of Favorite objects
## Parameters
- connection (FoyerAPI.Connection): Connection to server
- favorite (Favorite):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, FoyerAPI.Model.Favorite.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec post_favorites(Tesla.Env.client, FoyerAPI.Model.Favorite.t, keyword()) :: {:ok, nil} | {:ok, FoyerAPI.Model.Favorite.t} | {:error, Tesla.Env.t}
def post_favorites(connection, favorite, _opts \\ []) do
%{}
|> method(:post)
|> url("/Favorite")
|> add_param(:body, :body, favorite)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %FoyerAPI.Model.Favorite{}},
{ 401, false}
])
end
end