소스 검색

Support paging in GetCollectionPosts

NOTE: this breaks the current API!
v3
Matt Baer 1 년 전
부모
커밋
190db0955b
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. +6
    -2
      collection.go

+ 6
- 2
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
}


불러오는 중...
취소
저장