forked from google/go-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcredentials.go
More file actions
37 lines (29 loc) · 1.02 KB
/
credentials.go
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2025 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"
)
// CredentialsService handles credentials related methods of the GitHub API.
type CredentialsService service
// revokeCredentialsRequest represents the request body for revoking credentials.
type revokeCredentialsRequest struct {
// The list of credential strings (tokens) to revoke.
Credentials []string `json:"credentials"`
}
// Revoke revokes a list of credentials.
//
// GitHub API docs: https://docs.github.com/rest/credentials/revoke#revoke-a-list-of-credentials
//
//meta:operation POST /credentials/revoke
func (s *CredentialsService) Revoke(ctx context.Context, credentials []string) (*Response, error) {
u := "credentials/revoke"
reqBody := &revokeCredentialsRequest{Credentials: credentials}
req, err := s.client.NewRequest("POST", u, reqBody)
if err != nil {
return nil, err
}
return s.client.Do(ctx, req, nil)
}