Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions content.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,22 @@ func (a *API) GetChildPages(id string) (*Search, error) {
}

// GetComments returns a list of comments belonging to id
func (a *API) GetComments(id string) (*Search, error) {
func (a *API) GetComments(id string, query ContentQuery) (*Search, error) {
ep, err := a.getContentChildEndpoint(id, "comment")
if err != nil {
return nil, err
}
ep.RawQuery = addContentQueryParams(query).Encode()
return a.SendSearchRequest(ep, "GET")
}

// GetAttachments returns a list of attachments belonging to id
func (a *API) GetAttachments(id string) (*Search, error) {
func (a *API) GetAttachments(id string, query ContentQuery) (*Search, error) {
ep, err := a.getContentChildEndpoint(id, "attachment")
if err != nil {
return nil, err
}
ep.RawQuery = addContentQueryParams(query).Encode()
return a.SendSearchRequest(ep, "GET")
}

Expand Down
4 changes: 2 additions & 2 deletions content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func TestContentGetter(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, &Search{}, p)

p, err = api.GetComments("42")
p, err = api.GetComments("42", ContentQuery{})
assert.Nil(t, err)
assert.Equal(t, &Search{}, p)

p, err = api.GetAttachments("42")
p, err = api.GetAttachments("42", ContentQuery{})
assert.Nil(t, err)
assert.Equal(t, &Search{}, p)

Expand Down
4 changes: 2 additions & 2 deletions examples/attributes/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {
}

// get comments of a specific page
res, err := api.GetComments("1234567")
res, err := api.GetComments("1234567", goconfluence.ContentQuery{})
if err != nil {
log.Fatal(err)
}
Expand All @@ -24,7 +24,7 @@ func main() {
}

// get attachments of a specific page
res, err = api.GetAttachments("1234567")
res, err = api.GetAttachments("1234567", goconfluence.ContentQuery{})
if err != nil {
log.Fatal(err)
}
Expand Down