GoogleApi.Gax.DataWrapper (ega_gax v0.5.0)

Copy Markdown 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"
  }
}

Summary

Functions

Unwrap a data-wrapped JSON response.

Types

t()

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

Functions

decode(data_wrapper, options)

@spec 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"}