MCPcopy Create free account
hub / github.com/google/go-github / CreateInstallationToken

Method CreateInstallationToken

github/apps.go:386–401  ·  view source on GitHub ↗

CreateInstallationToken creates a new installation token. GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app meta:operation POST /app/installations/{installation_id}/access_tokens

(ctx context.Context, id int64, opts *InstallationTokenOptions)

Source from the content-addressed store, hash-verified

384//
385//meta:operation POST /app/installations/{installation_id}/access_tokens
386func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) {
387 u := fmt.Sprintf("app/installations/%v/access_tokens", id)
388
389 req, err := s.client.NewRequest(ctx, "POST", u, opts)
390 if err != nil {
391 return nil, nil, err
392 }
393
394 var t *InstallationToken
395 resp, err := s.client.Do(req, &t)
396 if err != nil {
397 return nil, resp, err
398 }
399
400 return t, resp, nil
401}
402
403// CreateInstallationTokenListRepos creates a new installation token with a list of all repositories in an installation which is not possible with CreateInstallationToken.
404//

Calls 2

NewRequestMethod · 0.80
DoMethod · 0.45