# 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.Dependabot do @moduledoc """ GitHub `dependabot` API. """ import Noizu.Github @doc """ Add selected repository to an organization secret @see https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret """ def add_selected_repo_to_org_secret(org, secret_name, repository_id, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}/repositories/#{repository_id}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Create or update an organization secret @see https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret """ def create_or_update_org_secret(org, secret_name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Create or update a repository secret @see https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret """ def create_or_update_repo_secret(secret_name, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/secrets/#{secret_name}" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Delete an organization secret @see https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret """ def delete_org_secret(org, secret_name, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Delete a repository secret @see https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret """ def delete_repo_secret(secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/secrets/#{secret_name}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Get a Dependabot alert @see https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert """ def get_alert(alert_number, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/alerts/#{alert_number}" body = %{} api_call(:get, url, body, Noizu.Github.DependabotAlert, options) end @doc """ Get an organization public key @see https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key """ def get_org_public_key(org, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/public-key" body = %{} api_call(:get, url, body, Noizu.Github.DependabotPublicKey, options) end @doc """ Get an organization secret @see https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret """ def get_org_secret(org, secret_name, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}" body = %{} api_call(:get, url, body, Noizu.Github.OrganizationDependabotSecret, options) end @doc """ Get a repository public key @see https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key """ def get_repo_public_key(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/secrets/public-key" body = %{} api_call(:get, url, body, Noizu.Github.DependabotPublicKey, options) end @doc """ Get a repository secret @see https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret """ def get_repo_secret(secret_name, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/secrets/#{secret_name}" body = %{} api_call(:get, url, body, Noizu.Github.DependabotSecret, options) end @doc """ List Dependabot alerts for an enterprise @see https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-enterprise """ def list_alerts_for_enterprise(enterprise, options \\ nil) do url = ( query = [ get_field(:classification, options, nil), get_field(:state, options, nil), get_field(:severity, options, nil), get_field(:ecosystem, options, nil), get_field(:package, options, nil), get_field(:epss_percentage, options, nil), get_field(:has, options, nil), get_field(:assignee, options, nil), get_field(:scope, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil), get_field(:before, options, nil), get_field(:after, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/enterprises/#{enterprise}/dependabot/alerts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.DependabotAlertWithRepository, options) end @doc """ List Dependabot alerts for an organization @see https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization """ def list_alerts_for_org(org, options \\ nil) do url = ( query = [ get_field(:classification, options, nil), get_field(:state, options, nil), get_field(:severity, options, nil), get_field(:ecosystem, options, nil), get_field(:package, options, nil), get_field(:epss_percentage, options, nil), get_field(:artifact_registry_url, options, nil), get_field(:artifact_registry, options, nil), get_field(:has, options, nil), get_field(:assignee, options, nil), get_field(:runtime_risk, options, nil), get_field(:scope, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil), get_field(:before, options, nil), get_field(:after, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/dependabot/alerts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.DependabotAlertWithRepository, options) end @doc """ List Dependabot alerts for a repository @see https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository """ def list_alerts_for_repo(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:classification, options, nil), get_field(:state, options, nil), get_field(:severity, options, nil), get_field(:ecosystem, options, nil), get_field(:package, options, nil), get_field(:manifest, options, nil), get_field(:epss_percentage, options, nil), get_field(:has, options, nil), get_field(:assignee, options, nil), get_field(:scope, options, nil), get_field(:sort, options, nil), get_field(:direction, options, nil), get_field(:before, options, nil), get_field(:after, options, nil), get_field(:per_page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/dependabot/alerts" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Collection.DependabotAlert, options) end @doc """ List organization secrets @see https://docs.github.com/rest/dependabot/secrets#list-organization-secrets """ def list_org_secrets(org, options \\ nil) do url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/orgs/#{org}/dependabot/secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List repository secrets @see https://docs.github.com/rest/dependabot/secrets#list-repository-secrets """ def list_repo_secrets(options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = ( query = [ get_field(:per_page, options, nil), get_field(:page, options, nil) ] |> Enum.filter(& &1) qs = if query == [], do: "", else: "?" <> Enum.join(query, "&") github_base() <> "/repos/#{owner}/#{repo}/dependabot/secrets" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ List selected repositories for an organization secret @see https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret """ def list_selected_repos_for_org_secret(org, secret_name, options \\ nil) do 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() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}/repositories" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.Raw, options) end @doc """ Remove selected repository from an organization secret @see https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret """ def remove_selected_repo_from_org_secret(org, secret_name, repository_id, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}/repositories/#{repository_id}" body = %{} api_call(:delete, url, body, Noizu.Github.Raw, options) end @doc """ Lists the repositories Dependabot can access in an enterprise @see https://docs.github.com/rest/dependabot/repository-access#lists-the-repositories-dependabot-can-access-in-an-enterprise """ def repository_access_for_enterprise(enterprise, options \\ nil) do 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() <> "/enterprises/#{enterprise}/dependabot/repository-access" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.DependabotRepositoryAccessDetails, options) end @doc """ Lists the repositories Dependabot can access in an organization @see https://docs.github.com/rest/dependabot/repository-access#lists-the-repositories-dependabot-can-access-in-an-organization """ def repository_access_for_org(org, options \\ nil) do 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() <> "/orgs/#{org}/dependabot/repository-access" <> qs ) body = %{} api_call(:get, url, body, Noizu.Github.DependabotRepositoryAccessDetails, options) end @doc """ Set the default repository access level for Dependabot @see https://docs.github.com/rest/dependabot/repository-access#set-the-default-repository-access-level-for-dependabot """ def set_repository_access_default_level(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/repository-access/default-level" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set the default repository access level for Dependabot in an enterprise @see https://docs.github.com/rest/dependabot/repository-access#set-the-default-repository-access-level-for-dependabot-in-an-enterprise """ def set_repository_access_default_level_for_enterprise(enterprise, body, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/dependabot/repository-access/default-level" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Set selected repositories for an organization secret @see https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret """ def set_selected_repos_for_org_secret(org, secret_name, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/secrets/#{secret_name}/repositories" body = body api_call(:put, url, body, Noizu.Github.Raw, options) end @doc """ Update a Dependabot alert @see https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert """ def update_alert(alert_number, body, options \\ nil) do owner = repo_owner(options) repo = repo_name(options) url = github_base() <> "/repos/#{owner}/#{repo}/dependabot/alerts/#{alert_number}" body = body api_call(:patch, url, body, Noizu.Github.DependabotAlert, options) end @doc """ Updates Dependabot's repository access list for an enterprise @see https://docs.github.com/rest/dependabot/repository-access#updates-dependabots-repository-access-list-for-an-enterprise """ def update_repository_access_for_enterprise(enterprise, body, options \\ nil) do url = github_base() <> "/enterprises/#{enterprise}/dependabot/repository-access" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end @doc """ Updates Dependabot's repository access list for an organization @see https://docs.github.com/rest/dependabot/repository-access#updates-dependabots-repository-access-list-for-an-organization """ def update_repository_access_for_org(org, body, options \\ nil) do url = github_base() <> "/orgs/#{org}/dependabot/repository-access" body = body api_call(:patch, url, body, Noizu.Github.Raw, options) end end