dub 0.31.0__py3-none-any.whl → 0.33.0__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/analytics.py +6 -6
- dub/commissions.py +12 -12
- dub/customers.py +24 -321
- dub/domains.py +34 -38
- dub/embed_tokens.py +6 -6
- dub/events.py +6 -6
- dub/folders.py +24 -28
- dub/links.py +58 -74
- dub/models/components/__init__.py +38 -6
- dub/models/components/analyticstopurls.py +2 -2
- dub/models/components/clickevent.py +10 -9
- dub/models/components/commissioncreatedevent.py +5 -2
- dub/models/components/folderschema.py +6 -1
- dub/models/components/leadcreatedevent.py +15 -11
- dub/models/components/leadevent.py +10 -9
- dub/models/components/linkclickedevent.py +10 -9
- dub/models/components/linkschema.py +9 -3
- dub/models/components/{tagschema.py → linktagschema.py} +2 -2
- dub/models/components/linkwebhookevent.py +10 -9
- dub/models/components/partnerapplicationsubmittedevent.py +269 -0
- dub/models/components/partnerenrolledevent.py +93 -29
- dub/models/components/salecreatedevent.py +15 -11
- dub/models/components/saleevent.py +10 -9
- dub/models/components/webhookevent.py +6 -0
- dub/models/components/workspaceschema.py +11 -0
- dub/models/errors/badrequest.py +1 -1
- dub/models/errors/conflict.py +1 -1
- dub/models/errors/duberror.py +1 -1
- dub/models/errors/forbidden.py +1 -1
- dub/models/errors/internalservererror.py +1 -1
- dub/models/errors/inviteexpired.py +1 -1
- dub/models/errors/no_response_error.py +1 -1
- dub/models/errors/notfound.py +1 -1
- dub/models/errors/ratelimitexceeded.py +1 -1
- dub/models/errors/responsevalidationerror.py +1 -1
- dub/models/errors/sdkerror.py +1 -1
- dub/models/errors/unauthorized.py +1 -1
- dub/models/errors/unprocessableentity.py +1 -1
- dub/models/operations/__init__.py +17 -35
- dub/models/operations/banpartner.py +83 -0
- dub/models/operations/bulkcreatelinks.py +2 -2
- dub/models/operations/createfolder.py +8 -3
- dub/models/operations/createlink.py +2 -2
- dub/models/operations/createpartner.py +93 -29
- dub/models/operations/listcommissions.py +13 -2
- dub/models/operations/listevents.py +10 -0
- dub/models/operations/listpartners.py +107 -47
- dub/models/operations/retrieveanalytics.py +16 -1
- dub/models/operations/retrievelinks.py +42 -7
- dub/models/operations/retrievepartneranalytics.py +51 -11
- dub/models/operations/tracklead.py +2 -2
- dub/models/operations/updatecommission.py +7 -2
- dub/models/operations/updatefolder.py +8 -3
- dub/models/operations/updatelink.py +2 -2
- dub/models/operations/upsertlink.py +2 -2
- dub/partners.py +310 -36
- dub/qr_codes.py +4 -4
- dub/tags.py +24 -32
- dub/track.py +12 -20
- dub/utils/retries.py +69 -5
- dub/utils/unmarshal_json_response.py +15 -1
- dub/workspaces.py +12 -20
- {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/METADATA +2 -21
- {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/RECORD +67 -66
- dub/models/operations/createcustomer.py +0 -382
- {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/WHEEL +0 -0
- {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,382 +0,0 @@
|
|
|
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_extensions import Annotated, NotRequired, TypedDict
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class CreateCustomerRequestBodyTypedDict(TypedDict):
|
|
12
|
-
external_id: str
|
|
13
|
-
r"""Unique identifier for the customer in the client's app."""
|
|
14
|
-
email: NotRequired[Nullable[str]]
|
|
15
|
-
r"""Email of the customer in the client's app."""
|
|
16
|
-
name: NotRequired[Nullable[str]]
|
|
17
|
-
r"""Name of the customer in the client's app. If not provided, a random name will be generated."""
|
|
18
|
-
avatar: NotRequired[Nullable[str]]
|
|
19
|
-
r"""Avatar URL of the customer in the client's app."""
|
|
20
|
-
stripe_customer_id: NotRequired[Nullable[str]]
|
|
21
|
-
r"""The customer's Stripe customer ID. Useful for attribution recurring sale events to the partner who referred the customer."""
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class CreateCustomerRequestBody(BaseModel):
|
|
25
|
-
external_id: Annotated[str, pydantic.Field(alias="externalId")]
|
|
26
|
-
r"""Unique identifier for the customer in the client's app."""
|
|
27
|
-
|
|
28
|
-
email: OptionalNullable[str] = UNSET
|
|
29
|
-
r"""Email of the customer in the client's app."""
|
|
30
|
-
|
|
31
|
-
name: OptionalNullable[str] = UNSET
|
|
32
|
-
r"""Name of the customer in the client's app. If not provided, a random name will be generated."""
|
|
33
|
-
|
|
34
|
-
avatar: OptionalNullable[str] = UNSET
|
|
35
|
-
r"""Avatar URL of the customer in the client's app."""
|
|
36
|
-
|
|
37
|
-
stripe_customer_id: Annotated[
|
|
38
|
-
OptionalNullable[str], pydantic.Field(alias="stripeCustomerId")
|
|
39
|
-
] = UNSET
|
|
40
|
-
r"""The customer's Stripe customer ID. Useful for attribution recurring sale events to the partner who referred the customer."""
|
|
41
|
-
|
|
42
|
-
@model_serializer(mode="wrap")
|
|
43
|
-
def serialize_model(self, handler):
|
|
44
|
-
optional_fields = ["email", "name", "avatar", "stripeCustomerId"]
|
|
45
|
-
nullable_fields = ["email", "name", "avatar", "stripeCustomerId"]
|
|
46
|
-
null_default_fields = []
|
|
47
|
-
|
|
48
|
-
serialized = handler(self)
|
|
49
|
-
|
|
50
|
-
m = {}
|
|
51
|
-
|
|
52
|
-
for n, f in type(self).model_fields.items():
|
|
53
|
-
k = f.alias or n
|
|
54
|
-
val = serialized.get(k)
|
|
55
|
-
serialized.pop(k, None)
|
|
56
|
-
|
|
57
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
58
|
-
is_set = (
|
|
59
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
60
|
-
or k in null_default_fields
|
|
61
|
-
) # pylint: disable=no-member
|
|
62
|
-
|
|
63
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
64
|
-
m[k] = val
|
|
65
|
-
elif val != UNSET_SENTINEL and (
|
|
66
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
67
|
-
):
|
|
68
|
-
m[k] = val
|
|
69
|
-
|
|
70
|
-
return m
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class CreateCustomerLinkTypedDict(TypedDict):
|
|
74
|
-
id: str
|
|
75
|
-
r"""The unique ID of the short link."""
|
|
76
|
-
domain: str
|
|
77
|
-
r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
|
|
78
|
-
key: str
|
|
79
|
-
r"""The short link slug. If not provided, a random 7-character slug will be generated."""
|
|
80
|
-
short_link: str
|
|
81
|
-
r"""The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`)."""
|
|
82
|
-
url: str
|
|
83
|
-
r"""The destination URL of the short link."""
|
|
84
|
-
program_id: Nullable[str]
|
|
85
|
-
r"""The ID of the program the short link is associated with."""
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class CreateCustomerLink(BaseModel):
|
|
89
|
-
id: str
|
|
90
|
-
r"""The unique ID of the short link."""
|
|
91
|
-
|
|
92
|
-
domain: str
|
|
93
|
-
r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
|
|
94
|
-
|
|
95
|
-
key: str
|
|
96
|
-
r"""The short link slug. If not provided, a random 7-character slug will be generated."""
|
|
97
|
-
|
|
98
|
-
short_link: Annotated[str, pydantic.Field(alias="shortLink")]
|
|
99
|
-
r"""The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`)."""
|
|
100
|
-
|
|
101
|
-
url: str
|
|
102
|
-
r"""The destination URL of the short link."""
|
|
103
|
-
|
|
104
|
-
program_id: Annotated[Nullable[str], pydantic.Field(alias="programId")]
|
|
105
|
-
r"""The ID of the program the short link is associated with."""
|
|
106
|
-
|
|
107
|
-
@model_serializer(mode="wrap")
|
|
108
|
-
def serialize_model(self, handler):
|
|
109
|
-
optional_fields = []
|
|
110
|
-
nullable_fields = ["programId"]
|
|
111
|
-
null_default_fields = []
|
|
112
|
-
|
|
113
|
-
serialized = handler(self)
|
|
114
|
-
|
|
115
|
-
m = {}
|
|
116
|
-
|
|
117
|
-
for n, f in type(self).model_fields.items():
|
|
118
|
-
k = f.alias or n
|
|
119
|
-
val = serialized.get(k)
|
|
120
|
-
serialized.pop(k, None)
|
|
121
|
-
|
|
122
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
123
|
-
is_set = (
|
|
124
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
125
|
-
or k in null_default_fields
|
|
126
|
-
) # pylint: disable=no-member
|
|
127
|
-
|
|
128
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
129
|
-
m[k] = val
|
|
130
|
-
elif val != UNSET_SENTINEL and (
|
|
131
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
132
|
-
):
|
|
133
|
-
m[k] = val
|
|
134
|
-
|
|
135
|
-
return m
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class CreateCustomerPartnerTypedDict(TypedDict):
|
|
139
|
-
id: str
|
|
140
|
-
r"""The partner's unique ID on Dub."""
|
|
141
|
-
name: str
|
|
142
|
-
r"""The partner's full legal name."""
|
|
143
|
-
email: Nullable[str]
|
|
144
|
-
r"""The partner's email address. Should be a unique value across Dub."""
|
|
145
|
-
image: Nullable[str]
|
|
146
|
-
r"""The partner's avatar image."""
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
class CreateCustomerPartner(BaseModel):
|
|
150
|
-
id: str
|
|
151
|
-
r"""The partner's unique ID on Dub."""
|
|
152
|
-
|
|
153
|
-
name: str
|
|
154
|
-
r"""The partner's full legal name."""
|
|
155
|
-
|
|
156
|
-
email: Nullable[str]
|
|
157
|
-
r"""The partner's email address. Should be a unique value across Dub."""
|
|
158
|
-
|
|
159
|
-
image: Nullable[str]
|
|
160
|
-
r"""The partner's avatar image."""
|
|
161
|
-
|
|
162
|
-
@model_serializer(mode="wrap")
|
|
163
|
-
def serialize_model(self, handler):
|
|
164
|
-
optional_fields = []
|
|
165
|
-
nullable_fields = ["email", "image"]
|
|
166
|
-
null_default_fields = []
|
|
167
|
-
|
|
168
|
-
serialized = handler(self)
|
|
169
|
-
|
|
170
|
-
m = {}
|
|
171
|
-
|
|
172
|
-
for n, f in type(self).model_fields.items():
|
|
173
|
-
k = f.alias or n
|
|
174
|
-
val = serialized.get(k)
|
|
175
|
-
serialized.pop(k, None)
|
|
176
|
-
|
|
177
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
178
|
-
is_set = (
|
|
179
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
180
|
-
or k in null_default_fields
|
|
181
|
-
) # pylint: disable=no-member
|
|
182
|
-
|
|
183
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
184
|
-
m[k] = val
|
|
185
|
-
elif val != UNSET_SENTINEL and (
|
|
186
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
187
|
-
):
|
|
188
|
-
m[k] = val
|
|
189
|
-
|
|
190
|
-
return m
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
class CreateCustomerType(str, Enum):
|
|
194
|
-
PERCENTAGE = "percentage"
|
|
195
|
-
FLAT = "flat"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
class CreateCustomerDiscountTypedDict(TypedDict):
|
|
199
|
-
id: str
|
|
200
|
-
amount: float
|
|
201
|
-
type: CreateCustomerType
|
|
202
|
-
max_duration: Nullable[float]
|
|
203
|
-
coupon_id: Nullable[str]
|
|
204
|
-
coupon_test_id: Nullable[str]
|
|
205
|
-
description: NotRequired[Nullable[str]]
|
|
206
|
-
partners_count: NotRequired[Nullable[float]]
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
class CreateCustomerDiscount(BaseModel):
|
|
210
|
-
id: str
|
|
211
|
-
|
|
212
|
-
amount: float
|
|
213
|
-
|
|
214
|
-
type: CreateCustomerType
|
|
215
|
-
|
|
216
|
-
max_duration: Annotated[Nullable[float], pydantic.Field(alias="maxDuration")]
|
|
217
|
-
|
|
218
|
-
coupon_id: Annotated[Nullable[str], pydantic.Field(alias="couponId")]
|
|
219
|
-
|
|
220
|
-
coupon_test_id: Annotated[Nullable[str], pydantic.Field(alias="couponTestId")]
|
|
221
|
-
|
|
222
|
-
description: OptionalNullable[str] = UNSET
|
|
223
|
-
|
|
224
|
-
partners_count: Annotated[
|
|
225
|
-
OptionalNullable[float], pydantic.Field(alias="partnersCount")
|
|
226
|
-
] = UNSET
|
|
227
|
-
|
|
228
|
-
@model_serializer(mode="wrap")
|
|
229
|
-
def serialize_model(self, handler):
|
|
230
|
-
optional_fields = ["description", "partnersCount"]
|
|
231
|
-
nullable_fields = [
|
|
232
|
-
"maxDuration",
|
|
233
|
-
"couponId",
|
|
234
|
-
"couponTestId",
|
|
235
|
-
"description",
|
|
236
|
-
"partnersCount",
|
|
237
|
-
]
|
|
238
|
-
null_default_fields = []
|
|
239
|
-
|
|
240
|
-
serialized = handler(self)
|
|
241
|
-
|
|
242
|
-
m = {}
|
|
243
|
-
|
|
244
|
-
for n, f in type(self).model_fields.items():
|
|
245
|
-
k = f.alias or n
|
|
246
|
-
val = serialized.get(k)
|
|
247
|
-
serialized.pop(k, None)
|
|
248
|
-
|
|
249
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
250
|
-
is_set = (
|
|
251
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
252
|
-
or k in null_default_fields
|
|
253
|
-
) # pylint: disable=no-member
|
|
254
|
-
|
|
255
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
256
|
-
m[k] = val
|
|
257
|
-
elif val != UNSET_SENTINEL and (
|
|
258
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
259
|
-
):
|
|
260
|
-
m[k] = val
|
|
261
|
-
|
|
262
|
-
return m
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
class CreateCustomerResponseBodyTypedDict(TypedDict):
|
|
266
|
-
r"""The customer was created."""
|
|
267
|
-
|
|
268
|
-
id: str
|
|
269
|
-
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`)."""
|
|
270
|
-
external_id: str
|
|
271
|
-
r"""Unique identifier for the customer in the client's app."""
|
|
272
|
-
name: str
|
|
273
|
-
r"""Name of the customer."""
|
|
274
|
-
created_at: str
|
|
275
|
-
r"""The date the customer was created."""
|
|
276
|
-
email: NotRequired[Nullable[str]]
|
|
277
|
-
r"""Email of the customer."""
|
|
278
|
-
avatar: NotRequired[Nullable[str]]
|
|
279
|
-
r"""Avatar URL of the customer."""
|
|
280
|
-
country: NotRequired[Nullable[str]]
|
|
281
|
-
r"""Country of the customer."""
|
|
282
|
-
sales: NotRequired[Nullable[float]]
|
|
283
|
-
r"""Total number of sales for the customer."""
|
|
284
|
-
sale_amount: NotRequired[Nullable[float]]
|
|
285
|
-
r"""Total amount of sales for the customer."""
|
|
286
|
-
link: NotRequired[Nullable[CreateCustomerLinkTypedDict]]
|
|
287
|
-
program_id: NotRequired[Nullable[str]]
|
|
288
|
-
partner: NotRequired[Nullable[CreateCustomerPartnerTypedDict]]
|
|
289
|
-
discount: NotRequired[Nullable[CreateCustomerDiscountTypedDict]]
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
class CreateCustomerResponseBody(BaseModel):
|
|
293
|
-
r"""The customer was created."""
|
|
294
|
-
|
|
295
|
-
id: str
|
|
296
|
-
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`)."""
|
|
297
|
-
|
|
298
|
-
external_id: Annotated[str, pydantic.Field(alias="externalId")]
|
|
299
|
-
r"""Unique identifier for the customer in the client's app."""
|
|
300
|
-
|
|
301
|
-
name: str
|
|
302
|
-
r"""Name of the customer."""
|
|
303
|
-
|
|
304
|
-
created_at: Annotated[str, pydantic.Field(alias="createdAt")]
|
|
305
|
-
r"""The date the customer was created."""
|
|
306
|
-
|
|
307
|
-
email: OptionalNullable[str] = UNSET
|
|
308
|
-
r"""Email of the customer."""
|
|
309
|
-
|
|
310
|
-
avatar: OptionalNullable[str] = UNSET
|
|
311
|
-
r"""Avatar URL of the customer."""
|
|
312
|
-
|
|
313
|
-
country: OptionalNullable[str] = UNSET
|
|
314
|
-
r"""Country of the customer."""
|
|
315
|
-
|
|
316
|
-
sales: OptionalNullable[float] = UNSET
|
|
317
|
-
r"""Total number of sales for the customer."""
|
|
318
|
-
|
|
319
|
-
sale_amount: Annotated[
|
|
320
|
-
OptionalNullable[float], pydantic.Field(alias="saleAmount")
|
|
321
|
-
] = UNSET
|
|
322
|
-
r"""Total amount of sales for the customer."""
|
|
323
|
-
|
|
324
|
-
link: OptionalNullable[CreateCustomerLink] = UNSET
|
|
325
|
-
|
|
326
|
-
program_id: Annotated[OptionalNullable[str], pydantic.Field(alias="programId")] = (
|
|
327
|
-
UNSET
|
|
328
|
-
)
|
|
329
|
-
|
|
330
|
-
partner: OptionalNullable[CreateCustomerPartner] = UNSET
|
|
331
|
-
|
|
332
|
-
discount: OptionalNullable[CreateCustomerDiscount] = UNSET
|
|
333
|
-
|
|
334
|
-
@model_serializer(mode="wrap")
|
|
335
|
-
def serialize_model(self, handler):
|
|
336
|
-
optional_fields = [
|
|
337
|
-
"email",
|
|
338
|
-
"avatar",
|
|
339
|
-
"country",
|
|
340
|
-
"sales",
|
|
341
|
-
"saleAmount",
|
|
342
|
-
"link",
|
|
343
|
-
"programId",
|
|
344
|
-
"partner",
|
|
345
|
-
"discount",
|
|
346
|
-
]
|
|
347
|
-
nullable_fields = [
|
|
348
|
-
"email",
|
|
349
|
-
"avatar",
|
|
350
|
-
"country",
|
|
351
|
-
"sales",
|
|
352
|
-
"saleAmount",
|
|
353
|
-
"link",
|
|
354
|
-
"programId",
|
|
355
|
-
"partner",
|
|
356
|
-
"discount",
|
|
357
|
-
]
|
|
358
|
-
null_default_fields = []
|
|
359
|
-
|
|
360
|
-
serialized = handler(self)
|
|
361
|
-
|
|
362
|
-
m = {}
|
|
363
|
-
|
|
364
|
-
for n, f in type(self).model_fields.items():
|
|
365
|
-
k = f.alias or n
|
|
366
|
-
val = serialized.get(k)
|
|
367
|
-
serialized.pop(k, None)
|
|
368
|
-
|
|
369
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
370
|
-
is_set = (
|
|
371
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
372
|
-
or k in null_default_fields
|
|
373
|
-
) # pylint: disable=no-member
|
|
374
|
-
|
|
375
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
376
|
-
m[k] = val
|
|
377
|
-
elif val != UNSET_SENTINEL and (
|
|
378
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
379
|
-
):
|
|
380
|
-
m[k] = val
|
|
381
|
-
|
|
382
|
-
return m
|
|
File without changes
|
|
File without changes
|