aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/apps_installation.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2019-10-23 23:03:17 -0700
committerGitHub <noreply@github.com>2019-10-23 23:03:17 -0700
commit613139e7bef81d3573e7988a47eb6765f3de347a (patch)
tree49de7277898d3ff47a122c072568edb8ed4c9ac9 /vendor/github.com/google/go-github/github/apps_installation.go
parentfb100dbf98f02e4c631d142ff0f52ec29ee2f00c (diff)
Enable Go modules (#5835)
* Remove vendor * Enable Go modules * ci: add command to fetch dependencies * ci: update setting * ci: update settings * Require Go 1.11 * Rename module name to gogs.io/gogs
Diffstat (limited to 'vendor/github.com/google/go-github/github/apps_installation.go')
-rw-r--r--vendor/github.com/google/go-github/github/apps_installation.go101
1 files changed, 0 insertions, 101 deletions
diff --git a/vendor/github.com/google/go-github/github/apps_installation.go b/vendor/github.com/google/go-github/github/apps_installation.go
deleted file mode 100644
index ccfecb8d..00000000
--- a/vendor/github.com/google/go-github/github/apps_installation.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2016 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"
- "fmt"
-)
-
-// ListRepos lists the repositories that are accessible to the authenticated installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories
-func (s *AppsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repository, *Response, error) {
- u, err := addOptions("installation/repositories", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var r struct {
- Repositories []*Repository `json:"repositories"`
- }
- resp, err := s.client.Do(ctx, req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r.Repositories, resp, nil
-}
-
-// ListUserRepos lists repositories that are accessible
-// to the authenticated user for an installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
-func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opt *ListOptions) ([]*Repository, *Response, error) {
- u := fmt.Sprintf("user/installations/%v/repositories", id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var r struct {
- Repositories []*Repository `json:"repositories"`
- }
- resp, err := s.client.Do(ctx, req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r.Repositories, resp, nil
-}
-
-// AddRepository adds a single repository to an installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#add-repository-to-installation
-func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) {
- u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Repository)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// RemoveRepository removes a single repository from an installation.
-//
-// GitHub docs: https://developer.github.com/v3/apps/installations/#remove-repository-from-installation
-func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) {
- u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}