Current section
Files
Jump to
Current section
Files
lib/api/structs/protected_branch.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.ProtectedBranch do
@moduledoc false
defstruct [
:allow_deletions,
:allow_force_pushes,
:allow_fork_syncing,
:block_creations,
:enforce_admins,
:lock_branch,
:required_conversation_resolution,
:required_linear_history,
:required_pull_request_reviews,
:required_signatures,
:required_status_checks,
:restrictions,
: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__{
allow_deletions: Map.get(json, :allow_deletions),
allow_force_pushes: Map.get(json, :allow_force_pushes),
allow_fork_syncing: Map.get(json, :allow_fork_syncing),
block_creations: Map.get(json, :block_creations),
enforce_admins: Map.get(json, :enforce_admins),
lock_branch: Map.get(json, :lock_branch),
required_conversation_resolution: Map.get(json, :required_conversation_resolution),
required_linear_history: Map.get(json, :required_linear_history),
required_pull_request_reviews: Map.get(json, :required_pull_request_reviews),
required_signatures: Map.get(json, :required_signatures),
required_status_checks:
Noizu.Github.StatusCheckPolicy.from_json(Map.get(json, :required_status_checks)),
restrictions: Noizu.Github.BranchRestrictionPolicy.from_json(Map.get(json, :restrictions)),
url: Map.get(json, :url)
}
end
def from_json(other, _headers), do: other
end