-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from vallerion/sync-sdk
Update SDK to actual API Reference
- Loading branch information
Showing
74 changed files
with
1,877 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package messagebird | ||
|
||
import ( | ||
"net/url" | ||
"strconv" | ||
) | ||
|
||
// PaginationRequest can be used to set pagination options in List(). | ||
type PaginationRequest struct { | ||
Limit, Offset int | ||
} | ||
|
||
func (cpr *PaginationRequest) QueryParams() string { | ||
if cpr == nil { | ||
return "" | ||
} | ||
|
||
query := url.Values{} | ||
if cpr.Limit > 0 { | ||
query.Set("limit", strconv.Itoa(cpr.Limit)) | ||
} | ||
if cpr.Offset >= 0 { | ||
query.Set("offset", strconv.Itoa(cpr.Offset)) | ||
} | ||
|
||
return query.Encode() | ||
} | ||
|
||
// DefaultPagination provides reasonable values for List requests. | ||
var DefaultPagination = &PaginationRequest{ | ||
Limit: 20, | ||
Offset: 0, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.