Current section

Files

Jump to
noizu_github lib api structs webhook_status.ex
Raw

lib/api/structs/webhook_status.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.WebhookStatus do
@moduledoc false
defstruct [
:avatar_url,
:branches,
:commit,
:context,
:created_at,
:description,
:enterprise,
:id,
:installation,
:name,
:organization,
:repository,
:sender,
:sha,
:state,
:target_url,
: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__{
avatar_url: Map.get(json, :avatar_url),
branches: Map.get(json, :branches),
commit: Map.get(json, :commit),
context: Map.get(json, :context),
created_at: Map.get(json, :created_at),
description: Map.get(json, :description),
enterprise: Noizu.Github.EnterpriseWebhooks.from_json(Map.get(json, :enterprise)),
id: Map.get(json, :id),
installation: Noizu.Github.SimpleInstallation.from_json(Map.get(json, :installation)),
name: Map.get(json, :name),
organization:
Noizu.Github.OrganizationSimpleWebhooks.from_json(Map.get(json, :organization)),
repository: Noizu.Github.RepositoryWebhooks.from_json(Map.get(json, :repository)),
sender: Noizu.Github.SimpleUser.from_json(Map.get(json, :sender)),
sha: Map.get(json, :sha),
state: Map.get(json, :state),
target_url: Map.get(json, :target_url),
updated_at: Map.get(json, :updated_at)
}
end
def from_json(other, _headers), do: other
end