// Copyright 2021 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// ListPackages lists the packages for an organization.//// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization////meta:operation GET /orgs/{org}/packagesfunc ( *OrganizationsService) ( context.Context, string, *PackageListOptions) ([]*Package, *Response, error) { := fmt.Sprintf("orgs/%v/packages", ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*Package , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// GetPackage gets a package by name from an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization////meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}func ( *OrganizationsService) ( context.Context, , , string) (*Package, *Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v", , , url.PathEscape()) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *Package , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// DeletePackage deletes a package from an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization////meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}func ( *OrganizationsService) ( context.Context, , , string) (*Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v", , , url.PathEscape()) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }return .client.Do(, , nil)}// RestorePackage restores a package to an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization////meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restorefunc ( *OrganizationsService) ( context.Context, , , string) (*Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", , , url.PathEscape()) , := .client.NewRequest("POST", , nil)if != nil {returnnil, }return .client.Do(, , nil)}// PackageGetAllVersions gets all versions of a package in an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization////meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versionsfunc ( *OrganizationsService) ( context.Context, , , string, *PackageListOptions) ([]*PackageVersion, *Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", , , url.PathEscape()) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*PackageVersion , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// PackageGetVersion gets a specific version of a package in an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization////meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}func ( *OrganizationsService) ( context.Context, , , string, int64) (*PackageVersion, *Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", , , url.PathEscape(), ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *PackageVersion , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// PackageDeleteVersion deletes a package version from an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization////meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}func ( *OrganizationsService) ( context.Context, , , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", , , url.PathEscape(), ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }return .client.Do(, , nil)}// PackageRestoreVersion restores a package version to an organization.//// Note that packageName is escaped for the URL path so that you don't need to.//// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization////meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restorefunc ( *OrganizationsService) ( context.Context, , , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", , , url.PathEscape(), ) , := .client.NewRequest("POST", , nil)if != nil {returnnil, }return .client.Do(, , nil)}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.