google_gax v0.4.0 GoogleApi.Gax.DataWrapper View Source

Module and struct to help serialize/deserialize "data-wrapped" responses.

An endpoint response may be declared as type "Pet" and "data-wrapped" which means the response would have an outer object with a single "data" key:

{
  "data": { // real pet data
    "id": 123,
    "name": "Fido"
  }
}

Link to this section Summary

Functions

Unwrap a data-wrapped JSON response.

Link to this section Types

Specs

t() :: %GoogleApi.Gax.DataWrapper{data: any()}

Link to this section Functions

Link to this function

decode(data_wrapper, options)

View Source

Specs

decode(t(), keyword()) :: any()

Unwrap a data-wrapped JSON response.

Examples

iex> GoogleApi.Gax.DataWrapper.decode(%GoogleApi.Gax.DataWrapper{data: %{"id" => 123, "name" => "Fido"}}, struct: %TestClient.Model.Pet{})
%TestClient.Model.Pet{id: 123, name: "Fido"}