You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+81-58Lines changed: 81 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,85 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
NOTE: For more granular API-specific changes, please see our [API Changelog](https://developers.klaviyo.com/en/docs/changelog_)
9
9
10
+
## [11.0.0] Typed SDK - revision 2024-07-15
11
+
12
+
### Added
13
+
- Typed Responses (Breaking change)
14
+
- By default, all API methods will return a type representing the response payload instead of dictionary, as was the case in previous versions of this SDK. Using the typed response, you can access fields of a response using dot notation, like so:
15
+
```python
16
+
from klaviyo_api import KlaviyoAPI
17
+
18
+
client = KlaviyoAPI(
19
+
api_key,
20
+
max_delay=0,
21
+
max_retries=0
22
+
)
23
+
24
+
profiles = client.Profiles.get_profiles()
25
+
profile_id = profiles.data[0].id
26
+
profile = client.Profiles.get_profile(profile_id)
27
+
profile_id = profile.data.id
28
+
profile_email = profile.data.attributes.email
29
+
30
+
print(type(profile).__name__) # prints GetProfileResponseCompoundDocument
31
+
```
32
+
The class used in this example is found [here](src/openapi_client/models/get_profile_response_collection_compound_document.py).
33
+
34
+
This is a breaking change, as response objects will now require dot notation to access their fields versus the subscriptable access method used for dictionaries, i.e. `profile.data.id` vs `profile['data']['id']`. We have provided a [backwards compatibility strategy](#backwards-compatibility) to smooth the transition from dictionary responses to typed responses.
35
+
36
+
#### Backwards Compatibility
37
+
To maintain backwards compatibility with previous versions of this SDK, we have added an `options` argument that allows you to continue using dictionaries as response values. There are two ways to use this `options` argument:
38
+
```python
39
+
from klaviyo_api import KlaviyoAPI
40
+
from openapi_client.api_arg_options importUSE_DICTIONARY_FOR_RESPONSE_DATA
The first way will only return a dictionary for that specific `get_profiles` call. The second makes it so that allAPI methods called using `dictionary_client` will return dictionaries as responses.
70
+
71
+
- Some API methods still return response data that isnot fully typed. See the [Untyped Response Data for Specific APIs](README.md#untyped-response-data-for-specific-apis) in the README for more details.
72
+
- Filter Builder - A new class to help construct filter query parameters.
@@ -20,63 +99,7 @@ NOTE: For more granular API-specific changes, please see our [API Changelog](htt
20
99
-`klaviyo.Profiles.subscribe()`
21
100
- added `historical_import` flag for importing historically consented profiles can now be optionally supplied in the payload for the Subscribe Profiles endpoint.
22
101
- When using this flag, a consented_at date must be provided and must be in the past.
23
-
24
-
## [9.0.0] - revision 2024-06-15
25
-
26
-
### Added
27
-
- Segments Api
28
-
- New create segment endpoint `SegmentsApi.createSegment()`.
29
-
- New delete segment endpoint `SegementsApi.deleteSegment()`.
30
-
- Updated exisiting segments endpoints to include the segment definition
31
-
- For more information, see our [Segments API overview](https://developers.klaviyo.com/en/reference/segments_api_overview).
32
-
33
-
- Flows Api
34
-
- New delete flows endpoint `FlowsApi.deleteFlow()`
35
-
36
-
## [8.0.1] - revision 2024-05-15
37
-
38
-
### Added
39
-
40
-
- Fixes issue where `filter` query params for any API call were being duplicated on request send. See issue: https://github.com/klaviyo/klaviyo-api-python/issues/51
41
-
42
-
## [8.0.0] - revision 2024-05-15
43
-
44
-
### Added
45
-
46
-
- Bulk Create Events API with
47
-
- We have added support for creating events in bulk via the EventsApi.bulkCreateEvents method
48
-
- Create multiple events for new and existing profiles and/or update profile properties in a single API call. For more information, see our [Events API overview](https://developers.klaviyo.com/en/reference/events_api_overview).
49
-
50
-
### Changed
51
-
52
-
- Accounts API
53
-
- `Accounts.get_account` and `Accounts.get_accounts` have been updated to return the account's locale, e.g. `"en-US"`.
54
-
55
-
-**Breaking**
56
-
- Subscribe API Synchronous Validation Improved
57
-
- To provide better feedback for handling SMS subscriptions, we’ve added improved validation behavior to ProfilesApi.subscribeProfiles method. In prior revisions, such requests may appear as 202s but will fail to update SMS consent. To handle this issue, 400 validation errors are returned for the following cases
58
-
1. If a profile is subscribed to SMS marketing and [age-gating is enabled](https://help.klaviyo.com/hc/en-us/articles/4408311712667) but age_gated_date_of_birth is not provided, or the DOB does not meet the region's requirements.
59
-
2. If the account does not have a sending number in the phone number’s region.
60
-
3. If the phone number is in a region not supported by Klaviyo.
61
-
4. If consented_at is set and the list or global setting is double opt-in.
62
-
- Pydantic V2
63
-
- This SDK now uses Pydantic V2. This may cause some compatibility issues if your source code depends on Pydantic V1.
64
-
- Renamed Fields in SDK
65
-
- As of the 2024-05-15 release, some models fields are named differently than they appear in API documentation. These fields are
66
-
- `datetime`: renamed to `datetime_`
67
-
- `date`: renamed to `date_`
68
-
69
-
This is to manage compatibility with Pydantic v2. An example of this can be seen in [StaticScheduleOptions](src/openapi_client/models/static_schedule_options.py).
70
-
71
-
```python
72
-
class StaticScheduleOptions(BaseModel):
73
-
"""
74
-
StaticScheduleOptions
75
-
""" # noqa: E501
76
-
datetime_: datetime = Field(description="The time to send at", alias="datetime")
By default, allAPI methods will return a type representing the response payload instead of dictionary, as was the case in previous versions of this SDK. Using the typed response, you can access fields of a response using dot notation, like so:
3947
+
```python
3948
+
from klaviyo_api import KlaviyoAPI
3949
+
3950
+
client= KlaviyoAPI(
3951
+
api_key,
3952
+
max_delay=0,
3953
+
max_retries=0
3954
+
)
3955
+
3956
+
profiles= client.Profiles.get_profiles()
3957
+
profile_id= profiles.data[0].id
3958
+
profile= client.Profiles.get_profile(profile_id)
3959
+
profile_id= profile.data.id
3960
+
profile_email= profile.data.attributes.email
3961
+
3962
+
print(type(profile).__name__) # prints GetProfileResponseCompoundDocument
3963
+
```
3964
+
The class used in this example is found [here](src/openapi_client/models/get_profile_response_collection_compound_document.py).
3965
+
3966
+
This is a breaking change, as response objects will now require dot notation to access their fields versus the subscriptable access method used for dictionaries, i.e. `profile.data.id` vs `profile['data']['id']`. We have provided a [backwards compatibility strategy](#backwards-compatibility) to smooth the transition from dictionary responses to typed responses.
3967
+
3968
+
### Backwards Compatibility
3969
+
To maintain backwards compatibility with previous versions of this SDK, we have added an `options` argument that allows you to continue using dictionaries as response values. There are two ways to use this `options` argument:
3970
+
```python
3971
+
from klaviyo_api import KlaviyoAPI
3972
+
from openapi_client.api_arg_options importUSE_DICTIONARY_FOR_RESPONSE_DATA
The first way will only return a dictionary for that specific `get_profiles` call. The second makes it so that allAPI methods called using `dictionary_client` will return dictionaries as responses.
4001
+
4002
+
## Untyped Response Data for Specific APIs
4003
+
Select APIs do not yet have fully typed responses. Please use our API docs to inspect the schema of the response data for the following APIs.
4004
+
-**Segments**- The subproperty `conditions`isnot yet typed in responses for the following APIs:
0 commit comments