Skip to content

Commit

Permalink
version 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
klaviyo-sdk committed Feb 26, 2024
1 parent 292b6d9 commit ca855b1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ NOTE: For more granular API-specific changes, please see our [API Changelog](htt



## [7.1.0] - revision 2024-02-15

### Added:

- Optional `$user_agent_suffix` param to client instantiation
- example usage:
```
$klaviyo = new KlaviyoAPI(
'YOUR_API_KEY',
$num_retries = 3,
$wait_seconds = 3,
$guzzle_options = [],
$user_agent_suffix = "YOUR_APP_NAME");
```

## [7.0.0] - revision 2024-02-15

### Added:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Klaviyo PHP SDK

- SDK version: 7.0.0
- SDK version: 7.1.0
- API Revision: 2024-02-15

## Helpful Resources
Expand Down Expand Up @@ -101,7 +101,8 @@ $klaviyo = new KlaviyoAPI(
'YOUR_API_KEY',
$num_retries = 3,
$wait_seconds = 3,
$guzzle_options = []);
$guzzle_options = [],
$user_agent_suffix = "YOUR_APP_NAME");

$response = $klaviyo->Metrics->getMetrics();
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "klaviyo/api",
"version": "7.0.0",
"version": "7.1.0",
"description": "PHP SDK for Klaviyo's API.",
"keywords": [
"openapitools",
Expand Down
10 changes: 5 additions & 5 deletions lib/API/SegmentsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ public function getSegmentTagsRequest($id, $fields_tag = null, $apiKey = null)
*
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` (optional)
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
*
Expand All @@ -2193,7 +2193,7 @@ public function getSegments($fields_segment = null, $fields_tag = null, $filter
*
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` (optional)
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
*
Expand Down Expand Up @@ -2365,7 +2365,7 @@ public function getSegmentsWithHttpInfo($fields_segment = null, $fields_tag = nu
*
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` (optional)
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
*
Expand All @@ -2389,7 +2389,7 @@ function ($response) {
*
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` (optional)
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
*
Expand Down Expand Up @@ -2447,7 +2447,7 @@ function ($exception) {
*
* @param string[] $fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string[] $fields_tag For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than` (optional)
* @param string $filter For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` (optional)
* @param string[] $include For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships (optional)
* @param string $page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination (optional)
*
Expand Down
4 changes: 2 additions & 2 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Configuration
*
* @var string
*/
protected $userAgent = 'klaviyo-api-php/7.0.0';
protected $userAgent = 'klaviyo-api-php/7.1.0';

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

return $report;
Expand Down
5 changes: 4 additions & 1 deletion lib/KlaviyoAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class KlaviyoAPI {



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

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

$this->config = clone Configuration::getDefaultConfiguration();
$this->config->setApiKey('Authorization',"Klaviyo-API-Key $this->api_key");
$user_agent = $this->config->getUserAgent();
$user_agent = $user_agent . $user_agent_suffix;
$this->config->setUserAgent($user_agent);


$this->Accounts = new Subclient(
Expand Down

0 comments on commit ca855b1

Please sign in to comment.