dub 0.32.0__py3-none-any.whl → 0.34.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.
Files changed (70) hide show
  1. dub/_version.py +3 -3
  2. dub/analytics.py +6 -4
  3. dub/basesdk.py +6 -0
  4. dub/commissions.py +12 -8
  5. dub/customers.py +24 -313
  6. dub/domains.py +34 -26
  7. dub/embed_tokens.py +6 -4
  8. dub/events.py +6 -4
  9. dub/folders.py +24 -20
  10. dub/links.py +58 -54
  11. dub/models/components/__init__.py +81 -149
  12. dub/models/components/analyticstopurls.py +2 -2
  13. dub/models/components/leadcreatedevent.py +15 -14
  14. dub/models/components/linkclickedevent.py +19 -18
  15. dub/models/components/linkerrorschema.py +12 -12
  16. dub/models/components/linkschema.py +9 -3
  17. dub/models/components/linktagschema.py +3 -3
  18. dub/models/components/linktagschemaoutput.py +38 -0
  19. dub/models/components/linkwebhookevent.py +15 -16
  20. dub/models/components/partnerapplicationsubmittedevent.py +269 -0
  21. dub/models/components/partnerenrolledevent.py +68 -8
  22. dub/models/components/salecreatedevent.py +15 -14
  23. dub/models/components/webhookevent.py +6 -0
  24. dub/models/components/workspaceschema.py +6 -0
  25. dub/models/operations/__init__.py +147 -57
  26. dub/models/operations/banpartner.py +83 -0
  27. dub/models/operations/createpartner.py +68 -59
  28. dub/models/operations/createpartnerlink.py +0 -51
  29. dub/models/operations/createreferralsembedtoken.py +0 -51
  30. dub/models/operations/getcustomers.py +18 -0
  31. dub/models/operations/getlinkinfo.py +0 -2
  32. dub/models/operations/getlinks.py +2 -2
  33. dub/models/operations/getlinkscount.py +2 -2
  34. dub/models/operations/getqrcode.py +1 -1
  35. dub/models/operations/listcommissions.py +13 -2
  36. dub/models/operations/listdomains.py +1 -1
  37. dub/models/operations/listevents.py +2026 -21
  38. dub/models/operations/listpartners.py +75 -8
  39. dub/models/operations/retrieveanalytics.py +28 -5
  40. dub/models/operations/retrievelinks.py +44 -9
  41. dub/models/operations/retrievepartneranalytics.py +51 -11
  42. dub/models/operations/tracklead.py +4 -4
  43. dub/models/operations/updatecommission.py +7 -2
  44. dub/models/operations/updatecustomer.py +23 -11
  45. dub/models/operations/updatelink.py +0 -2
  46. dub/models/operations/updateworkspace.py +3 -3
  47. dub/models/operations/upsertpartnerlink.py +0 -51
  48. dub/partners.py +316 -24
  49. dub/qr_codes.py +4 -2
  50. dub/tags.py +24 -20
  51. dub/track.py +12 -16
  52. dub/types/basemodel.py +41 -3
  53. dub/utils/__init__.py +0 -3
  54. dub/utils/enums.py +60 -0
  55. dub/utils/forms.py +21 -10
  56. dub/utils/queryparams.py +14 -2
  57. dub/utils/requestbodies.py +3 -3
  58. dub/utils/retries.py +69 -5
  59. dub/utils/serializers.py +0 -20
  60. dub/utils/unmarshal_json_response.py +15 -1
  61. dub/workspaces.py +12 -16
  62. {dub-0.32.0.dist-info → dub-0.34.0.dist-info}/METADATA +15 -33
  63. {dub-0.32.0.dist-info → dub-0.34.0.dist-info}/RECORD +65 -67
  64. dub/models/components/clickevent.py +0 -556
  65. dub/models/components/continentcode.py +0 -16
  66. dub/models/components/leadevent.py +0 -680
  67. dub/models/components/saleevent.py +0 -779
  68. dub/models/operations/createcustomer.py +0 -382
  69. {dub-0.32.0.dist-info → dub-0.34.0.dist-info}/WHEEL +0 -0
  70. {dub-0.32.0.dist-info → dub-0.34.0.dist-info}/licenses/LICENSE +0 -0
@@ -26,7 +26,7 @@ class Status(str, Enum):
26
26
  ARCHIVED = "archived"
27
27
 
28
28
 
29
- class PartnerEnrolledEventLinkTypedDict(TypedDict):
29
+ class LinksTypedDict(TypedDict):
30
30
  id: str
31
31
  r"""The unique ID of the short link."""
32
32
  domain: str
@@ -49,7 +49,7 @@ class PartnerEnrolledEventLinkTypedDict(TypedDict):
49
49
  r"""The total dollar value of sales (in cents) generated by the short link."""
50
50
 
51
51
 
52
- class PartnerEnrolledEventLink(BaseModel):
52
+ class Links(BaseModel):
53
53
  id: str
54
54
  r"""The unique ID of the short link."""
55
55
 
@@ -111,6 +111,8 @@ class PartnerEnrolledEventDataTypedDict(TypedDict):
111
111
  r"""The partner's Stripe Connect ID (for receiving payouts via Stripe)."""
112
112
  payouts_enabled_at: Nullable[str]
113
113
  r"""The date when the partner enabled payouts."""
114
+ trusted_at: Nullable[str]
115
+ r"""The date when the partner received the trusted badge in the partner network."""
114
116
  program_id: str
115
117
  r"""The program's unique ID on Dub."""
116
118
  partner_id: str
@@ -120,7 +122,7 @@ class PartnerEnrolledEventDataTypedDict(TypedDict):
120
122
  created_at: str
121
123
  status: Status
122
124
  r"""The status of the partner's enrollment in the program."""
123
- links: Nullable[List[PartnerEnrolledEventLinkTypedDict]]
125
+ links: Nullable[List[LinksTypedDict]]
124
126
  r"""The partner's referral links in this program."""
125
127
  description: NotRequired[Nullable[str]]
126
128
  r"""A brief description of the partner and their background."""
@@ -147,9 +149,21 @@ class PartnerEnrolledEventDataTypedDict(TypedDict):
147
149
  total_sales: NotRequired[float]
148
150
  r"""The total number of sales generated by the partner's links (includes recurring sales)"""
149
151
  total_sale_amount: NotRequired[float]
150
- r"""The total amount of sales (in cents) generated by the partner's links"""
152
+ r"""Total revenue generated by the partner's links"""
151
153
  net_revenue: NotRequired[float]
152
- r"""The total net revenue generated by the partner"""
154
+ r"""Net revenue after commissions (`Total Revenue - Total Commissions`)"""
155
+ earnings_per_click: NotRequired[Nullable[float]]
156
+ r"""Earnings Per Click (EPC) (`Total Revenue ÷ Total Clicks`)"""
157
+ average_lifetime_value: NotRequired[Nullable[float]]
158
+ r"""Average lifetime value for each paying customer (`Total Revenue ÷ Total Conversions`)"""
159
+ click_to_lead_rate: NotRequired[Nullable[float]]
160
+ r"""Percentage of clicks that become leads (`Total Leads ÷ Total Clicks`)"""
161
+ click_to_conversion_rate: NotRequired[Nullable[float]]
162
+ r"""Percentage of clicks that convert to paying customers (`Total Conversions ÷ Total Clicks`)"""
163
+ lead_to_conversion_rate: NotRequired[Nullable[float]]
164
+ r"""Percentage of leads that convert to paying customers (`Total Conversions ÷ Total Leads`)"""
165
+ return_on_ad_spend: NotRequired[Nullable[float]]
166
+ r"""Return On Ad Spend (ROAS) (`Total Revenue ÷ Total Commissions`)"""
153
167
  website: NotRequired[Nullable[str]]
154
168
  r"""The partner's website URL (including the https protocol)."""
155
169
  youtube: NotRequired[Nullable[str]]
@@ -194,6 +208,9 @@ class PartnerEnrolledEventData(BaseModel):
194
208
  ]
195
209
  r"""The date when the partner enabled payouts."""
196
210
 
211
+ trusted_at: Annotated[Nullable[str], pydantic.Field(alias="trustedAt")]
212
+ r"""The date when the partner received the trusted badge in the partner network."""
213
+
197
214
  program_id: Annotated[str, pydantic.Field(alias="programId")]
198
215
  r"""The program's unique ID on Dub."""
199
216
 
@@ -208,7 +225,7 @@ class PartnerEnrolledEventData(BaseModel):
208
225
  status: Status
209
226
  r"""The status of the partner's enrollment in the program."""
210
227
 
211
- links: Nullable[List[PartnerEnrolledEventLink]]
228
+ links: Nullable[List[Links]]
212
229
  r"""The partner's referral links in this program."""
213
230
 
214
231
  description: OptionalNullable[str] = UNSET
@@ -270,10 +287,40 @@ class PartnerEnrolledEventData(BaseModel):
270
287
  total_sale_amount: Annotated[
271
288
  Optional[float], pydantic.Field(alias="totalSaleAmount")
272
289
  ] = 0
273
- r"""The total amount of sales (in cents) generated by the partner's links"""
290
+ r"""Total revenue generated by the partner's links"""
274
291
 
275
292
  net_revenue: Annotated[Optional[float], pydantic.Field(alias="netRevenue")] = 0
276
- r"""The total net revenue generated by the partner"""
293
+ r"""Net revenue after commissions (`Total Revenue - Total Commissions`)"""
294
+
295
+ earnings_per_click: Annotated[
296
+ OptionalNullable[float], pydantic.Field(alias="earningsPerClick")
297
+ ] = UNSET
298
+ r"""Earnings Per Click (EPC) (`Total Revenue ÷ Total Clicks`)"""
299
+
300
+ average_lifetime_value: Annotated[
301
+ OptionalNullable[float], pydantic.Field(alias="averageLifetimeValue")
302
+ ] = UNSET
303
+ r"""Average lifetime value for each paying customer (`Total Revenue ÷ Total Conversions`)"""
304
+
305
+ click_to_lead_rate: Annotated[
306
+ OptionalNullable[float], pydantic.Field(alias="clickToLeadRate")
307
+ ] = UNSET
308
+ r"""Percentage of clicks that become leads (`Total Leads ÷ Total Clicks`)"""
309
+
310
+ click_to_conversion_rate: Annotated[
311
+ OptionalNullable[float], pydantic.Field(alias="clickToConversionRate")
312
+ ] = UNSET
313
+ r"""Percentage of clicks that convert to paying customers (`Total Conversions ÷ Total Clicks`)"""
314
+
315
+ lead_to_conversion_rate: Annotated[
316
+ OptionalNullable[float], pydantic.Field(alias="leadToConversionRate")
317
+ ] = UNSET
318
+ r"""Percentage of leads that convert to paying customers (`Total Conversions ÷ Total Leads`)"""
319
+
320
+ return_on_ad_spend: Annotated[
321
+ OptionalNullable[float], pydantic.Field(alias="returnOnAdSpend")
322
+ ] = UNSET
323
+ r"""Return On Ad Spend (ROAS) (`Total Revenue ÷ Total Commissions`)"""
277
324
 
278
325
  website: OptionalNullable[str] = UNSET
279
326
  r"""The partner's website URL (including the https protocol)."""
@@ -312,6 +359,12 @@ class PartnerEnrolledEventData(BaseModel):
312
359
  "totalSales",
313
360
  "totalSaleAmount",
314
361
  "netRevenue",
362
+ "earningsPerClick",
363
+ "averageLifetimeValue",
364
+ "clickToLeadRate",
365
+ "clickToConversionRate",
366
+ "leadToConversionRate",
367
+ "returnOnAdSpend",
315
368
  "website",
316
369
  "youtube",
317
370
  "twitter",
@@ -328,6 +381,7 @@ class PartnerEnrolledEventData(BaseModel):
328
381
  "paypalEmail",
329
382
  "stripeConnectId",
330
383
  "payoutsEnabledAt",
384
+ "trustedAt",
331
385
  "groupId",
332
386
  "tenantId",
333
387
  "links",
@@ -338,6 +392,12 @@ class PartnerEnrolledEventData(BaseModel):
338
392
  "applicationId",
339
393
  "bannedAt",
340
394
  "bannedReason",
395
+ "earningsPerClick",
396
+ "averageLifetimeValue",
397
+ "clickToLeadRate",
398
+ "clickToConversionRate",
399
+ "leadToConversionRate",
400
+ "returnOnAdSpend",
341
401
  "website",
342
402
  "youtube",
343
403
  "twitter",
@@ -207,6 +207,7 @@ class SaleCreatedEventLinkTypedDict(TypedDict):
207
207
  archived: bool
208
208
  expires_at: str
209
209
  expired_url: Nullable[str]
210
+ disabled_at: str
210
211
  password: Nullable[str]
211
212
  r"""The password required to access the destination URL of the short link."""
212
213
  proxy: bool
@@ -249,8 +250,8 @@ class SaleCreatedEventLinkTypedDict(TypedDict):
249
250
  r"""The UTM term of the short link."""
250
251
  utm_content: Nullable[str]
251
252
  r"""The UTM content of the short link."""
252
- test_started_at: Nullable[str]
253
- test_completed_at: Nullable[str]
253
+ test_started_at: str
254
+ test_completed_at: str
254
255
  user_id: Nullable[str]
255
256
  workspace_id: str
256
257
  r"""The workspace ID of the short link."""
@@ -307,6 +308,8 @@ class SaleCreatedEventLink(BaseModel):
307
308
 
308
309
  expired_url: Annotated[Nullable[str], pydantic.Field(alias="expiredUrl")]
309
310
 
311
+ disabled_at: Annotated[str, pydantic.Field(alias="disabledAt")]
312
+
310
313
  password: Nullable[str]
311
314
  r"""The password required to access the destination URL of the short link."""
312
315
 
@@ -372,9 +375,9 @@ class SaleCreatedEventLink(BaseModel):
372
375
  utm_content: Nullable[str]
373
376
  r"""The UTM content of the short link."""
374
377
 
375
- test_started_at: Annotated[Nullable[str], pydantic.Field(alias="testStartedAt")]
378
+ test_started_at: Annotated[str, pydantic.Field(alias="testStartedAt")]
376
379
 
377
- test_completed_at: Annotated[Nullable[str], pydantic.Field(alias="testCompletedAt")]
380
+ test_completed_at: Annotated[str, pydantic.Field(alias="testCompletedAt")]
378
381
 
379
382
  user_id: Annotated[Nullable[str], pydantic.Field(alias="userId")]
380
383
 
@@ -459,8 +462,6 @@ class SaleCreatedEventLink(BaseModel):
459
462
  "utm_term",
460
463
  "utm_content",
461
464
  "testVariants",
462
- "testStartedAt",
463
- "testCompletedAt",
464
465
  "userId",
465
466
  "tagId",
466
467
  ]
@@ -491,14 +492,14 @@ class SaleCreatedEventLink(BaseModel):
491
492
  return m
492
493
 
493
494
 
494
- class SaleCreatedEventSaleTypedDict(TypedDict):
495
+ class SaleTypedDict(TypedDict):
495
496
  amount: float
496
497
  currency: str
497
498
  payment_processor: str
498
499
  invoice_id: Nullable[str]
499
500
 
500
501
 
501
- class SaleCreatedEventSale(BaseModel):
502
+ class Sale(BaseModel):
502
503
  amount: float
503
504
 
504
505
  currency: str
@@ -631,9 +632,9 @@ class SaleCreatedEventDataTypedDict(TypedDict):
631
632
  customer: SaleCreatedEventCustomerTypedDict
632
633
  click: SaleCreatedEventClickTypedDict
633
634
  link: SaleCreatedEventLinkTypedDict
634
- sale: SaleCreatedEventSaleTypedDict
635
- metadata: Nullable[Dict[str, Any]]
635
+ sale: SaleTypedDict
636
636
  partner: NotRequired[Nullable[SaleCreatedEventPartnerTypedDict]]
637
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
637
638
 
638
639
 
639
640
  class SaleCreatedEventData(BaseModel):
@@ -645,15 +646,15 @@ class SaleCreatedEventData(BaseModel):
645
646
 
646
647
  link: SaleCreatedEventLink
647
648
 
648
- sale: SaleCreatedEventSale
649
-
650
- metadata: Nullable[Dict[str, Any]]
649
+ sale: Sale
651
650
 
652
651
  partner: OptionalNullable[SaleCreatedEventPartner] = UNSET
653
652
 
653
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
654
+
654
655
  @model_serializer(mode="wrap")
655
656
  def serialize_model(self, handler):
656
- optional_fields = ["partner"]
657
+ optional_fields = ["partner", "metadata"]
657
658
  nullable_fields = ["partner", "metadata"]
658
659
  null_default_fields = []
659
660
 
@@ -8,6 +8,10 @@ from .commissioncreatedevent import (
8
8
  from .leadcreatedevent import LeadCreatedEvent, LeadCreatedEventTypedDict
9
9
  from .linkclickedevent import LinkClickedEvent, LinkClickedEventTypedDict
10
10
  from .linkwebhookevent import LinkWebhookEvent, LinkWebhookEventTypedDict
11
+ from .partnerapplicationsubmittedevent import (
12
+ PartnerApplicationSubmittedEvent,
13
+ PartnerApplicationSubmittedEventTypedDict,
14
+ )
11
15
  from .partnerenrolledevent import PartnerEnrolledEvent, PartnerEnrolledEventTypedDict
12
16
  from .salecreatedevent import SaleCreatedEvent, SaleCreatedEventTypedDict
13
17
  from typing import Union
@@ -22,6 +26,7 @@ WebhookEventTypedDict = TypeAliasType(
22
26
  LeadCreatedEventTypedDict,
23
27
  SaleCreatedEventTypedDict,
24
28
  PartnerEnrolledEventTypedDict,
29
+ PartnerApplicationSubmittedEventTypedDict,
25
30
  CommissionCreatedEventTypedDict,
26
31
  ],
27
32
  )
@@ -36,6 +41,7 @@ WebhookEvent = TypeAliasType(
36
41
  LeadCreatedEvent,
37
42
  SaleCreatedEvent,
38
43
  PartnerEnrolledEvent,
44
+ PartnerApplicationSubmittedEvent,
39
45
  CommissionCreatedEvent,
40
46
  ],
41
47
  )
@@ -105,6 +105,8 @@ class WorkspaceSchemaTypedDict(TypedDict):
105
105
  r"""The invite code of the workspace."""
106
106
  plan: Plan
107
107
  r"""The plan of the workspace."""
108
+ plan_tier: Nullable[float]
109
+ r"""The tier of the workspace's plan."""
108
110
  stripe_id: Nullable[str]
109
111
  r"""The Stripe ID of the workspace."""
110
112
  billing_cycle_start: float
@@ -185,6 +187,9 @@ class WorkspaceSchema(BaseModel):
185
187
  plan: Plan
186
188
  r"""The plan of the workspace."""
187
189
 
190
+ plan_tier: Annotated[Nullable[float], pydantic.Field(alias="planTier")]
191
+ r"""The tier of the workspace's plan."""
192
+
188
193
  stripe_id: Annotated[Nullable[str], pydantic.Field(alias="stripeId")]
189
194
  r"""The Stripe ID of the workspace."""
190
195
 
@@ -287,6 +292,7 @@ class WorkspaceSchema(BaseModel):
287
292
  nullable_fields = [
288
293
  "logo",
289
294
  "inviteCode",
295
+ "planTier",
290
296
  "stripeId",
291
297
  "paymentFailedAt",
292
298
  "stripeConnectId",