mirror of
https://github.com/google/go-github.git
synced 2026-10-28 16:34:37 +08:00
BREAKING CHANGE: All internal calls now provide `Context` via the `Request` itself.
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
// Copyright 2024 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 github
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// ListAttestations returns a collection of artifact attestations
|
|
// with a given subject digest that are associated with repositories
|
|
// owned by an organization.
|
|
//
|
|
// GitHub API docs: https://docs.github.com/rest/orgs/attestations?apiVersion=2022-11-28#list-attestations
|
|
//
|
|
//meta:operation GET /orgs/{org}/attestations/{subject_digest}
|
|
func (s *OrganizationsService) ListAttestations(ctx context.Context, org, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) {
|
|
u := fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest)
|
|
|
|
u, err := addOptions(u, opts)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
req, err := s.client.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
var attestations *AttestationsResponse
|
|
resp, err := s.client.Do(req, &attestations)
|
|
if err != nil {
|
|
return nil, resp, err
|
|
}
|
|
|
|
return attestations, resp, nil
|
|
}
|