Current section
Files
Jump to
Current section
Files
lib/api/structs/thread.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.Thread do
@moduledoc false
defstruct [
:id,
:last_read_at,
:reason,
:repository,
:subject,
:subscription_url,
:unread,
:updated_at,
: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__{
id: Map.get(json, :id),
last_read_at: Map.get(json, :last_read_at),
reason: Map.get(json, :reason),
repository: Noizu.Github.MinimalRepository.from_json(Map.get(json, :repository)),
subject: Map.get(json, :subject),
subscription_url: Map.get(json, :subscription_url),
unread: Map.get(json, :unread),
updated_at: Map.get(json, :updated_at),
url: Map.get(json, :url)
}
end
def from_json(other, _headers), do: other
end