dub 0.24.0__py3-none-any.whl → 0.24.1__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.
@@ -67,6 +67,7 @@ from .createpartner import (
67
67
  CreatePartnerRequestBodyTypedDict,
68
68
  CreatePartnerResponseBody,
69
69
  CreatePartnerResponseBodyTypedDict,
70
+ CreatePartnerStatus,
70
71
  CreatePartnerTagIds,
71
72
  CreatePartnerTagIdsTypedDict,
72
73
  CreatePartnerTagNames,
@@ -75,7 +76,6 @@ from .createpartner import (
75
76
  CreatePartnerTestVariantsTypedDict,
76
77
  LinkProps,
77
78
  LinkPropsTypedDict,
78
- Status,
79
79
  )
80
80
  from .createpartnerlink import (
81
81
  CreatePartnerLinkLinkProps,
@@ -203,6 +203,19 @@ from .gettags import (
203
203
  IdsTypedDict,
204
204
  )
205
205
  from .getworkspace import GetWorkspaceRequest, GetWorkspaceRequestTypedDict
206
+ from .listcommissions import (
207
+ ListCommissionsQueryParamInterval,
208
+ ListCommissionsQueryParamSortBy,
209
+ ListCommissionsQueryParamSortOrder,
210
+ ListCommissionsRequest,
211
+ ListCommissionsRequestTypedDict,
212
+ ListCommissionsResponseBody,
213
+ ListCommissionsResponseBodyTypedDict,
214
+ ListCommissionsStatus,
215
+ ListCommissionsType,
216
+ QueryParamStatus,
217
+ Type,
218
+ )
206
219
  from .listdomains import (
207
220
  ListDomainsRequest,
208
221
  ListDomainsRequestTypedDict,
@@ -272,6 +285,17 @@ from .tracksale import (
272
285
  TrackSaleResponseBody,
273
286
  TrackSaleResponseBodyTypedDict,
274
287
  )
288
+ from .updatecommission import (
289
+ Status,
290
+ UpdateCommissionRequest,
291
+ UpdateCommissionRequestBody,
292
+ UpdateCommissionRequestBodyTypedDict,
293
+ UpdateCommissionRequestTypedDict,
294
+ UpdateCommissionResponseBody,
295
+ UpdateCommissionResponseBodyTypedDict,
296
+ UpdateCommissionStatus,
297
+ UpdateCommissionType,
298
+ )
275
299
  from .updatecustomer import (
276
300
  UpdateCustomerDiscount,
277
301
  UpdateCustomerDiscountTypedDict,
@@ -312,14 +336,6 @@ from .updatelink import (
312
336
  UpdateLinkTestVariants,
313
337
  UpdateLinkTestVariantsTypedDict,
314
338
  )
315
- from .updatepartnersale import (
316
- Type,
317
- UpdatePartnerSaleRequestBody,
318
- UpdatePartnerSaleRequestBodyTypedDict,
319
- UpdatePartnerSaleResponseBody,
320
- UpdatePartnerSaleResponseBodyTypedDict,
321
- UpdatePartnerSaleStatus,
322
- )
323
339
  from .updatetag import (
324
340
  UpdateTagColor,
325
341
  UpdateTagRequest,
@@ -414,6 +430,7 @@ __all__ = [
414
430
  "CreatePartnerRequestBodyTypedDict",
415
431
  "CreatePartnerResponseBody",
416
432
  "CreatePartnerResponseBodyTypedDict",
433
+ "CreatePartnerStatus",
417
434
  "CreatePartnerTagIds",
418
435
  "CreatePartnerTagIdsTypedDict",
419
436
  "CreatePartnerTagNames",
@@ -515,6 +532,15 @@ __all__ = [
515
532
  "LinkProps",
516
533
  "LinkPropsTypedDict",
517
534
  "LinkTypedDict",
535
+ "ListCommissionsQueryParamInterval",
536
+ "ListCommissionsQueryParamSortBy",
537
+ "ListCommissionsQueryParamSortOrder",
538
+ "ListCommissionsRequest",
539
+ "ListCommissionsRequestTypedDict",
540
+ "ListCommissionsResponseBody",
541
+ "ListCommissionsResponseBodyTypedDict",
542
+ "ListCommissionsStatus",
543
+ "ListCommissionsType",
518
544
  "ListDomainsRequest",
519
545
  "ListDomainsRequestTypedDict",
520
546
  "ListDomainsResponse",
@@ -538,6 +564,7 @@ __all__ = [
538
564
  "QueryParamInterval",
539
565
  "QueryParamSortBy",
540
566
  "QueryParamSortOrder",
567
+ "QueryParamStatus",
541
568
  "QueryParamTagIds",
542
569
  "QueryParamTagIdsTypedDict",
543
570
  "QueryParamTagNames",
@@ -587,6 +614,14 @@ __all__ = [
587
614
  "Trigger",
588
615
  "Two",
589
616
  "Type",
617
+ "UpdateCommissionRequest",
618
+ "UpdateCommissionRequestBody",
619
+ "UpdateCommissionRequestBodyTypedDict",
620
+ "UpdateCommissionRequestTypedDict",
621
+ "UpdateCommissionResponseBody",
622
+ "UpdateCommissionResponseBodyTypedDict",
623
+ "UpdateCommissionStatus",
624
+ "UpdateCommissionType",
590
625
  "UpdateCustomerDiscount",
591
626
  "UpdateCustomerDiscountTypedDict",
592
627
  "UpdateCustomerLink",
@@ -619,11 +654,6 @@ __all__ = [
619
654
  "UpdateLinkTagNamesTypedDict",
620
655
  "UpdateLinkTestVariants",
621
656
  "UpdateLinkTestVariantsTypedDict",
622
- "UpdatePartnerSaleRequestBody",
623
- "UpdatePartnerSaleRequestBodyTypedDict",
624
- "UpdatePartnerSaleResponseBody",
625
- "UpdatePartnerSaleResponseBodyTypedDict",
626
- "UpdatePartnerSaleStatus",
627
657
  "UpdateTagColor",
628
658
  "UpdateTagRequest",
629
659
  "UpdateTagRequestBody",
@@ -640,7 +640,7 @@ class CreatePartnerRequestBody(BaseModel):
640
640
  return m
641
641
 
642
642
 
643
- class Status(str, Enum):
643
+ class CreatePartnerStatus(str, Enum):
644
644
  r"""The status of the partner's enrollment in the program."""
645
645
 
646
646
  PENDING = "pending"
@@ -734,7 +734,7 @@ class CreatePartnerResponseBodyTypedDict(TypedDict):
734
734
  r"""The date when the partner enabled payouts."""
735
735
  created_at: str
736
736
  r"""The date when the partner was created on Dub."""
737
- status: Status
737
+ status: CreatePartnerStatus
738
738
  r"""The status of the partner's enrollment in the program."""
739
739
  program_id: str
740
740
  r"""The program's unique ID on Dub."""
@@ -808,7 +808,7 @@ class CreatePartnerResponseBody(BaseModel):
808
808
  created_at: Annotated[str, pydantic.Field(alias="createdAt")]
809
809
  r"""The date when the partner was created on Dub."""
810
810
 
811
- status: Status
811
+ status: CreatePartnerStatus
812
812
  r"""The status of the partner's enrollment in the program."""
813
813
 
814
814
  program_id: Annotated[str, pydantic.Field(alias="programId")]
@@ -0,0 +1,252 @@
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 dub.utils import FieldMetadata, QueryParamMetadata
6
+ from enum import Enum
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from typing import Optional
10
+ from typing_extensions import Annotated, NotRequired, TypedDict
11
+
12
+
13
+ class Type(str, Enum):
14
+ CLICK = "click"
15
+ LEAD = "lead"
16
+ SALE = "sale"
17
+
18
+
19
+ class QueryParamStatus(str, Enum):
20
+ r"""Filter the list of commissions by their corresponding status."""
21
+
22
+ PENDING = "pending"
23
+ PROCESSED = "processed"
24
+ PAID = "paid"
25
+ REFUNDED = "refunded"
26
+ DUPLICATE = "duplicate"
27
+ FRAUD = "fraud"
28
+ CANCELED = "canceled"
29
+
30
+
31
+ class ListCommissionsQueryParamSortBy(str, Enum):
32
+ r"""The field to sort the list of commissions by."""
33
+
34
+ CREATED_AT = "createdAt"
35
+ AMOUNT = "amount"
36
+
37
+
38
+ class ListCommissionsQueryParamSortOrder(str, Enum):
39
+ r"""The sort order for the list of commissions."""
40
+
41
+ ASC = "asc"
42
+ DESC = "desc"
43
+
44
+
45
+ class ListCommissionsQueryParamInterval(str, Enum):
46
+ r"""The interval to retrieve commissions for."""
47
+
48
+ TWENTY_FOURH = "24h"
49
+ SEVEND = "7d"
50
+ THIRTYD = "30d"
51
+ NINETYD = "90d"
52
+ ONEY = "1y"
53
+ MTD = "mtd"
54
+ QTD = "qtd"
55
+ YTD = "ytd"
56
+ ALL = "all"
57
+
58
+
59
+ class ListCommissionsRequestTypedDict(TypedDict):
60
+ type: NotRequired[Type]
61
+ customer_id: NotRequired[str]
62
+ r"""Filter the list of commissions by the associated customer."""
63
+ payout_id: NotRequired[str]
64
+ r"""Filter the list of commissions by the associated payout."""
65
+ partner_id: NotRequired[str]
66
+ r"""Filter the list of commissions by the associated partner."""
67
+ invoice_id: NotRequired[str]
68
+ r"""Filter the list of commissions by the associated invoice. Since invoiceId is unique on a per-program basis, this will only return one commission per invoice."""
69
+ status: NotRequired[QueryParamStatus]
70
+ r"""Filter the list of commissions by their corresponding status."""
71
+ sort_by: NotRequired[ListCommissionsQueryParamSortBy]
72
+ r"""The field to sort the list of commissions by."""
73
+ sort_order: NotRequired[ListCommissionsQueryParamSortOrder]
74
+ r"""The sort order for the list of commissions."""
75
+ interval: NotRequired[ListCommissionsQueryParamInterval]
76
+ r"""The interval to retrieve commissions for."""
77
+ start: NotRequired[str]
78
+ r"""The start date of the date range to filter the commissions by."""
79
+ end: NotRequired[str]
80
+ r"""The end date of the date range to filter the commissions by."""
81
+ page: NotRequired[float]
82
+ r"""The page number for pagination."""
83
+ page_size: NotRequired[float]
84
+ r"""The number of items per page."""
85
+
86
+
87
+ class ListCommissionsRequest(BaseModel):
88
+ type: Annotated[
89
+ Optional[Type],
90
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
91
+ ] = None
92
+
93
+ customer_id: Annotated[
94
+ Optional[str],
95
+ pydantic.Field(alias="customerId"),
96
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
97
+ ] = None
98
+ r"""Filter the list of commissions by the associated customer."""
99
+
100
+ payout_id: Annotated[
101
+ Optional[str],
102
+ pydantic.Field(alias="payoutId"),
103
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
104
+ ] = None
105
+ r"""Filter the list of commissions by the associated payout."""
106
+
107
+ partner_id: Annotated[
108
+ Optional[str],
109
+ pydantic.Field(alias="partnerId"),
110
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
111
+ ] = None
112
+ r"""Filter the list of commissions by the associated partner."""
113
+
114
+ invoice_id: Annotated[
115
+ Optional[str],
116
+ pydantic.Field(alias="invoiceId"),
117
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
118
+ ] = None
119
+ r"""Filter the list of commissions by the associated invoice. Since invoiceId is unique on a per-program basis, this will only return one commission per invoice."""
120
+
121
+ status: Annotated[
122
+ Optional[QueryParamStatus],
123
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
124
+ ] = None
125
+ r"""Filter the list of commissions by their corresponding status."""
126
+
127
+ sort_by: Annotated[
128
+ Optional[ListCommissionsQueryParamSortBy],
129
+ pydantic.Field(alias="sortBy"),
130
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
131
+ ] = ListCommissionsQueryParamSortBy.CREATED_AT
132
+ r"""The field to sort the list of commissions by."""
133
+
134
+ sort_order: Annotated[
135
+ Optional[ListCommissionsQueryParamSortOrder],
136
+ pydantic.Field(alias="sortOrder"),
137
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
138
+ ] = ListCommissionsQueryParamSortOrder.DESC
139
+ r"""The sort order for the list of commissions."""
140
+
141
+ interval: Annotated[
142
+ Optional[ListCommissionsQueryParamInterval],
143
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
144
+ ] = ListCommissionsQueryParamInterval.ALL
145
+ r"""The interval to retrieve commissions for."""
146
+
147
+ start: Annotated[
148
+ Optional[str],
149
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
150
+ ] = None
151
+ r"""The start date of the date range to filter the commissions by."""
152
+
153
+ end: Annotated[
154
+ Optional[str],
155
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
156
+ ] = None
157
+ r"""The end date of the date range to filter the commissions by."""
158
+
159
+ page: Annotated[
160
+ Optional[float],
161
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
162
+ ] = 1
163
+ r"""The page number for pagination."""
164
+
165
+ page_size: Annotated[
166
+ Optional[float],
167
+ pydantic.Field(alias="pageSize"),
168
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
169
+ ] = 100
170
+ r"""The number of items per page."""
171
+
172
+
173
+ class ListCommissionsType(str, Enum):
174
+ CLICK = "click"
175
+ LEAD = "lead"
176
+ SALE = "sale"
177
+
178
+
179
+ class ListCommissionsStatus(str, Enum):
180
+ PENDING = "pending"
181
+ PROCESSED = "processed"
182
+ PAID = "paid"
183
+ REFUNDED = "refunded"
184
+ DUPLICATE = "duplicate"
185
+ FRAUD = "fraud"
186
+ CANCELED = "canceled"
187
+
188
+
189
+ class ListCommissionsResponseBodyTypedDict(TypedDict):
190
+ id: str
191
+ r"""The commission's unique ID on Dub."""
192
+ amount: float
193
+ earnings: float
194
+ currency: str
195
+ status: ListCommissionsStatus
196
+ created_at: str
197
+ updated_at: str
198
+ type: NotRequired[ListCommissionsType]
199
+ invoice_id: NotRequired[Nullable[str]]
200
+
201
+
202
+ class ListCommissionsResponseBody(BaseModel):
203
+ id: str
204
+ r"""The commission's unique ID on Dub."""
205
+
206
+ amount: float
207
+
208
+ earnings: float
209
+
210
+ currency: str
211
+
212
+ status: ListCommissionsStatus
213
+
214
+ created_at: Annotated[str, pydantic.Field(alias="createdAt")]
215
+
216
+ updated_at: Annotated[str, pydantic.Field(alias="updatedAt")]
217
+
218
+ type: Optional[ListCommissionsType] = None
219
+
220
+ invoice_id: Annotated[OptionalNullable[str], pydantic.Field(alias="invoiceId")] = (
221
+ UNSET
222
+ )
223
+
224
+ @model_serializer(mode="wrap")
225
+ def serialize_model(self, handler):
226
+ optional_fields = ["type", "invoiceId"]
227
+ nullable_fields = ["invoiceId"]
228
+ null_default_fields = []
229
+
230
+ serialized = handler(self)
231
+
232
+ m = {}
233
+
234
+ for n, f in type(self).model_fields.items():
235
+ k = f.alias or n
236
+ val = serialized.get(k)
237
+ serialized.pop(k, None)
238
+
239
+ optional_nullable = k in optional_fields and k in nullable_fields
240
+ is_set = (
241
+ self.__pydantic_fields_set__.intersection({n})
242
+ or k in null_default_fields
243
+ ) # pylint: disable=no-member
244
+
245
+ if val is not None and val != UNSET_SENTINEL:
246
+ m[k] = val
247
+ elif val != UNSET_SENTINEL and (
248
+ not k in optional_fields or (optional_nullable and is_set)
249
+ ):
250
+ m[k] = val
251
+
252
+ return m
@@ -0,0 +1,150 @@
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 dub.utils import FieldMetadata, PathParamMetadata, RequestMetadata
6
+ from enum import Enum
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from typing import Optional
10
+ from typing_extensions import Annotated, NotRequired, TypedDict
11
+
12
+
13
+ class Status(str, Enum):
14
+ r"""Useful for marking a commission as refunded, duplicate, canceled, or fraudulent. Takes precedence over `amount` and `modifyAmount`. When a commission is marked as refunded, duplicate, canceled, or fraudulent, it will be omitted from the payout, and the payout amount will be recalculated accordingly. Paid commissions cannot be updated."""
15
+
16
+ REFUNDED = "refunded"
17
+ DUPLICATE = "duplicate"
18
+ CANCELED = "canceled"
19
+ FRAUD = "fraud"
20
+
21
+
22
+ class UpdateCommissionRequestBodyTypedDict(TypedDict):
23
+ amount: NotRequired[float]
24
+ r"""The new absolute amount for the sale. Paid commissions cannot be updated."""
25
+ modify_amount: NotRequired[float]
26
+ r"""Modify the current sale amount: use positive values to increase the amount, negative values to decrease it. Takes precedence over `amount`. Paid commissions cannot be updated."""
27
+ currency: NotRequired[str]
28
+ r"""The currency of the sale amount to update. Accepts ISO 4217 currency codes."""
29
+ status: NotRequired[Status]
30
+ r"""Useful for marking a commission as refunded, duplicate, canceled, or fraudulent. Takes precedence over `amount` and `modifyAmount`. When a commission is marked as refunded, duplicate, canceled, or fraudulent, it will be omitted from the payout, and the payout amount will be recalculated accordingly. Paid commissions cannot be updated."""
31
+
32
+
33
+ class UpdateCommissionRequestBody(BaseModel):
34
+ amount: Optional[float] = None
35
+ r"""The new absolute amount for the sale. Paid commissions cannot be updated."""
36
+
37
+ modify_amount: Annotated[Optional[float], pydantic.Field(alias="modifyAmount")] = (
38
+ None
39
+ )
40
+ r"""Modify the current sale amount: use positive values to increase the amount, negative values to decrease it. Takes precedence over `amount`. Paid commissions cannot be updated."""
41
+
42
+ currency: Optional[str] = "usd"
43
+ r"""The currency of the sale amount to update. Accepts ISO 4217 currency codes."""
44
+
45
+ status: Optional[Status] = None
46
+ r"""Useful for marking a commission as refunded, duplicate, canceled, or fraudulent. Takes precedence over `amount` and `modifyAmount`. When a commission is marked as refunded, duplicate, canceled, or fraudulent, it will be omitted from the payout, and the payout amount will be recalculated accordingly. Paid commissions cannot be updated."""
47
+
48
+
49
+ class UpdateCommissionRequestTypedDict(TypedDict):
50
+ id: str
51
+ r"""The commission's unique ID on Dub."""
52
+ request_body: NotRequired[UpdateCommissionRequestBodyTypedDict]
53
+
54
+
55
+ class UpdateCommissionRequest(BaseModel):
56
+ id: Annotated[
57
+ str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
58
+ ]
59
+ r"""The commission's unique ID on Dub."""
60
+
61
+ request_body: Annotated[
62
+ Optional[UpdateCommissionRequestBody],
63
+ FieldMetadata(request=RequestMetadata(media_type="application/json")),
64
+ ] = None
65
+
66
+
67
+ class UpdateCommissionType(str, Enum):
68
+ CLICK = "click"
69
+ LEAD = "lead"
70
+ SALE = "sale"
71
+
72
+
73
+ class UpdateCommissionStatus(str, Enum):
74
+ PENDING = "pending"
75
+ PROCESSED = "processed"
76
+ PAID = "paid"
77
+ REFUNDED = "refunded"
78
+ DUPLICATE = "duplicate"
79
+ FRAUD = "fraud"
80
+ CANCELED = "canceled"
81
+
82
+
83
+ class UpdateCommissionResponseBodyTypedDict(TypedDict):
84
+ r"""The updated commission."""
85
+
86
+ id: str
87
+ r"""The commission's unique ID on Dub."""
88
+ amount: float
89
+ earnings: float
90
+ currency: str
91
+ status: UpdateCommissionStatus
92
+ created_at: str
93
+ updated_at: str
94
+ type: NotRequired[UpdateCommissionType]
95
+ invoice_id: NotRequired[Nullable[str]]
96
+
97
+
98
+ class UpdateCommissionResponseBody(BaseModel):
99
+ r"""The updated commission."""
100
+
101
+ id: str
102
+ r"""The commission's unique ID on Dub."""
103
+
104
+ amount: float
105
+
106
+ earnings: float
107
+
108
+ currency: str
109
+
110
+ status: UpdateCommissionStatus
111
+
112
+ created_at: Annotated[str, pydantic.Field(alias="createdAt")]
113
+
114
+ updated_at: Annotated[str, pydantic.Field(alias="updatedAt")]
115
+
116
+ type: Optional[UpdateCommissionType] = None
117
+
118
+ invoice_id: Annotated[OptionalNullable[str], pydantic.Field(alias="invoiceId")] = (
119
+ UNSET
120
+ )
121
+
122
+ @model_serializer(mode="wrap")
123
+ def serialize_model(self, handler):
124
+ optional_fields = ["type", "invoiceId"]
125
+ nullable_fields = ["invoiceId"]
126
+ null_default_fields = []
127
+
128
+ serialized = handler(self)
129
+
130
+ m = {}
131
+
132
+ for n, f in type(self).model_fields.items():
133
+ k = f.alias or n
134
+ val = serialized.get(k)
135
+ serialized.pop(k, None)
136
+
137
+ optional_nullable = k in optional_fields and k in nullable_fields
138
+ is_set = (
139
+ self.__pydantic_fields_set__.intersection({n})
140
+ or k in null_default_fields
141
+ ) # pylint: disable=no-member
142
+
143
+ if val is not None and val != UNSET_SENTINEL:
144
+ m[k] = val
145
+ elif val != UNSET_SENTINEL and (
146
+ not k in optional_fields or (optional_nullable and is_set)
147
+ ):
148
+ m[k] = val
149
+
150
+ return m