github.com/google/go-github/v69@v69.2.0/github/users_attestations.go (about) 1 // Copyright 2024 The go-github AUTHORS. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 package github 7 8 import ( 9 "context" 10 "fmt" 11 ) 12 13 // ListAttestations returns a collection of artifact attestations 14 // with a given subject digest that are associated with repositories 15 // owned by a user. 16 // 17 // GitHub API docs: https://docs.github.com/rest/users/attestations#list-attestations 18 // 19 //meta:operation GET /users/{username}/attestations/{subject_digest} 20 func (s *UsersService) ListAttestations(ctx context.Context, user, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { 21 var u = fmt.Sprintf("users/%v/attestations/%v", user, subjectDigest) 22 23 u, err := addOptions(u, opts) 24 if err != nil { 25 return nil, nil, err 26 } 27 28 req, err := s.client.NewRequest("GET", u, nil) 29 if err != nil { 30 return nil, nil, err 31 } 32 33 var attestations *AttestationsResponse 34 res, err := s.client.Do(ctx, req, &attestations) 35 if err != nil { 36 return nil, res, err 37 } 38 39 return attestations, res, nil 40 }