Current section

Files

Jump to
noizu_github lib api structs gist_simple.ex
Raw

lib/api/structs/gist_simple.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.GistSimple do
@moduledoc false
defstruct [
:comments,
:comments_enabled,
:comments_url,
:commits_url,
:created_at,
:description,
:files,
:fork_of,
:forks,
:forks_url,
:git_pull_url,
:git_push_url,
:history,
:html_url,
:id,
:node_id,
:owner,
:public,
:truncated,
:updated_at,
:url,
:user
]
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__{
comments: Map.get(json, :comments),
comments_enabled: Map.get(json, :comments_enabled),
comments_url: Map.get(json, :comments_url),
commits_url: Map.get(json, :commits_url),
created_at: Map.get(json, :created_at),
description: Map.get(json, :description),
files: Map.get(json, :files),
fork_of: Map.get(json, :fork_of),
forks: Map.get(json, :forks),
forks_url: Map.get(json, :forks_url),
git_pull_url: Map.get(json, :git_pull_url),
git_push_url: Map.get(json, :git_push_url),
history: Enum.map(Map.get(json, :history) || [], &Noizu.Github.GistHistory.from_json(&1)),
html_url: Map.get(json, :html_url),
id: Map.get(json, :id),
node_id: Map.get(json, :node_id),
owner: Noizu.Github.SimpleUser.from_json(Map.get(json, :owner)),
public: Map.get(json, :public),
truncated: Map.get(json, :truncated),
updated_at: Map.get(json, :updated_at),
url: Map.get(json, :url),
user: Map.get(json, :user)
}
end
def from_json(other, _headers), do: other
end