Akd v0.3.1 FreshbooksApiClient.Interface behaviour View Source

This module defines the behavior an interface must implement in order to be accessible through the native callers of this package.

This module is at the heart of FreshbooksApiClient and catalyzes its extendability. This abstraction/behaviour provides a set of functions which can be included in a newly introduced Freshbooks resource and quickly integrated with the rest of the API client.

See FreshbooksApiClient.Interace.Tasks for a simple example. See FreshbooksApiClient.Interace.Staff for a complex example.

Callbacks:

  • create(params, caller) -> Creates the resource on Freshbooks.
  • update(params, caller) -> Updates an existing resource on Freshbooks.
  • get(params, caller) -> Retrieves an existing resource from Freshbooks.
  • delete(params, caller) -> Deletes an existing resource from Freshbooks.
  • list(params, caller) -> Retrieves a list of existing resources from Freshbooks.
  • translate(caller, action, response) -> Translates a response to a Schema struct.

Link to this section Summary

Types

Types that denote an unsuccessful response

Various response types that can happen upon an interface call

Types that denote a successful response

Link to this section Types

Types that denote an unsuccessful response

Link to this type response() View Source
response() :: {:ok, success()} | {:error, failure()}

Various response types that can happen upon an interface call

Types that denote a successful response

Link to this section Functions

Link to this macro __using__(opts) View Source (macro)

A Simple way of accessing all of Interace’s features

Link to this function to_schema(schema, params) View Source
Link to this function translate(interface, schema, arg1, arg4, arg2) View Source

Link to this section Callbacks

Link to this callback create(map, atom) View Source
create(map(), atom()) :: response()
Link to this callback delete(map, atom) View Source
delete(map(), atom()) :: response()
Link to this callback get(map, atom) View Source
get(map(), atom()) :: response()
Link to this callback list(map, atom) View Source
list(map(), atom()) :: response()
Link to this callback translate(atom, atom, term) View Source
translate(atom(), atom(), term()) :: Ecto.Schema.t()
Link to this callback update(map, atom) View Source
update(map(), atom()) :: response()
Link to this callback xml_parent_spec(atom) View Source
xml_parent_spec(atom()) :: {any(), list()}