Current section
Files
Jump to
Current section
Files
lib/api/structs/discussion.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.Discussion do
@moduledoc false
defstruct [
:active_lock_reason,
:answer_chosen_at,
:answer_chosen_by,
:answer_html_url,
:author_association,
:body,
:category,
:comments,
:created_at,
:html_url,
:id,
:labels,
:locked,
:node_id,
:number,
:reactions,
:repository_url,
:state,
:state_reason,
:timeline_url,
:title,
:updated_at,
: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__{
active_lock_reason: Map.get(json, :active_lock_reason),
answer_chosen_at: Map.get(json, :answer_chosen_at),
answer_chosen_by: Map.get(json, :answer_chosen_by),
answer_html_url: Map.get(json, :answer_html_url),
author_association: Map.get(json, :author_association),
body: Map.get(json, :body),
category: Map.get(json, :category),
comments: Map.get(json, :comments),
created_at: Map.get(json, :created_at),
html_url: Map.get(json, :html_url),
id: Map.get(json, :id),
labels: Enum.map(Map.get(json, :labels) || [], &Noizu.Github.Label.from_json(&1)),
locked: Map.get(json, :locked),
node_id: Map.get(json, :node_id),
number: Map.get(json, :number),
reactions: Map.get(json, :reactions),
repository_url: Map.get(json, :repository_url),
state: Map.get(json, :state),
state_reason: Map.get(json, :state_reason),
timeline_url: Map.get(json, :timeline_url),
title: Map.get(json, :title),
updated_at: Map.get(json, :updated_at),
user: Map.get(json, :user)
}
end
def from_json(other, _headers), do: other
end