# 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.BranchProtection do @moduledoc false defstruct [ :allow_deletions, :allow_force_pushes, :allow_fork_syncing, :block_creations, :enabled, :enforce_admins, :lock_branch, :name, :protection_url, :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), enabled: Map.get(json, :enabled), enforce_admins: Noizu.Github.ProtectedBranchAdminEnforced.from_json(Map.get(json, :enforce_admins)), lock_branch: Map.get(json, :lock_branch), name: Map.get(json, :name), protection_url: Map.get(json, :protection_url), required_conversation_resolution: Map.get(json, :required_conversation_resolution), required_linear_history: Map.get(json, :required_linear_history), required_pull_request_reviews: Noizu.Github.ProtectedBranchPullRequestReview.from_json( Map.get(json, :required_pull_request_reviews) ), required_signatures: Map.get(json, :required_signatures), required_status_checks: Noizu.Github.ProtectedBranchRequiredStatusCheck.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