f12d597965
- Update comment to correctly describe `ListOrgActionSecretOption` as listing organization secrets instead of members - Add new file `repo_action.go` with functionality to list a repository's secrets including the structure and API call Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/660 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
33 lines
1 KiB
Go
33 lines
1 KiB
Go
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package forgejo
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
)
|
|
|
|
// ListOrgActionSecretOption list OrgActionSecret options
|
|
type ListOrgActionSecretOption struct {
|
|
ListOptions
|
|
}
|
|
|
|
// ListOrgActionSecret list an organization's secrets
|
|
func (c *Client) ListOrgActionSecret(org string, opt ListOrgActionSecretOption) ([]*Secret, *Response, error) {
|
|
if err := escapeValidatePathSegments(&org); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
opt.setDefaults()
|
|
secrets := make([]*Secret, 0, opt.PageSize)
|
|
|
|
link, _ := url.Parse(fmt.Sprintf("/orgs/%s/actions/secrets", org))
|
|
link.RawQuery = opt.getURLQuery().Encode()
|
|
resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, &secrets)
|
|
return secrets, resp, err
|
|
}
|