dub 0.31.0__py3-none-any.whl → 0.33.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. dub/_version.py +3 -3
  2. dub/analytics.py +6 -6
  3. dub/commissions.py +12 -12
  4. dub/customers.py +24 -321
  5. dub/domains.py +34 -38
  6. dub/embed_tokens.py +6 -6
  7. dub/events.py +6 -6
  8. dub/folders.py +24 -28
  9. dub/links.py +58 -74
  10. dub/models/components/__init__.py +38 -6
  11. dub/models/components/analyticstopurls.py +2 -2
  12. dub/models/components/clickevent.py +10 -9
  13. dub/models/components/commissioncreatedevent.py +5 -2
  14. dub/models/components/folderschema.py +6 -1
  15. dub/models/components/leadcreatedevent.py +15 -11
  16. dub/models/components/leadevent.py +10 -9
  17. dub/models/components/linkclickedevent.py +10 -9
  18. dub/models/components/linkschema.py +9 -3
  19. dub/models/components/{tagschema.py → linktagschema.py} +2 -2
  20. dub/models/components/linkwebhookevent.py +10 -9
  21. dub/models/components/partnerapplicationsubmittedevent.py +269 -0
  22. dub/models/components/partnerenrolledevent.py +93 -29
  23. dub/models/components/salecreatedevent.py +15 -11
  24. dub/models/components/saleevent.py +10 -9
  25. dub/models/components/webhookevent.py +6 -0
  26. dub/models/components/workspaceschema.py +11 -0
  27. dub/models/errors/badrequest.py +1 -1
  28. dub/models/errors/conflict.py +1 -1
  29. dub/models/errors/duberror.py +1 -1
  30. dub/models/errors/forbidden.py +1 -1
  31. dub/models/errors/internalservererror.py +1 -1
  32. dub/models/errors/inviteexpired.py +1 -1
  33. dub/models/errors/no_response_error.py +1 -1
  34. dub/models/errors/notfound.py +1 -1
  35. dub/models/errors/ratelimitexceeded.py +1 -1
  36. dub/models/errors/responsevalidationerror.py +1 -1
  37. dub/models/errors/sdkerror.py +1 -1
  38. dub/models/errors/unauthorized.py +1 -1
  39. dub/models/errors/unprocessableentity.py +1 -1
  40. dub/models/operations/__init__.py +17 -35
  41. dub/models/operations/banpartner.py +83 -0
  42. dub/models/operations/bulkcreatelinks.py +2 -2
  43. dub/models/operations/createfolder.py +8 -3
  44. dub/models/operations/createlink.py +2 -2
  45. dub/models/operations/createpartner.py +93 -29
  46. dub/models/operations/listcommissions.py +13 -2
  47. dub/models/operations/listevents.py +10 -0
  48. dub/models/operations/listpartners.py +107 -47
  49. dub/models/operations/retrieveanalytics.py +16 -1
  50. dub/models/operations/retrievelinks.py +42 -7
  51. dub/models/operations/retrievepartneranalytics.py +51 -11
  52. dub/models/operations/tracklead.py +2 -2
  53. dub/models/operations/updatecommission.py +7 -2
  54. dub/models/operations/updatefolder.py +8 -3
  55. dub/models/operations/updatelink.py +2 -2
  56. dub/models/operations/upsertlink.py +2 -2
  57. dub/partners.py +310 -36
  58. dub/qr_codes.py +4 -4
  59. dub/tags.py +24 -32
  60. dub/track.py +12 -20
  61. dub/utils/retries.py +69 -5
  62. dub/utils/unmarshal_json_response.py +15 -1
  63. dub/workspaces.py +12 -20
  64. {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/METADATA +2 -21
  65. {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/RECORD +67 -66
  66. dub/models/operations/createcustomer.py +0 -382
  67. {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/WHEEL +0 -0
  68. {dub-0.31.0.dist-info → dub-0.33.0.dist-info}/licenses/LICENSE +0 -0
@@ -44,7 +44,7 @@ class UpdateLinkRequestBodyTypedDict(TypedDict):
44
44
  url: NotRequired[str]
45
45
  r"""The destination URL of the short link."""
46
46
  domain: NotRequired[str]
47
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
47
+ r"""The domain of the short link (without protocol). If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
48
48
  key: NotRequired[str]
49
49
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
50
50
  external_id: NotRequired[Nullable[str]]
@@ -123,7 +123,7 @@ class UpdateLinkRequestBody(BaseModel):
123
123
  r"""The destination URL of the short link."""
124
124
 
125
125
  domain: Optional[str] = None
126
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
126
+ r"""The domain of the short link (without protocol). If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
127
127
 
128
128
  key: Optional[str] = None
129
129
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
@@ -43,7 +43,7 @@ class UpsertLinkRequestBodyTypedDict(TypedDict):
43
43
  url: str
44
44
  r"""The destination URL of the short link."""
45
45
  domain: NotRequired[str]
46
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
46
+ r"""The domain of the short link (without protocol). If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
47
47
  key: NotRequired[str]
48
48
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
49
49
  key_length: NotRequired[float]
@@ -127,7 +127,7 @@ class UpsertLinkRequestBody(BaseModel):
127
127
  r"""The destination URL of the short link."""
128
128
 
129
129
  domain: Optional[str] = None
130
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
130
+ r"""The domain of the short link (without protocol). If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
131
131
 
132
132
  key: Optional[str] = None
133
133
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
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.
@@ -86,7 +86,7 @@ class Partners(BaseSDK):
86
86
  config=self.sdk_configuration,
87
87
  base_url=base_url or "",
88
88
  operation_id="createPartner",
89
- oauth2_scopes=[],
89
+ oauth2_scopes=None,
90
90
  security_source=self.sdk_configuration.security,
91
91
  ),
92
92
  request=req,
@@ -109,7 +109,7 @@ class Partners(BaseSDK):
109
109
  response_data: Any = None
110
110
  if utils.match_response(http_res, "201", "application/json"):
111
111
  return unmarshal_json_response(
112
- Optional[operations.CreatePartnerResponseBody], http_res
112
+ operations.CreatePartnerResponseBody, http_res
113
113
  )
114
114
  if utils.match_response(http_res, "400", "application/json"):
115
115
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -166,7 +166,7 @@ class Partners(BaseSDK):
166
166
  server_url: Optional[str] = None,
167
167
  timeout_ms: Optional[int] = None,
168
168
  http_headers: Optional[Mapping[str, str]] = None,
169
- ) -> Optional[operations.CreatePartnerResponseBody]:
169
+ ) -> operations.CreatePartnerResponseBody:
170
170
  r"""Create or update a partner
171
171
 
172
172
  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.
@@ -229,7 +229,7 @@ class Partners(BaseSDK):
229
229
  config=self.sdk_configuration,
230
230
  base_url=base_url or "",
231
231
  operation_id="createPartner",
232
- oauth2_scopes=[],
232
+ oauth2_scopes=None,
233
233
  security_source=self.sdk_configuration.security,
234
234
  ),
235
235
  request=req,
@@ -252,7 +252,7 @@ class Partners(BaseSDK):
252
252
  response_data: Any = None
253
253
  if utils.match_response(http_res, "201", "application/json"):
254
254
  return unmarshal_json_response(
255
- Optional[operations.CreatePartnerResponseBody], http_res
255
+ operations.CreatePartnerResponseBody, http_res
256
256
  )
257
257
  if utils.match_response(http_res, "400", "application/json"):
258
258
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -306,7 +306,7 @@ class Partners(BaseSDK):
306
306
  server_url: Optional[str] = None,
307
307
  timeout_ms: Optional[int] = None,
308
308
  http_headers: Optional[Mapping[str, str]] = None,
309
- ) -> Optional[List[operations.ListPartnersResponseBody]]:
309
+ ) -> List[operations.ListPartnersResponseBody]:
310
310
  r"""List all partners
311
311
 
312
312
  List all partners for a partner program.
@@ -360,7 +360,7 @@ class Partners(BaseSDK):
360
360
  config=self.sdk_configuration,
361
361
  base_url=base_url or "",
362
362
  operation_id="listPartners",
363
- oauth2_scopes=[],
363
+ oauth2_scopes=None,
364
364
  security_source=self.sdk_configuration.security,
365
365
  ),
366
366
  request=req,
@@ -383,7 +383,7 @@ class Partners(BaseSDK):
383
383
  response_data: Any = None
384
384
  if utils.match_response(http_res, "200", "application/json"):
385
385
  return unmarshal_json_response(
386
- Optional[List[operations.ListPartnersResponseBody]], http_res
386
+ List[operations.ListPartnersResponseBody], http_res
387
387
  )
388
388
  if utils.match_response(http_res, "400", "application/json"):
389
389
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -437,7 +437,7 @@ class Partners(BaseSDK):
437
437
  server_url: Optional[str] = None,
438
438
  timeout_ms: Optional[int] = None,
439
439
  http_headers: Optional[Mapping[str, str]] = None,
440
- ) -> Optional[List[operations.ListPartnersResponseBody]]:
440
+ ) -> List[operations.ListPartnersResponseBody]:
441
441
  r"""List all partners
442
442
 
443
443
  List all partners for a partner program.
@@ -491,7 +491,7 @@ class Partners(BaseSDK):
491
491
  config=self.sdk_configuration,
492
492
  base_url=base_url or "",
493
493
  operation_id="listPartners",
494
- oauth2_scopes=[],
494
+ oauth2_scopes=None,
495
495
  security_source=self.sdk_configuration.security,
496
496
  ),
497
497
  request=req,
@@ -514,7 +514,7 @@ class Partners(BaseSDK):
514
514
  response_data: Any = None
515
515
  if utils.match_response(http_res, "200", "application/json"):
516
516
  return unmarshal_json_response(
517
- Optional[List[operations.ListPartnersResponseBody]], http_res
517
+ List[operations.ListPartnersResponseBody], http_res
518
518
  )
519
519
  if utils.match_response(http_res, "400", "application/json"):
520
520
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -571,7 +571,7 @@ class Partners(BaseSDK):
571
571
  server_url: Optional[str] = None,
572
572
  timeout_ms: Optional[int] = None,
573
573
  http_headers: Optional[Mapping[str, str]] = None,
574
- ) -> Optional[components.LinkSchema]:
574
+ ) -> components.LinkSchema:
575
575
  r"""Create a link for a partner
576
576
 
577
577
  Create a link for a partner that is enrolled in your program.
@@ -634,7 +634,7 @@ class Partners(BaseSDK):
634
634
  config=self.sdk_configuration,
635
635
  base_url=base_url or "",
636
636
  operation_id="createPartnerLink",
637
- oauth2_scopes=[],
637
+ oauth2_scopes=None,
638
638
  security_source=self.sdk_configuration.security,
639
639
  ),
640
640
  request=req,
@@ -656,7 +656,7 @@ class Partners(BaseSDK):
656
656
 
657
657
  response_data: Any = None
658
658
  if utils.match_response(http_res, "201", "application/json"):
659
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
659
+ return unmarshal_json_response(components.LinkSchema, http_res)
660
660
  if utils.match_response(http_res, "400", "application/json"):
661
661
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
662
662
  raise errors.BadRequest(response_data, http_res)
@@ -712,7 +712,7 @@ class Partners(BaseSDK):
712
712
  server_url: Optional[str] = None,
713
713
  timeout_ms: Optional[int] = None,
714
714
  http_headers: Optional[Mapping[str, str]] = None,
715
- ) -> Optional[components.LinkSchema]:
715
+ ) -> components.LinkSchema:
716
716
  r"""Create a link for a partner
717
717
 
718
718
  Create a link for a partner that is enrolled in your program.
@@ -775,7 +775,7 @@ class Partners(BaseSDK):
775
775
  config=self.sdk_configuration,
776
776
  base_url=base_url or "",
777
777
  operation_id="createPartnerLink",
778
- oauth2_scopes=[],
778
+ oauth2_scopes=None,
779
779
  security_source=self.sdk_configuration.security,
780
780
  ),
781
781
  request=req,
@@ -797,7 +797,7 @@ class Partners(BaseSDK):
797
797
 
798
798
  response_data: Any = None
799
799
  if utils.match_response(http_res, "201", "application/json"):
800
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
800
+ return unmarshal_json_response(components.LinkSchema, http_res)
801
801
  if utils.match_response(http_res, "400", "application/json"):
802
802
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
803
803
  raise errors.BadRequest(response_data, http_res)
@@ -850,7 +850,7 @@ class Partners(BaseSDK):
850
850
  server_url: Optional[str] = None,
851
851
  timeout_ms: Optional[int] = None,
852
852
  http_headers: Optional[Mapping[str, str]] = None,
853
- ) -> Optional[List[operations.Link]]:
853
+ ) -> List[operations.Link]:
854
854
  r"""Retrieve a partner's links.
855
855
 
856
856
  Retrieve a partner's links by their partner ID or tenant ID.
@@ -904,7 +904,7 @@ class Partners(BaseSDK):
904
904
  config=self.sdk_configuration,
905
905
  base_url=base_url or "",
906
906
  operation_id="retrieveLinks",
907
- oauth2_scopes=[],
907
+ oauth2_scopes=None,
908
908
  security_source=self.sdk_configuration.security,
909
909
  ),
910
910
  request=req,
@@ -926,7 +926,7 @@ class Partners(BaseSDK):
926
926
 
927
927
  response_data: Any = None
928
928
  if utils.match_response(http_res, "200", "application/json"):
929
- return unmarshal_json_response(Optional[List[operations.Link]], http_res)
929
+ return unmarshal_json_response(List[operations.Link], http_res)
930
930
  if utils.match_response(http_res, "400", "application/json"):
931
931
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
932
932
  raise errors.BadRequest(response_data, http_res)
@@ -979,7 +979,7 @@ class Partners(BaseSDK):
979
979
  server_url: Optional[str] = None,
980
980
  timeout_ms: Optional[int] = None,
981
981
  http_headers: Optional[Mapping[str, str]] = None,
982
- ) -> Optional[List[operations.Link]]:
982
+ ) -> List[operations.Link]:
983
983
  r"""Retrieve a partner's links.
984
984
 
985
985
  Retrieve a partner's links by their partner ID or tenant ID.
@@ -1033,7 +1033,7 @@ class Partners(BaseSDK):
1033
1033
  config=self.sdk_configuration,
1034
1034
  base_url=base_url or "",
1035
1035
  operation_id="retrieveLinks",
1036
- oauth2_scopes=[],
1036
+ oauth2_scopes=None,
1037
1037
  security_source=self.sdk_configuration.security,
1038
1038
  ),
1039
1039
  request=req,
@@ -1055,7 +1055,7 @@ class Partners(BaseSDK):
1055
1055
 
1056
1056
  response_data: Any = None
1057
1057
  if utils.match_response(http_res, "200", "application/json"):
1058
- return unmarshal_json_response(Optional[List[operations.Link]], http_res)
1058
+ return unmarshal_json_response(List[operations.Link], http_res)
1059
1059
  if utils.match_response(http_res, "400", "application/json"):
1060
1060
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1061
1061
  raise errors.BadRequest(response_data, http_res)
@@ -1111,7 +1111,7 @@ class Partners(BaseSDK):
1111
1111
  server_url: Optional[str] = None,
1112
1112
  timeout_ms: Optional[int] = None,
1113
1113
  http_headers: Optional[Mapping[str, str]] = None,
1114
- ) -> Optional[components.LinkSchema]:
1114
+ ) -> components.LinkSchema:
1115
1115
  r"""Upsert a link for a partner
1116
1116
 
1117
1117
  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.
@@ -1174,7 +1174,7 @@ class Partners(BaseSDK):
1174
1174
  config=self.sdk_configuration,
1175
1175
  base_url=base_url or "",
1176
1176
  operation_id="upsertPartnerLink",
1177
- oauth2_scopes=[],
1177
+ oauth2_scopes=None,
1178
1178
  security_source=self.sdk_configuration.security,
1179
1179
  ),
1180
1180
  request=req,
@@ -1196,7 +1196,7 @@ class Partners(BaseSDK):
1196
1196
 
1197
1197
  response_data: Any = None
1198
1198
  if utils.match_response(http_res, "200", "application/json"):
1199
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
1199
+ return unmarshal_json_response(components.LinkSchema, http_res)
1200
1200
  if utils.match_response(http_res, "400", "application/json"):
1201
1201
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1202
1202
  raise errors.BadRequest(response_data, http_res)
@@ -1252,7 +1252,7 @@ class Partners(BaseSDK):
1252
1252
  server_url: Optional[str] = None,
1253
1253
  timeout_ms: Optional[int] = None,
1254
1254
  http_headers: Optional[Mapping[str, str]] = None,
1255
- ) -> Optional[components.LinkSchema]:
1255
+ ) -> components.LinkSchema:
1256
1256
  r"""Upsert a link for a partner
1257
1257
 
1258
1258
  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.
@@ -1315,7 +1315,7 @@ class Partners(BaseSDK):
1315
1315
  config=self.sdk_configuration,
1316
1316
  base_url=base_url or "",
1317
1317
  operation_id="upsertPartnerLink",
1318
- oauth2_scopes=[],
1318
+ oauth2_scopes=None,
1319
1319
  security_source=self.sdk_configuration.security,
1320
1320
  ),
1321
1321
  request=req,
@@ -1337,7 +1337,7 @@ class Partners(BaseSDK):
1337
1337
 
1338
1338
  response_data: Any = None
1339
1339
  if utils.match_response(http_res, "200", "application/json"):
1340
- return unmarshal_json_response(Optional[components.LinkSchema], http_res)
1340
+ return unmarshal_json_response(components.LinkSchema, http_res)
1341
1341
  if utils.match_response(http_res, "400", "application/json"):
1342
1342
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1343
1343
  raise errors.BadRequest(response_data, http_res)
@@ -1391,7 +1391,7 @@ class Partners(BaseSDK):
1391
1391
  server_url: Optional[str] = None,
1392
1392
  timeout_ms: Optional[int] = None,
1393
1393
  http_headers: Optional[Mapping[str, str]] = None,
1394
- ) -> Optional[operations.RetrievePartnerAnalyticsResponseBody]:
1394
+ ) -> operations.RetrievePartnerAnalyticsResponseBody:
1395
1395
  r"""Retrieve analytics for a partner
1396
1396
 
1397
1397
  Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter.
@@ -1447,7 +1447,7 @@ class Partners(BaseSDK):
1447
1447
  config=self.sdk_configuration,
1448
1448
  base_url=base_url or "",
1449
1449
  operation_id="retrievePartnerAnalytics",
1450
- oauth2_scopes=[],
1450
+ oauth2_scopes=None,
1451
1451
  security_source=self.sdk_configuration.security,
1452
1452
  ),
1453
1453
  request=req,
@@ -1470,7 +1470,7 @@ class Partners(BaseSDK):
1470
1470
  response_data: Any = None
1471
1471
  if utils.match_response(http_res, "200", "application/json"):
1472
1472
  return unmarshal_json_response(
1473
- Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
1473
+ operations.RetrievePartnerAnalyticsResponseBody, http_res
1474
1474
  )
1475
1475
  if utils.match_response(http_res, "400", "application/json"):
1476
1476
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -1525,7 +1525,7 @@ class Partners(BaseSDK):
1525
1525
  server_url: Optional[str] = None,
1526
1526
  timeout_ms: Optional[int] = None,
1527
1527
  http_headers: Optional[Mapping[str, str]] = None,
1528
- ) -> Optional[operations.RetrievePartnerAnalyticsResponseBody]:
1528
+ ) -> operations.RetrievePartnerAnalyticsResponseBody:
1529
1529
  r"""Retrieve analytics for a partner
1530
1530
 
1531
1531
  Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter.
@@ -1581,7 +1581,7 @@ class Partners(BaseSDK):
1581
1581
  config=self.sdk_configuration,
1582
1582
  base_url=base_url or "",
1583
1583
  operation_id="retrievePartnerAnalytics",
1584
- oauth2_scopes=[],
1584
+ oauth2_scopes=None,
1585
1585
  security_source=self.sdk_configuration.security,
1586
1586
  ),
1587
1587
  request=req,
@@ -1604,7 +1604,7 @@ class Partners(BaseSDK):
1604
1604
  response_data: Any = None
1605
1605
  if utils.match_response(http_res, "200", "application/json"):
1606
1606
  return unmarshal_json_response(
1607
- Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
1607
+ operations.RetrievePartnerAnalyticsResponseBody, http_res
1608
1608
  )
1609
1609
  if utils.match_response(http_res, "400", "application/json"):
1610
1610
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
@@ -1647,3 +1647,277 @@ class Partners(BaseSDK):
1647
1647
  raise errors.SDKError("API error occurred", http_res, http_res_text)
1648
1648
 
1649
1649
  raise errors.SDKError("Unexpected response received", http_res)
1650
+
1651
+ def ban(
1652
+ self,
1653
+ *,
1654
+ request: Optional[
1655
+ Union[
1656
+ operations.BanPartnerRequestBody,
1657
+ operations.BanPartnerRequestBodyTypedDict,
1658
+ ]
1659
+ ] = None,
1660
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1661
+ server_url: Optional[str] = None,
1662
+ timeout_ms: Optional[int] = None,
1663
+ http_headers: Optional[Mapping[str, str]] = None,
1664
+ ) -> operations.BanPartnerResponseBody:
1665
+ r"""Ban a partner
1666
+
1667
+ Ban a partner from your program. This will disable all links and mark all commissions as canceled.
1668
+
1669
+ :param request: The request object to send.
1670
+ :param retries: Override the default retry configuration for this method
1671
+ :param server_url: Override the default server URL for this method
1672
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1673
+ :param http_headers: Additional headers to set or replace on requests.
1674
+ """
1675
+ base_url = None
1676
+ url_variables = None
1677
+ if timeout_ms is None:
1678
+ timeout_ms = self.sdk_configuration.timeout_ms
1679
+
1680
+ if server_url is not None:
1681
+ base_url = server_url
1682
+ else:
1683
+ base_url = self._get_url(base_url, url_variables)
1684
+
1685
+ if not isinstance(request, BaseModel):
1686
+ request = utils.unmarshal(
1687
+ request, Optional[operations.BanPartnerRequestBody]
1688
+ )
1689
+ request = cast(Optional[operations.BanPartnerRequestBody], request)
1690
+
1691
+ req = self._build_request(
1692
+ method="POST",
1693
+ path="/partners/ban",
1694
+ base_url=base_url,
1695
+ url_variables=url_variables,
1696
+ request=request,
1697
+ request_body_required=False,
1698
+ request_has_path_params=False,
1699
+ request_has_query_params=True,
1700
+ user_agent_header="user-agent",
1701
+ accept_header_value="application/json",
1702
+ http_headers=http_headers,
1703
+ security=self.sdk_configuration.security,
1704
+ get_serialized_body=lambda: utils.serialize_request_body(
1705
+ request, False, True, "json", Optional[operations.BanPartnerRequestBody]
1706
+ ),
1707
+ timeout_ms=timeout_ms,
1708
+ )
1709
+
1710
+ if retries == UNSET:
1711
+ if self.sdk_configuration.retry_config is not UNSET:
1712
+ retries = self.sdk_configuration.retry_config
1713
+
1714
+ retry_config = None
1715
+ if isinstance(retries, utils.RetryConfig):
1716
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1717
+
1718
+ http_res = self.do_request(
1719
+ hook_ctx=HookContext(
1720
+ config=self.sdk_configuration,
1721
+ base_url=base_url or "",
1722
+ operation_id="banPartner",
1723
+ oauth2_scopes=None,
1724
+ security_source=self.sdk_configuration.security,
1725
+ ),
1726
+ request=req,
1727
+ error_status_codes=[
1728
+ "400",
1729
+ "401",
1730
+ "403",
1731
+ "404",
1732
+ "409",
1733
+ "410",
1734
+ "422",
1735
+ "429",
1736
+ "4XX",
1737
+ "500",
1738
+ "5XX",
1739
+ ],
1740
+ retry_config=retry_config,
1741
+ )
1742
+
1743
+ response_data: Any = None
1744
+ if utils.match_response(http_res, "200", "application/json"):
1745
+ return unmarshal_json_response(operations.BanPartnerResponseBody, http_res)
1746
+ if utils.match_response(http_res, "400", "application/json"):
1747
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1748
+ raise errors.BadRequest(response_data, http_res)
1749
+ if utils.match_response(http_res, "401", "application/json"):
1750
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
1751
+ raise errors.Unauthorized(response_data, http_res)
1752
+ if utils.match_response(http_res, "403", "application/json"):
1753
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
1754
+ raise errors.Forbidden(response_data, http_res)
1755
+ if utils.match_response(http_res, "404", "application/json"):
1756
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
1757
+ raise errors.NotFound(response_data, http_res)
1758
+ if utils.match_response(http_res, "409", "application/json"):
1759
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
1760
+ raise errors.Conflict(response_data, http_res)
1761
+ if utils.match_response(http_res, "410", "application/json"):
1762
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
1763
+ raise errors.InviteExpired(response_data, http_res)
1764
+ if utils.match_response(http_res, "422", "application/json"):
1765
+ response_data = unmarshal_json_response(
1766
+ errors.UnprocessableEntityData, http_res
1767
+ )
1768
+ raise errors.UnprocessableEntity(response_data, http_res)
1769
+ if utils.match_response(http_res, "429", "application/json"):
1770
+ response_data = unmarshal_json_response(
1771
+ errors.RateLimitExceededData, http_res
1772
+ )
1773
+ raise errors.RateLimitExceeded(response_data, http_res)
1774
+ if utils.match_response(http_res, "500", "application/json"):
1775
+ response_data = unmarshal_json_response(
1776
+ errors.InternalServerErrorData, http_res
1777
+ )
1778
+ raise errors.InternalServerError(response_data, http_res)
1779
+ if utils.match_response(http_res, "4XX", "*"):
1780
+ http_res_text = utils.stream_to_text(http_res)
1781
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1782
+ if utils.match_response(http_res, "5XX", "*"):
1783
+ http_res_text = utils.stream_to_text(http_res)
1784
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1785
+
1786
+ raise errors.SDKError("Unexpected response received", http_res)
1787
+
1788
+ async def ban_async(
1789
+ self,
1790
+ *,
1791
+ request: Optional[
1792
+ Union[
1793
+ operations.BanPartnerRequestBody,
1794
+ operations.BanPartnerRequestBodyTypedDict,
1795
+ ]
1796
+ ] = None,
1797
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1798
+ server_url: Optional[str] = None,
1799
+ timeout_ms: Optional[int] = None,
1800
+ http_headers: Optional[Mapping[str, str]] = None,
1801
+ ) -> operations.BanPartnerResponseBody:
1802
+ r"""Ban a partner
1803
+
1804
+ Ban a partner from your program. This will disable all links and mark all commissions as canceled.
1805
+
1806
+ :param request: The request object to send.
1807
+ :param retries: Override the default retry configuration for this method
1808
+ :param server_url: Override the default server URL for this method
1809
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1810
+ :param http_headers: Additional headers to set or replace on requests.
1811
+ """
1812
+ base_url = None
1813
+ url_variables = None
1814
+ if timeout_ms is None:
1815
+ timeout_ms = self.sdk_configuration.timeout_ms
1816
+
1817
+ if server_url is not None:
1818
+ base_url = server_url
1819
+ else:
1820
+ base_url = self._get_url(base_url, url_variables)
1821
+
1822
+ if not isinstance(request, BaseModel):
1823
+ request = utils.unmarshal(
1824
+ request, Optional[operations.BanPartnerRequestBody]
1825
+ )
1826
+ request = cast(Optional[operations.BanPartnerRequestBody], request)
1827
+
1828
+ req = self._build_request_async(
1829
+ method="POST",
1830
+ path="/partners/ban",
1831
+ base_url=base_url,
1832
+ url_variables=url_variables,
1833
+ request=request,
1834
+ request_body_required=False,
1835
+ request_has_path_params=False,
1836
+ request_has_query_params=True,
1837
+ user_agent_header="user-agent",
1838
+ accept_header_value="application/json",
1839
+ http_headers=http_headers,
1840
+ security=self.sdk_configuration.security,
1841
+ get_serialized_body=lambda: utils.serialize_request_body(
1842
+ request, False, True, "json", Optional[operations.BanPartnerRequestBody]
1843
+ ),
1844
+ timeout_ms=timeout_ms,
1845
+ )
1846
+
1847
+ if retries == UNSET:
1848
+ if self.sdk_configuration.retry_config is not UNSET:
1849
+ retries = self.sdk_configuration.retry_config
1850
+
1851
+ retry_config = None
1852
+ if isinstance(retries, utils.RetryConfig):
1853
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1854
+
1855
+ http_res = await self.do_request_async(
1856
+ hook_ctx=HookContext(
1857
+ config=self.sdk_configuration,
1858
+ base_url=base_url or "",
1859
+ operation_id="banPartner",
1860
+ oauth2_scopes=None,
1861
+ security_source=self.sdk_configuration.security,
1862
+ ),
1863
+ request=req,
1864
+ error_status_codes=[
1865
+ "400",
1866
+ "401",
1867
+ "403",
1868
+ "404",
1869
+ "409",
1870
+ "410",
1871
+ "422",
1872
+ "429",
1873
+ "4XX",
1874
+ "500",
1875
+ "5XX",
1876
+ ],
1877
+ retry_config=retry_config,
1878
+ )
1879
+
1880
+ response_data: Any = None
1881
+ if utils.match_response(http_res, "200", "application/json"):
1882
+ return unmarshal_json_response(operations.BanPartnerResponseBody, http_res)
1883
+ if utils.match_response(http_res, "400", "application/json"):
1884
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1885
+ raise errors.BadRequest(response_data, http_res)
1886
+ if utils.match_response(http_res, "401", "application/json"):
1887
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
1888
+ raise errors.Unauthorized(response_data, http_res)
1889
+ if utils.match_response(http_res, "403", "application/json"):
1890
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
1891
+ raise errors.Forbidden(response_data, http_res)
1892
+ if utils.match_response(http_res, "404", "application/json"):
1893
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
1894
+ raise errors.NotFound(response_data, http_res)
1895
+ if utils.match_response(http_res, "409", "application/json"):
1896
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
1897
+ raise errors.Conflict(response_data, http_res)
1898
+ if utils.match_response(http_res, "410", "application/json"):
1899
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
1900
+ raise errors.InviteExpired(response_data, http_res)
1901
+ if utils.match_response(http_res, "422", "application/json"):
1902
+ response_data = unmarshal_json_response(
1903
+ errors.UnprocessableEntityData, http_res
1904
+ )
1905
+ raise errors.UnprocessableEntity(response_data, http_res)
1906
+ if utils.match_response(http_res, "429", "application/json"):
1907
+ response_data = unmarshal_json_response(
1908
+ errors.RateLimitExceededData, http_res
1909
+ )
1910
+ raise errors.RateLimitExceeded(response_data, http_res)
1911
+ if utils.match_response(http_res, "500", "application/json"):
1912
+ response_data = unmarshal_json_response(
1913
+ errors.InternalServerErrorData, http_res
1914
+ )
1915
+ raise errors.InternalServerError(response_data, http_res)
1916
+ if utils.match_response(http_res, "4XX", "*"):
1917
+ http_res_text = await utils.stream_to_text_async(http_res)
1918
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1919
+ if utils.match_response(http_res, "5XX", "*"):
1920
+ http_res_text = await utils.stream_to_text_async(http_res)
1921
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1922
+
1923
+ raise errors.SDKError("Unexpected response received", 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.
@@ -74,7 +74,7 @@ class QRCodes(BaseSDK):
74
74
  config=self.sdk_configuration,
75
75
  base_url=base_url or "",
76
76
  operation_id="getQRCode",
77
- oauth2_scopes=[],
77
+ oauth2_scopes=None,
78
78
  security_source=self.sdk_configuration.security,
79
79
  ),
80
80
  request=req,
@@ -149,7 +149,7 @@ class QRCodes(BaseSDK):
149
149
  server_url: Optional[str] = None,
150
150
  timeout_ms: Optional[int] = None,
151
151
  http_headers: Optional[Mapping[str, str]] = None,
152
- ) -> Optional[str]:
152
+ ) -> str:
153
153
  r"""Retrieve a QR code
154
154
 
155
155
  Retrieve a QR code for a link.
@@ -203,7 +203,7 @@ class QRCodes(BaseSDK):
203
203
  config=self.sdk_configuration,
204
204
  base_url=base_url or "",
205
205
  operation_id="getQRCode",
206
- oauth2_scopes=[],
206
+ oauth2_scopes=None,
207
207
  security_source=self.sdk_configuration.security,
208
208
  ),
209
209
  request=req,