Skip to content

Commit 68227fd

Browse files
feat(api): api update
1 parent f2d1c34 commit 68227fd

File tree

12 files changed

+395
-5
lines changed

12 files changed

+395
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 89
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-dc58bf2d74b40fe371b76b90e76ab4d389a6cd9d2afe336d2e28ef3ed4eb7226.yml
3-
openapi_spec_hash: e8aa884b9308beae7e9b5b3ec0cb2e04
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-40ca41599f579fdd44c2e3e32a7d1bba51ba567050c0dcd5bc099ce8d48bba97.yml
3+
openapi_spec_hash: 72e32d434bbd7ccf7296a2eed7c642ef
44
config_hash: 658c551418df454aa40794f8ac679c18

src/knockapi/resources/objects/objects.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ def set_preferences(
837837
_persistence_strategy: Literal["merge", "replace"] | Omit = omit,
838838
categories: Optional[Dict[str, object_set_preferences_params.Categories]] | Omit = omit,
839839
channel_types: Optional[PreferenceSetChannelTypesParam] | Omit = omit,
840+
channels: Optional[Dict[str, object_set_preferences_params.Channels]] | Omit = omit,
840841
commercial_subscribed: Optional[bool] | Omit = omit,
841842
workflows: Optional[Dict[str, object_set_preferences_params.Workflows]] | Omit = omit,
842843
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -867,6 +868,8 @@ def set_preferences(
867868
868869
channel_types: Channel type preferences.
869870
871+
channels: Channel preferences.
872+
870873
commercial_subscribed: Whether the recipient is subscribed to commercial communications. When false,
871874
the recipient will not receive commercial workflow notifications.
872875
@@ -896,6 +899,7 @@ def set_preferences(
896899
"_persistence_strategy": _persistence_strategy,
897900
"categories": categories,
898901
"channel_types": channel_types,
902+
"channels": channels,
899903
"commercial_subscribed": commercial_subscribed,
900904
"workflows": workflows,
901905
},
@@ -1740,6 +1744,7 @@ async def set_preferences(
17401744
_persistence_strategy: Literal["merge", "replace"] | Omit = omit,
17411745
categories: Optional[Dict[str, object_set_preferences_params.Categories]] | Omit = omit,
17421746
channel_types: Optional[PreferenceSetChannelTypesParam] | Omit = omit,
1747+
channels: Optional[Dict[str, object_set_preferences_params.Channels]] | Omit = omit,
17431748
commercial_subscribed: Optional[bool] | Omit = omit,
17441749
workflows: Optional[Dict[str, object_set_preferences_params.Workflows]] | Omit = omit,
17451750
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1770,6 +1775,8 @@ async def set_preferences(
17701775
17711776
channel_types: Channel type preferences.
17721777
1778+
channels: Channel preferences.
1779+
17731780
commercial_subscribed: Whether the recipient is subscribed to commercial communications. When false,
17741781
the recipient will not receive commercial workflow notifications.
17751782
@@ -1799,6 +1806,7 @@ async def set_preferences(
17991806
"_persistence_strategy": _persistence_strategy,
18001807
"categories": categories,
18011808
"channel_types": channel_types,
1809+
"channels": channels,
18021810
"commercial_subscribed": commercial_subscribed,
18031811
"workflows": workflows,
18041812
},

src/knockapi/resources/users/users.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ def set_preferences(
771771
_persistence_strategy: Literal["merge", "replace"] | Omit = omit,
772772
categories: Optional[Dict[str, user_set_preferences_params.Categories]] | Omit = omit,
773773
channel_types: Optional[PreferenceSetChannelTypesParam] | Omit = omit,
774+
channels: Optional[Dict[str, user_set_preferences_params.Channels]] | Omit = omit,
774775
commercial_subscribed: Optional[bool] | Omit = omit,
775776
workflows: Optional[Dict[str, user_set_preferences_params.Workflows]] | Omit = omit,
776777
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -797,6 +798,8 @@ def set_preferences(
797798
798799
channel_types: Channel type preferences.
799800
801+
channels: Channel preferences.
802+
800803
commercial_subscribed: Whether the recipient is subscribed to commercial communications. When false,
801804
the recipient will not receive commercial workflow notifications.
802805
@@ -824,6 +827,7 @@ def set_preferences(
824827
"_persistence_strategy": _persistence_strategy,
825828
"categories": categories,
826829
"channel_types": channel_types,
830+
"channels": channels,
827831
"commercial_subscribed": commercial_subscribed,
828832
"workflows": workflows,
829833
},
@@ -1587,6 +1591,7 @@ async def set_preferences(
15871591
_persistence_strategy: Literal["merge", "replace"] | Omit = omit,
15881592
categories: Optional[Dict[str, user_set_preferences_params.Categories]] | Omit = omit,
15891593
channel_types: Optional[PreferenceSetChannelTypesParam] | Omit = omit,
1594+
channels: Optional[Dict[str, user_set_preferences_params.Channels]] | Omit = omit,
15901595
commercial_subscribed: Optional[bool] | Omit = omit,
15911596
workflows: Optional[Dict[str, user_set_preferences_params.Workflows]] | Omit = omit,
15921597
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1613,6 +1618,8 @@ async def set_preferences(
16131618
16141619
channel_types: Channel type preferences.
16151620
1621+
channels: Channel preferences.
1622+
16161623
commercial_subscribed: Whether the recipient is subscribed to commercial communications. When false,
16171624
the recipient will not receive commercial workflow notifications.
16181625
@@ -1640,6 +1647,7 @@ async def set_preferences(
16401647
"_persistence_strategy": _persistence_strategy,
16411648
"categories": categories,
16421649
"channel_types": channel_types,
1650+
"channels": channels,
16431651
"commercial_subscribed": commercial_subscribed,
16441652
"workflows": workflows,
16451653
},

src/knockapi/types/object_set_preferences_params.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Union, Iterable, Optional
6-
from typing_extensions import Literal, Annotated, TypeAlias, TypedDict
6+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

88
from .._utils import PropertyInfo
99
from .shared_params.condition import Condition
@@ -13,8 +13,14 @@
1313
"ObjectSetPreferencesParams",
1414
"Categories",
1515
"CategoriesPreferenceSetWorkflowCategorySettingObject",
16+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannels",
17+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
18+
"Channels",
19+
"ChannelsPreferenceSetChannelSetting",
1620
"Workflows",
1721
"WorkflowsPreferenceSetWorkflowCategorySettingObject",
22+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels",
23+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
1824
]
1925

2026

@@ -35,6 +41,9 @@ class ObjectSetPreferencesParams(TypedDict, total=False):
3541
channel_types: Optional[PreferenceSetChannelTypesParam]
3642
"""Channel type preferences."""
3743

44+
channels: Optional[Dict[str, Channels]]
45+
"""Channel preferences."""
46+
3847
commercial_subscribed: Optional[bool]
3948
"""Whether the recipient is subscribed to commercial communications.
4049
@@ -48,21 +57,55 @@ class ObjectSetPreferencesParams(TypedDict, total=False):
4857
"""
4958

5059

60+
class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False):
61+
conditions: Required[Iterable[Condition]]
62+
"""A list of conditions to apply to a specific channel."""
63+
64+
65+
CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
66+
bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
67+
]
68+
69+
5170
class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False):
5271
channel_types: Optional[PreferenceSetChannelTypesParam]
5372
"""Channel type preferences."""
5473

74+
channels: Optional[Dict[str, CategoriesPreferenceSetWorkflowCategorySettingObjectChannels]]
75+
"""Channel preferences."""
76+
5577
conditions: Optional[Iterable[Condition]]
5678
"""A list of conditions to apply to a channel type."""
5779

5880

5981
Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject]
6082

6183

84+
class ChannelsPreferenceSetChannelSetting(TypedDict, total=False):
85+
conditions: Required[Iterable[Condition]]
86+
"""A list of conditions to apply to a specific channel."""
87+
88+
89+
Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting]
90+
91+
92+
class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False):
93+
conditions: Required[Iterable[Condition]]
94+
"""A list of conditions to apply to a specific channel."""
95+
96+
97+
WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
98+
bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
99+
]
100+
101+
62102
class WorkflowsPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False):
63103
channel_types: Optional[PreferenceSetChannelTypesParam]
64104
"""Channel type preferences."""
65105

106+
channels: Optional[Dict[str, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels]]
107+
"""Channel preferences."""
108+
66109
conditions: Optional[Iterable[Condition]]
67110
"""A list of conditions to apply to a channel type."""
68111

src/knockapi/types/recipients/preference_set.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,66 @@
1111
"PreferenceSet",
1212
"Categories",
1313
"CategoriesPreferenceSetWorkflowCategorySettingObject",
14+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannels",
15+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
16+
"Channels",
17+
"ChannelsPreferenceSetChannelSetting",
1418
"Workflows",
1519
"WorkflowsPreferenceSetWorkflowCategorySettingObject",
20+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels",
21+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
22+
]
23+
24+
25+
class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(BaseModel):
26+
conditions: List[Condition]
27+
"""A list of conditions to apply to a specific channel."""
28+
29+
30+
CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
31+
bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
1632
]
1733

1834

1935
class CategoriesPreferenceSetWorkflowCategorySettingObject(BaseModel):
2036
channel_types: Optional[PreferenceSetChannelTypes] = None
2137
"""Channel type preferences."""
2238

39+
channels: Optional[Dict[str, CategoriesPreferenceSetWorkflowCategorySettingObjectChannels]] = None
40+
"""Channel preferences."""
41+
2342
conditions: Optional[List[Condition]] = None
2443
"""A list of conditions to apply to a channel type."""
2544

2645

2746
Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject]
2847

2948

49+
class ChannelsPreferenceSetChannelSetting(BaseModel):
50+
conditions: List[Condition]
51+
"""A list of conditions to apply to a specific channel."""
52+
53+
54+
Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting]
55+
56+
57+
class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(BaseModel):
58+
conditions: List[Condition]
59+
"""A list of conditions to apply to a specific channel."""
60+
61+
62+
WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
63+
bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
64+
]
65+
66+
3067
class WorkflowsPreferenceSetWorkflowCategorySettingObject(BaseModel):
3168
channel_types: Optional[PreferenceSetChannelTypes] = None
3269
"""Channel type preferences."""
3370

71+
channels: Optional[Dict[str, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels]] = None
72+
"""Channel preferences."""
73+
3474
conditions: Optional[List[Condition]] = None
3575
"""A list of conditions to apply to a channel type."""
3676

@@ -51,6 +91,15 @@ class PreferenceSet(BaseModel):
5191
channel_types: Optional[PreferenceSetChannelTypes] = None
5292
"""Channel type preferences."""
5393

94+
channels: Optional[Dict[str, Channels]] = None
95+
"""Channel preferences."""
96+
97+
commercial_subscribed: Optional[bool] = None
98+
"""Whether the recipient is subscribed to commercial communications.
99+
100+
When false, the recipient will not receive commercial workflow notifications.
101+
"""
102+
54103
workflows: Optional[Dict[str, Workflows]] = None
55104
"""
56105
An object where the key is the workflow key and the values are the preference

src/knockapi/types/recipients/preference_set_request_param.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Union, Iterable, Optional
6-
from typing_extensions import Literal, Annotated, TypeAlias, TypedDict
6+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

88
from ..._utils import PropertyInfo
99
from ..shared_params.condition import Condition
@@ -13,26 +13,66 @@
1313
"PreferenceSetRequestParam",
1414
"Categories",
1515
"CategoriesPreferenceSetWorkflowCategorySettingObject",
16+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannels",
17+
"CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
18+
"Channels",
19+
"ChannelsPreferenceSetChannelSetting",
1620
"Workflows",
1721
"WorkflowsPreferenceSetWorkflowCategorySettingObject",
22+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels",
23+
"WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting",
24+
]
25+
26+
27+
class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False):
28+
conditions: Required[Iterable[Condition]]
29+
"""A list of conditions to apply to a specific channel."""
30+
31+
32+
CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
33+
bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
1834
]
1935

2036

2137
class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False):
2238
channel_types: Optional[PreferenceSetChannelTypesParam]
2339
"""Channel type preferences."""
2440

41+
channels: Optional[Dict[str, CategoriesPreferenceSetWorkflowCategorySettingObjectChannels]]
42+
"""Channel preferences."""
43+
2544
conditions: Optional[Iterable[Condition]]
2645
"""A list of conditions to apply to a channel type."""
2746

2847

2948
Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject]
3049

3150

51+
class ChannelsPreferenceSetChannelSetting(TypedDict, total=False):
52+
conditions: Required[Iterable[Condition]]
53+
"""A list of conditions to apply to a specific channel."""
54+
55+
56+
Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting]
57+
58+
59+
class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False):
60+
conditions: Required[Iterable[Condition]]
61+
"""A list of conditions to apply to a specific channel."""
62+
63+
64+
WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[
65+
bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting
66+
]
67+
68+
3269
class WorkflowsPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False):
3370
channel_types: Optional[PreferenceSetChannelTypesParam]
3471
"""Channel type preferences."""
3572

73+
channels: Optional[Dict[str, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels]]
74+
"""Channel preferences."""
75+
3676
conditions: Optional[Iterable[Condition]]
3777
"""A list of conditions to apply to a channel type."""
3878

@@ -57,6 +97,9 @@ class PreferenceSetRequestParam(TypedDict, total=False):
5797
channel_types: Optional[PreferenceSetChannelTypesParam]
5898
"""Channel type preferences."""
5999

100+
channels: Optional[Dict[str, Channels]]
101+
"""Channel preferences."""
102+
60103
commercial_subscribed: Optional[bool]
61104
"""Whether the recipient is subscribed to commercial communications.
62105

0 commit comments

Comments
 (0)