Current section
Files
Jump to
Current section
Files
lib/api/structs/repository_advisory.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.RepositoryAdvisory do
@moduledoc false
defstruct [
:author,
:closed_at,
:collaborating_teams,
:collaborating_users,
:created_at,
:credits,
:credits_detailed,
:cve_id,
:cvss,
:cvss_severities,
:cwe_ids,
:cwes,
:description,
:ghsa_id,
:html_url,
:identifiers,
:private_fork,
:published_at,
:publisher,
:severity,
:state,
:submission,
:summary,
:updated_at,
:url,
:vulnerabilities,
:withdrawn_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__{
author: Noizu.Github.SimpleUser.from_json(Map.get(json, :author)),
closed_at: Map.get(json, :closed_at),
collaborating_teams:
Enum.map(Map.get(json, :collaborating_teams) || [], &Noizu.Github.Team.from_json(&1)),
collaborating_users:
Enum.map(
Map.get(json, :collaborating_users) || [],
&Noizu.Github.SimpleUser.from_json(&1)
),
created_at: Map.get(json, :created_at),
credits: Map.get(json, :credits),
credits_detailed:
Enum.map(
Map.get(json, :credits_detailed) || [],
&Noizu.Github.RepositoryAdvisoryCredit.from_json(&1)
),
cve_id: Map.get(json, :cve_id),
cvss: Map.get(json, :cvss),
cvss_severities: Noizu.Github.CvssSeverities.from_json(Map.get(json, :cvss_severities)),
cwe_ids: Map.get(json, :cwe_ids),
cwes: Map.get(json, :cwes),
description: Map.get(json, :description),
ghsa_id: Map.get(json, :ghsa_id),
html_url: Map.get(json, :html_url),
identifiers: Map.get(json, :identifiers),
private_fork: Noizu.Github.SimpleRepository.from_json(Map.get(json, :private_fork)),
published_at: Map.get(json, :published_at),
publisher: Noizu.Github.SimpleUser.from_json(Map.get(json, :publisher)),
severity: Map.get(json, :severity),
state: Map.get(json, :state),
submission: Map.get(json, :submission),
summary: Map.get(json, :summary),
updated_at: Map.get(json, :updated_at),
url: Map.get(json, :url),
vulnerabilities:
Enum.map(
Map.get(json, :vulnerabilities) || [],
&Noizu.Github.RepositoryAdvisoryVulnerability.from_json(&1)
),
withdrawn_at: Map.get(json, :withdrawn_at)
}
end
def from_json(other, _headers), do: other
end