Skip to content

Commit ec00e60

Browse files
Merge pull request #17 from klaviyo/v2.1.1
2.1.1 release
2 parents 7387e70 + 8c5559f commit ec00e60

42 files changed

Lines changed: 141 additions & 107 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
## [2.1.0] - revision 2023-01-24
4+
## [2.1.1] - revision 2023-02-22
5+
### Changes
6+
- Multi-store
7+
- ConfigWrappers passed into the api wrappers now works as intended
8+
- PageSize is now added as an optional param to the following endpoints
9+
- Segments
10+
- getSegmentProfiles
11+
- Profiles
12+
- getProfiles
13+
- Lists
14+
- getListProfiles
15+
16+
## [2.1.0] - revision 2023-02-22
517

618
### Added
719
- Campaigns (which were previously in our Beta API/SDKs)

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Klaviyo JavaScript SDK
22

3-
- SDK version: 2.1.0
3+
- SDK version: 2.1.1
44

55
- Revision: 2023-02-22
66

@@ -60,9 +60,9 @@ ConfigWrapper("KLAVIYO PRIVATE KEY GOES HERE")
6060
```
6161
Or if ES6 isn't your thing
6262
```JavaScript
63-
var KaviyoSdk = require('klaviyo-api');
63+
var klaviyoSdk = require('klaviyo-api');
6464

65-
KaviyoSdk.ConfigWrapper("KLAVIYO PRIVATE KEY GOES HERE")
65+
klaviyoSdk.ConfigWrapper("KLAVIYO PRIVATE KEY GOES HERE")
6666
```
6767

6868
To edit the exponential backoff built into the ConfigWrapper you can pass optional parameters
@@ -77,8 +77,9 @@ ConfigWrapper("KLAVIYO PRIVATE KEY GOES HERE", {
7777
})
7878
```
7979

80-
NOTE:
80+
NOTES:
8181
* The SDK retries on resolvable errors, namely: rate limits (common) and server errors on klaviyo (rare).
82+
* The first ConfigWrapper created is the default, if you want to use more than one api key see [multi-store instructions below](https://github.com/klaviyo/klaviyo-api-node#multiple-stores)
8283

8384
### To call the `getProfile` operation:
8485

@@ -104,19 +105,19 @@ try {
104105
response = await Profiles.getProfile(profileId, opts)
105106
console.log(response);
106107
} catch (e) {
107-
console.log(error);
108+
console.log(e);
108109
}
109110
```
110111

111112
once again if you're not using ES6
112113

113114
```Javascript
114-
var KaviyoSdk = require('klaviyo-api');
115+
var KlaviyoSdk = require('klaviyo-api');
115116

116117
var profileId = "PROFILE_ID";
117118
var opts = {};
118119

119-
KaviyoSdk.Profiles.getProfile(profileId, opts)
120+
KlaviyoSdk.Profiles.getProfile(profileId, opts)
120121
.then(data => 'Do Something Here')
121122
.catch(error => 'An error was thrown check the HTTP code with error.status');
122123
```
@@ -142,7 +143,7 @@ try {
142143
const status = response.status
143144
const headers = response.headers
144145
} catch (e) {
145-
console.log(error);
146+
console.log(e);
146147
}
147148
```
148149

@@ -182,7 +183,7 @@ Obtain the cursor value from the call you want to get the next page for, then pa
182183
// page cursor looks like 'WzE2NDA5OTUyMDAsICIzYzRjeXdGTndadyIsIHRydWVd'
183184
// next.link returns the entire url of the next call but the sdk will accept the entire link and use only the relevant cursor
184185

185-
const response = await Profiles.getProfiles();
186+
const response = await Profiles.getProfiles({});
186187
const opts = {pageCursor: response.body.links.next}
187188
const response2 = await Profiles.getProfiles(opts);
188189
```
@@ -256,7 +257,7 @@ const Campaigns.createCampaignClone(body)
256257

257258

258259

259-
#### [Create Campaign Message Assign Template](https://developers.klaviyo.com/en/v2023-02-22/reference/create_campaign_message_assign_template)
260+
#### [Assign Campaign Message Template](https://developers.klaviyo.com/en/v2023-02-22/reference/create_campaign_message_assign_template)
260261

261262
```JavaScript
262263
const Campaigns.createCampaignMessageAssignTemplate(body)
@@ -1585,7 +1586,7 @@ const Templates.updateTemplate(body, id)
15851586

15861587
try {
15871588
await YOUR_CALL
1588-
} catch e {
1589+
} catch (e) {
15891590
print(e.status, e.body, e.headers)
15901591
}
15911592
```

dist/ApiClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var ApiClient = /*#__PURE__*/function () {
5858
*/
5959
this.defaultHeaders = {
6060
revision: "2023-02-22",
61-
"User-Agent": "klaviyo-api-node/2.1.0"
61+
"User-Agent": "klaviyo-api-node/2.1.1"
6262
};
6363

6464
/**

dist/api/CampaignsApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function CampaignsApi(apiClient) {
142142
};
143143
}());
144144
/**
145-
* Create Campaign Message Assign Template
145+
* Assign Campaign Message Template
146146
* Creates a non-reusable version of the template and assigns it to the message.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `Campaigns Write`
147147
* @param {<&vendorExtensions.x-jsdoc-type>} body Takes a reusable template, clones it, and assigns the non-reusable clone to the message.
148148
* @return {Promise} a {@link https://www.promisejs.org/|Promise}

dist/api/CatalogsApi.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function CatalogsApi(apiClient) {
340340
/**
341341
* Delete Catalog Category
342342
* Delete a catalog category using the given category ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
343-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
343+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
344344
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
345345
*/
346346
_defineProperty(this, "deleteCatalogCategory", /*#__PURE__*/function () {
@@ -467,7 +467,7 @@ function CatalogsApi(apiClient) {
467467
/**
468468
* Delete Catalog Item
469469
* Delete a catalog item with the given item ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
470-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
470+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
471471
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
472472
*/
473473
_defineProperty(this, "deleteCatalogItem", /*#__PURE__*/function () {
@@ -594,7 +594,7 @@ function CatalogsApi(apiClient) {
594594
/**
595595
* Delete Catalog Variant
596596
* Delete a catalog item variant with the given variant ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
597-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
597+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
598598
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
599599
*/
600600
_defineProperty(this, "deleteCatalogVariant", /*#__PURE__*/function () {
@@ -708,7 +708,7 @@ function CatalogsApi(apiClient) {
708708
/**
709709
* Get Catalog Category
710710
* Get a catalog category with the given category ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
711-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
711+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
712712
* @param {Object} opts Optional parameters
713713
* @param {Array.<module:model/String>} opts.fieldsCatalogCategory For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
714714
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
@@ -769,7 +769,7 @@ function CatalogsApi(apiClient) {
769769
/**
770770
* Get Catalog Category Items
771771
* Get all items in a category with the given category ID. Items can be sorted by the following fields, in ascending and descending order: &#x60;created&#x60; Include parameters can be provided to get the following related resource data: &#x60;variants&#x60; Returns a maximum of 100 items per request.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
772-
* @param {<&vendorExtensions.x-jsdoc-type>} categoryId The catalog category ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
772+
* @param {<&vendorExtensions.x-jsdoc-type>} categoryId The catalog category ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
773773
* @param {Object} opts Optional parameters
774774
* @param {Array.<module:model/String>} opts.fieldsCatalogItem For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
775775
* @param {Array.<module:model/String>} opts.fieldsCatalogVariant For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
@@ -909,7 +909,7 @@ function CatalogsApi(apiClient) {
909909
/**
910910
* Get Catalog Item
911911
* Get a specific catalog item with the given item ID. Include parameters can be provided to get the following related resource data: &#x60;variants&#x60;&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
912-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
912+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
913913
* @param {Object} opts Optional parameters
914914
* @param {Array.<module:model/String>} opts.fieldsCatalogItem For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
915915
* @param {Array.<module:model/String>} opts.fieldsCatalogVariant For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
@@ -974,7 +974,7 @@ function CatalogsApi(apiClient) {
974974
/**
975975
* Get Catalog Item Categories
976976
* Get all catalog categories that an item with the given item ID is in. Catalog categories can be sorted by the following fields, in ascending and descending order: &#x60;created&#x60; Returns a maximum of 100 categories per request.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
977-
* @param {<&vendorExtensions.x-jsdoc-type>} itemId The catalog item ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
977+
* @param {<&vendorExtensions.x-jsdoc-type>} itemId The catalog item ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
978978
* @param {Object} opts Optional parameters
979979
* @param {Array.<module:model/String>} opts.fieldsCatalogCategory For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
980980
* @param {String} opts.filter For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;ids&#x60;: &#x60;any&#x60;&lt;br&gt;&#x60;item&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;name&#x60;: &#x60;contains&#x60;
@@ -1110,7 +1110,7 @@ function CatalogsApi(apiClient) {
11101110
/**
11111111
* Get Catalog Item Variants
11121112
* Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: &#x60;created&#x60; Returns a maximum of 100 variants per request.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
1113-
* @param {<&vendorExtensions.x-jsdoc-type>} itemId The catalog item ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
1113+
* @param {<&vendorExtensions.x-jsdoc-type>} itemId The catalog item ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
11141114
* @param {Object} opts Optional parameters
11151115
* @param {Array.<module:model/String>} opts.fieldsCatalogVariant For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
11161116
* @param {String} opts.filter For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;ids&#x60;: &#x60;any&#x60;&lt;br&gt;&#x60;item&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;sku&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;title&#x60;: &#x60;contains&#x60;&lt;br&gt;&#x60;published&#x60;: &#x60;equals&#x60;
@@ -1239,7 +1239,7 @@ function CatalogsApi(apiClient) {
12391239
/**
12401240
* Get Catalog Variant
12411241
* Get a catalog item variant with the given variant ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;Catalogs Read&#x60;
1242-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
1242+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
12431243
* @param {Object} opts Optional parameters
12441244
* @param {Array.<module:model/String>} opts.fieldsCatalogVariant For more information please visit https://developers.klaviyo.com/en/v2023-02-22/reference/api-overview#sparse-fieldsets
12451245
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
@@ -2922,7 +2922,7 @@ function CatalogsApi(apiClient) {
29222922
* Update Catalog Category
29232923
* Update a catalog category with the given category ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
29242924
* @param {<&vendorExtensions.x-jsdoc-type>} body
2925-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
2925+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog category ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
29262926
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
29272927
*/
29282928
_defineProperty(this, "updateCatalogCategory", /*#__PURE__*/function () {
@@ -3056,7 +3056,7 @@ function CatalogsApi(apiClient) {
30563056
* Update Catalog Item
30573057
* Update a catalog item with the given item ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
30583058
* @param {<&vendorExtensions.x-jsdoc-type>} body
3059-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
3059+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog item ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
30603060
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
30613061
*/
30623062
_defineProperty(this, "updateCatalogItem", /*#__PURE__*/function () {
@@ -3190,7 +3190,7 @@ function CatalogsApi(apiClient) {
31903190
* Update Catalog Variant
31913191
* Update a catalog item variant with the given variant ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;75/s&#x60;&lt;br&gt;Steady: &#x60;700/m&#x60; **Scopes:** &#x60;Catalogs Write&#x60;
31923192
* @param {<&vendorExtensions.x-jsdoc-type>} body
3193-
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;${integration}:::${catalog}:::${external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
3193+
* @param {<&vendorExtensions.x-jsdoc-type>} id The catalog variant ID is a compound ID (string), with format: &#x60;{integration}:::{catalog}:::{external_id}&#x60;. Currently, the only supported integration type is &#x60;$custom&#x60;, and the only supported catalog is &#x60;$default&#x60;.
31943194
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
31953195
*/
31963196
_defineProperty(this, "updateCatalogVariant", /*#__PURE__*/function () {

dist/api/FlowsApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ function FlowsApi(apiClient) {
814814
* Update Flow Status
815815
* Update the status of a flow with the given flow ID, and all actions in that flow.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60; **Scopes:** &#x60;Flows Write&#x60;
816816
* @param {<&vendorExtensions.x-jsdoc-type>} body
817-
* @param {<&vendorExtensions.x-jsdoc-type>} id
817+
* @param {<&vendorExtensions.x-jsdoc-type>} id ID of the Flow to update. Ex: XVTP5Q
818818
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
819819
*/
820820
_defineProperty(this, "updateFlow", /*#__PURE__*/function () {

0 commit comments

Comments
 (0)