1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add gerrit widget

This commit is contained in:
Anand Sudhir Prayaga 2018-06-27 15:59:50 +02:00 committed by Chris Cummer
parent 599a2aa813
commit 279822f0a6
5 changed files with 48 additions and 46 deletions

10
Gopkg.lock generated
View File

@ -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"

View File

@ -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
}

View File

@ -68,7 +68,7 @@ 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"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
}

View File

@ -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 {

View File

@ -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"`
}