Skip to content

Commit

Permalink
fix(creative): add cursor/count in GetRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Dec 12, 2022
1 parent 7477f3d commit b09ce60
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions marketing-api/model/creative/get_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ type GetRequest struct {
Page int `json:"page,omitempty"`
// PageSize 页面大小默认值: 10,大小上限1000
PageSize int `json:"page_size,omitempty"`
// Cursor 页码游标值,第一次拉取,传入0
// 同时传入时,cursor优先级大于page
// 注:page+page_size与cursor+count为两种分页方式
// cursor+count适用于获取数据记录数≥10000的场景
Cursor int `json:"cursor,omitempt"`
// Count 页面数据量
// 注:page+page_size与cursor+count为两种分页方式
// cursor+count适用于获取数据记录数≥10000的场景
Count int `json:"count,omitempty"`
}

// Encode implement GetRequest interface
Expand All @@ -41,6 +50,10 @@ func (r GetRequest) Encode() string {
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
if r.Cursor > 0 || r.Count > 0 {
values.Set("cursor", strconv.Itoa(r.Cursor))
values.Set("count", strconv.Itoa(r.Count))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
Expand Down

0 comments on commit b09ce60

Please sign in to comment.