spotter v0.6.0 Spotter.Endpoint.Base behaviour

Base module for implementing endpoints.

By default any module must implement three required functions, that’s going to use this functionality later:

  • new(path, permissions) for creating a new instance of a structure
  • match(endpoint, path) for getting an understanding that the appropriate endpoint
  • has_permissions(endpoint, permissions) for checking an access to the particular resource

Also the base module provides two methods, each of those returns an input data as is by default, but can be overridden:

  • tranform(data) for post-processing data before passing it further
  • validate(data) for validating an input data

Link to this section Summary

Link to this section Callbacks

Link to this callback has_permissions(endpoint, permissions)
has_permissions(endpoint :: any(), permissions :: [String.t()]) :: boolean()
Link to this callback match(endpoint, path)
match(endpoint :: any(), path :: String.t()) :: boolean()
Link to this callback new(path, permissions)
new(path :: Strint.t(), permissions :: [String.t()]) :: UserDefined