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

Commit

Permalink
Merge pull request #1650 from blacknon/master
Browse files Browse the repository at this point in the history
update SnippetFile.
  • Loading branch information
svanharmelen authored Feb 16, 2023
2 parents 172b5e0 + df4112a commit e837f2d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
24 changes: 12 additions & 12 deletions project_snippets.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, option
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_snippets.html#create-new-snippet
type CreateProjectSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*SnippetFile `url:"files,omitempty" json:"files,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*CreateSnippetFileOptions `url:"files,omitempty" json:"files,omitempty"`
}

// CreateSnippet creates a new project snippet. The user must have permission
Expand Down Expand Up @@ -128,12 +128,12 @@ func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProje
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_snippets.html#update-snippet
type UpdateProjectSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*SnippetFile `url:"files,omitempty" json:"files,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*UpdateSnippetFileOptions `url:"files,omitempty" json:"files,omitempty"`
}

// UpdateSnippet updates an existing project snippet. The user must have
Expand Down
39 changes: 25 additions & 14 deletions snippets.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ func (s *SnippetsService) SnippetFileContent(snippet int, ref, filename string,
return b.Bytes(), resp, err
}

// SnippetFile represents the object that is used to create snippets
// CreateSnippetFileOptions represents the create snippet file options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippets.html#create-new-snippet
type SnippetFile struct {
type CreateSnippetFileOptions struct {
FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
}
Expand All @@ -166,12 +166,12 @@ type SnippetFile struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippets.html#create-new-snippet
type CreateSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*SnippetFile `url:"files,omitempty" json:"files,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*CreateSnippetFileOptions `url:"files,omitempty" json:"files,omitempty"`
}

// CreateSnippet creates a new snippet. The user must have permission
Expand All @@ -194,17 +194,28 @@ func (s *SnippetsService) CreateSnippet(opt *CreateSnippetOptions, options ...Re
return ps, resp, err
}

// UpdateSnippetFileOptions represents the update snippet file options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippets.html#update-snippet
type UpdateSnippetFileOptions struct {
Action *string `url:"action,omitempty" json:"action,omitempty"`
FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
PreviousPath *string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
}

// UpdateSnippetOptions represents the available UpdateSnippet() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippets.html#update-snippet
type UpdateSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*SnippetFile `url:"files,omitempty" json:"files,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Files *[]*UpdateSnippetFileOptions `url:"files,omitempty" json:"files,omitempty"`
}

// UpdateSnippet updates an existing snippet. The user must have
Expand Down

0 comments on commit e837f2d

Please sign in to comment.