View Source CastorEDC (ExCastorEDC v0.2.0)

Acts as a wrapper for Tesla and provides convenience functions to perform HTTP requests.

alias CastorEDC.Client

client = Client.new("<client id>", "<client secret>")
{:ok, client} = CastorEDC.authenticate(client)

After authenticating against the API you can then use the other modules to perform API requests, e.g:

{200, list_of_studies, _} = CastorEDC.Common.Studies.list(client)

list_of_studies

Link to this section Summary

Functions

Will exchange a valid combination of client id and secret into an access token. The access token can then be used to make further requests to the API

Internal convenience function for GET requests

Internal convenience function for PATCH requests

Internal convenience function for POST requests

Link to this section Functions

@spec authenticate(CastorEDC.Client.t()) ::
  {:ok, CastorEDC.Client.t()} | {:error, String.t()}

Will exchange a valid combination of client id and secret into an access token. The access token can then be used to make further requests to the API

Link to this function

get(url, client, params \\ [])

View Source
@spec get(String.t(), CastorEDC.Client.t(), []) :: {integer(), %{}, Tesla.Env.t()}

Internal convenience function for GET requests

Link to this function

patch(url, client, body)

View Source
@spec patch(String.t(), CastorEDC.Client.t(), %{}) :: {integer(), %{}, Tesla.Env.t()}

Internal convenience function for PATCH requests

@spec post(String.t(), CastorEDC.Client.t(), %{}) :: {integer(), %{}, Tesla.Env.t()}

Internal convenience function for POST requests