Skip to content

Commit

Permalink
init: add installation requests api
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijit-hota committed Oct 3, 2023
1 parent 8cd452b commit 2bec3f1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions github/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ type InstallationPermissions struct {
Workflows *string `json:"workflows,omitempty"`
}

// InstallationRequest represents a pending GitHub App installation request.
type InstallationRequest struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Account *User `json:"account,omitempty"`
Requester *User `json:"requester,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
}

// Installation represents a GitHub Apps installation.
type Installation struct {
ID *int64 `json:"id,omitempty"`
Expand Down Expand Up @@ -175,6 +184,29 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response,
return app, resp, nil
}

// ListInstallationRequests lists the pending installation requests that the current GitHub App has.
//
// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installation-requests-for-the-authenticated-app
func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) {
u, err := addOptions("app/installation-requests", opts)
if err != nil {
return nil, nil, err
}

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}

var i []*InstallationRequest
resp, err := s.client.Do(ctx, req, &i)
if err != nil {
return nil, resp, err
}

return i, resp, nil
}

// ListInstallations lists the installations that the current GitHub App has.
//
// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app
Expand Down

0 comments on commit 2bec3f1

Please sign in to comment.