# 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.Api.SecretScanning do @moduledoc """ GitHub `secret-scanning` API. """ import Noizu.Github @doc """ Create a push protection bypass @see https://docs.github.com/rest/secret-scanning/secret-scanning#create-a-push-protection-bypass """ def create_push_protection_bypass(body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/push-protection-bypasses" body = body api_call(:post, url, body, Noizu.Github.SecretScanningPushProtectionBypass, options) end @doc """ Get a secret scanning alert @see https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert """ def get_alert(alert_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:hide_secret, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.SecretScanningAlert, options) end @doc """ Get secret scanning scan history for a repository @see https://docs.github.com/rest/secret-scanning/secret-scanning#get-secret-scanning-scan-history-for-a-repository """ def get_scan_history(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/scan-history" body = %{} api_call(:get, url, body, Noizu.Github.SecretScanningScanHistory, options) end @doc """ List secret scanning alerts for an organization @see https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization """ def list_alerts_for_org(org, options \\ nil) do url = ( query = [ get_field(:state, options, nil), get_field(:secret_type, options, nil), get_field(:exclude_secret_types, options, nil), get_field(:exclude_providers, options, nil), get_field(:providers, options, nil), get_field(:resolution, options, nil), get_field(:assignee, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil), get_field(:page, options, nil), get_field(:per_page, options, nil), get_field(:before, options, nil), get_field(:after, options, nil), get_field(:validity, options, nil), get_field(:is_publicly_leaked, options, nil), get_field(:is_multi_repo, options, nil), get_field(:hide_secret, options, nil), get_field(:is_bypassed, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/secret-scanning/alerts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.OrganizationSecretScanningAlert, options) end @doc """ List secret scanning alerts for a repository @see https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository """ def list_alerts_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:state, options, nil), get_field(:secret_type, options, nil), get_field(:exclude_secret_types, options, nil), get_field(:exclude_providers, options, nil), get_field(:providers, options, nil), get_field(:resolution, options, nil), get_field(:assignee, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil), get_field(:page, options, nil), get_field(:per_page, options, nil), get_field(:before, options, nil), get_field(:after, options, nil), get_field(:validity, options, nil), get_field(:is_publicly_leaked, options, nil), get_field(:is_multi_repo, options, nil), get_field(:hide_secret, options, nil), get_field(:is_bypassed, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/alerts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.SecretScanningAlert, options) end @doc """ List locations for a secret scanning alert @see https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert """ def list_locations_for_alert(alert_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:page, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}/locations" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.SecretScanningLocation, options) end @doc """ List organization pattern configurations @see https://docs.github.com/rest/secret-scanning/push-protection#list-organization-pattern-configurations """ def list_org_pattern_configs(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/secret-scanning/pattern-configurations" body = %{} api_call(:get, url, body, Noizu.Github.SecretScanningPatternConfiguration, options) end @doc """ Update a secret scanning alert @see https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert """ def update_alert(alert_number, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/secret-scanning/alerts/#{alert_number}" body = body api_call(:patch, url, body, Noizu.Github.SecretScanningAlert, options) end @doc """ Update organization pattern configurations @see https://docs.github.com/rest/secret-scanning/push-protection#update-organization-pattern-configurations """ def update_org_pattern_configs(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/secret-scanning/pattern-configurations" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end end