# 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.Packages do
@moduledoc """
GitHub `packages` API.
"""
import Noizu.Github
@doc """
Delete a package for the authenticated user
@see https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user
"""
def delete_package_for_authenticated_user(package_type, package_name, options \\ nil) do
url = github_base() <> "/user/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Delete a package for an organization
@see https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization
"""
def delete_package_for_org(package_type, package_name, org, options \\ nil) do
url = github_base() <> "/orgs/#{org}/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Delete a package for a user
@see https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user
"""
def delete_package_for_user(package_type, package_name, username, options \\ nil) do
url = github_base() <> "/users/#{username}/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Delete a package version for the authenticated user
@see https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user
"""
def delete_package_version_for_authenticated_user(
package_type,
package_name,
package_version_id,
options \\ nil
) do
url =
github_base() <>
"/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Delete package version for an organization
@see https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization
"""
def delete_package_version_for_org(
package_type,
package_name,
org,
package_version_id,
options \\ nil
) do
url =
github_base() <>
"/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
Delete package version for a user
@see https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user
"""
def delete_package_version_for_user(
package_type,
package_name,
username,
package_version_id,
options \\ nil
) do
url =
github_base() <>
"/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:delete, url, body, Noizu.Github.Raw, options)
end
@doc """
List package versions for a package owned by the authenticated user
@see https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user
"""
def get_all_package_versions_for_package_owned_by_authenticated_user(
package_type,
package_name,
options \\ nil
) do
url =
(
query =
[
get_field(:page, options, nil),
get_field(:per_page, options, nil),
get_field(:state, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/user/packages/#{package_type}/#{package_name}/versions" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.PackageVersion, options)
end
@doc """
List package versions for a package owned by an organization
@see https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization
"""
def get_all_package_versions_for_package_owned_by_org(
package_type,
package_name,
org,
options \\ nil
) do
url =
(
query =
[
get_field(:page, options, nil),
get_field(:per_page, options, nil),
get_field(:state, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/packages/#{package_type}/#{package_name}/versions" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.PackageVersion, options)
end
@doc """
List package versions for a package owned by a user
@see https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user
"""
def get_all_package_versions_for_package_owned_by_user(
package_type,
package_name,
username,
options \\ nil
) do
url = github_base() <> "/users/#{username}/packages/#{package_type}/#{package_name}/versions"
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.PackageVersion, options)
end
@doc """
Get a package for the authenticated user
@see https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user
"""
def get_package_for_authenticated_user(package_type, package_name, options \\ nil) do
url = github_base() <> "/user/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:get, url, body, Noizu.Github.Package, options)
end
@doc """
Get a package for an organization
@see https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization
"""
def get_package_for_organization(package_type, package_name, org, options \\ nil) do
url = github_base() <> "/orgs/#{org}/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:get, url, body, Noizu.Github.Package, options)
end
@doc """
Get a package for a user
@see https://docs.github.com/rest/packages/packages#get-a-package-for-a-user
"""
def get_package_for_user(package_type, package_name, username, options \\ nil) do
url = github_base() <> "/users/#{username}/packages/#{package_type}/#{package_name}"
body = %{}
api_call(:get, url, body, Noizu.Github.Package, options)
end
@doc """
Get a package version for the authenticated user
@see https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user
"""
def get_package_version_for_authenticated_user(
package_type,
package_name,
package_version_id,
options \\ nil
) do
url =
github_base() <>
"/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:get, url, body, Noizu.Github.PackageVersion, options)
end
@doc """
Get a package version for an organization
@see https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization
"""
def get_package_version_for_organization(
package_type,
package_name,
org,
package_version_id,
options \\ nil
) do
url =
github_base() <>
"/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:get, url, body, Noizu.Github.PackageVersion, options)
end
@doc """
Get a package version for a user
@see https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user
"""
def get_package_version_for_user(
package_type,
package_name,
package_version_id,
username,
options \\ nil
) do
url =
github_base() <>
"/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}"
body = %{}
api_call(:get, url, body, Noizu.Github.PackageVersion, options)
end
@doc """
Get list of conflicting packages during Docker migration for authenticated-user
@see https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-authenticated-user
"""
def list_docker_migration_conflicting_packages_for_authenticated_user(options \\ nil) do
url = github_base() <> "/user/docker/conflicts"
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
Get list of conflicting packages during Docker migration for organization
@see https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-organization
"""
def list_docker_migration_conflicting_packages_for_organization(org, options \\ nil) do
url = github_base() <> "/orgs/#{org}/docker/conflicts"
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
Get list of conflicting packages during Docker migration for user
@see https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-user
"""
def list_docker_migration_conflicting_packages_for_user(username, options \\ nil) do
url = github_base() <> "/users/#{username}/docker/conflicts"
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
List packages for the authenticated user's namespace
@see https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace
"""
def list_packages_for_authenticated_user(options \\ nil) do
url =
(
query =
[
get_field(:package_type, options, nil),
get_field(:visibility, options, nil),
get_field(:page, options, nil),
get_field(:per_page, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/user/packages" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
List packages for an organization
@see https://docs.github.com/rest/packages/packages#list-packages-for-an-organization
"""
def list_packages_for_organization(org, options \\ nil) do
url =
(
query =
[
get_field(:package_type, options, nil),
get_field(:visibility, options, nil),
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}/packages" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
List packages for a user
@see https://docs.github.com/rest/packages/packages#list-packages-for-a-user
"""
def list_packages_for_user(username, options \\ nil) do
url =
(
query =
[
get_field(:package_type, options, nil),
get_field(:visibility, options, nil),
get_field(:page, options, nil),
get_field(:per_page, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/users/#{username}/packages" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Collection.Package, options)
end
@doc """
Restore a package for the authenticated user
@see https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user
"""
def restore_package_for_authenticated_user(package_type, package_name, body, options \\ nil) do
url =
(
query =
[
get_field(:token, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/user/packages/#{package_type}/#{package_name}/restore" <> qs
)
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
@doc """
Restore a package for an organization
@see https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization
"""
def restore_package_for_org(package_type, package_name, org, body, options \\ nil) do
url =
(
query =
[
get_field(:token, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/packages/#{package_type}/#{package_name}/restore" <> qs
)
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
@doc """
Restore a package for a user
@see https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user
"""
def restore_package_for_user(package_type, package_name, username, body, options \\ nil) do
url =
(
query =
[
get_field(:token, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <>
"/users/#{username}/packages/#{package_type}/#{package_name}/restore" <> qs
)
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
@doc """
Restore a package version for the authenticated user
@see https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user
"""
def restore_package_version_for_authenticated_user(
package_type,
package_name,
package_version_id,
body,
options \\ nil
) do
url =
github_base() <>
"/user/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
@doc """
Restore package version for an organization
@see https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization
"""
def restore_package_version_for_org(
package_type,
package_name,
org,
package_version_id,
body,
options \\ nil
) do
url =
github_base() <>
"/orgs/#{org}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
@doc """
Restore package version for a user
@see https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user
"""
def restore_package_version_for_user(
package_type,
package_name,
username,
package_version_id,
body,
options \\ nil
) do
url =
github_base() <>
"/users/#{username}/packages/#{package_type}/#{package_name}/versions/#{package_version_id}/restore"
body = body
api_call(:post, url, body, Noizu.Github.Raw, options)
end
end