Commit 1206a345 authored by Sander van Harmelen's avatar Sander van Harmelen

Add missing delete functions for the `notes` service

Fixes #185
parent 2bf0bc1c
...@@ -25,16 +25,14 @@ import ( ...@@ -25,16 +25,14 @@ import (
// NotesService handles communication with the notes related methods // NotesService handles communication with the notes related methods
// of the GitLab API. // of the GitLab API.
// //
// GitLab API docs: // GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md
type NotesService struct { type NotesService struct {
client *Client client *Client
} }
// Note represents a GitLab note. // Note represents a GitLab note.
// //
// GitLab API docs: // GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md
type Note struct { type Note struct {
ID int `json:"id"` ID int `json:"id"`
Body string `json:"body"` Body string `json:"body"`
...@@ -49,9 +47,6 @@ type Note struct { ...@@ -49,9 +47,6 @@ type Note struct {
State string `json:"state"` State string `json:"state"`
CreatedAt *time.Time `json:"created_at"` CreatedAt *time.Time `json:"created_at"`
} `json:"author"` } `json:"author"`
System bool `json:"system"`
Upvote bool `json:"upvote"`
Downvote bool `json:"downvote"`
ExpiresAt *time.Time `json:"expires_at"` ExpiresAt *time.Time `json:"expires_at"`
UpdatedAt *time.Time `json:"updated_at"` UpdatedAt *time.Time `json:"updated_at"`
CreatedAt *time.Time `json:"created_at"` CreatedAt *time.Time `json:"created_at"`
...@@ -64,7 +59,7 @@ func (n Note) String() string { ...@@ -64,7 +59,7 @@ func (n Note) String() string {
// ListIssueNotesOptions represents the available ListIssueNotes() options. // ListIssueNotesOptions represents the available ListIssueNotes() options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#list-project-issue-notes // https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
type ListIssueNotesOptions struct { type ListIssueNotesOptions struct {
ListOptions ListOptions
} }
...@@ -72,7 +67,7 @@ type ListIssueNotesOptions struct { ...@@ -72,7 +67,7 @@ type ListIssueNotesOptions struct {
// ListIssueNotes gets a list of all notes for a single issue. // ListIssueNotes gets a list of all notes for a single issue.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#list-project-issue-notes // https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) { func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -97,7 +92,7 @@ func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssue ...@@ -97,7 +92,7 @@ func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssue
// GetIssueNote returns a single note for a specific project issue. // GetIssueNote returns a single note for a specific project issue.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#get-single-issue-note // https://docs.gitlab.com/ce/api/notes.html#get-single-issue-note
func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -123,7 +118,7 @@ func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options .. ...@@ -123,7 +118,7 @@ func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ..
// options. // options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-issue-note // https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
type CreateIssueNoteOptions struct { type CreateIssueNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
...@@ -131,7 +126,7 @@ type CreateIssueNoteOptions struct { ...@@ -131,7 +126,7 @@ type CreateIssueNoteOptions struct {
// CreateIssueNote creates a new note to a single project issue. // CreateIssueNote creates a new note to a single project issue.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-issue-note // https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -157,14 +152,14 @@ func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIs ...@@ -157,14 +152,14 @@ func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIs
// options. // options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-issue-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
type UpdateIssueNoteOptions struct { type UpdateIssueNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateIssueNote modifies existing note of an issue. // UpdateIssueNote modifies existing note of an issue.
// //
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-issue-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -208,7 +203,7 @@ func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...@@ -208,7 +203,7 @@ func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options
// notes are comments users can post to a snippet. // notes are comments users can post to a snippet.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#list-all-snippet-notes // https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, options ...OptionFunc) ([]*Note, *Response, error) { func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, options ...OptionFunc) ([]*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -233,7 +228,7 @@ func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, options .. ...@@ -233,7 +228,7 @@ func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, options ..
// GetSnippetNote returns a single note for a given snippet. // GetSnippetNote returns a single note for a given snippet.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#get-single-snippet-note // https://docs.gitlab.com/ce/api/notes.html#get-single-snippet-note
func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -259,7 +254,7 @@ func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, option ...@@ -259,7 +254,7 @@ func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, option
// options. // options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-snippet-note // https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
type CreateSnippetNoteOptions struct { type CreateSnippetNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
...@@ -268,7 +263,7 @@ type CreateSnippetNoteOptions struct { ...@@ -268,7 +263,7 @@ type CreateSnippetNoteOptions struct {
// comments users can post to a snippet. // comments users can post to a snippet.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-snippet-note // https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -294,14 +289,14 @@ func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *Crea ...@@ -294,14 +289,14 @@ func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *Crea
// options. // options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-snippet-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
type UpdateSnippetNoteOptions struct { type UpdateSnippetNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateSnippetNote modifies existing note of a snippet. // UpdateSnippetNote modifies existing note of a snippet.
// //
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-snippet-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -344,7 +339,7 @@ func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, opt ...@@ -344,7 +339,7 @@ func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, opt
// ListMergeRequestNotes gets a list of all notes for a single merge request. // ListMergeRequestNotes gets a list of all notes for a single merge request.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#list-all-merge-request-notes // https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, options ...OptionFunc) ([]*Note, *Response, error) { func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, options ...OptionFunc) ([]*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -369,7 +364,7 @@ func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, ...@@ -369,7 +364,7 @@ func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int,
// GetMergeRequestNote returns a single note for a given merge request. // GetMergeRequestNote returns a single note for a given merge request.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#get-single-merge-request-note // https://docs.gitlab.com/ce/api/notes.html#get-single-merge-request-note
func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -395,7 +390,7 @@ func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note i ...@@ -395,7 +390,7 @@ func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note i
// CreateMergeRequestNote() options. // CreateMergeRequestNote() options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-merge-request-note // https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
type CreateMergeRequestNoteOptions struct { type CreateMergeRequestNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
...@@ -403,7 +398,7 @@ type CreateMergeRequestNoteOptions struct { ...@@ -403,7 +398,7 @@ type CreateMergeRequestNoteOptions struct {
// CreateMergeRequestNote creates a new note for a single merge request. // CreateMergeRequestNote creates a new note for a single merge request.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#create-new-merge-request-note // https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
...@@ -429,14 +424,14 @@ func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, ...@@ -429,14 +424,14 @@ func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int,
// UpdateMergeRequestNote() options. // UpdateMergeRequestNote() options.
// //
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-merge-request-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
type UpdateMergeRequestNoteOptions struct { type UpdateMergeRequestNoteOptions struct {
Body *string `url:"body,omitempty" json:"body,omitempty"` Body *string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateMergeRequestNote modifies existing note of a merge request. // UpdateMergeRequestNote modifies existing note of a merge request.
// //
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/notes.md#modify-existing-merge-request-note // https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) { func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment