portal_api_wrapper v0.1.0 PortalApiWrapper

Documentation for PortalApiWrapper.

Link to this section Summary

Functions

Make a create call against against an api collection

Make an index call against against an api collection

Make a show call against against an object in an api collection

Make an update call against against an object in an api collection

Link to this section Functions

Link to this function

create(collection, params, token)

Make a create call against against an api collection

  • collection is the atom name of the collection, e.g., :campaigns, :order_lines, ets
  • params is the request body
  • token is the auth token to include in the header

returns one of:

  • {:ok, object} where object is teh created object
  • {:error, code: code} response had non 200 code
  • {:error, _} request failed, no response
Link to this function

index(collection, search_params, paging_params, token)

Make an index call against against an api collection

  • collection is the atom name of the collection, e.g., :campaigns, :order_lines, ets
  • search_params is a keyword list of search params
  • paging_params is a keyword list of paging params
  • token is the auth token to include in the header

returns one of:

  • {:ok, results, paging} where results is a list and paging is a map
  • {:error, code: code} response had non 200 code
  • {:error, _} request failed, no response
Link to this function

show(collection, object_id, token)

Make a show call against against an object in an api collection

  • collection is the atom name of the collection, e.g., :campaigns, :order_lines, ets
  • object_id is the id of the object in question
  • token is the auth token to include in the header

returns one of:

  • {:ok, object} where object is teh created object
  • {:error, code: code} response had non 200 code
  • {:error, _} request failed, no response
Link to this function

update(collection, object_id, params, token)

Make an update call against against an object in an api collection

  • collection is the atom name of the collection, e.g., :campaigns, :order_lines, ets
  • object_id is the id of the object in question
  • params is the map of updates to apply
  • token is the auth token to include in the header

returns one of:

  • {:ok, object} where object is teh created object
  • {:error, code: code} response had non 200 code
  • {:error, _} request failed, no response