Skip to content

Commit c1548f0

Browse files
klaviyo-sdkklaviyo-sdk
andauthored
version 7.1.0 (#47)
Co-authored-by: klaviyo-sdk <[email protected]>
1 parent 292b6d9 commit c1548f0

6 files changed

Lines changed: 30 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ NOTE: For more granular API-specific changes, please see our [API Changelog](htt
99

1010

1111

12+
## [7.1.0] - revision 2024-02-15
13+
14+
### Added:
15+
16+
- Optional `$user_agent_suffix` param to client instantiation
17+
- example usage:
18+
```
19+
$klaviyo = new KlaviyoAPI(
20+
'YOUR_API_KEY',
21+
$num_retries = 3,
22+
$wait_seconds = 3,
23+
$guzzle_options = [],
24+
$user_agent_suffix = "YOUR_APP_NAME");
25+
```
26+
1227
## [7.0.0] - revision 2024-02-15
1328

1429
### Added:

README.md

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

3-
- SDK version: 7.0.0
3+
- SDK version: 7.1.0
44
- API Revision: 2024-02-15
55

66
## Helpful Resources
@@ -101,7 +101,8 @@ $klaviyo = new KlaviyoAPI(
101101
'YOUR_API_KEY',
102102
$num_retries = 3,
103103
$wait_seconds = 3,
104-
$guzzle_options = []);
104+
$guzzle_options = [],
105+
$user_agent_suffix = "YOUR_APP_NAME");
105106

106107
$response = $klaviyo->Metrics->getMetrics();
107108
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "klaviyo/api",
3-
"version": "7.0.0",
3+
"version": "7.1.0",
44
"description": "PHP SDK for Klaviyo's API.",
55
"keywords": [
66
"openapitools",

lib/API/SegmentsApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ public function getSegmentTagsRequest($id, $fields_tag = null, $apiKey = null)
21722172
*
21732173
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
21742174
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
2175-
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60; (optional)
2175+
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;is_active&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;is_starred&#x60;: &#x60;equals&#x60; (optional)
21762176
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
21772177
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
21782178
*
@@ -2193,7 +2193,7 @@ public function getSegments($fields_segment = null, $fields_tag = null, $filter
21932193
*
21942194
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
21952195
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
2196-
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60; (optional)
2196+
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;is_active&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;is_starred&#x60;: &#x60;equals&#x60; (optional)
21972197
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
21982198
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
21992199
*
@@ -2365,7 +2365,7 @@ public function getSegmentsWithHttpInfo($fields_segment = null, $fields_tag = nu
23652365
*
23662366
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
23672367
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
2368-
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60; (optional)
2368+
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;is_active&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;is_starred&#x60;: &#x60;equals&#x60; (optional)
23692369
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
23702370
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
23712371
*
@@ -2389,7 +2389,7 @@ function ($response) {
23892389
*
23902390
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
23912391
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
2392-
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60; (optional)
2392+
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;is_active&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;is_starred&#x60;: &#x60;equals&#x60; (optional)
23932393
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
23942394
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
23952395
*
@@ -2447,7 +2447,7 @@ function ($exception) {
24472447
*
24482448
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
24492449
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
2450-
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60; (optional)
2450+
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;name&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;id&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;created&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;updated&#x60;: &#x60;greater-than&#x60;&lt;br&gt;&#x60;is_active&#x60;: &#x60;any&#x60;, &#x60;equals&#x60;&lt;br&gt;&#x60;is_starred&#x60;: &#x60;equals&#x60; (optional)
24512451
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
24522452
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
24532453
*

lib/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class Configuration
101101
*
102102
* @var string
103103
*/
104-
protected $userAgent = 'klaviyo-api-php/7.0.0';
104+
protected $userAgent = 'klaviyo-api-php/7.1.0';
105105

106106
/**
107107
* Debug switch (default set to false)
@@ -434,7 +434,7 @@ public static function toDebugReport()
434434
$report .= ' OS: ' . php_uname() . PHP_EOL;
435435
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
436436
$report .= ' The version of the OpenAPI document: 2024-02-15' . PHP_EOL;
437-
$report .= ' SDK Package Version: 7.0.0' . PHP_EOL;
437+
$report .= ' SDK Package Version: 7.1.0' . PHP_EOL;
438438
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
439439

440440
return $report;

lib/KlaviyoAPI.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class KlaviyoAPI {
4848

4949

5050

51-
public function __construct($api_key, $num_retries = 3, $wait_seconds = 3, $guzzle_options = []) {
51+
public function __construct($api_key, $num_retries = 3, $wait_seconds = 3, $guzzle_options = [], $user_agent_suffix = "") {
5252

5353
if (gettype($num_retries) == 'NULL'){
5454
$num_retries = 3;
@@ -65,6 +65,9 @@ public function __construct($api_key, $num_retries = 3, $wait_seconds = 3, $guzz
6565

6666
$this->config = clone Configuration::getDefaultConfiguration();
6767
$this->config->setApiKey('Authorization',"Klaviyo-API-Key $this->api_key");
68+
$user_agent = $this->config->getUserAgent();
69+
$user_agent = $user_agent . $user_agent_suffix;
70+
$this->config->setUserAgent($user_agent);
6871

6972

7073
$this->Accounts = new Subclient(

0 commit comments

Comments
 (0)