View Source MongoosePush.Service behaviour (MongoosePush v2.2.0-dev)

Generic interface for push notifications services.

Summary

Types

Error tuple with unified internal representation and exact reason returned by service

Types

@type error() :: {error_type(), error_reason()}

Error tuple with unified internal representation and exact reason returned by service

@type error_reason() :: atom()
@type error_type() ::
  :invalid_request
  | :internal_config
  | :auth
  | :unregistered
  | :too_many_requests
  | :unspecified
  | :service_internal
  | :payload_too_large
  | :unknown
@type notification() :: term()
@type options() :: [Keyword.t()]

Callbacks

@callback choose_pool(MongoosePush.mode(), [atom()]) ::
  MongoosePush.Application.pool_name() | nil
Link to this callback

prepare_notification(t, request, pool_name)

View Source
@callback prepare_notification(
  String.t(),
  MongoosePush.request(),
  MongoosePush.Application.pool_name()
) :: notification()
Link to this callback

push(notification, t, pool_name, options)

View Source
@callback push(
  notification(),
  String.t(),
  MongoosePush.Application.pool_name(),
  options()
) :: :ok | {:error, error()} | {:error, MongoosePush.error()}
@callback supervisor_entry([MongoosePush.Application.pool_definition()] | nil) ::
  {module(), term()}