diff --git a/Gopkg.lock b/Gopkg.lock index 8a0e37d8..edbca7df 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -62,7 +62,7 @@ branch = "master" name = "github.com/google/go-github" packages = ["github"] - revision = "60d040d2dafa18fa3e86cbf22fbc3208ef9ef1e0" + revision = "60f2773bd99aa86164bc80bf370be6ba63b47dea" [[projects]] branch = "master" @@ -125,10 +125,10 @@ version = "v1.2.2" [[projects]] - branch = "master" name = "github.com/xanzy/go-gitlab" packages = ["."] - revision = "6ada444068f460636db26ca0dd66cf2aa518fa8f" + revision = "79dad8e74fd097eb2e0fd0883f1978213e88107a" + version = "v0.10.7" [[projects]] branch = "master" @@ -143,7 +143,7 @@ "context", "context/ctxhttp" ] - revision = "e514e69ffb8bc3c76a71ae40de0118d794855992" + revision = "039a4258aec0ad3c79b905677cceeab13b296a77" [[projects]] branch = "master" @@ -179,7 +179,7 @@ "googleapi/internal/uritemplates", "sheets/v4" ] - revision = "082d671a2a341aa205b22b580fa69747dcc3cdc8" + revision = "1d2d9cc0ae74226e8076e2a87e211c8fea38a160" [[projects]] name = "google.golang.org/appengine" diff --git a/vendor/github.com/google/go-github/github/apps.go b/vendor/github.com/google/go-github/github/apps.go index c1f7f138..249a449b 100644 --- a/vendor/github.com/google/go-github/github/apps.go +++ b/vendor/github.com/google/go-github/github/apps.go @@ -126,23 +126,7 @@ func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) ( // // GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { - u := fmt.Sprintf("app/installations/%v", id) - - 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) - - i := new(Installation) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil + return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id)) } // ListUserInstallations lists installations that are accessible to the authenticated user. @@ -195,3 +179,42 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*I return t, resp, nil } + +// FindOrganizationInstallation finds the organization's installation information. +// +// GitHub API docs: https://developer.github.com/v3/apps/#find-organization-installation +func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) +} + +// FindRepositoryInstallation finds the repository's installation information. +// +// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation +func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) +} + +// FindUserInstallation finds the user's installation information. +// +// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation +func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) +} + +func (s *AppsService) getInstallation(ctx context.Context, url string) (*Installation, *Response, error) { + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return nil, nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeIntegrationPreview) + + i := new(Installation) + resp, err := s.client.Do(ctx, req, i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} diff --git a/vendor/github.com/xanzy/go-gitlab/deployments.go b/vendor/github.com/xanzy/go-gitlab/deployments.go index a648605e..e43d1c4a 100644 --- a/vendor/github.com/xanzy/go-gitlab/deployments.go +++ b/vendor/github.com/xanzy/go-gitlab/deployments.go @@ -68,8 +68,8 @@ type Deployment struct { // https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments type ListProjectDeploymentsOptions struct { ListOptions - OrderBy *OrderByValue `url:"order_by,omitempty" json:"order_by,omitempty"` - Sort *string `url:"sort,omitempty" json:"sort,omitempty"` + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` } // ListProjectDeployments gets a list of deployments in a project. diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index 6019d87a..65cb4198 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -186,19 +186,6 @@ var notificationLevelTypes = map[string]NotificationLevelValue{ "custom": CustomNotificationLevel, } -// OrderByValue represent in which order to sort the item -type OrderByValue string - -// These constants represent all valid order by values. -const ( - OrderByCreatedAt OrderByValue = "created_at" - OrderByID OrderByValue = "id" - OrderByIID OrderByValue = "iid" - OrderByRef OrderByValue = "ref" - OrderByStatus OrderByValue = "status" - OrderByUserID OrderByValue = "user_id" -) - // VisibilityValue represents a visibility level within GitLab. // // GitLab API docs: https://docs.gitlab.com/ce/api/ @@ -832,14 +819,6 @@ func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { return p } -// OrderBy is a helper routine that allocates a new OrderByValue -// to store v and returns a pointer to it. -func OrderBy(v OrderByValue) *OrderByValue { - p := new(OrderByValue) - *p = v - return p -} - // Visibility is a helper routine that allocates a new VisibilityValue // to store v and returns a pointer to it. func Visibility(v VisibilityValue) *VisibilityValue { diff --git a/vendor/github.com/xanzy/go-gitlab/pipelines.go b/vendor/github.com/xanzy/go-gitlab/pipelines.go index 0c736dd2..952d0d2c 100644 --- a/vendor/github.com/xanzy/go-gitlab/pipelines.go +++ b/vendor/github.com/xanzy/go-gitlab/pipelines.go @@ -87,7 +87,7 @@ type ListProjectPipelinesOptions struct { YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"` Name *string `url:"name,omitempty" json:"name,omitempty"` Username *string `url:"username,omitempty" json:"username,omitempty"` - OrderBy *OrderByValue `url:"order_by,omitempty" json:"order_by,omitempty"` + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` Sort *string `url:"sort,omitempty" json:"sort,omitempty"` }