Current section
Files
Jump to
Current section
Files
lib/api/structs/global_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.GlobalAdvisory do
@moduledoc false
defstruct [
:credits,
:cve_id,
:cvss,
:cvss_severities,
:cwes,
:description,
:epss,
:ghsa_id,
:github_reviewed_at,
:html_url,
:identifiers,
:nvd_published_at,
:published_at,
:references,
:repository_advisory_url,
:severity,
:source_code_location,
:summary,
:type,
: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__{
credits: Map.get(json, :credits),
cve_id: Map.get(json, :cve_id),
cvss: Map.get(json, :cvss),
cvss_severities: Noizu.Github.CvssSeverities.from_json(Map.get(json, :cvss_severities)),
cwes: Map.get(json, :cwes),
description: Map.get(json, :description),
epss: Noizu.Github.SecurityAdvisoryEpss.from_json(Map.get(json, :epss)),
ghsa_id: Map.get(json, :ghsa_id),
github_reviewed_at: Map.get(json, :github_reviewed_at),
html_url: Map.get(json, :html_url),
identifiers: Map.get(json, :identifiers),
nvd_published_at: Map.get(json, :nvd_published_at),
published_at: Map.get(json, :published_at),
references: Map.get(json, :references),
repository_advisory_url: Map.get(json, :repository_advisory_url),
severity: Map.get(json, :severity),
source_code_location: Map.get(json, :source_code_location),
summary: Map.get(json, :summary),
type: Map.get(json, :type),
updated_at: Map.get(json, :updated_at),
url: Map.get(json, :url),
vulnerabilities:
Enum.map(Map.get(json, :vulnerabilities) || [], &Noizu.Github.Vulnerability.from_json(&1)),
withdrawn_at: Map.get(json, :withdrawn_at)
}
end
def from_json(other, _headers), do: other
end