# 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.CommitComparison do @moduledoc false defstruct [ :ahead_by, :base_commit, :behind_by, :commits, :diff_url, :files, :html_url, :merge_base_commit, :patch_url, :permalink_url, :status, :total_commits, :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__{ ahead_by: Map.get(json, :ahead_by), base_commit: Noizu.Github.Commit.from_json(Map.get(json, :base_commit)), behind_by: Map.get(json, :behind_by), commits: Enum.map(Map.get(json, :commits) || [], &Noizu.Github.Commit.from_json(&1)), diff_url: Map.get(json, :diff_url), files: Enum.map(Map.get(json, :files) || [], &Noizu.Github.DiffEntry.from_json(&1)), html_url: Map.get(json, :html_url), merge_base_commit: Noizu.Github.Commit.from_json(Map.get(json, :merge_base_commit)), patch_url: Map.get(json, :patch_url), permalink_url: Map.get(json, :permalink_url), status: Map.get(json, :status), total_commits: Map.get(json, :total_commits), url: Map.get(json, :url) } end def from_json(other, _headers), do: other end