portal_api_wrapper v0.5.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

Call to api for sign_in

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, message} 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, message} 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, message} response had non 200 code
  • {:error, _} request failed, no response
Link to this function

sign_in(email, password)

Call to api for sign_in

Takes (email, password)

returns

  • {:ok, token}
  • {:error, code, message} (non-200 response)
  • {:error, message} (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, message} response had non 200 code
  • {:error, _} request failed, no response