JsonApiClient v0.5.2 JsonApiClient View Source

A client library for interacting with REST APIs that comply with the JSON API spec described at http://jsonapi.org

Link to this section Summary

Functions

Execute a JSON API Request using HTTP POST

Error raising version of create/1

Execute a JSON API Request using HTTP DELETE

Error raising version of delete/1

Execute a JSON API Request

Error raising version of execute/1

Execute a JSON API Request using HTTP GET

Error raising version of fetch/1

Execute a JSON API Request using HTTP PATCH

Error raising version of update/1

Link to this section Functions

Execute a JSON API Request using HTTP POST

Error raising version of create/1

Execute a JSON API Request using HTTP DELETE

Error raising version of delete/1

Execute a JSON API Request

Takes a JsonApiClient.Request and preforms the described request.

Returns either a tuple with :ok and a JsonApiClient.Response struct (or nil) or :error and a JsonApiClient.RequestError struct depending on the http response code and whether the server response was valid according to the JSON API spec.

ScenarioServer Response ValidReturn Value
2**yes{:ok, %Response{status: 2**, doc: %Document{}}
4**yes{:ok, %Response{status: 4**, doc: %Document{} or nil}
5**yes{:ok, %Response{status: 5**, doc: %Document{} or nil}
2**no{:error, %RequestError{status: 2**, message: "Invalid response body"}}
4**no{:ok, %Response{status: 4**, doc: nil}}
5**no{:ok, %Response{status: 3**, doc: nil}}
socket errorn/a{:error, %RequestError{status: nil, message: "Error completing HTTP request econnrefused", original_error: error}}

Error raising version of execute/1

Execute a JSON API Request using HTTP GET

Error raising version of fetch/1

Execute a JSON API Request using HTTP PATCH

Error raising version of update/1