# 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.PrivateRegistries do
@moduledoc """
GitHub `private-registries` API.
"""
import Noizu.Github
@doc """
Create a private registry for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#create-a-private-registry-for-an-organization
"""
def create_org_private_registry(org, body, options \\ nil) do
url = github_base() <> "/orgs/#{org}/private-registries"
body = body
api_call(
:post,
url,
body,
Noizu.Github.OrgPrivateRegistryConfigurationWithSelectedRepositories,
options
)
end
@doc """
Delete a private registry for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#delete-a-private-registry-for-an-organization
"""
def delete_org_private_registry(org, secret_name, options \\ nil) do
url = github_base() <> "/orgs/#{org}/private-registries/#{secret_name}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Get a private registry for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#get-a-private-registry-for-an-organization
"""
def get_org_private_registry(org, secret_name, options \\ nil) do
url = github_base() <> "/orgs/#{org}/private-registries/#{secret_name}"
body = %{}
api_call(:get, url, body, Noizu.Github.OrgPrivateRegistryConfiguration, options)
end
@doc """
Get private registries public key for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#get-private-registries-public-key-for-an-organization
"""
def get_org_public_key(org, options \\ nil) do
url = github_base() <> "/orgs/#{org}/private-registries/public-key"
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
List private registries for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#list-private-registries-for-an-organization
"""
def list_org_private_registries(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}/private-registries" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Update a private registry for an organization
@see https://docs.github.com/rest/private-registries/organization-configurations#update-a-private-registry-for-an-organization
"""
def update_org_private_registry(org, secret_name, body, options \\ nil) do
url = github_base() <> "/orgs/#{org}/private-registries/#{secret_name}"
body = body
api_call(:patch, url, body, Noizu.Github.Raw, options)
end
end