Skip to content

Commit

Permalink
add v3.0.0 upgrade notes and changelog
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Vieira <[email protected]>
  • Loading branch information
Bruno Vieira committed Sep 15, 2023
1 parent 2478378 commit 73730a7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
30 changes: 30 additions & 0 deletions 4.0-Upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Upgrading to chartmogul-node 3.0.0

This new version replaces the existing pagination for the `.all()` endpoints that used a combination of `page` and `per_page` parameters, and instead uses a `cursor` based pagination. So to list (as an example) Plans you now can:

```javascript
const ChartMogul = require('chartmogul-node');
const config = new ChartMogul.Config('apiKey');

// Getting the first page
plans = ChartMogul.Plan.all(config, { per_page: 10, cursor: 'cursor==' })

// This will return an array of plans (if available), and a cursor + has_more fields
{
"plans": [
{
"uuid": "some_uuid",
"data_source_uuid": "some_uuid",
"name": "Master Plan"
}
],
"has_more": true,
"cursor": "MjAyMy0wNy0yOFQwODowOToyMi4xNTQyMDMwMDBaJjk0NDQ0Mg=="
}

if (plans.has_more) {
more_plans = ChartMogul.Plan.all(config, { per_page: 10, cursor: plans.cursor })
}
```

If you have existing code that relies on the `page` parameter, those requests will throw an error now alerting you of their deprecation.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html

## [3.0.0] - 2023-09-15

### Added
- Support for cursor based pagination to `.all()` endpoints.
- Changelog and 3.0.0 upgrade instructions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 73730a7

Please sign in to comment.