github.com/google/go-github/v49@v49.1.0/github/apps_manifest.go (about) 1 // Copyright 2019 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 // AppConfig describes the configuration of a GitHub App. 14 type AppConfig struct { 15 ID *int64 `json:"id,omitempty"` 16 Slug *string `json:"slug,omitempty"` 17 NodeID *string `json:"node_id,omitempty"` 18 Owner *User `json:"owner,omitempty"` 19 Name *string `json:"name,omitempty"` 20 Description *string `json:"description,omitempty"` 21 ExternalURL *string `json:"external_url,omitempty"` 22 HTMLURL *string `json:"html_url,omitempty"` 23 CreatedAt *Timestamp `json:"created_at,omitempty"` 24 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 25 ClientID *string `json:"client_id,omitempty"` 26 ClientSecret *string `json:"client_secret,omitempty"` 27 WebhookSecret *string `json:"webhook_secret,omitempty"` 28 PEM *string `json:"pem,omitempty"` 29 } 30 31 // CompleteAppManifest completes the App manifest handshake flow for the given 32 // code. 33 // 34 // GitHub API docs: https://docs.github.com/en/rest/apps/apps#create-a-github-app-from-a-manifest 35 func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { 36 u := fmt.Sprintf("app-manifests/%s/conversions", code) 37 req, err := s.client.NewRequest("POST", u, nil) 38 if err != nil { 39 return nil, nil, err 40 } 41 42 cfg := new(AppConfig) 43 resp, err := s.client.Do(ctx, req, cfg) 44 if err != nil { 45 return nil, resp, err 46 } 47 48 return cfg, resp, nil 49 }