Current section
Files
Jump to
Current section
Files
lib/api/structs/authentication_token.ex
# Generated by `mix github.gen` from docs/github-api/api.github.com.json.
# Do not edit by hand; re-run the task instead.
defmodule Noizu.Github.AuthenticationToken do
@moduledoc false
defstruct [
:expires_at,
:permissions,
:repositories,
:repository_selection,
:single_file,
:token
]
def from_json(json, headers \\ [])
def from_json(nil, _headers), do: nil
def from_json(list, headers) when is_list(list) do
Enum.map(list, &from_json(&1, headers))
end
def from_json(json, _headers) when is_map(json) do
%__MODULE__{
expires_at: Map.get(json, :expires_at),
permissions: Map.get(json, :permissions),
repositories:
Enum.map(Map.get(json, :repositories) || [], &Noizu.Github.Repository.from_json(&1)),
repository_selection: Map.get(json, :repository_selection),
single_file: Map.get(json, :single_file),
token: Map.get(json, :token)
}
end
def from_json(other, _headers), do: other
end