Current section

Files

Jump to
noizu_github lib api structs release.ex
Raw

lib/api/structs/release.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.Release do
@moduledoc false
defstruct [
:assets,
:assets_url,
:author,
:body,
:body_html,
:body_text,
:created_at,
:discussion_url,
:draft,
:html_url,
:id,
:immutable,
:mentions_count,
:name,
:node_id,
:prerelease,
:published_at,
:reactions,
:tag_name,
:tarball_url,
:target_commitish,
:updated_at,
:upload_url,
:url,
:zipball_url
]
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__{
assets: Enum.map(Map.get(json, :assets) || [], &Noizu.Github.ReleaseAsset.from_json(&1)),
assets_url: Map.get(json, :assets_url),
author: Noizu.Github.SimpleUser.from_json(Map.get(json, :author)),
body: Map.get(json, :body),
body_html: Map.get(json, :body_html),
body_text: Map.get(json, :body_text),
created_at: Map.get(json, :created_at),
discussion_url: Map.get(json, :discussion_url),
draft: Map.get(json, :draft),
html_url: Map.get(json, :html_url),
id: Map.get(json, :id),
immutable: Map.get(json, :immutable),
mentions_count: Map.get(json, :mentions_count),
name: Map.get(json, :name),
node_id: Map.get(json, :node_id),
prerelease: Map.get(json, :prerelease),
published_at: Map.get(json, :published_at),
reactions: Noizu.Github.ReactionRollup.from_json(Map.get(json, :reactions)),
tag_name: Map.get(json, :tag_name),
tarball_url: Map.get(json, :tarball_url),
target_commitish: Map.get(json, :target_commitish),
updated_at: Map.get(json, :updated_at),
upload_url: Map.get(json, :upload_url),
url: Map.get(json, :url),
zipball_url: Map.get(json, :zipball_url)
}
end
def from_json(other, _headers), do: other
end