Current section
Files
Jump to
Current section
Files
lib/api/structs/repository_ruleset.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.RepositoryRuleset do
@moduledoc false
defstruct [
:_links,
:bypass_actors,
:conditions,
:created_at,
:current_user_can_bypass,
:enforcement,
:id,
:name,
:node_id,
:rules,
:source,
:source_type,
:target,
:updated_at
]
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__{
_links: Map.get(json, :_links),
bypass_actors:
Enum.map(
Map.get(json, :bypass_actors) || [],
&Noizu.Github.RepositoryRulesetBypassActor.from_json(&1)
),
conditions: Map.get(json, :conditions),
created_at: Map.get(json, :created_at),
current_user_can_bypass: Map.get(json, :current_user_can_bypass),
enforcement: Map.get(json, :enforcement),
id: Map.get(json, :id),
name: Map.get(json, :name),
node_id: Map.get(json, :node_id),
rules: Map.get(json, :rules),
source: Map.get(json, :source),
source_type: Map.get(json, :source_type),
target: Map.get(json, :target),
updated_at: Map.get(json, :updated_at)
}
end
def from_json(other, _headers), do: other
end