dub 0.34.0__py3-none-any.whl → 0.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. dub/_version.py +3 -3
  2. dub/basesdk.py +20 -6
  3. dub/{workspaces.py → bounties.py} +349 -69
  4. dub/models/components/__init__.py +114 -26
  5. dub/models/components/analyticsbrowsers.py +18 -1
  6. dub/models/components/analyticscities.py +18 -1
  7. dub/models/components/analyticscontinents.py +18 -1
  8. dub/models/components/analyticscount.py +18 -1
  9. dub/models/components/analyticscountries.py +20 -1
  10. dub/models/components/analyticsdevices.py +18 -1
  11. dub/models/components/analyticsos.py +18 -1
  12. dub/models/components/analyticsreferers.py +18 -1
  13. dub/models/components/analyticsrefererurls.py +18 -1
  14. dub/models/components/analyticsregions.py +18 -1
  15. dub/models/components/analyticstimeseries.py +18 -1
  16. dub/models/components/analyticstoplinks.py +16 -26
  17. dub/models/components/analyticstopurls.py +18 -1
  18. dub/models/components/analyticstriggers.py +18 -1
  19. dub/models/components/commissioncreatedevent.py +123 -63
  20. dub/models/components/domainschema.py +31 -50
  21. dub/models/components/folderschema.py +18 -19
  22. dub/models/components/leadcreatedevent.py +151 -134
  23. dub/models/components/linkclickedevent.py +57 -70
  24. dub/models/components/linkschema.py +63 -64
  25. dub/models/components/linkwebhookevent.py +43 -51
  26. dub/models/components/partneranalyticscount.py +18 -1
  27. dub/models/components/partneranalyticstimeseries.py +18 -1
  28. dub/models/components/partneranalyticstoplinks.py +16 -27
  29. dub/models/components/partnerapplicationsubmittedevent.py +42 -75
  30. dub/models/components/partnerenrolledevent.py +477 -83
  31. dub/models/components/salecreatedevent.py +152 -151
  32. dub/models/errors/badrequest.py +18 -1
  33. dub/models/errors/conflict.py +18 -1
  34. dub/models/errors/forbidden.py +18 -1
  35. dub/models/errors/internalservererror.py +18 -1
  36. dub/models/errors/inviteexpired.py +18 -1
  37. dub/models/errors/notfound.py +18 -1
  38. dub/models/errors/ratelimitexceeded.py +18 -1
  39. dub/models/errors/unauthorized.py +18 -1
  40. dub/models/errors/unprocessableentity.py +18 -1
  41. dub/models/operations/__init__.py +323 -19
  42. dub/models/operations/approvebountysubmission.py +211 -0
  43. dub/models/operations/banpartner.py +14 -19
  44. dub/models/operations/bulkcreatelinks.py +86 -87
  45. dub/models/operations/bulkupdatelinks.py +97 -82
  46. dub/models/operations/checkdomainstatus.py +1 -17
  47. dub/models/operations/createdomain.py +33 -34
  48. dub/models/operations/createfolder.py +18 -19
  49. dub/models/operations/createlink.py +86 -87
  50. dub/models/operations/createpartner.py +560 -168
  51. dub/models/operations/createpartnerlink.py +74 -85
  52. dub/models/operations/createreferralsembedtoken.py +99 -87
  53. dub/models/operations/createtag.py +18 -1
  54. dub/models/operations/deactivatepartner.py +65 -0
  55. dub/models/operations/getcustomer.py +106 -105
  56. dub/models/operations/getcustomers.py +123 -105
  57. dub/models/operations/getlinkinfo.py +18 -1
  58. dub/models/operations/getlinks.py +36 -1
  59. dub/models/operations/getlinkscount.py +32 -1
  60. dub/models/operations/getqrcode.py +29 -1
  61. dub/models/operations/gettags.py +20 -1
  62. dub/models/operations/listbountysubmissions.py +249 -0
  63. dub/models/operations/listcommissions.py +129 -64
  64. dub/models/operations/listdomains.py +18 -1
  65. dub/models/operations/listevents.py +414 -389
  66. dub/models/operations/listfolders.py +18 -1
  67. dub/models/operations/listpartners.py +510 -84
  68. dub/models/operations/registerdomain.py +1 -17
  69. dub/models/operations/rejectbountysubmission.py +219 -0
  70. dub/models/operations/retrieveanalytics.py +65 -66
  71. dub/models/operations/retrievelinks.py +30 -19
  72. dub/models/operations/retrievepartneranalytics.py +25 -28
  73. dub/models/operations/tracklead.py +38 -83
  74. dub/models/operations/tracksale.py +52 -95
  75. dub/models/operations/updatecommission.py +126 -64
  76. dub/models/operations/updatecustomer.py +122 -131
  77. dub/models/operations/updatedomain.py +50 -35
  78. dub/models/operations/updatefolder.py +34 -19
  79. dub/models/operations/updatelink.py +101 -86
  80. dub/models/operations/updatetag.py +34 -1
  81. dub/models/operations/upsertlink.py +86 -87
  82. dub/models/operations/upsertpartnerlink.py +77 -90
  83. dub/partners.py +288 -0
  84. dub/sdk.py +3 -3
  85. dub/utils/__init__.py +10 -1
  86. {dub-0.34.0.dist-info → dub-0.35.0.dist-info}/METADATA +10 -8
  87. dub-0.35.0.dist-info/RECORD +143 -0
  88. dub/models/components/workspaceschema.py +0 -328
  89. dub/models/operations/getworkspace.py +0 -21
  90. dub/models/operations/updateworkspace.py +0 -78
  91. dub-0.34.0.dist-info/RECORD +0 -142
  92. {dub-0.34.0.dist-info → dub-0.35.0.dist-info}/WHEEL +0 -0
  93. {dub-0.34.0.dist-info → dub-0.35.0.dist-info}/licenses/LICENSE +0 -0
@@ -187,82 +187,81 @@ class UpsertPartnerLinkLinkProps(BaseModel):
187
187
 
188
188
  @model_serializer(mode="wrap")
189
189
  def serialize_model(self, handler):
190
- optional_fields = [
191
- "keyLength",
192
- "externalId",
193
- "tenantId",
194
- "prefix",
195
- "archived",
196
- "tagIds",
197
- "tagNames",
198
- "comments",
199
- "expiresAt",
200
- "expiredUrl",
201
- "password",
202
- "proxy",
203
- "title",
204
- "description",
205
- "image",
206
- "video",
207
- "rewrite",
208
- "ios",
209
- "android",
210
- "doIndex",
211
- "testVariants",
212
- "testStartedAt",
213
- "testCompletedAt",
214
- ]
215
- nullable_fields = [
216
- "externalId",
217
- "tenantId",
218
- "comments",
219
- "expiresAt",
220
- "expiredUrl",
221
- "password",
222
- "title",
223
- "description",
224
- "image",
225
- "video",
226
- "ios",
227
- "android",
228
- "testVariants",
229
- "testStartedAt",
230
- "testCompletedAt",
231
- ]
232
- null_default_fields = []
233
-
190
+ optional_fields = set(
191
+ [
192
+ "keyLength",
193
+ "externalId",
194
+ "tenantId",
195
+ "prefix",
196
+ "archived",
197
+ "tagIds",
198
+ "tagNames",
199
+ "comments",
200
+ "expiresAt",
201
+ "expiredUrl",
202
+ "password",
203
+ "proxy",
204
+ "title",
205
+ "description",
206
+ "image",
207
+ "video",
208
+ "rewrite",
209
+ "ios",
210
+ "android",
211
+ "doIndex",
212
+ "testVariants",
213
+ "testStartedAt",
214
+ "testCompletedAt",
215
+ ]
216
+ )
217
+ nullable_fields = set(
218
+ [
219
+ "externalId",
220
+ "tenantId",
221
+ "comments",
222
+ "expiresAt",
223
+ "expiredUrl",
224
+ "password",
225
+ "title",
226
+ "description",
227
+ "image",
228
+ "video",
229
+ "ios",
230
+ "android",
231
+ "testVariants",
232
+ "testStartedAt",
233
+ "testCompletedAt",
234
+ ]
235
+ )
234
236
  serialized = handler(self)
235
-
236
237
  m = {}
237
238
 
238
239
  for n, f in type(self).model_fields.items():
239
240
  k = f.alias or n
240
241
  val = serialized.get(k)
241
- serialized.pop(k, None)
242
-
243
- optional_nullable = k in optional_fields and k in nullable_fields
244
- is_set = (
245
- self.__pydantic_fields_set__.intersection({n})
246
- or k in null_default_fields
247
- ) # pylint: disable=no-member
248
-
249
- if val is not None and val != UNSET_SENTINEL:
250
- m[k] = val
251
- elif val != UNSET_SENTINEL and (
252
- not k in optional_fields or (optional_nullable and is_set)
253
- ):
254
- m[k] = val
242
+ is_nullable_and_explicitly_set = (
243
+ k in nullable_fields
244
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
245
+ )
246
+
247
+ if val != UNSET_SENTINEL:
248
+ if (
249
+ val is not None
250
+ or k not in optional_fields
251
+ or is_nullable_and_explicitly_set
252
+ ):
253
+ m[k] = val
255
254
 
256
255
  return m
257
256
 
258
257
 
259
258
  class UpsertPartnerLinkRequestBodyTypedDict(TypedDict):
259
+ url: str
260
+ r"""The URL to upsert for. Will throw an error if the domain doesn't match the program's default URL domain."""
260
261
  partner_id: NotRequired[Nullable[str]]
261
262
  r"""The ID of the partner to create a link for. Will take precedence over `tenantId` if provided."""
262
263
  tenant_id: NotRequired[Nullable[str]]
263
264
  r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""
264
- url: NotRequired[Nullable[str]]
265
- r"""The URL to shorten (if not provided, the program's default URL will be used). Will throw an error if the domain doesn't match the program's default URL domain."""
266
265
  key: NotRequired[str]
267
266
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
268
267
  comments: NotRequired[Nullable[str]]
@@ -272,6 +271,9 @@ class UpsertPartnerLinkRequestBodyTypedDict(TypedDict):
272
271
 
273
272
 
274
273
  class UpsertPartnerLinkRequestBody(BaseModel):
274
+ url: str
275
+ r"""The URL to upsert for. Will throw an error if the domain doesn't match the program's default URL domain."""
276
+
275
277
  partner_id: Annotated[OptionalNullable[str], pydantic.Field(alias="partnerId")] = (
276
278
  UNSET
277
279
  )
@@ -282,9 +284,6 @@ class UpsertPartnerLinkRequestBody(BaseModel):
282
284
  )
283
285
  r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""
284
286
 
285
- url: OptionalNullable[str] = UNSET
286
- r"""The URL to shorten (if not provided, the program's default URL will be used). Will throw an error if the domain doesn't match the program's default URL domain."""
287
-
288
287
  key: Optional[str] = None
289
288
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
290
289
 
@@ -298,37 +297,25 @@ class UpsertPartnerLinkRequestBody(BaseModel):
298
297
 
299
298
  @model_serializer(mode="wrap")
300
299
  def serialize_model(self, handler):
301
- optional_fields = [
302
- "partnerId",
303
- "tenantId",
304
- "url",
305
- "key",
306
- "comments",
307
- "linkProps",
308
- ]
309
- nullable_fields = ["partnerId", "tenantId", "url", "comments"]
310
- null_default_fields = []
311
-
300
+ optional_fields = set(["partnerId", "tenantId", "key", "comments", "linkProps"])
301
+ nullable_fields = set(["partnerId", "tenantId", "comments"])
312
302
  serialized = handler(self)
313
-
314
303
  m = {}
315
304
 
316
305
  for n, f in type(self).model_fields.items():
317
306
  k = f.alias or n
318
307
  val = serialized.get(k)
319
- serialized.pop(k, None)
320
-
321
- optional_nullable = k in optional_fields and k in nullable_fields
322
- is_set = (
323
- self.__pydantic_fields_set__.intersection({n})
324
- or k in null_default_fields
325
- ) # pylint: disable=no-member
326
-
327
- if val is not None and val != UNSET_SENTINEL:
328
- m[k] = val
329
- elif val != UNSET_SENTINEL and (
330
- not k in optional_fields or (optional_nullable and is_set)
331
- ):
332
- m[k] = val
308
+ is_nullable_and_explicitly_set = (
309
+ k in nullable_fields
310
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
311
+ )
312
+
313
+ if val != UNSET_SENTINEL:
314
+ if (
315
+ val is not None
316
+ or k not in optional_fields
317
+ or is_nullable_and_explicitly_set
318
+ ):
319
+ m[k] = val
333
320
 
334
321
  return m
dub/partners.py CHANGED
@@ -1939,3 +1939,291 @@ class Partners(BaseSDK):
1939
1939
  raise errors.SDKError("API error occurred", http_res, http_res_text)
1940
1940
 
1941
1941
  raise errors.SDKError("Unexpected response received", http_res)
1942
+
1943
+ def deactivate(
1944
+ self,
1945
+ *,
1946
+ request: Optional[
1947
+ Union[
1948
+ operations.DeactivatePartnerRequestBody,
1949
+ operations.DeactivatePartnerRequestBodyTypedDict,
1950
+ ]
1951
+ ] = None,
1952
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1953
+ server_url: Optional[str] = None,
1954
+ timeout_ms: Optional[int] = None,
1955
+ http_headers: Optional[Mapping[str, str]] = None,
1956
+ ) -> operations.DeactivatePartnerResponseBody:
1957
+ r"""Deactivate a partner
1958
+
1959
+ This will deactivate the partner from your program and disable all their active links. Their commissions and payouts will remain intact. You can reactivate them later if needed.
1960
+
1961
+ :param request: The request object to send.
1962
+ :param retries: Override the default retry configuration for this method
1963
+ :param server_url: Override the default server URL for this method
1964
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1965
+ :param http_headers: Additional headers to set or replace on requests.
1966
+ """
1967
+ base_url = None
1968
+ url_variables = None
1969
+ if timeout_ms is None:
1970
+ timeout_ms = self.sdk_configuration.timeout_ms
1971
+
1972
+ if server_url is not None:
1973
+ base_url = server_url
1974
+ else:
1975
+ base_url = self._get_url(base_url, url_variables)
1976
+
1977
+ if not isinstance(request, BaseModel):
1978
+ request = utils.unmarshal(
1979
+ request, Optional[operations.DeactivatePartnerRequestBody]
1980
+ )
1981
+ request = cast(Optional[operations.DeactivatePartnerRequestBody], request)
1982
+
1983
+ req = self._build_request(
1984
+ method="POST",
1985
+ path="/partners/deactivate",
1986
+ base_url=base_url,
1987
+ url_variables=url_variables,
1988
+ request=request,
1989
+ request_body_required=False,
1990
+ request_has_path_params=False,
1991
+ request_has_query_params=True,
1992
+ user_agent_header="user-agent",
1993
+ accept_header_value="application/json",
1994
+ http_headers=http_headers,
1995
+ security=self.sdk_configuration.security,
1996
+ get_serialized_body=lambda: utils.serialize_request_body(
1997
+ request,
1998
+ False,
1999
+ True,
2000
+ "json",
2001
+ Optional[operations.DeactivatePartnerRequestBody],
2002
+ ),
2003
+ allow_empty_value=None,
2004
+ timeout_ms=timeout_ms,
2005
+ )
2006
+
2007
+ if retries == UNSET:
2008
+ if self.sdk_configuration.retry_config is not UNSET:
2009
+ retries = self.sdk_configuration.retry_config
2010
+
2011
+ retry_config = None
2012
+ if isinstance(retries, utils.RetryConfig):
2013
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2014
+
2015
+ http_res = self.do_request(
2016
+ hook_ctx=HookContext(
2017
+ config=self.sdk_configuration,
2018
+ base_url=base_url or "",
2019
+ operation_id="deactivatePartner",
2020
+ oauth2_scopes=None,
2021
+ security_source=self.sdk_configuration.security,
2022
+ ),
2023
+ request=req,
2024
+ error_status_codes=[
2025
+ "400",
2026
+ "401",
2027
+ "403",
2028
+ "404",
2029
+ "409",
2030
+ "410",
2031
+ "422",
2032
+ "429",
2033
+ "4XX",
2034
+ "500",
2035
+ "5XX",
2036
+ ],
2037
+ retry_config=retry_config,
2038
+ )
2039
+
2040
+ response_data: Any = None
2041
+ if utils.match_response(http_res, "200", "application/json"):
2042
+ return unmarshal_json_response(
2043
+ operations.DeactivatePartnerResponseBody, http_res
2044
+ )
2045
+ if utils.match_response(http_res, "400", "application/json"):
2046
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
2047
+ raise errors.BadRequest(response_data, http_res)
2048
+ if utils.match_response(http_res, "401", "application/json"):
2049
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
2050
+ raise errors.Unauthorized(response_data, http_res)
2051
+ if utils.match_response(http_res, "403", "application/json"):
2052
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
2053
+ raise errors.Forbidden(response_data, http_res)
2054
+ if utils.match_response(http_res, "404", "application/json"):
2055
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
2056
+ raise errors.NotFound(response_data, http_res)
2057
+ if utils.match_response(http_res, "409", "application/json"):
2058
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
2059
+ raise errors.Conflict(response_data, http_res)
2060
+ if utils.match_response(http_res, "410", "application/json"):
2061
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
2062
+ raise errors.InviteExpired(response_data, http_res)
2063
+ if utils.match_response(http_res, "422", "application/json"):
2064
+ response_data = unmarshal_json_response(
2065
+ errors.UnprocessableEntityData, http_res
2066
+ )
2067
+ raise errors.UnprocessableEntity(response_data, http_res)
2068
+ if utils.match_response(http_res, "429", "application/json"):
2069
+ response_data = unmarshal_json_response(
2070
+ errors.RateLimitExceededData, http_res
2071
+ )
2072
+ raise errors.RateLimitExceeded(response_data, http_res)
2073
+ if utils.match_response(http_res, "500", "application/json"):
2074
+ response_data = unmarshal_json_response(
2075
+ errors.InternalServerErrorData, http_res
2076
+ )
2077
+ raise errors.InternalServerError(response_data, http_res)
2078
+ if utils.match_response(http_res, "4XX", "*"):
2079
+ http_res_text = utils.stream_to_text(http_res)
2080
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
2081
+ if utils.match_response(http_res, "5XX", "*"):
2082
+ http_res_text = utils.stream_to_text(http_res)
2083
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
2084
+
2085
+ raise errors.SDKError("Unexpected response received", http_res)
2086
+
2087
+ async def deactivate_async(
2088
+ self,
2089
+ *,
2090
+ request: Optional[
2091
+ Union[
2092
+ operations.DeactivatePartnerRequestBody,
2093
+ operations.DeactivatePartnerRequestBodyTypedDict,
2094
+ ]
2095
+ ] = None,
2096
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2097
+ server_url: Optional[str] = None,
2098
+ timeout_ms: Optional[int] = None,
2099
+ http_headers: Optional[Mapping[str, str]] = None,
2100
+ ) -> operations.DeactivatePartnerResponseBody:
2101
+ r"""Deactivate a partner
2102
+
2103
+ This will deactivate the partner from your program and disable all their active links. Their commissions and payouts will remain intact. You can reactivate them later if needed.
2104
+
2105
+ :param request: The request object to send.
2106
+ :param retries: Override the default retry configuration for this method
2107
+ :param server_url: Override the default server URL for this method
2108
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2109
+ :param http_headers: Additional headers to set or replace on requests.
2110
+ """
2111
+ base_url = None
2112
+ url_variables = None
2113
+ if timeout_ms is None:
2114
+ timeout_ms = self.sdk_configuration.timeout_ms
2115
+
2116
+ if server_url is not None:
2117
+ base_url = server_url
2118
+ else:
2119
+ base_url = self._get_url(base_url, url_variables)
2120
+
2121
+ if not isinstance(request, BaseModel):
2122
+ request = utils.unmarshal(
2123
+ request, Optional[operations.DeactivatePartnerRequestBody]
2124
+ )
2125
+ request = cast(Optional[operations.DeactivatePartnerRequestBody], request)
2126
+
2127
+ req = self._build_request_async(
2128
+ method="POST",
2129
+ path="/partners/deactivate",
2130
+ base_url=base_url,
2131
+ url_variables=url_variables,
2132
+ request=request,
2133
+ request_body_required=False,
2134
+ request_has_path_params=False,
2135
+ request_has_query_params=True,
2136
+ user_agent_header="user-agent",
2137
+ accept_header_value="application/json",
2138
+ http_headers=http_headers,
2139
+ security=self.sdk_configuration.security,
2140
+ get_serialized_body=lambda: utils.serialize_request_body(
2141
+ request,
2142
+ False,
2143
+ True,
2144
+ "json",
2145
+ Optional[operations.DeactivatePartnerRequestBody],
2146
+ ),
2147
+ allow_empty_value=None,
2148
+ timeout_ms=timeout_ms,
2149
+ )
2150
+
2151
+ if retries == UNSET:
2152
+ if self.sdk_configuration.retry_config is not UNSET:
2153
+ retries = self.sdk_configuration.retry_config
2154
+
2155
+ retry_config = None
2156
+ if isinstance(retries, utils.RetryConfig):
2157
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2158
+
2159
+ http_res = await self.do_request_async(
2160
+ hook_ctx=HookContext(
2161
+ config=self.sdk_configuration,
2162
+ base_url=base_url or "",
2163
+ operation_id="deactivatePartner",
2164
+ oauth2_scopes=None,
2165
+ security_source=self.sdk_configuration.security,
2166
+ ),
2167
+ request=req,
2168
+ error_status_codes=[
2169
+ "400",
2170
+ "401",
2171
+ "403",
2172
+ "404",
2173
+ "409",
2174
+ "410",
2175
+ "422",
2176
+ "429",
2177
+ "4XX",
2178
+ "500",
2179
+ "5XX",
2180
+ ],
2181
+ retry_config=retry_config,
2182
+ )
2183
+
2184
+ response_data: Any = None
2185
+ if utils.match_response(http_res, "200", "application/json"):
2186
+ return unmarshal_json_response(
2187
+ operations.DeactivatePartnerResponseBody, http_res
2188
+ )
2189
+ if utils.match_response(http_res, "400", "application/json"):
2190
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
2191
+ raise errors.BadRequest(response_data, http_res)
2192
+ if utils.match_response(http_res, "401", "application/json"):
2193
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
2194
+ raise errors.Unauthorized(response_data, http_res)
2195
+ if utils.match_response(http_res, "403", "application/json"):
2196
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
2197
+ raise errors.Forbidden(response_data, http_res)
2198
+ if utils.match_response(http_res, "404", "application/json"):
2199
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
2200
+ raise errors.NotFound(response_data, http_res)
2201
+ if utils.match_response(http_res, "409", "application/json"):
2202
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
2203
+ raise errors.Conflict(response_data, http_res)
2204
+ if utils.match_response(http_res, "410", "application/json"):
2205
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
2206
+ raise errors.InviteExpired(response_data, http_res)
2207
+ if utils.match_response(http_res, "422", "application/json"):
2208
+ response_data = unmarshal_json_response(
2209
+ errors.UnprocessableEntityData, http_res
2210
+ )
2211
+ raise errors.UnprocessableEntity(response_data, http_res)
2212
+ if utils.match_response(http_res, "429", "application/json"):
2213
+ response_data = unmarshal_json_response(
2214
+ errors.RateLimitExceededData, http_res
2215
+ )
2216
+ raise errors.RateLimitExceeded(response_data, http_res)
2217
+ if utils.match_response(http_res, "500", "application/json"):
2218
+ response_data = unmarshal_json_response(
2219
+ errors.InternalServerErrorData, http_res
2220
+ )
2221
+ raise errors.InternalServerError(response_data, http_res)
2222
+ if utils.match_response(http_res, "4XX", "*"):
2223
+ http_res_text = await utils.stream_to_text_async(http_res)
2224
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
2225
+ if utils.match_response(http_res, "5XX", "*"):
2226
+ http_res_text = await utils.stream_to_text_async(http_res)
2227
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
2228
+
2229
+ raise errors.SDKError("Unexpected response received", http_res)
dub/sdk.py CHANGED
@@ -17,6 +17,7 @@ import weakref
17
17
 
18
18
  if TYPE_CHECKING:
19
19
  from dub.analytics import Analytics
20
+ from dub.bounties import Bounties
20
21
  from dub.commissions import Commissions
21
22
  from dub.customers import Customers
22
23
  from dub.domains import Domains
@@ -28,7 +29,6 @@ if TYPE_CHECKING:
28
29
  from dub.qr_codes import QRCodes
29
30
  from dub.tags import Tags
30
31
  from dub.track import Track
31
- from dub.workspaces import Workspaces
32
32
 
33
33
 
34
34
  class Dub(BaseSDK):
@@ -44,9 +44,9 @@ class Dub(BaseSDK):
44
44
  customers: "Customers"
45
45
  partners: "Partners"
46
46
  commissions: "Commissions"
47
- workspaces: "Workspaces"
48
47
  embed_tokens: "EmbedTokens"
49
48
  qr_codes: "QRCodes"
49
+ bounties: "Bounties"
50
50
  _sub_sdk_map = {
51
51
  "links": ("dub.links", "Links"),
52
52
  "analytics": ("dub.analytics", "Analytics"),
@@ -58,9 +58,9 @@ class Dub(BaseSDK):
58
58
  "customers": ("dub.customers", "Customers"),
59
59
  "partners": ("dub.partners", "Partners"),
60
60
  "commissions": ("dub.commissions", "Commissions"),
61
- "workspaces": ("dub.workspaces", "Workspaces"),
62
61
  "embed_tokens": ("dub.embed_tokens", "EmbedTokens"),
63
62
  "qr_codes": ("dub.qr_codes", "QRCodes"),
63
+ "bounties": ("dub.bounties", "Bounties"),
64
64
  }
65
65
 
66
66
  def __init__(
dub/utils/__init__.py CHANGED
@@ -1,10 +1,19 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from typing import TYPE_CHECKING
3
+ from typing import TYPE_CHECKING, Callable, TypeVar
4
4
  from importlib import import_module
5
+ import asyncio
5
6
  import builtins
6
7
  import sys
7
8
 
9
+ _T = TypeVar("_T")
10
+
11
+
12
+ async def run_sync_in_thread(func: Callable[..., _T], *args) -> _T:
13
+ """Run a synchronous function in a thread pool to avoid blocking the event loop."""
14
+ return await asyncio.to_thread(func, *args)
15
+
16
+
8
17
  if TYPE_CHECKING:
9
18
  from .annotations import get_discriminator
10
19
  from .datetimes import parse_datetime
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dub
3
- Version: 0.34.0
3
+ Version: 0.35.0
4
4
  Summary: Python Client SDK Generated by Speakeasy
5
5
  License-File: LICENSE
6
6
  Author: Speakeasy
7
- Requires-Python: >=3.9.2
7
+ Requires-Python: >=3.10
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
@@ -104,7 +104,7 @@ It's also possible to write a standalone Python script without needing to set up
104
104
  ```python
105
105
  #!/usr/bin/env -S uv run --script
106
106
  # /// script
107
- # requires-python = ">=3.9"
107
+ # requires-python = ">=3.10"
108
108
  # dependencies = [
109
109
  # "dub",
110
110
  # ]
@@ -281,6 +281,12 @@ asyncio.run(main())
281
281
 
282
282
  * [retrieve](https://github.com/dubinc/dub-python/blob/master/docs/sdks/analytics/README.md#retrieve) - Retrieve analytics for a link, a domain, or the authenticated workspace.
283
283
 
284
+ ### [Bounties](https://github.com/dubinc/dub-python/blob/master/docs/sdks/bounties/README.md)
285
+
286
+ * [list_submissions](https://github.com/dubinc/dub-python/blob/master/docs/sdks/bounties/README.md#list_submissions) - List bounty submissions
287
+ * [approve_submission](https://github.com/dubinc/dub-python/blob/master/docs/sdks/bounties/README.md#approve_submission) - Approve a bounty submission
288
+ * [reject_submission](https://github.com/dubinc/dub-python/blob/master/docs/sdks/bounties/README.md#reject_submission) - Reject a bounty submission
289
+
284
290
  ### [Commissions](https://github.com/dubinc/dub-python/blob/master/docs/sdks/commissions/README.md)
285
291
 
286
292
  * [list](https://github.com/dubinc/dub-python/blob/master/docs/sdks/commissions/README.md#list) - Get commissions for a program.
@@ -339,6 +345,7 @@ asyncio.run(main())
339
345
  * [upsert_link](https://github.com/dubinc/dub-python/blob/master/docs/sdks/partners/README.md#upsert_link) - Upsert a link for a partner
340
346
  * [analytics](https://github.com/dubinc/dub-python/blob/master/docs/sdks/partners/README.md#analytics) - Retrieve analytics for a partner
341
347
  * [ban](https://github.com/dubinc/dub-python/blob/master/docs/sdks/partners/README.md#ban) - Ban a partner
348
+ * [deactivate](https://github.com/dubinc/dub-python/blob/master/docs/sdks/partners/README.md#deactivate) - Deactivate a partner
342
349
 
343
350
  ### [QRCodes](https://github.com/dubinc/dub-python/blob/master/docs/sdks/qrcodes/README.md)
344
351
 
@@ -356,11 +363,6 @@ asyncio.run(main())
356
363
  * [lead](https://github.com/dubinc/dub-python/blob/master/docs/sdks/track/README.md#lead) - Track a lead
357
364
  * [sale](https://github.com/dubinc/dub-python/blob/master/docs/sdks/track/README.md#sale) - Track a sale
358
365
 
359
- ### [Workspaces](https://github.com/dubinc/dub-python/blob/master/docs/sdks/workspaces/README.md)
360
-
361
- * [get](https://github.com/dubinc/dub-python/blob/master/docs/sdks/workspaces/README.md#get) - Retrieve a workspace
362
- * [update](https://github.com/dubinc/dub-python/blob/master/docs/sdks/workspaces/README.md#update) - Update a workspace
363
-
364
366
  </details>
365
367
  <!-- End Available Resources and Operations [operations] -->
366
368