Current section

Files

Jump to
noizu_github lib api structs migration.ex
Raw

lib/api/structs/migration.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.Migration do
@moduledoc false
defstruct [
:archive_url,
:created_at,
:exclude,
:exclude_attachments,
:exclude_git_data,
:exclude_metadata,
:exclude_owner_projects,
:exclude_releases,
:guid,
:id,
:lock_repositories,
:node_id,
:org_metadata_only,
:owner,
:repositories,
:state,
: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__{
archive_url: Map.get(json, :archive_url),
created_at: Map.get(json, :created_at),
exclude: Map.get(json, :exclude),
exclude_attachments: Map.get(json, :exclude_attachments),
exclude_git_data: Map.get(json, :exclude_git_data),
exclude_metadata: Map.get(json, :exclude_metadata),
exclude_owner_projects: Map.get(json, :exclude_owner_projects),
exclude_releases: Map.get(json, :exclude_releases),
guid: Map.get(json, :guid),
id: Map.get(json, :id),
lock_repositories: Map.get(json, :lock_repositories),
node_id: Map.get(json, :node_id),
org_metadata_only: Map.get(json, :org_metadata_only),
owner: Noizu.Github.NullableSimpleUser.from_json(Map.get(json, :owner)),
repositories:
Enum.map(Map.get(json, :repositories) || [], &Noizu.Github.Repository.from_json(&1)),
state: Map.get(json, :state),
updated_at: Map.get(json, :updated_at),
url: Map.get(json, :url)
}
end
def from_json(other, _headers), do: other
end