Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Few minor tweaks after merging a round of PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Sep 25, 2023
1 parent 21fd9d5 commit 09b2215
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
4 changes: 1 addition & 3 deletions examples/repository_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ func repositoryArchiveExample() {
// Get repository archive
opt := &gitlab.ArchiveOptions{
Format: gitlab.String("tar.gz"),
// Gitlab API supports archiving first level directories at the moment, e.g. "mygroup/myproject/mydir".
// If you pass 2+ level directory in path, whole repository will be archived and downloaded.
Path: gitlab.String("mydir"),
Path: gitlab.String("mydir"),
}
content, _, err := git.Repositories.Archive("mygroup/myproject", opt, nil)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions examples/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func dataDogExample() {
// Create new DataDog integration
opts := &gitlab.SetDataDogServiceOptions{
APIKey: gitlab.String("testing"),
ArchiveTraceEvents: gitlab.Bool(true),
DataDogEnv: gitlab.String("sandbox"),
DataDogService: gitlab.String("test"),
DataDogSite: gitlab.String("datadoghq.com"),
DataDogTags: gitlab.String("country:canada\nprovince:ontario"),
ArchiveTraceEvents: gitlab.Bool(true),
}

_, err = git.Services.SetDataDogService(1, opts)
Expand All @@ -50,9 +50,9 @@ func dataDogExample() {
log.Fatal(err)
}
fmt.Printf(
"api_url: %s, archive_trace_events: %v, datadog_env: %s, datadog_service: %s, datadog_site: %s, datadog_tags: %s",
svc.Properties.APIURL, svc.Properties.ArchiveTraceEvents, svc.Properties.DataDogEnv,
svc.Properties.DataDogService, svc.Properties.DataDogSite, svc.Properties.DataDogTags,
"api_url: %s, datadog_env: %s, datadog_service: %s, datadog_site: %s, datadog_tags: %s",
svc.Properties.APIURL, svc.Properties.DataDogEnv, svc.Properties.DataDogService,
svc.Properties.DataDogSite, svc.Properties.DataDogTags,
)

// Delete the integration
Expand Down
1 change: 1 addition & 0 deletions group_access_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (s *GroupAccessTokensService) CreateGroupAccessToken(gid interface{}, opt *

// RotateGroupAccessToken revokes a group access token and returns a new group
// access token that expires in one week.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_access_tokens.html#rotate-a-group-access-token
func (s *GroupAccessTokensService) RotateGroupAccessToken(gid interface{}, id int, options ...RequestOptionFunc) (*GroupAccessToken, *Response, error) {
Expand Down
15 changes: 8 additions & 7 deletions merge_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,19 @@ func (s *MergeRequestsService) GetMergeRequestParticipants(pid interface{}, merg
return nil, nil, err
}

var ps []*BasicUser
resp, err := s.client.Do(req, &ps)
var bu []*BasicUser
resp, err := s.client.Do(req, &bu)
if err != nil {
return nil, resp, err
}

return ps, resp, nil
return bu, resp, nil
}

// MergeRequestReviewer represents a GitLab merge request reviewer.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/merge_requests.html#get-single-merge-request-reviewers
// GitLab API docs:
// https://docs.gitlab.com/ee/api/merge_requests.html#get-single-merge-request-reviewers
type MergeRequestReviewer struct {
User *BasicUser `json:"user"`
State string `json:"state"`
Expand All @@ -576,13 +577,13 @@ func (s *MergeRequestsService) GetMergeRequestReviewers(pid interface{}, mergeRe
return nil, nil, err
}

var ps []*MergeRequestReviewer
resp, err := s.client.Do(req, &ps)
var mrr []*MergeRequestReviewer
resp, err := s.client.Do(req, &mrr)
if err != nil {
return nil, resp, err
}

return ps, resp, nil
return mrr, resp, nil
}

// ListMergeRequestPipelines gets all pipelines for the provided merge request.
Expand Down
1 change: 1 addition & 0 deletions project_access_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func (s *ProjectAccessTokensService) CreateProjectAccessToken(pid interface{}, o

// RotateProjectAccessToken revokes a project access token and returns a new
// project access token that expires in one week.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_access_tokens.html#rotate-a-project-access-token
func (s *ProjectAccessTokensService) RotateProjectAccessToken(pid interface{}, id int, options ...RequestOptionFunc) (*ProjectAccessToken, *Response, error) {
Expand Down
4 changes: 2 additions & 2 deletions services.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ type DataDogService struct {
// https://docs.gitlab.com/ee/api/services.html#datadog
type DataDogServiceProperties struct {
APIURL string `url:"api_url,omitempty" json:"api_url,omitempty"`
ArchiveTraceEvents bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
DataDogEnv string `url:"datadog_env,omitempty" json:"datadog_env,omitempty"`
DataDogService string `url:"datadog_service,omitempty" json:"datadog_service,omitempty"`
DataDogSite string `url:"datadog_site,omitempty" json:"datadog_site,omitempty"`
DataDogTags string `url:"datadog_tags,omitempty" json:"datadog_tags,omitempty"`
ArchiveTraceEvents bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
}

// GetDataDogService gets DataDog service settings for a project.
Expand Down Expand Up @@ -234,11 +234,11 @@ func (s *ServicesService) GetDataDogService(pid interface{}, options ...RequestO
type SetDataDogServiceOptions struct {
APIKey *string `url:"api_key,omitempty" json:"api_key,omitempty"`
APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
ArchiveTraceEvents *bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
DataDogEnv *string `url:"datadog_env,omitempty" json:"datadog_env,omitempty"`
DataDogService *string `url:"datadog_service,omitempty" json:"datadog_service,omitempty"`
DataDogSite *string `url:"datadog_site,omitempty" json:"datadog_site,omitempty"`
DataDogTags *string `url:"datadog_tags,omitempty" json:"datadog_tags,omitempty"`
ArchiveTraceEvents *bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
}

// SetDataDogService sets DataDog service settings for a project.
Expand Down
2 changes: 1 addition & 1 deletion testdata/list_merge_request_diff.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"renamed_file": false,
"deleted_file": false
}
]
]

0 comments on commit 09b2215

Please sign in to comment.