# File generated from Twilio's OpenAPI spec — do not edit manually defmodule Twilio.Api.V2010.NotificationService do @moduledoc """ [DEPRECATED] Log entries Operations: `list`, `fetch` """ alias Twilio.Client alias Twilio.Deserializer @doc """ Retrieve a list of notifications belonging to the account used to make the request Operation: `ListNotification` | Tags: Api20100401Notification ## Query Parameters | Parameter | Type | Description | |-----------|------|-------------| # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength | `Log` | integer | Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. | # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength | `MessageDate` | string (date) | Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. | # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength | `MessageDate<` | string (date) | Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. | # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength | `MessageDate>` | string (date) | Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. | """ @spec list(Client.t(), map(), keyword()) :: {:ok, Twilio.Page.t()} | {:ok, map(), map()} | :ok | {:error, Twilio.Error.t()} def list(client, params \\ %{}, opts \\ []) do case Client.request( client, :get, "/2010-04-01/Accounts/#{client.account_sid}/Notifications.json", params: params, opts: opts, base_url: "https://api.twilio.com" ) do {:ok, data} -> page = Twilio.Page.from_response(data, "notifications") {:ok, %{ page | items: Deserializer.deserialize_list(page.items, Twilio.Resources.Api.V2010.Notification) }} error -> error end end # credo:disable-for-next-line Credo.Check.Readability.MaxLineLength @doc "Stream: Retrieve a list of notifications belonging to the account used to make the request (lazy auto-pagination)." @spec stream(Client.t(), map(), keyword()) :: Enumerable.t() def stream(client, params \\ %{}, opts \\ []) do Twilio.Page.stream( fn page_opts -> list(client, Map.merge(params, page_opts), opts) end, "notifications" ) end @doc """ Fetch a notification belonging to the account used to make the request Operation: `FetchNotification` | Tags: Api20100401Notification """ @spec fetch(Client.t(), String.t(), keyword()) :: {:ok, Twilio.Resources.Api.V2010.Notification.t()} | {:ok, map(), map()} | :ok | {:error, Twilio.Error.t()} def fetch(client, sid, opts \\ []) do with {:ok, data} <- Client.request( client, :get, "/2010-04-01/Accounts/#{client.account_sid}/Notifications/#{sid}.json", opts: opts, base_url: "https://api.twilio.com" ) do {:ok, Deserializer.deserialize(data, Twilio.Resources.Api.V2010.Notification)} end end end