spotter v0.4.1 Spotter.Endpoint.Dynamic

Wrapper for a resource with the dynamic path.

Link to this section Summary

Functions

Defines the endpoint with dynamic path

Checks for all specified permissions from the first list in the second

Generates a regular expression based on the passed path string argument. Can raise the Regex.CompileError in case of errors

Checks that the passed permissions can provide an access to the certain resource

Checking a match of the passed path with the endpoint path via regex search

Returns a new instance of Spotter.Endpoint.Dynamic struct

Post-processing data before passing it further

Validate an input data

Link to this section Functions

Link to this function %Spotter.Endpoint.Dynamic{} (struct)

Defines the endpoint with dynamic path.

  • :regex - Regex expression for further checks with the passed path. Required.
  • :base.path - Path to the recource. For example, api.learderboard.get.{id}. Required.
  • :base.permissions - List of permissions, required for getting an access to the resource. Default is [].
Link to this function access_granted?(required_permissions, permissions)
access_granted?(
  required_permissions :: [String.t()],
  permissions :: [String.t()]
) :: boolean()

Checks for all specified permissions from the first list in the second.

Link to this function generate_regex(path)
generate_regex(path :: String.t()) :: String.t()

Generates a regular expression based on the passed path string argument. Can raise the Regex.CompileError in case of errors.

Link to this function has_permissions(endpoint, permissions)
has_permissions(
  endpoint :: Spotter.Endpoint.Dynamic,
  permissions :: [String.t()]
) :: boolean()

Checks that the passed permissions can provide an access to the certain resource.

Link to this function match(endpoint, path)
match(endpoint :: Spotter.Endpoint.Dynamic, path :: String.t()) :: boolean()

Checking a match of the passed path with the endpoint path via regex search.

Link to this function new(path, permissions)
new(path :: String.t(), permissions :: [String.t()]) :: Spotter.Endpoint.Dynamic

Returns a new instance of Spotter.Endpoint.Dynamic struct.

Link to this function transform(endpoint, data)
transform(endpoint :: any(), data :: any()) ::
  {:ok, any()} | {:error, String.t()}

Post-processing data before passing it further.

Link to this function validate(endpoint, data)
validate(endpoint :: any(), data :: any()) ::
  {:ok, any()} | {:error, String.t()}

Validate an input data.