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
dub/partners.py CHANGED
@@ -23,7 +23,7 @@ class Partners(BaseSDK):
23
23
  server_url: Optional[str] = None,
24
24
  timeout_ms: Optional[int] = None,
25
25
  http_headers: Optional[Mapping[str, str]] = None,
26
- ) -> Optional[operations.CreatePartnerResponseBody]:
26
+ ) -> operations.CreatePartnerResponseBody:
27
27
  r"""Create or update a partner
28
28
 
29
29
  Creates or updates a partner record (upsert behavior). If a partner with the same email already exists, their program enrollment will be updated with the provided tenantId. If no existing partner is found, a new partner will be created using the supplied information.
@@ -70,6 +70,7 @@ class Partners(BaseSDK):
70
70
  "json",
71
71
  Optional[operations.CreatePartnerRequestBody],
72
72
  ),
73
+ allow_empty_value=None,
73
74
  timeout_ms=timeout_ms,
74
75
  )
75
76
 
@@ -109,7 +110,7 @@ class Partners(BaseSDK):
109
110
  response_data: Any = None
110
111
  if utils.match_response(http_res, "201", "application/json"):
111
112
  return unmarshal_json_response(
112
- Optional[operations.CreatePartnerResponseBody], http_res
113
+ operations.CreatePartnerResponseBody, http_res
113
114
  )
114
115
  if utils.match_response(http_res, "400", "application/json"):
115
116
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -166,7 +167,7 @@ class Partners(BaseSDK):
166
167
  server_url: Optional[str] = None,
167
168
  timeout_ms: Optional[int] = None,
168
169
  http_headers: Optional[Mapping[str, str]] = None,
169
- ) -> Optional[operations.CreatePartnerResponseBody]:
170
+ ) -> operations.CreatePartnerResponseBody:
170
171
  r"""Create or update a partner
171
172
 
172
173
  Creates or updates a partner record (upsert behavior). If a partner with the same email already exists, their program enrollment will be updated with the provided tenantId. If no existing partner is found, a new partner will be created using the supplied information.
@@ -213,6 +214,7 @@ class Partners(BaseSDK):
213
214
  "json",
214
215
  Optional[operations.CreatePartnerRequestBody],
215
216
  ),
217
+ allow_empty_value=None,
216
218
  timeout_ms=timeout_ms,
217
219
  )
218
220
 
@@ -252,7 +254,7 @@ class Partners(BaseSDK):
252
254
  response_data: Any = None
253
255
  if utils.match_response(http_res, "201", "application/json"):
254
256
  return unmarshal_json_response(
255
- Optional[operations.CreatePartnerResponseBody], http_res
257
+ operations.CreatePartnerResponseBody, http_res
256
258
  )
257
259
  if utils.match_response(http_res, "400", "application/json"):
258
260
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -306,7 +308,7 @@ class Partners(BaseSDK):
306
308
  server_url: Optional[str] = None,
307
309
  timeout_ms: Optional[int] = None,
308
310
  http_headers: Optional[Mapping[str, str]] = None,
309
- ) -> Optional[List[operations.ListPartnersResponseBody]]:
311
+ ) -> List[operations.ListPartnersResponseBody]:
310
312
  r"""List all partners
311
313
 
312
314
  List all partners for a partner program.
@@ -344,6 +346,7 @@ class Partners(BaseSDK):
344
346
  accept_header_value="application/json",
345
347
  http_headers=http_headers,
346
348
  security=self.sdk_configuration.security,
349
+ allow_empty_value=None,
347
350
  timeout_ms=timeout_ms,
348
351
  )
349
352
 
@@ -383,7 +386,7 @@ class Partners(BaseSDK):
383
386
  response_data: Any = None
384
387
  if utils.match_response(http_res, "200", "application/json"):
385
388
  return unmarshal_json_response(
386
- Optional[List[operations.ListPartnersResponseBody]], http_res
389
+ List[operations.ListPartnersResponseBody], http_res
387
390
  )
388
391
  if utils.match_response(http_res, "400", "application/json"):
389
392
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -437,7 +440,7 @@ class Partners(BaseSDK):
437
440
  server_url: Optional[str] = None,
438
441
  timeout_ms: Optional[int] = None,
439
442
  http_headers: Optional[Mapping[str, str]] = None,
440
- ) -> Optional[List[operations.ListPartnersResponseBody]]:
443
+ ) -> List[operations.ListPartnersResponseBody]:
441
444
  r"""List all partners
442
445
 
443
446
  List all partners for a partner program.
@@ -475,6 +478,7 @@ class Partners(BaseSDK):
475
478
  accept_header_value="application/json",
476
479
  http_headers=http_headers,
477
480
  security=self.sdk_configuration.security,
481
+ allow_empty_value=None,
478
482
  timeout_ms=timeout_ms,
479
483
  )
480
484
 
@@ -514,7 +518,7 @@ class Partners(BaseSDK):
514
518
  response_data: Any = None
515
519
  if utils.match_response(http_res, "200", "application/json"):
516
520
  return unmarshal_json_response(
517
- Optional[List[operations.ListPartnersResponseBody]], http_res
521
+ List[operations.ListPartnersResponseBody], http_res
518
522
  )
519
523
  if utils.match_response(http_res, "400", "application/json"):
520
524
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -571,7 +575,7 @@ class Partners(BaseSDK):
571
575
  server_url: Optional[str] = None,
572
576
  timeout_ms: Optional[int] = None,
573
577
  http_headers: Optional[Mapping[str, str]] = None,
574
- ) -> Optional[components.LinkSchema]:
578
+ ) -> components.LinkSchema:
575
579
  r"""Create a link for a partner
576
580
 
577
581
  Create a link for a partner that is enrolled in your program.
@@ -618,6 +622,7 @@ class Partners(BaseSDK):
618
622
  "json",
619
623
  Optional[operations.CreatePartnerLinkRequestBody],
620
624
  ),
625
+ allow_empty_value=None,
621
626
  timeout_ms=timeout_ms,
622
627
  )
623
628
 
@@ -656,7 +661,7 @@ class Partners(BaseSDK):
656
661
 
657
662
  response_data: Any = None
658
663
  if utils.match_response(http_res, "201", "application/json"):
659
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
664
+ return unmarshal_json_response(components.LinkSchema, http_res)
660
665
  if utils.match_response(http_res, "400", "application/json"):
661
666
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
662
667
  raise errors.BadRequest(response_data, http_res)
@@ -712,7 +717,7 @@ class Partners(BaseSDK):
712
717
  server_url: Optional[str] = None,
713
718
  timeout_ms: Optional[int] = None,
714
719
  http_headers: Optional[Mapping[str, str]] = None,
715
- ) -> Optional[components.LinkSchema]:
720
+ ) -> components.LinkSchema:
716
721
  r"""Create a link for a partner
717
722
 
718
723
  Create a link for a partner that is enrolled in your program.
@@ -759,6 +764,7 @@ class Partners(BaseSDK):
759
764
  "json",
760
765
  Optional[operations.CreatePartnerLinkRequestBody],
761
766
  ),
767
+ allow_empty_value=None,
762
768
  timeout_ms=timeout_ms,
763
769
  )
764
770
 
@@ -797,7 +803,7 @@ class Partners(BaseSDK):
797
803
 
798
804
  response_data: Any = None
799
805
  if utils.match_response(http_res, "201", "application/json"):
800
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
806
+ return unmarshal_json_response(components.LinkSchema, http_res)
801
807
  if utils.match_response(http_res, "400", "application/json"):
802
808
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
803
809
  raise errors.BadRequest(response_data, http_res)
@@ -850,7 +856,7 @@ class Partners(BaseSDK):
850
856
  server_url: Optional[str] = None,
851
857
  timeout_ms: Optional[int] = None,
852
858
  http_headers: Optional[Mapping[str, str]] = None,
853
- ) -> Optional[List[operations.Link]]:
859
+ ) -> List[operations.RetrieveLinksResponseBody]:
854
860
  r"""Retrieve a partner's links.
855
861
 
856
862
  Retrieve a partner's links by their partner ID or tenant ID.
@@ -888,6 +894,7 @@ class Partners(BaseSDK):
888
894
  accept_header_value="application/json",
889
895
  http_headers=http_headers,
890
896
  security=self.sdk_configuration.security,
897
+ allow_empty_value=None,
891
898
  timeout_ms=timeout_ms,
892
899
  )
893
900
 
@@ -926,7 +933,9 @@ class Partners(BaseSDK):
926
933
 
927
934
  response_data: Any = None
928
935
  if utils.match_response(http_res, "200", "application/json"):
929
- return unmarshal_json_response(Optional[List[operations.Link]], http_res)
936
+ return unmarshal_json_response(
937
+ List[operations.RetrieveLinksResponseBody], http_res
938
+ )
930
939
  if utils.match_response(http_res, "400", "application/json"):
931
940
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
932
941
  raise errors.BadRequest(response_data, http_res)
@@ -979,7 +988,7 @@ class Partners(BaseSDK):
979
988
  server_url: Optional[str] = None,
980
989
  timeout_ms: Optional[int] = None,
981
990
  http_headers: Optional[Mapping[str, str]] = None,
982
- ) -> Optional[List[operations.Link]]:
991
+ ) -> List[operations.RetrieveLinksResponseBody]:
983
992
  r"""Retrieve a partner's links.
984
993
 
985
994
  Retrieve a partner's links by their partner ID or tenant ID.
@@ -1017,6 +1026,7 @@ class Partners(BaseSDK):
1017
1026
  accept_header_value="application/json",
1018
1027
  http_headers=http_headers,
1019
1028
  security=self.sdk_configuration.security,
1029
+ allow_empty_value=None,
1020
1030
  timeout_ms=timeout_ms,
1021
1031
  )
1022
1032
 
@@ -1055,7 +1065,9 @@ class Partners(BaseSDK):
1055
1065
 
1056
1066
  response_data: Any = None
1057
1067
  if utils.match_response(http_res, "200", "application/json"):
1058
- return unmarshal_json_response(Optional[List[operations.Link]], http_res)
1068
+ return unmarshal_json_response(
1069
+ List[operations.RetrieveLinksResponseBody], http_res
1070
+ )
1059
1071
  if utils.match_response(http_res, "400", "application/json"):
1060
1072
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1061
1073
  raise errors.BadRequest(response_data, http_res)
@@ -1111,7 +1123,7 @@ class Partners(BaseSDK):
1111
1123
  server_url: Optional[str] = None,
1112
1124
  timeout_ms: Optional[int] = None,
1113
1125
  http_headers: Optional[Mapping[str, str]] = None,
1114
- ) -> Optional[components.LinkSchema]:
1126
+ ) -> components.LinkSchema:
1115
1127
  r"""Upsert a link for a partner
1116
1128
 
1117
1129
  Upsert a link for a partner that is enrolled in your program. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.
@@ -1158,6 +1170,7 @@ class Partners(BaseSDK):
1158
1170
  "json",
1159
1171
  Optional[operations.UpsertPartnerLinkRequestBody],
1160
1172
  ),
1173
+ allow_empty_value=None,
1161
1174
  timeout_ms=timeout_ms,
1162
1175
  )
1163
1176
 
@@ -1196,7 +1209,7 @@ class Partners(BaseSDK):
1196
1209
 
1197
1210
  response_data: Any = None
1198
1211
  if utils.match_response(http_res, "200", "application/json"):
1199
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
1212
+ return unmarshal_json_response(components.LinkSchema, http_res)
1200
1213
  if utils.match_response(http_res, "400", "application/json"):
1201
1214
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1202
1215
  raise errors.BadRequest(response_data, http_res)
@@ -1252,7 +1265,7 @@ class Partners(BaseSDK):
1252
1265
  server_url: Optional[str] = None,
1253
1266
  timeout_ms: Optional[int] = None,
1254
1267
  http_headers: Optional[Mapping[str, str]] = None,
1255
- ) -> Optional[components.LinkSchema]:
1268
+ ) -> components.LinkSchema:
1256
1269
  r"""Upsert a link for a partner
1257
1270
 
1258
1271
  Upsert a link for a partner that is enrolled in your program. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.
@@ -1299,6 +1312,7 @@ class Partners(BaseSDK):
1299
1312
  "json",
1300
1313
  Optional[operations.UpsertPartnerLinkRequestBody],
1301
1314
  ),
1315
+ allow_empty_value=None,
1302
1316
  timeout_ms=timeout_ms,
1303
1317
  )
1304
1318
 
@@ -1337,7 +1351,7 @@ class Partners(BaseSDK):
1337
1351
 
1338
1352
  response_data: Any = None
1339
1353
  if utils.match_response(http_res, "200", "application/json"):
1340
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
1354
+ return unmarshal_json_response(components.LinkSchema, http_res)
1341
1355
  if utils.match_response(http_res, "400", "application/json"):
1342
1356
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1343
1357
  raise errors.BadRequest(response_data, http_res)
@@ -1391,7 +1405,7 @@ class Partners(BaseSDK):
1391
1405
  server_url: Optional[str] = None,
1392
1406
  timeout_ms: Optional[int] = None,
1393
1407
  http_headers: Optional[Mapping[str, str]] = None,
1394
- ) -> Optional[operations.RetrievePartnerAnalyticsResponseBody]:
1408
+ ) -> operations.RetrievePartnerAnalyticsResponseBody:
1395
1409
  r"""Retrieve analytics for a partner
1396
1410
 
1397
1411
  Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter.
@@ -1431,6 +1445,7 @@ class Partners(BaseSDK):
1431
1445
  accept_header_value="application/json",
1432
1446
  http_headers=http_headers,
1433
1447
  security=self.sdk_configuration.security,
1448
+ allow_empty_value=None,
1434
1449
  timeout_ms=timeout_ms,
1435
1450
  )
1436
1451
 
@@ -1470,7 +1485,7 @@ class Partners(BaseSDK):
1470
1485
  response_data: Any = None
1471
1486
  if utils.match_response(http_res, "200", "application/json"):
1472
1487
  return unmarshal_json_response(
1473
- Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
1488
+ operations.RetrievePartnerAnalyticsResponseBody, http_res
1474
1489
  )
1475
1490
  if utils.match_response(http_res, "400", "application/json"):
1476
1491
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -1525,7 +1540,7 @@ class Partners(BaseSDK):
1525
1540
  server_url: Optional[str] = None,
1526
1541
  timeout_ms: Optional[int] = None,
1527
1542
  http_headers: Optional[Mapping[str, str]] = None,
1528
- ) -> Optional[operations.RetrievePartnerAnalyticsResponseBody]:
1543
+ ) -> operations.RetrievePartnerAnalyticsResponseBody:
1529
1544
  r"""Retrieve analytics for a partner
1530
1545
 
1531
1546
  Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter.
@@ -1565,6 +1580,7 @@ class Partners(BaseSDK):
1565
1580
  accept_header_value="application/json",
1566
1581
  http_headers=http_headers,
1567
1582
  security=self.sdk_configuration.security,
1583
+ allow_empty_value=None,
1568
1584
  timeout_ms=timeout_ms,
1569
1585
  )
1570
1586
 
@@ -1604,8 +1620,284 @@ class Partners(BaseSDK):
1604
1620
  response_data: Any = None
1605
1621
  if utils.match_response(http_res, "200", "application/json"):
1606
1622
  return unmarshal_json_response(
1607
- Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
1623
+ operations.RetrievePartnerAnalyticsResponseBody, http_res
1624
+ )
1625
+ if utils.match_response(http_res, "400", "application/json"):
1626
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1627
+ raise errors.BadRequest(response_data, http_res)
1628
+ if utils.match_response(http_res, "401", "application/json"):
1629
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
1630
+ raise errors.Unauthorized(response_data, http_res)
1631
+ if utils.match_response(http_res, "403", "application/json"):
1632
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
1633
+ raise errors.Forbidden(response_data, http_res)
1634
+ if utils.match_response(http_res, "404", "application/json"):
1635
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
1636
+ raise errors.NotFound(response_data, http_res)
1637
+ if utils.match_response(http_res, "409", "application/json"):
1638
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
1639
+ raise errors.Conflict(response_data, http_res)
1640
+ if utils.match_response(http_res, "410", "application/json"):
1641
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
1642
+ raise errors.InviteExpired(response_data, http_res)
1643
+ if utils.match_response(http_res, "422", "application/json"):
1644
+ response_data = unmarshal_json_response(
1645
+ errors.UnprocessableEntityData, http_res
1646
+ )
1647
+ raise errors.UnprocessableEntity(response_data, http_res)
1648
+ if utils.match_response(http_res, "429", "application/json"):
1649
+ response_data = unmarshal_json_response(
1650
+ errors.RateLimitExceededData, http_res
1651
+ )
1652
+ raise errors.RateLimitExceeded(response_data, http_res)
1653
+ if utils.match_response(http_res, "500", "application/json"):
1654
+ response_data = unmarshal_json_response(
1655
+ errors.InternalServerErrorData, http_res
1656
+ )
1657
+ raise errors.InternalServerError(response_data, http_res)
1658
+ if utils.match_response(http_res, "4XX", "*"):
1659
+ http_res_text = await utils.stream_to_text_async(http_res)
1660
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1661
+ if utils.match_response(http_res, "5XX", "*"):
1662
+ http_res_text = await utils.stream_to_text_async(http_res)
1663
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1664
+
1665
+ raise errors.SDKError("Unexpected response received", http_res)
1666
+
1667
+ def ban(
1668
+ self,
1669
+ *,
1670
+ request: Optional[
1671
+ Union[
1672
+ operations.BanPartnerRequestBody,
1673
+ operations.BanPartnerRequestBodyTypedDict,
1674
+ ]
1675
+ ] = None,
1676
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1677
+ server_url: Optional[str] = None,
1678
+ timeout_ms: Optional[int] = None,
1679
+ http_headers: Optional[Mapping[str, str]] = None,
1680
+ ) -> operations.BanPartnerResponseBody:
1681
+ r"""Ban a partner
1682
+
1683
+ Ban a partner from your program. This will disable all links and mark all commissions as canceled.
1684
+
1685
+ :param request: The request object to send.
1686
+ :param retries: Override the default retry configuration for this method
1687
+ :param server_url: Override the default server URL for this method
1688
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1689
+ :param http_headers: Additional headers to set or replace on requests.
1690
+ """
1691
+ base_url = None
1692
+ url_variables = None
1693
+ if timeout_ms is None:
1694
+ timeout_ms = self.sdk_configuration.timeout_ms
1695
+
1696
+ if server_url is not None:
1697
+ base_url = server_url
1698
+ else:
1699
+ base_url = self._get_url(base_url, url_variables)
1700
+
1701
+ if not isinstance(request, BaseModel):
1702
+ request = utils.unmarshal(
1703
+ request, Optional[operations.BanPartnerRequestBody]
1704
+ )
1705
+ request = cast(Optional[operations.BanPartnerRequestBody], request)
1706
+
1707
+ req = self._build_request(
1708
+ method="POST",
1709
+ path="/partners/ban",
1710
+ base_url=base_url,
1711
+ url_variables=url_variables,
1712
+ request=request,
1713
+ request_body_required=False,
1714
+ request_has_path_params=False,
1715
+ request_has_query_params=True,
1716
+ user_agent_header="user-agent",
1717
+ accept_header_value="application/json",
1718
+ http_headers=http_headers,
1719
+ security=self.sdk_configuration.security,
1720
+ get_serialized_body=lambda: utils.serialize_request_body(
1721
+ request, False, True, "json", Optional[operations.BanPartnerRequestBody]
1722
+ ),
1723
+ allow_empty_value=None,
1724
+ timeout_ms=timeout_ms,
1725
+ )
1726
+
1727
+ if retries == UNSET:
1728
+ if self.sdk_configuration.retry_config is not UNSET:
1729
+ retries = self.sdk_configuration.retry_config
1730
+
1731
+ retry_config = None
1732
+ if isinstance(retries, utils.RetryConfig):
1733
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1734
+
1735
+ http_res = self.do_request(
1736
+ hook_ctx=HookContext(
1737
+ config=self.sdk_configuration,
1738
+ base_url=base_url or "",
1739
+ operation_id="banPartner",
1740
+ oauth2_scopes=None,
1741
+ security_source=self.sdk_configuration.security,
1742
+ ),
1743
+ request=req,
1744
+ error_status_codes=[
1745
+ "400",
1746
+ "401",
1747
+ "403",
1748
+ "404",
1749
+ "409",
1750
+ "410",
1751
+ "422",
1752
+ "429",
1753
+ "4XX",
1754
+ "500",
1755
+ "5XX",
1756
+ ],
1757
+ retry_config=retry_config,
1758
+ )
1759
+
1760
+ response_data: Any = None
1761
+ if utils.match_response(http_res, "200", "application/json"):
1762
+ return unmarshal_json_response(operations.BanPartnerResponseBody, http_res)
1763
+ if utils.match_response(http_res, "400", "application/json"):
1764
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1765
+ raise errors.BadRequest(response_data, http_res)
1766
+ if utils.match_response(http_res, "401", "application/json"):
1767
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
1768
+ raise errors.Unauthorized(response_data, http_res)
1769
+ if utils.match_response(http_res, "403", "application/json"):
1770
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
1771
+ raise errors.Forbidden(response_data, http_res)
1772
+ if utils.match_response(http_res, "404", "application/json"):
1773
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
1774
+ raise errors.NotFound(response_data, http_res)
1775
+ if utils.match_response(http_res, "409", "application/json"):
1776
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
1777
+ raise errors.Conflict(response_data, http_res)
1778
+ if utils.match_response(http_res, "410", "application/json"):
1779
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
1780
+ raise errors.InviteExpired(response_data, http_res)
1781
+ if utils.match_response(http_res, "422", "application/json"):
1782
+ response_data = unmarshal_json_response(
1783
+ errors.UnprocessableEntityData, http_res
1784
+ )
1785
+ raise errors.UnprocessableEntity(response_data, http_res)
1786
+ if utils.match_response(http_res, "429", "application/json"):
1787
+ response_data = unmarshal_json_response(
1788
+ errors.RateLimitExceededData, http_res
1789
+ )
1790
+ raise errors.RateLimitExceeded(response_data, http_res)
1791
+ if utils.match_response(http_res, "500", "application/json"):
1792
+ response_data = unmarshal_json_response(
1793
+ errors.InternalServerErrorData, http_res
1608
1794
  )
1795
+ raise errors.InternalServerError(response_data, http_res)
1796
+ if utils.match_response(http_res, "4XX", "*"):
1797
+ http_res_text = utils.stream_to_text(http_res)
1798
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1799
+ if utils.match_response(http_res, "5XX", "*"):
1800
+ http_res_text = utils.stream_to_text(http_res)
1801
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1802
+
1803
+ raise errors.SDKError("Unexpected response received", http_res)
1804
+
1805
+ async def ban_async(
1806
+ self,
1807
+ *,
1808
+ request: Optional[
1809
+ Union[
1810
+ operations.BanPartnerRequestBody,
1811
+ operations.BanPartnerRequestBodyTypedDict,
1812
+ ]
1813
+ ] = None,
1814
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1815
+ server_url: Optional[str] = None,
1816
+ timeout_ms: Optional[int] = None,
1817
+ http_headers: Optional[Mapping[str, str]] = None,
1818
+ ) -> operations.BanPartnerResponseBody:
1819
+ r"""Ban a partner
1820
+
1821
+ Ban a partner from your program. This will disable all links and mark all commissions as canceled.
1822
+
1823
+ :param request: The request object to send.
1824
+ :param retries: Override the default retry configuration for this method
1825
+ :param server_url: Override the default server URL for this method
1826
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1827
+ :param http_headers: Additional headers to set or replace on requests.
1828
+ """
1829
+ base_url = None
1830
+ url_variables = None
1831
+ if timeout_ms is None:
1832
+ timeout_ms = self.sdk_configuration.timeout_ms
1833
+
1834
+ if server_url is not None:
1835
+ base_url = server_url
1836
+ else:
1837
+ base_url = self._get_url(base_url, url_variables)
1838
+
1839
+ if not isinstance(request, BaseModel):
1840
+ request = utils.unmarshal(
1841
+ request, Optional[operations.BanPartnerRequestBody]
1842
+ )
1843
+ request = cast(Optional[operations.BanPartnerRequestBody], request)
1844
+
1845
+ req = self._build_request_async(
1846
+ method="POST",
1847
+ path="/partners/ban",
1848
+ base_url=base_url,
1849
+ url_variables=url_variables,
1850
+ request=request,
1851
+ request_body_required=False,
1852
+ request_has_path_params=False,
1853
+ request_has_query_params=True,
1854
+ user_agent_header="user-agent",
1855
+ accept_header_value="application/json",
1856
+ http_headers=http_headers,
1857
+ security=self.sdk_configuration.security,
1858
+ get_serialized_body=lambda: utils.serialize_request_body(
1859
+ request, False, True, "json", Optional[operations.BanPartnerRequestBody]
1860
+ ),
1861
+ allow_empty_value=None,
1862
+ timeout_ms=timeout_ms,
1863
+ )
1864
+
1865
+ if retries == UNSET:
1866
+ if self.sdk_configuration.retry_config is not UNSET:
1867
+ retries = self.sdk_configuration.retry_config
1868
+
1869
+ retry_config = None
1870
+ if isinstance(retries, utils.RetryConfig):
1871
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1872
+
1873
+ http_res = await self.do_request_async(
1874
+ hook_ctx=HookContext(
1875
+ config=self.sdk_configuration,
1876
+ base_url=base_url or "",
1877
+ operation_id="banPartner",
1878
+ oauth2_scopes=None,
1879
+ security_source=self.sdk_configuration.security,
1880
+ ),
1881
+ request=req,
1882
+ error_status_codes=[
1883
+ "400",
1884
+ "401",
1885
+ "403",
1886
+ "404",
1887
+ "409",
1888
+ "410",
1889
+ "422",
1890
+ "429",
1891
+ "4XX",
1892
+ "500",
1893
+ "5XX",
1894
+ ],
1895
+ retry_config=retry_config,
1896
+ )
1897
+
1898
+ response_data: Any = None
1899
+ if utils.match_response(http_res, "200", "application/json"):
1900
+ return unmarshal_json_response(operations.BanPartnerResponseBody, http_res)
1609
1901
  if utils.match_response(http_res, "400", "application/json"):
1610
1902
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1611
1903
  raise errors.BadRequest(response_data, http_res)
dub/qr_codes.py CHANGED
@@ -20,7 +20,7 @@ class QRCodes(BaseSDK):
20
20
  server_url: Optional[str] = None,
21
21
  timeout_ms: Optional[int] = None,
22
22
  http_headers: Optional[Mapping[str, str]] = None,
23
- ) -> Optional[str]:
23
+ ) -> str:
24
24
  r"""Retrieve a QR code
25
25
 
26
26
  Retrieve a QR code for a link.
@@ -58,6 +58,7 @@ class QRCodes(BaseSDK):
58
58
  accept_header_value="image/png",
59
59
  http_headers=http_headers,
60
60
  security=self.sdk_configuration.security,
61
+ allow_empty_value=None,
61
62
  timeout_ms=timeout_ms,
62
63
  )
63
64
 
@@ -149,7 +150,7 @@ class QRCodes(BaseSDK):
149
150
  server_url: Optional[str] = None,
150
151
  timeout_ms: Optional[int] = None,
151
152
  http_headers: Optional[Mapping[str, str]] = None,
152
- ) -> Optional[str]:
153
+ ) -> str:
153
154
  r"""Retrieve a QR code
154
155
 
155
156
  Retrieve a QR code for a link.
@@ -187,6 +188,7 @@ class QRCodes(BaseSDK):
187
188
  accept_header_value="image/png",
188
189
  http_headers=http_headers,
189
190
  security=self.sdk_configuration.security,
191
+ allow_empty_value=None,
190
192
  timeout_ms=timeout_ms,
191
193
  )
192
194