dub 0.32.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 (45) hide show
  1. dub/_version.py +3 -3
  2. dub/analytics.py +4 -4
  3. dub/commissions.py +8 -8
  4. dub/customers.py +16 -313
  5. dub/domains.py +22 -26
  6. dub/embed_tokens.py +4 -4
  7. dub/events.py +4 -4
  8. dub/folders.py +16 -20
  9. dub/links.py +38 -54
  10. dub/models/components/__init__.py +32 -0
  11. dub/models/components/analyticstopurls.py +2 -2
  12. dub/models/components/clickevent.py +7 -6
  13. dub/models/components/leadcreatedevent.py +7 -6
  14. dub/models/components/leadevent.py +7 -6
  15. dub/models/components/linkclickedevent.py +7 -6
  16. dub/models/components/linkschema.py +6 -0
  17. dub/models/components/linkwebhookevent.py +7 -6
  18. dub/models/components/partnerapplicationsubmittedevent.py +269 -0
  19. dub/models/components/partnerenrolledevent.py +64 -4
  20. dub/models/components/salecreatedevent.py +7 -6
  21. dub/models/components/saleevent.py +7 -6
  22. dub/models/components/webhookevent.py +6 -0
  23. dub/models/components/workspaceschema.py +6 -0
  24. dub/models/operations/__init__.py +17 -35
  25. dub/models/operations/banpartner.py +83 -0
  26. dub/models/operations/createpartner.py +64 -4
  27. dub/models/operations/listcommissions.py +13 -2
  28. dub/models/operations/listevents.py +10 -0
  29. dub/models/operations/listpartners.py +71 -4
  30. dub/models/operations/retrieveanalytics.py +12 -0
  31. dub/models/operations/retrievelinks.py +42 -7
  32. dub/models/operations/retrievepartneranalytics.py +51 -11
  33. dub/models/operations/updatecommission.py +7 -2
  34. dub/partners.py +298 -24
  35. dub/qr_codes.py +2 -2
  36. dub/tags.py +16 -24
  37. dub/track.py +8 -16
  38. dub/utils/retries.py +69 -5
  39. dub/utils/unmarshal_json_response.py +15 -1
  40. dub/workspaces.py +8 -16
  41. {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/METADATA +2 -20
  42. {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/RECORD +44 -43
  43. dub/models/operations/createcustomer.py +0 -382
  44. {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/WHEEL +0 -0
  45. {dub-0.32.0.dist-info → dub-0.33.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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
dub/tags.py CHANGED
@@ -23,7 +23,7 @@ class Tags(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[components.LinkTagSchema]:
26
+ ) -> components.LinkTagSchema:
27
27
  r"""Create a tag
28
28
 
29
29
  Create a tag for the authenticated workspace.
@@ -104,7 +104,7 @@ class Tags(BaseSDK):
104
104
 
105
105
  response_data: Any = None
106
106
  if utils.match_response(http_res, "201", "application/json"):
107
- return unmarshal_json_response(Optional[components.LinkTagSchema], http_res)
107
+ return unmarshal_json_response(components.LinkTagSchema, http_res)
108
108
  if utils.match_response(http_res, "400", "application/json"):
109
109
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
110
110
  raise errors.BadRequest(response_data, http_res)
@@ -160,7 +160,7 @@ class Tags(BaseSDK):
160
160
  server_url: Optional[str] = None,
161
161
  timeout_ms: Optional[int] = None,
162
162
  http_headers: Optional[Mapping[str, str]] = None,
163
- ) -> Optional[components.LinkTagSchema]:
163
+ ) -> components.LinkTagSchema:
164
164
  r"""Create a tag
165
165
 
166
166
  Create a tag for the authenticated workspace.
@@ -241,7 +241,7 @@ class Tags(BaseSDK):
241
241
 
242
242
  response_data: Any = None
243
243
  if utils.match_response(http_res, "201", "application/json"):
244
- return unmarshal_json_response(Optional[components.LinkTagSchema], http_res)
244
+ return unmarshal_json_response(components.LinkTagSchema, http_res)
245
245
  if utils.match_response(http_res, "400", "application/json"):
246
246
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
247
247
  raise errors.BadRequest(response_data, http_res)
@@ -292,7 +292,7 @@ class Tags(BaseSDK):
292
292
  server_url: Optional[str] = None,
293
293
  timeout_ms: Optional[int] = None,
294
294
  http_headers: Optional[Mapping[str, str]] = None,
295
- ) -> Optional[List[components.LinkTagSchema]]:
295
+ ) -> List[components.LinkTagSchema]:
296
296
  r"""Retrieve a list of tags
297
297
 
298
298
  Retrieve a list of tags for the authenticated workspace.
@@ -368,9 +368,7 @@ class Tags(BaseSDK):
368
368
 
369
369
  response_data: Any = None
370
370
  if utils.match_response(http_res, "200", "application/json"):
371
- return unmarshal_json_response(
372
- Optional[List[components.LinkTagSchema]], http_res
373
- )
371
+ return unmarshal_json_response(List[components.LinkTagSchema], http_res)
374
372
  if utils.match_response(http_res, "400", "application/json"):
375
373
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
376
374
  raise errors.BadRequest(response_data, http_res)
@@ -421,7 +419,7 @@ class Tags(BaseSDK):
421
419
  server_url: Optional[str] = None,
422
420
  timeout_ms: Optional[int] = None,
423
421
  http_headers: Optional[Mapping[str, str]] = None,
424
- ) -> Optional[List[components.LinkTagSchema]]:
422
+ ) -> List[components.LinkTagSchema]:
425
423
  r"""Retrieve a list of tags
426
424
 
427
425
  Retrieve a list of tags for the authenticated workspace.
@@ -497,9 +495,7 @@ class Tags(BaseSDK):
497
495
 
498
496
  response_data: Any = None
499
497
  if utils.match_response(http_res, "200", "application/json"):
500
- return unmarshal_json_response(
501
- Optional[List[components.LinkTagSchema]], http_res
502
- )
498
+ return unmarshal_json_response(List[components.LinkTagSchema], http_res)
503
499
  if utils.match_response(http_res, "400", "application/json"):
504
500
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
505
501
  raise errors.BadRequest(response_data, http_res)
@@ -556,7 +552,7 @@ class Tags(BaseSDK):
556
552
  server_url: Optional[str] = None,
557
553
  timeout_ms: Optional[int] = None,
558
554
  http_headers: Optional[Mapping[str, str]] = None,
559
- ) -> Optional[components.LinkTagSchema]:
555
+ ) -> components.LinkTagSchema:
560
556
  r"""Update a tag
561
557
 
562
558
  Update a tag in the workspace.
@@ -643,7 +639,7 @@ class Tags(BaseSDK):
643
639
 
644
640
  response_data: Any = None
645
641
  if utils.match_response(http_res, "200", "application/json"):
646
- return unmarshal_json_response(Optional[components.LinkTagSchema], http_res)
642
+ return unmarshal_json_response(components.LinkTagSchema, http_res)
647
643
  if utils.match_response(http_res, "400", "application/json"):
648
644
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
649
645
  raise errors.BadRequest(response_data, http_res)
@@ -700,7 +696,7 @@ class Tags(BaseSDK):
700
696
  server_url: Optional[str] = None,
701
697
  timeout_ms: Optional[int] = None,
702
698
  http_headers: Optional[Mapping[str, str]] = None,
703
- ) -> Optional[components.LinkTagSchema]:
699
+ ) -> components.LinkTagSchema:
704
700
  r"""Update a tag
705
701
 
706
702
  Update a tag in the workspace.
@@ -787,7 +783,7 @@ class Tags(BaseSDK):
787
783
 
788
784
  response_data: Any = None
789
785
  if utils.match_response(http_res, "200", "application/json"):
790
- return unmarshal_json_response(Optional[components.LinkTagSchema], http_res)
786
+ return unmarshal_json_response(components.LinkTagSchema, http_res)
791
787
  if utils.match_response(http_res, "400", "application/json"):
792
788
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
793
789
  raise errors.BadRequest(response_data, http_res)
@@ -838,7 +834,7 @@ class Tags(BaseSDK):
838
834
  server_url: Optional[str] = None,
839
835
  timeout_ms: Optional[int] = None,
840
836
  http_headers: Optional[Mapping[str, str]] = None,
841
- ) -> Optional[operations.DeleteTagResponseBody]:
837
+ ) -> operations.DeleteTagResponseBody:
842
838
  r"""Delete a tag
843
839
 
844
840
  Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag.
@@ -914,9 +910,7 @@ class Tags(BaseSDK):
914
910
 
915
911
  response_data: Any = None
916
912
  if utils.match_response(http_res, "200", "application/json"):
917
- return unmarshal_json_response(
918
- Optional[operations.DeleteTagResponseBody], http_res
919
- )
913
+ return unmarshal_json_response(operations.DeleteTagResponseBody, http_res)
920
914
  if utils.match_response(http_res, "400", "application/json"):
921
915
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
922
916
  raise errors.BadRequest(response_data, http_res)
@@ -967,7 +961,7 @@ class Tags(BaseSDK):
967
961
  server_url: Optional[str] = None,
968
962
  timeout_ms: Optional[int] = None,
969
963
  http_headers: Optional[Mapping[str, str]] = None,
970
- ) -> Optional[operations.DeleteTagResponseBody]:
964
+ ) -> operations.DeleteTagResponseBody:
971
965
  r"""Delete a tag
972
966
 
973
967
  Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag.
@@ -1043,9 +1037,7 @@ class Tags(BaseSDK):
1043
1037
 
1044
1038
  response_data: Any = None
1045
1039
  if utils.match_response(http_res, "200", "application/json"):
1046
- return unmarshal_json_response(
1047
- Optional[operations.DeleteTagResponseBody], http_res
1048
- )
1040
+ return unmarshal_json_response(operations.DeleteTagResponseBody, http_res)
1049
1041
  if utils.match_response(http_res, "400", "application/json"):
1050
1042
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
1051
1043
  raise errors.BadRequest(response_data, http_res)