View Source Chargebeex.Resource behaviour (chargebeex v0.4.0)

Generic macro implemented by most of the Chargebee resources. Provides whenever it is possible retrieve/create/list/update/delete actions for each resource.

Summary

Callbacks

Build a raw data map into in an internal structure.

Create a resource

Delete a resource

List a resource

Retrieve a resource

Update a resource

Callbacks

@callback build(raw_data :: map()) :: struct()

Build a raw data map into in an internal structure.

Link to this callback

create(params)

View Source (optional)
@callback create(params :: map()) :: {:ok, struct()}

Create a resource

Link to this callback

create(params, opts)

View Source (optional)
@callback create(params :: map(), opts :: list()) :: {:ok, struct()}
@callback delete(id :: String.t()) :: {:ok, struct()}

Delete a resource

Link to this callback

delete(id, opts)

View Source (optional)
@callback delete(id :: String.t(), opts :: list()) :: {:ok, struct()}
@callback list(params :: map()) :: {:ok, list(), map()}

List a resource

Link to this callback

list(params, opts)

View Source (optional)
@callback list(params :: map(), opts :: list()) :: {:ok, list(), map()}
@callback retrieve(id :: String.t()) :: {:ok, struct()}

Retrieve a resource

Link to this callback

retrieve(id, opts)

View Source (optional)
@callback retrieve(id :: String.t(), opts :: list()) :: {:ok, struct()}
Link to this callback

update(id, params)

View Source (optional)
@callback update(id :: String.t(), params :: map()) :: {:ok, struct()}

Update a resource

Link to this callback

update(id, params, opts)

View Source (optional)
@callback update(id :: String.t(), params :: map(), opts :: list()) :: {:ok, struct()}