MCPcopy Index your code
hub / github.com/google/go-github / Reset

Method Reset

github/authorizations.go:184–204  ·  view source on GitHub ↗

Reset is used to reset a valid OAuth token without end user involvement. Applications must save the "token" property in the response, because changes take effect immediately. Note that this operation requires the use of BasicAuth, but where the username is the OAuth application clientID, and the pa

(ctx context.Context, clientID, accessToken string)

Source from the content-addressed store, hash-verified

182//
183//meta:operation PATCH /applications/{client_id}/token
184func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) {
185 u := fmt.Sprintf("applications/%v/token", clientID)
186
187 reqBody := &struct {
188 AccessToken string `json:"access_token"`
189 }{AccessToken: accessToken}
190
191 req, err := s.client.NewRequest(ctx, "PATCH", u, reqBody)
192 if err != nil {
193 return nil, nil, err
194 }
195 req.Header.Set("Accept", mediaTypeOAuthAppPreview)
196
197 var a *Authorization
198 resp, err := s.client.Do(req, &a)
199 if err != nil {
200 return nil, resp, err
201 }
202
203 return a, resp, nil
204}
205
206// Revoke an authorization for an application.
207//

Callers 3

StringifyFunction · 0.80

Calls 2

NewRequestMethod · 0.80
DoMethod · 0.45

Tested by 2