Current section
Files
Jump to
Current section
Files
lib/hook_sniff_api/api/notifications.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule HookSniffAPI.Api.Notifications do
@moduledoc """
API calls for all endpoints tagged `Notifications`.
"""
alias HookSniffAPI.Connection
import HookSniffAPI.RequestBuilder
@doc """
List notifications
### Parameters
- `connection` (HookSniffAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:page` (integer()):
- `:per_page` (integer()):
### Returns
- `{:ok, HookSniffAPI.Model.NotificationListResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec notifications_get(Tesla.Env.client, keyword()) :: {:ok, HookSniffAPI.Model.NotificationListResponse.t} | {:error, Tesla.Env.t}
def notifications_get(connection, opts \\ []) do
optional_params = %{
:page => :query,
:per_page => :query
}
request =
%{}
|> method(:get)
|> url("/notifications")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, HookSniffAPI.Model.NotificationListResponse}
])
end
@doc """
Delete notification
### Parameters
- `connection` (HookSniffAPI.Connection): Connection to server
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec notifications_id_delete(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def notifications_id_delete(connection, id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/notifications/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false}
])
end
@doc """
Mark notification as read
### Parameters
- `connection` (HookSniffAPI.Connection): Connection to server
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec notifications_id_read_put(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def notifications_id_read_put(connection, id, _opts \\ []) do
request =
%{}
|> method(:put)
|> url("/notifications/#{id}/read")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false}
])
end
@doc """
Mark all notifications as read
### Parameters
- `connection` (HookSniffAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec notifications_read_all_put(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def notifications_read_all_put(connection, _opts \\ []) do
request =
%{}
|> method(:put)
|> url("/notifications/read-all")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false}
])
end
@doc """
Get unread notification count
### Parameters
- `connection` (HookSniffAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, HookSniffAPI.Model.NotificationsUnreadCountGet200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec notifications_unread_count_get(Tesla.Env.client, keyword()) :: {:ok, HookSniffAPI.Model.NotificationsUnreadCountGet200Response.t} | {:error, Tesla.Env.t}
def notifications_unread_count_get(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/notifications/unread-count")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, HookSniffAPI.Model.NotificationsUnreadCountGet200Response}
])
end
end