dub 0.34.1__py3-none-any.whl → 0.35.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 (93) hide show
  1. dub/_version.py +3 -3
  2. dub/basesdk.py +20 -6
  3. dub/models/components/__init__.py +108 -26
  4. dub/models/components/analyticsbrowsers.py +18 -1
  5. dub/models/components/analyticscities.py +18 -1
  6. dub/models/components/analyticscontinents.py +18 -1
  7. dub/models/components/analyticscount.py +18 -1
  8. dub/models/components/analyticscountries.py +20 -1
  9. dub/models/components/analyticsdevices.py +18 -1
  10. dub/models/components/analyticsos.py +18 -1
  11. dub/models/components/analyticsreferers.py +18 -1
  12. dub/models/components/analyticsrefererurls.py +18 -1
  13. dub/models/components/analyticsregions.py +18 -1
  14. dub/models/components/analyticstimeseries.py +18 -1
  15. dub/models/components/analyticstoplinks.py +16 -26
  16. dub/models/components/analyticstopurls.py +18 -1
  17. dub/models/components/analyticstriggers.py +18 -1
  18. dub/models/components/commissioncreatedevent.py +96 -64
  19. dub/models/components/domainschema.py +31 -50
  20. dub/models/components/folderschema.py +18 -19
  21. dub/models/components/leadcreatedevent.py +151 -134
  22. dub/models/components/linkclickedevent.py +57 -70
  23. dub/models/components/linkschema.py +63 -64
  24. dub/models/components/linkwebhookevent.py +43 -51
  25. dub/models/components/partneranalyticscount.py +18 -1
  26. dub/models/components/partneranalyticstimeseries.py +18 -1
  27. dub/models/components/partneranalyticstoplinks.py +16 -27
  28. dub/models/components/partnerapplicationsubmittedevent.py +42 -75
  29. dub/models/components/partnerenrolledevent.py +477 -83
  30. dub/models/components/salecreatedevent.py +152 -151
  31. dub/models/errors/badrequest.py +18 -1
  32. dub/models/errors/conflict.py +18 -1
  33. dub/models/errors/forbidden.py +18 -1
  34. dub/models/errors/internalservererror.py +18 -1
  35. dub/models/errors/inviteexpired.py +18 -1
  36. dub/models/errors/notfound.py +18 -1
  37. dub/models/errors/ratelimitexceeded.py +18 -1
  38. dub/models/errors/unauthorized.py +18 -1
  39. dub/models/errors/unprocessableentity.py +18 -1
  40. dub/models/operations/__init__.py +230 -19
  41. dub/models/operations/approvebountysubmission.py +71 -45
  42. dub/models/operations/banpartner.py +14 -19
  43. dub/models/operations/bulkcreatelinks.py +86 -87
  44. dub/models/operations/bulkupdatelinks.py +97 -82
  45. dub/models/operations/checkdomainstatus.py +1 -17
  46. dub/models/operations/createdomain.py +33 -34
  47. dub/models/operations/createfolder.py +18 -19
  48. dub/models/operations/createlink.py +86 -87
  49. dub/models/operations/createpartner.py +560 -168
  50. dub/models/operations/createpartnerlink.py +74 -85
  51. dub/models/operations/createreferralsembedtoken.py +99 -87
  52. dub/models/operations/createtag.py +18 -1
  53. dub/models/operations/deactivatepartner.py +65 -0
  54. dub/models/operations/getcustomer.py +106 -105
  55. dub/models/operations/getcustomers.py +123 -105
  56. dub/models/operations/getlinkinfo.py +18 -1
  57. dub/models/operations/getlinks.py +36 -1
  58. dub/models/operations/getlinkscount.py +32 -1
  59. dub/models/operations/getqrcode.py +29 -1
  60. dub/models/operations/gettags.py +20 -1
  61. dub/models/operations/listbountysubmissions.py +63 -26
  62. dub/models/operations/listcommissions.py +129 -64
  63. dub/models/operations/listdomains.py +18 -1
  64. dub/models/operations/listevents.py +414 -389
  65. dub/models/operations/listfolders.py +18 -1
  66. dub/models/operations/listpartners.py +510 -84
  67. dub/models/operations/registerdomain.py +1 -17
  68. dub/models/operations/rejectbountysubmission.py +71 -26
  69. dub/models/operations/retrieveanalytics.py +65 -66
  70. dub/models/operations/retrievelinks.py +30 -19
  71. dub/models/operations/retrievepartneranalytics.py +25 -28
  72. dub/models/operations/tracklead.py +38 -83
  73. dub/models/operations/tracksale.py +52 -95
  74. dub/models/operations/updatecommission.py +126 -64
  75. dub/models/operations/updatecustomer.py +122 -131
  76. dub/models/operations/updatedomain.py +50 -35
  77. dub/models/operations/updatefolder.py +34 -19
  78. dub/models/operations/updatelink.py +101 -86
  79. dub/models/operations/updatetag.py +34 -1
  80. dub/models/operations/upsertlink.py +86 -87
  81. dub/models/operations/upsertpartnerlink.py +72 -78
  82. dub/partners.py +288 -0
  83. dub/sdk.py +0 -3
  84. dub/utils/__init__.py +10 -1
  85. {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/METADATA +4 -8
  86. dub-0.35.0.dist-info/RECORD +143 -0
  87. dub/models/components/workspaceschema.py +0 -328
  88. dub/models/operations/getworkspace.py +0 -21
  89. dub/models/operations/updateworkspace.py +0 -78
  90. dub/workspaces.py +0 -561
  91. dub-0.34.1.dist-info/RECORD +0 -146
  92. {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/WHEEL +0 -0
  93. {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/licenses/LICENSE +0 -0
@@ -17,36 +17,42 @@ class SaleCreatedEventEvent(str, Enum):
17
17
  class SaleCreatedEventCustomerTypedDict(TypedDict):
18
18
  id: str
19
19
  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`)."""
20
- external_id: str
21
- r"""Unique identifier for the customer in the client's app."""
22
20
  name: str
23
21
  r"""Name of the customer."""
22
+ external_id: str
23
+ r"""Unique identifier for the customer in the client's app."""
24
24
  created_at: str
25
- r"""The date the customer was created."""
25
+ r"""The date the customer was created (usually the signup date or trial start date)."""
26
26
  email: NotRequired[Nullable[str]]
27
27
  r"""Email of the customer."""
28
28
  avatar: NotRequired[Nullable[str]]
29
29
  r"""Avatar URL of the customer."""
30
+ stripe_customer_id: NotRequired[Nullable[str]]
31
+ r"""The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer."""
30
32
  country: NotRequired[Nullable[str]]
31
33
  r"""Country of the customer."""
32
34
  sales: NotRequired[Nullable[float]]
33
35
  r"""Total number of sales for the customer."""
34
36
  sale_amount: NotRequired[Nullable[float]]
35
37
  r"""Total amount of sales for the customer."""
38
+ first_sale_at: NotRequired[Nullable[str]]
39
+ r"""The date the customer made their first sale. Useful for calculating the time to first sale and LTV."""
40
+ subscription_canceled_at: NotRequired[Nullable[str]]
41
+ r"""The date the customer canceled their subscription. Useful for calculating LTV and churn rate."""
36
42
 
37
43
 
38
44
  class SaleCreatedEventCustomer(BaseModel):
39
45
  id: str
40
46
  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`)."""
41
47
 
42
- external_id: Annotated[str, pydantic.Field(alias="externalId")]
43
- r"""Unique identifier for the customer in the client's app."""
44
-
45
48
  name: str
46
49
  r"""Name of the customer."""
47
50
 
51
+ external_id: Annotated[str, pydantic.Field(alias="externalId")]
52
+ r"""Unique identifier for the customer in the client's app."""
53
+
48
54
  created_at: Annotated[str, pydantic.Field(alias="createdAt")]
49
- r"""The date the customer was created."""
55
+ r"""The date the customer was created (usually the signup date or trial start date)."""
50
56
 
51
57
  email: OptionalNullable[str] = UNSET
52
58
  r"""Email of the customer."""
@@ -54,6 +60,11 @@ class SaleCreatedEventCustomer(BaseModel):
54
60
  avatar: OptionalNullable[str] = UNSET
55
61
  r"""Avatar URL of the customer."""
56
62
 
63
+ stripe_customer_id: Annotated[
64
+ OptionalNullable[str], pydantic.Field(alias="stripeCustomerId")
65
+ ] = UNSET
66
+ r"""The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer."""
67
+
57
68
  country: OptionalNullable[str] = UNSET
58
69
  r"""Country of the customer."""
59
70
 
@@ -65,33 +76,60 @@ class SaleCreatedEventCustomer(BaseModel):
65
76
  ] = UNSET
66
77
  r"""Total amount of sales for the customer."""
67
78
 
79
+ first_sale_at: Annotated[
80
+ OptionalNullable[str], pydantic.Field(alias="firstSaleAt")
81
+ ] = UNSET
82
+ r"""The date the customer made their first sale. Useful for calculating the time to first sale and LTV."""
83
+
84
+ subscription_canceled_at: Annotated[
85
+ OptionalNullable[str], pydantic.Field(alias="subscriptionCanceledAt")
86
+ ] = UNSET
87
+ r"""The date the customer canceled their subscription. Useful for calculating LTV and churn rate."""
88
+
68
89
  @model_serializer(mode="wrap")
69
90
  def serialize_model(self, handler):
70
- optional_fields = ["email", "avatar", "country", "sales", "saleAmount"]
71
- nullable_fields = ["email", "avatar", "country", "sales", "saleAmount"]
72
- null_default_fields = []
73
-
91
+ optional_fields = set(
92
+ [
93
+ "email",
94
+ "avatar",
95
+ "stripeCustomerId",
96
+ "country",
97
+ "sales",
98
+ "saleAmount",
99
+ "firstSaleAt",
100
+ "subscriptionCanceledAt",
101
+ ]
102
+ )
103
+ nullable_fields = set(
104
+ [
105
+ "email",
106
+ "avatar",
107
+ "stripeCustomerId",
108
+ "country",
109
+ "sales",
110
+ "saleAmount",
111
+ "firstSaleAt",
112
+ "subscriptionCanceledAt",
113
+ ]
114
+ )
74
115
  serialized = handler(self)
75
-
76
116
  m = {}
77
117
 
78
118
  for n, f in type(self).model_fields.items():
79
119
  k = f.alias or n
80
120
  val = serialized.get(k)
81
- serialized.pop(k, None)
82
-
83
- optional_nullable = k in optional_fields and k in nullable_fields
84
- is_set = (
85
- self.__pydantic_fields_set__.intersection({n})
86
- or k in null_default_fields
87
- ) # pylint: disable=no-member
88
-
89
- if val is not None and val != UNSET_SENTINEL:
90
- m[k] = val
91
- elif val != UNSET_SENTINEL and (
92
- not k in optional_fields or (optional_nullable and is_set)
93
- ):
94
- m[k] = val
121
+ is_nullable_and_explicitly_set = (
122
+ k in nullable_fields
123
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
124
+ )
125
+
126
+ if val != UNSET_SENTINEL:
127
+ if (
128
+ val is not None
129
+ or k not in optional_fields
130
+ or is_nullable_and_explicitly_set
131
+ ):
132
+ m[k] = val
95
133
 
96
134
  return m
97
135
 
@@ -147,31 +185,26 @@ class SaleCreatedEventClick(BaseModel):
147
185
 
148
186
  @model_serializer(mode="wrap")
149
187
  def serialize_model(self, handler):
150
- optional_fields = ["trigger"]
151
- nullable_fields = ["trigger"]
152
- null_default_fields = []
153
-
188
+ optional_fields = set(["trigger"])
189
+ nullable_fields = set(["trigger"])
154
190
  serialized = handler(self)
155
-
156
191
  m = {}
157
192
 
158
193
  for n, f in type(self).model_fields.items():
159
194
  k = f.alias or n
160
195
  val = serialized.get(k)
161
- serialized.pop(k, None)
162
-
163
- optional_nullable = k in optional_fields and k in nullable_fields
164
- is_set = (
165
- self.__pydantic_fields_set__.intersection({n})
166
- or k in null_default_fields
167
- ) # pylint: disable=no-member
168
-
169
- if val is not None and val != UNSET_SENTINEL:
170
- m[k] = val
171
- elif val != UNSET_SENTINEL and (
172
- not k in optional_fields or (optional_nullable and is_set)
173
- ):
174
- m[k] = val
196
+ is_nullable_and_explicitly_set = (
197
+ k in nullable_fields
198
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
199
+ )
200
+
201
+ if val != UNSET_SENTINEL:
202
+ if (
203
+ val is not None
204
+ or k not in optional_fields
205
+ or is_nullable_and_explicitly_set
206
+ ):
207
+ m[k] = val
175
208
 
176
209
  return m
177
210
 
@@ -431,63 +464,55 @@ class SaleCreatedEventLink(BaseModel):
431
464
 
432
465
  @model_serializer(mode="wrap")
433
466
  def serialize_model(self, handler):
434
- optional_fields = [
435
- "testVariants",
436
- "clicks",
437
- "leads",
438
- "conversions",
439
- "sales",
440
- "saleAmount",
441
- ]
442
- nullable_fields = [
443
- "externalId",
444
- "tenantId",
445
- "programId",
446
- "partnerId",
447
- "expiredUrl",
448
- "password",
449
- "title",
450
- "description",
451
- "image",
452
- "video",
453
- "ios",
454
- "android",
455
- "geo",
456
- "tags",
457
- "folderId",
458
- "comments",
459
- "utm_source",
460
- "utm_medium",
461
- "utm_campaign",
462
- "utm_term",
463
- "utm_content",
464
- "testVariants",
465
- "userId",
466
- "tagId",
467
- ]
468
- null_default_fields = []
469
-
467
+ optional_fields = set(
468
+ ["testVariants", "clicks", "leads", "conversions", "sales", "saleAmount"]
469
+ )
470
+ nullable_fields = set(
471
+ [
472
+ "externalId",
473
+ "tenantId",
474
+ "programId",
475
+ "partnerId",
476
+ "expiredUrl",
477
+ "password",
478
+ "title",
479
+ "description",
480
+ "image",
481
+ "video",
482
+ "ios",
483
+ "android",
484
+ "geo",
485
+ "tags",
486
+ "folderId",
487
+ "comments",
488
+ "utm_source",
489
+ "utm_medium",
490
+ "utm_campaign",
491
+ "utm_term",
492
+ "utm_content",
493
+ "testVariants",
494
+ "userId",
495
+ "tagId",
496
+ ]
497
+ )
470
498
  serialized = handler(self)
471
-
472
499
  m = {}
473
500
 
474
501
  for n, f in type(self).model_fields.items():
475
502
  k = f.alias or n
476
503
  val = serialized.get(k)
477
- serialized.pop(k, None)
478
-
479
- optional_nullable = k in optional_fields and k in nullable_fields
480
- is_set = (
481
- self.__pydantic_fields_set__.intersection({n})
482
- or k in null_default_fields
483
- ) # pylint: disable=no-member
484
-
485
- if val is not None and val != UNSET_SENTINEL:
486
- m[k] = val
487
- elif val != UNSET_SENTINEL and (
488
- not k in optional_fields or (optional_nullable and is_set)
489
- ):
490
- m[k] = val
504
+ is_nullable_and_explicitly_set = (
505
+ k in nullable_fields
506
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
507
+ )
508
+
509
+ if val != UNSET_SENTINEL:
510
+ if (
511
+ val is not None
512
+ or k not in optional_fields
513
+ or is_nullable_and_explicitly_set
514
+ ):
515
+ m[k] = val
491
516
 
492
517
  return m
493
518
 
@@ -510,30 +535,14 @@ class Sale(BaseModel):
510
535
 
511
536
  @model_serializer(mode="wrap")
512
537
  def serialize_model(self, handler):
513
- optional_fields = []
514
- nullable_fields = ["invoiceId"]
515
- null_default_fields = []
516
-
517
538
  serialized = handler(self)
518
-
519
539
  m = {}
520
540
 
521
541
  for n, f in type(self).model_fields.items():
522
542
  k = f.alias or n
523
543
  val = serialized.get(k)
524
- serialized.pop(k, None)
525
-
526
- optional_nullable = k in optional_fields and k in nullable_fields
527
- is_set = (
528
- self.__pydantic_fields_set__.intersection({n})
529
- or k in null_default_fields
530
- ) # pylint: disable=no-member
531
544
 
532
- if val is not None and val != UNSET_SENTINEL:
533
- m[k] = val
534
- elif val != UNSET_SENTINEL and (
535
- not k in optional_fields or (optional_nullable and is_set)
536
- ):
545
+ if val != UNSET_SENTINEL:
537
546
  m[k] = val
538
547
 
539
548
  return m
@@ -598,31 +607,28 @@ class SaleCreatedEventPartner(BaseModel):
598
607
 
599
608
  @model_serializer(mode="wrap")
600
609
  def serialize_model(self, handler):
601
- optional_fields = ["groupId"]
602
- nullable_fields = ["email", "image", "payoutsEnabledAt", "country", "groupId"]
603
- null_default_fields = []
604
-
610
+ optional_fields = set(["groupId"])
611
+ nullable_fields = set(
612
+ ["email", "image", "payoutsEnabledAt", "country", "groupId"]
613
+ )
605
614
  serialized = handler(self)
606
-
607
615
  m = {}
608
616
 
609
617
  for n, f in type(self).model_fields.items():
610
618
  k = f.alias or n
611
619
  val = serialized.get(k)
612
- serialized.pop(k, None)
613
-
614
- optional_nullable = k in optional_fields and k in nullable_fields
615
- is_set = (
616
- self.__pydantic_fields_set__.intersection({n})
617
- or k in null_default_fields
618
- ) # pylint: disable=no-member
619
-
620
- if val is not None and val != UNSET_SENTINEL:
621
- m[k] = val
622
- elif val != UNSET_SENTINEL and (
623
- not k in optional_fields or (optional_nullable and is_set)
624
- ):
625
- m[k] = val
620
+ is_nullable_and_explicitly_set = (
621
+ k in nullable_fields
622
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
623
+ )
624
+
625
+ if val != UNSET_SENTINEL:
626
+ if (
627
+ val is not None
628
+ or k not in optional_fields
629
+ or is_nullable_and_explicitly_set
630
+ ):
631
+ m[k] = val
626
632
 
627
633
  return m
628
634
 
@@ -654,31 +660,26 @@ class SaleCreatedEventData(BaseModel):
654
660
 
655
661
  @model_serializer(mode="wrap")
656
662
  def serialize_model(self, handler):
657
- optional_fields = ["partner", "metadata"]
658
- nullable_fields = ["partner", "metadata"]
659
- null_default_fields = []
660
-
663
+ optional_fields = set(["partner", "metadata"])
664
+ nullable_fields = set(["partner", "metadata"])
661
665
  serialized = handler(self)
662
-
663
666
  m = {}
664
667
 
665
668
  for n, f in type(self).model_fields.items():
666
669
  k = f.alias or n
667
670
  val = serialized.get(k)
668
- serialized.pop(k, None)
669
-
670
- optional_nullable = k in optional_fields and k in nullable_fields
671
- is_set = (
672
- self.__pydantic_fields_set__.intersection({n})
673
- or k in null_default_fields
674
- ) # pylint: disable=no-member
675
-
676
- if val is not None and val != UNSET_SENTINEL:
677
- m[k] = val
678
- elif val != UNSET_SENTINEL and (
679
- not k in optional_fields or (optional_nullable and is_set)
680
- ):
681
- m[k] = val
671
+ is_nullable_and_explicitly_set = (
672
+ k in nullable_fields
673
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
674
+ )
675
+
676
+ if val != UNSET_SENTINEL:
677
+ if (
678
+ val is not None
679
+ or k not in optional_fields
680
+ or is_nullable_and_explicitly_set
681
+ ):
682
+ m[k] = val
682
683
 
683
684
  return m
684
685
 
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class Error(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class BadRequestData(BaseModel):
40
57
  error: Error
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class ConflictError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class ConflictData(BaseModel):
40
57
  error: ConflictError
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class ForbiddenError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class ForbiddenData(BaseModel):
40
57
  error: ForbiddenError
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class InternalServerErrorError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class InternalServerErrorData(BaseModel):
40
57
  error: InternalServerErrorError
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class InviteExpiredError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class InviteExpiredData(BaseModel):
40
57
  error: InviteExpiredError
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class NotFoundError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class NotFoundData(BaseModel):
40
57
  error: NotFoundError
@@ -3,9 +3,10 @@
3
3
  from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from dub.models.errors import DubError
6
- from dub.types import BaseModel
6
+ from dub.types import BaseModel, UNSET_SENTINEL
7
7
  from enum import Enum
8
8
  import httpx
9
+ from pydantic import model_serializer
9
10
  from typing import Optional
10
11
  from typing_extensions import NotRequired, TypedDict
11
12
 
@@ -35,6 +36,22 @@ class RateLimitExceededError(BaseModel):
35
36
  doc_url: Optional[str] = None
36
37
  r"""A link to our documentation with more details about this error code"""
37
38
 
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = set(["doc_url"])
42
+ serialized = handler(self)
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+
49
+ if val != UNSET_SENTINEL:
50
+ if val is not None or k not in optional_fields:
51
+ m[k] = val
52
+
53
+ return m
54
+
38
55
 
39
56
  class RateLimitExceededData(BaseModel):
40
57
  error: RateLimitExceededError