dub 0.27.1__py3-none-any.whl → 0.27.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dub/_version.py +3 -3
- dub/models/components/__init__.py +38 -0
- dub/models/components/analyticstriggers.py +2 -0
- dub/models/components/commissioncreatedevent.py +281 -0
- dub/models/components/partnerenrolledevent.py +201 -74
- dub/models/components/saleevent.py +1 -0
- dub/models/components/webhookevent.py +6 -0
- dub/models/operations/__init__.py +68 -0
- dub/models/operations/createpartner.py +201 -74
- dub/models/operations/listcommissions.py +169 -8
- dub/models/operations/listevents.py +19 -0
- dub/models/operations/listpartners.py +516 -0
- dub/models/operations/retrieveanalytics.py +19 -0
- dub/models/operations/tracksale.py +1 -0
- dub/models/operations/updatecommission.py +169 -8
- dub/partners.py +262 -0
- {dub-0.27.1.dist-info → dub-0.27.2.dist-info}/METADATA +2 -1
- {dub-0.27.1.dist-info → dub-0.27.2.dist-info}/RECORD +20 -18
- {dub-0.27.1.dist-info → dub-0.27.2.dist-info}/LICENSE +0 -0
- {dub-0.27.1.dist-info → dub-0.27.2.dist-info}/WHEEL +0 -0
dub/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "dub"
|
|
6
|
-
__version__: str = "0.27.
|
|
6
|
+
__version__: str = "0.27.2"
|
|
7
7
|
__openapi_doc_version__: str = "0.0.1"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.27.
|
|
8
|
+
__gen_version__: str = "2.662.0"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.27.2 2.662.0 0.0.1 dub"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -51,6 +51,19 @@ if TYPE_CHECKING:
|
|
|
51
51
|
Link,
|
|
52
52
|
LinkTypedDict,
|
|
53
53
|
)
|
|
54
|
+
from .commissioncreatedevent import (
|
|
55
|
+
CommissionCreatedEvent,
|
|
56
|
+
CommissionCreatedEventCustomer,
|
|
57
|
+
CommissionCreatedEventCustomerTypedDict,
|
|
58
|
+
CommissionCreatedEventData,
|
|
59
|
+
CommissionCreatedEventDataTypedDict,
|
|
60
|
+
CommissionCreatedEventEvent,
|
|
61
|
+
CommissionCreatedEventStatus,
|
|
62
|
+
CommissionCreatedEventType,
|
|
63
|
+
CommissionCreatedEventTypedDict,
|
|
64
|
+
Partner,
|
|
65
|
+
PartnerTypedDict,
|
|
66
|
+
)
|
|
54
67
|
from .continentcode import ContinentCode
|
|
55
68
|
from .countrycode import CountryCode
|
|
56
69
|
from .domainschema import (
|
|
@@ -145,6 +158,7 @@ if TYPE_CHECKING:
|
|
|
145
158
|
PartnerAnalyticsTopLinksTypedDict,
|
|
146
159
|
)
|
|
147
160
|
from .partnerenrolledevent import (
|
|
161
|
+
BannedReason,
|
|
148
162
|
PartnerEnrolledEvent,
|
|
149
163
|
PartnerEnrolledEventData,
|
|
150
164
|
PartnerEnrolledEventDataTypedDict,
|
|
@@ -236,6 +250,7 @@ __all__ = [
|
|
|
236
250
|
"AnalyticsTopUrlsTypedDict",
|
|
237
251
|
"AnalyticsTriggers",
|
|
238
252
|
"AnalyticsTriggersTypedDict",
|
|
253
|
+
"BannedReason",
|
|
239
254
|
"City",
|
|
240
255
|
"Click",
|
|
241
256
|
"ClickEvent",
|
|
@@ -247,6 +262,15 @@ __all__ = [
|
|
|
247
262
|
"ClickTypedDict",
|
|
248
263
|
"Code",
|
|
249
264
|
"Color",
|
|
265
|
+
"CommissionCreatedEvent",
|
|
266
|
+
"CommissionCreatedEventCustomer",
|
|
267
|
+
"CommissionCreatedEventCustomerTypedDict",
|
|
268
|
+
"CommissionCreatedEventData",
|
|
269
|
+
"CommissionCreatedEventDataTypedDict",
|
|
270
|
+
"CommissionCreatedEventEvent",
|
|
271
|
+
"CommissionCreatedEventStatus",
|
|
272
|
+
"CommissionCreatedEventType",
|
|
273
|
+
"CommissionCreatedEventTypedDict",
|
|
250
274
|
"Continent",
|
|
251
275
|
"ContinentCode",
|
|
252
276
|
"CountryCode",
|
|
@@ -319,6 +343,7 @@ __all__ = [
|
|
|
319
343
|
"LinkWebhookEventTestVariantsTypedDict",
|
|
320
344
|
"LinkWebhookEventTypedDict",
|
|
321
345
|
"One",
|
|
346
|
+
"Partner",
|
|
322
347
|
"PartnerAnalyticsCount",
|
|
323
348
|
"PartnerAnalyticsCountTypedDict",
|
|
324
349
|
"PartnerAnalyticsTimeseries",
|
|
@@ -332,6 +357,7 @@ __all__ = [
|
|
|
332
357
|
"PartnerEnrolledEventLink",
|
|
333
358
|
"PartnerEnrolledEventLinkTypedDict",
|
|
334
359
|
"PartnerEnrolledEventTypedDict",
|
|
360
|
+
"PartnerTypedDict",
|
|
335
361
|
"PaymentProcessor",
|
|
336
362
|
"Plan",
|
|
337
363
|
"Region",
|
|
@@ -434,6 +460,17 @@ _dynamic_imports: dict[str, str] = {
|
|
|
434
460
|
"Event": ".clickevent",
|
|
435
461
|
"Link": ".clickevent",
|
|
436
462
|
"LinkTypedDict": ".clickevent",
|
|
463
|
+
"CommissionCreatedEvent": ".commissioncreatedevent",
|
|
464
|
+
"CommissionCreatedEventCustomer": ".commissioncreatedevent",
|
|
465
|
+
"CommissionCreatedEventCustomerTypedDict": ".commissioncreatedevent",
|
|
466
|
+
"CommissionCreatedEventData": ".commissioncreatedevent",
|
|
467
|
+
"CommissionCreatedEventDataTypedDict": ".commissioncreatedevent",
|
|
468
|
+
"CommissionCreatedEventEvent": ".commissioncreatedevent",
|
|
469
|
+
"CommissionCreatedEventStatus": ".commissioncreatedevent",
|
|
470
|
+
"CommissionCreatedEventType": ".commissioncreatedevent",
|
|
471
|
+
"CommissionCreatedEventTypedDict": ".commissioncreatedevent",
|
|
472
|
+
"Partner": ".commissioncreatedevent",
|
|
473
|
+
"PartnerTypedDict": ".commissioncreatedevent",
|
|
437
474
|
"ContinentCode": ".continentcode",
|
|
438
475
|
"CountryCode": ".countrycode",
|
|
439
476
|
"DomainSchema": ".domainschema",
|
|
@@ -515,6 +552,7 @@ _dynamic_imports: dict[str, str] = {
|
|
|
515
552
|
"PartnerAnalyticsTimeseriesTypedDict": ".partneranalyticstimeseries",
|
|
516
553
|
"PartnerAnalyticsTopLinks": ".partneranalyticstoplinks",
|
|
517
554
|
"PartnerAnalyticsTopLinksTypedDict": ".partneranalyticstoplinks",
|
|
555
|
+
"BannedReason": ".partnerenrolledevent",
|
|
518
556
|
"PartnerEnrolledEvent": ".partnerenrolledevent",
|
|
519
557
|
"PartnerEnrolledEventData": ".partnerenrolledevent",
|
|
520
558
|
"PartnerEnrolledEventDataTypedDict": ".partnerenrolledevent",
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from dub.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
from enum import Enum
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic import model_serializer
|
|
8
|
+
from typing import Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CommissionCreatedEventEvent(str, Enum):
|
|
13
|
+
COMMISSION_CREATED = "commission.created"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CommissionCreatedEventType(str, Enum):
|
|
17
|
+
CLICK = "click"
|
|
18
|
+
LEAD = "lead"
|
|
19
|
+
SALE = "sale"
|
|
20
|
+
CUSTOM = "custom"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CommissionCreatedEventStatus(str, Enum):
|
|
24
|
+
PENDING = "pending"
|
|
25
|
+
PROCESSED = "processed"
|
|
26
|
+
PAID = "paid"
|
|
27
|
+
REFUNDED = "refunded"
|
|
28
|
+
DUPLICATE = "duplicate"
|
|
29
|
+
FRAUD = "fraud"
|
|
30
|
+
CANCELED = "canceled"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class PartnerTypedDict(TypedDict):
|
|
34
|
+
id: str
|
|
35
|
+
r"""The partner's unique ID on Dub."""
|
|
36
|
+
name: str
|
|
37
|
+
r"""The partner's full legal name."""
|
|
38
|
+
email: Nullable[str]
|
|
39
|
+
r"""The partner's email address. Should be a unique value across Dub."""
|
|
40
|
+
image: Nullable[str]
|
|
41
|
+
r"""The partner's avatar image."""
|
|
42
|
+
payouts_enabled_at: Nullable[str]
|
|
43
|
+
r"""The date when the partner enabled payouts."""
|
|
44
|
+
country: Nullable[str]
|
|
45
|
+
r"""The partner's country (required for tax purposes)."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Partner(BaseModel):
|
|
49
|
+
id: str
|
|
50
|
+
r"""The partner's unique ID on Dub."""
|
|
51
|
+
|
|
52
|
+
name: str
|
|
53
|
+
r"""The partner's full legal name."""
|
|
54
|
+
|
|
55
|
+
email: Nullable[str]
|
|
56
|
+
r"""The partner's email address. Should be a unique value across Dub."""
|
|
57
|
+
|
|
58
|
+
image: Nullable[str]
|
|
59
|
+
r"""The partner's avatar image."""
|
|
60
|
+
|
|
61
|
+
payouts_enabled_at: Annotated[
|
|
62
|
+
Nullable[str], pydantic.Field(alias="payoutsEnabledAt")
|
|
63
|
+
]
|
|
64
|
+
r"""The date when the partner enabled payouts."""
|
|
65
|
+
|
|
66
|
+
country: Nullable[str]
|
|
67
|
+
r"""The partner's country (required for tax purposes)."""
|
|
68
|
+
|
|
69
|
+
@model_serializer(mode="wrap")
|
|
70
|
+
def serialize_model(self, handler):
|
|
71
|
+
optional_fields = []
|
|
72
|
+
nullable_fields = ["email", "image", "payoutsEnabledAt", "country"]
|
|
73
|
+
null_default_fields = []
|
|
74
|
+
|
|
75
|
+
serialized = handler(self)
|
|
76
|
+
|
|
77
|
+
m = {}
|
|
78
|
+
|
|
79
|
+
for n, f in type(self).model_fields.items():
|
|
80
|
+
k = f.alias or n
|
|
81
|
+
val = serialized.get(k)
|
|
82
|
+
serialized.pop(k, None)
|
|
83
|
+
|
|
84
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
85
|
+
is_set = (
|
|
86
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
87
|
+
or k in null_default_fields
|
|
88
|
+
) # pylint: disable=no-member
|
|
89
|
+
|
|
90
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
91
|
+
m[k] = val
|
|
92
|
+
elif val != UNSET_SENTINEL and (
|
|
93
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
94
|
+
):
|
|
95
|
+
m[k] = val
|
|
96
|
+
|
|
97
|
+
return m
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class CommissionCreatedEventCustomerTypedDict(TypedDict):
|
|
101
|
+
id: str
|
|
102
|
+
r"""The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`)."""
|
|
103
|
+
external_id: str
|
|
104
|
+
r"""Unique identifier for the customer in the client's app."""
|
|
105
|
+
name: str
|
|
106
|
+
r"""Name of the customer."""
|
|
107
|
+
created_at: str
|
|
108
|
+
r"""The date the customer was created."""
|
|
109
|
+
email: NotRequired[Nullable[str]]
|
|
110
|
+
r"""Email of the customer."""
|
|
111
|
+
avatar: NotRequired[Nullable[str]]
|
|
112
|
+
r"""Avatar URL of the customer."""
|
|
113
|
+
country: NotRequired[Nullable[str]]
|
|
114
|
+
r"""Country of the customer."""
|
|
115
|
+
sales: NotRequired[Nullable[float]]
|
|
116
|
+
r"""Total number of sales for the customer."""
|
|
117
|
+
sale_amount: NotRequired[Nullable[float]]
|
|
118
|
+
r"""Total amount of sales for the customer."""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class CommissionCreatedEventCustomer(BaseModel):
|
|
122
|
+
id: str
|
|
123
|
+
r"""The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`)."""
|
|
124
|
+
|
|
125
|
+
external_id: Annotated[str, pydantic.Field(alias="externalId")]
|
|
126
|
+
r"""Unique identifier for the customer in the client's app."""
|
|
127
|
+
|
|
128
|
+
name: str
|
|
129
|
+
r"""Name of the customer."""
|
|
130
|
+
|
|
131
|
+
created_at: Annotated[str, pydantic.Field(alias="createdAt")]
|
|
132
|
+
r"""The date the customer was created."""
|
|
133
|
+
|
|
134
|
+
email: OptionalNullable[str] = UNSET
|
|
135
|
+
r"""Email of the customer."""
|
|
136
|
+
|
|
137
|
+
avatar: OptionalNullable[str] = UNSET
|
|
138
|
+
r"""Avatar URL of the customer."""
|
|
139
|
+
|
|
140
|
+
country: OptionalNullable[str] = UNSET
|
|
141
|
+
r"""Country of the customer."""
|
|
142
|
+
|
|
143
|
+
sales: OptionalNullable[float] = UNSET
|
|
144
|
+
r"""Total number of sales for the customer."""
|
|
145
|
+
|
|
146
|
+
sale_amount: Annotated[
|
|
147
|
+
OptionalNullable[float], pydantic.Field(alias="saleAmount")
|
|
148
|
+
] = UNSET
|
|
149
|
+
r"""Total amount of sales for the customer."""
|
|
150
|
+
|
|
151
|
+
@model_serializer(mode="wrap")
|
|
152
|
+
def serialize_model(self, handler):
|
|
153
|
+
optional_fields = ["email", "avatar", "country", "sales", "saleAmount"]
|
|
154
|
+
nullable_fields = ["email", "avatar", "country", "sales", "saleAmount"]
|
|
155
|
+
null_default_fields = []
|
|
156
|
+
|
|
157
|
+
serialized = handler(self)
|
|
158
|
+
|
|
159
|
+
m = {}
|
|
160
|
+
|
|
161
|
+
for n, f in type(self).model_fields.items():
|
|
162
|
+
k = f.alias or n
|
|
163
|
+
val = serialized.get(k)
|
|
164
|
+
serialized.pop(k, None)
|
|
165
|
+
|
|
166
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
167
|
+
is_set = (
|
|
168
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
169
|
+
or k in null_default_fields
|
|
170
|
+
) # pylint: disable=no-member
|
|
171
|
+
|
|
172
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
173
|
+
m[k] = val
|
|
174
|
+
elif val != UNSET_SENTINEL and (
|
|
175
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
176
|
+
):
|
|
177
|
+
m[k] = val
|
|
178
|
+
|
|
179
|
+
return m
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class CommissionCreatedEventDataTypedDict(TypedDict):
|
|
183
|
+
id: str
|
|
184
|
+
r"""The commission's unique ID on Dub."""
|
|
185
|
+
amount: float
|
|
186
|
+
earnings: float
|
|
187
|
+
currency: str
|
|
188
|
+
status: CommissionCreatedEventStatus
|
|
189
|
+
invoice_id: Nullable[str]
|
|
190
|
+
description: Nullable[str]
|
|
191
|
+
quantity: float
|
|
192
|
+
created_at: str
|
|
193
|
+
updated_at: str
|
|
194
|
+
partner: PartnerTypedDict
|
|
195
|
+
type: NotRequired[CommissionCreatedEventType]
|
|
196
|
+
user_id: NotRequired[Nullable[str]]
|
|
197
|
+
r"""The user who created the manual commission."""
|
|
198
|
+
customer: NotRequired[Nullable[CommissionCreatedEventCustomerTypedDict]]
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class CommissionCreatedEventData(BaseModel):
|
|
202
|
+
id: str
|
|
203
|
+
r"""The commission's unique ID on Dub."""
|
|
204
|
+
|
|
205
|
+
amount: float
|
|
206
|
+
|
|
207
|
+
earnings: float
|
|
208
|
+
|
|
209
|
+
currency: str
|
|
210
|
+
|
|
211
|
+
status: CommissionCreatedEventStatus
|
|
212
|
+
|
|
213
|
+
invoice_id: Annotated[Nullable[str], pydantic.Field(alias="invoiceId")]
|
|
214
|
+
|
|
215
|
+
description: Nullable[str]
|
|
216
|
+
|
|
217
|
+
quantity: float
|
|
218
|
+
|
|
219
|
+
created_at: Annotated[str, pydantic.Field(alias="createdAt")]
|
|
220
|
+
|
|
221
|
+
updated_at: Annotated[str, pydantic.Field(alias="updatedAt")]
|
|
222
|
+
|
|
223
|
+
partner: Partner
|
|
224
|
+
|
|
225
|
+
type: Optional[CommissionCreatedEventType] = None
|
|
226
|
+
|
|
227
|
+
user_id: Annotated[OptionalNullable[str], pydantic.Field(alias="userId")] = UNSET
|
|
228
|
+
r"""The user who created the manual commission."""
|
|
229
|
+
|
|
230
|
+
customer: OptionalNullable[CommissionCreatedEventCustomer] = UNSET
|
|
231
|
+
|
|
232
|
+
@model_serializer(mode="wrap")
|
|
233
|
+
def serialize_model(self, handler):
|
|
234
|
+
optional_fields = ["type", "userId", "customer"]
|
|
235
|
+
nullable_fields = ["invoiceId", "description", "userId", "customer"]
|
|
236
|
+
null_default_fields = []
|
|
237
|
+
|
|
238
|
+
serialized = handler(self)
|
|
239
|
+
|
|
240
|
+
m = {}
|
|
241
|
+
|
|
242
|
+
for n, f in type(self).model_fields.items():
|
|
243
|
+
k = f.alias or n
|
|
244
|
+
val = serialized.get(k)
|
|
245
|
+
serialized.pop(k, None)
|
|
246
|
+
|
|
247
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
248
|
+
is_set = (
|
|
249
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
250
|
+
or k in null_default_fields
|
|
251
|
+
) # pylint: disable=no-member
|
|
252
|
+
|
|
253
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
254
|
+
m[k] = val
|
|
255
|
+
elif val != UNSET_SENTINEL and (
|
|
256
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
257
|
+
):
|
|
258
|
+
m[k] = val
|
|
259
|
+
|
|
260
|
+
return m
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class CommissionCreatedEventTypedDict(TypedDict):
|
|
264
|
+
r"""Triggered when a commission is created for a partner."""
|
|
265
|
+
|
|
266
|
+
id: str
|
|
267
|
+
event: CommissionCreatedEventEvent
|
|
268
|
+
created_at: str
|
|
269
|
+
data: CommissionCreatedEventDataTypedDict
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class CommissionCreatedEvent(BaseModel):
|
|
273
|
+
r"""Triggered when a commission is created for a partner."""
|
|
274
|
+
|
|
275
|
+
id: str
|
|
276
|
+
|
|
277
|
+
event: CommissionCreatedEventEvent
|
|
278
|
+
|
|
279
|
+
created_at: Annotated[str, pydantic.Field(alias="createdAt")]
|
|
280
|
+
|
|
281
|
+
data: CommissionCreatedEventData
|