From 190db0955bd6a804521712a7c35f84a78500e908 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 16 Mar 2023 16:56:07 -0400 Subject: [PATCH 1/2] Support paging in GetCollectionPosts NOTE: this breaks the current API! --- collection.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/collection.go b/collection.go index da44638..3760ccd 100644 --- a/collection.go +++ b/collection.go @@ -91,9 +91,13 @@ func (c *Client) GetCollection(alias string) (*Collection, error) { // GetCollectionPosts retrieves a collection's posts, returning the Posts // and any error (in user-friendly form) that occurs. See // https://developers.write.as/docs/api/#retrieve-collection-posts -func (c *Client) GetCollectionPosts(alias string) (*[]Post, error) { +func (c *Client) GetCollectionPosts(alias string, page int) (*[]Post, error) { coll := &Collection{} - env, err := c.get(fmt.Sprintf("/collections/%s/posts", alias), coll) + q := "" + if page > 0 { + q = fmt.Sprintf("?page=%d", page) + } + env, err := c.get(fmt.Sprintf("/collections/%s/posts%s", alias, q), coll) if err != nil { return nil, err } From 71bc8c5d99b65ca43a4d4d617e5723b9ba9eb9d9 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 16 Mar 2023 16:59:29 -0400 Subject: [PATCH 2/2] Update module to v3 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index b88b28a..cc252d4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/writeas/go-writeas/v2 +module github.com/writeas/go-writeas/v3 go 1.9