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
dub/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "dub"
6
- __version__: str = "0.34.0"
6
+ __version__: str = "0.35.0"
7
7
  __openapi_doc_version__: str = "0.0.1"
8
- __gen_version__: str = "2.793.2"
9
- __user_agent__: str = "speakeasy-sdk/python 0.34.0 2.793.2 0.0.1 dub"
8
+ __gen_version__: str = "2.803.3"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.35.0 2.803.3 0.0.1 dub"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
dub/basesdk.py CHANGED
@@ -4,7 +4,12 @@ from .sdkconfiguration import SDKConfiguration
4
4
  from dub import utils
5
5
  from dub._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext
6
6
  from dub.models import errors
7
- from dub.utils import RetryConfig, SerializedRequestBody, get_body_content
7
+ from dub.utils import (
8
+ RetryConfig,
9
+ SerializedRequestBody,
10
+ get_body_content,
11
+ run_sync_in_thread,
12
+ )
8
13
  import httpx
9
14
  from typing import Callable, List, Mapping, Optional, Tuple
10
15
  from urllib.parse import parse_qs, urlparse
@@ -308,7 +313,10 @@ class BaseSDK:
308
313
  async def do():
309
314
  http_res = None
310
315
  try:
311
- req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
316
+ req = await run_sync_in_thread(
317
+ hooks.before_request, BeforeRequestContext(hook_ctx), request
318
+ )
319
+
312
320
  logger.debug(
313
321
  "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
314
322
  req.method,
@@ -322,7 +330,10 @@ class BaseSDK:
322
330
 
323
331
  http_res = await client.send(req, stream=stream)
324
332
  except Exception as e:
325
- _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
333
+ _, e = await run_sync_in_thread(
334
+ hooks.after_error, AfterErrorContext(hook_ctx), None, e
335
+ )
336
+
326
337
  if e is not None:
327
338
  logger.debug("Request Exception", exc_info=True)
328
339
  raise e
@@ -340,9 +351,10 @@ class BaseSDK:
340
351
  )
341
352
 
342
353
  if utils.match_status_codes(error_status_codes, http_res.status_code):
343
- result, err = hooks.after_error(
344
- AfterErrorContext(hook_ctx), http_res, None
354
+ result, err = await run_sync_in_thread(
355
+ hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
345
356
  )
357
+
346
358
  if err is not None:
347
359
  logger.debug("Request Exception", exc_info=True)
348
360
  raise err
@@ -362,6 +374,8 @@ class BaseSDK:
362
374
  http_res = await do()
363
375
 
364
376
  if not utils.match_status_codes(error_status_codes, http_res.status_code):
365
- http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
377
+ http_res = await run_sync_in_thread(
378
+ hooks.after_success, AfterSuccessContext(hook_ctx), http_res
379
+ )
366
380
 
367
381
  return http_res
@@ -3,27 +3,28 @@
3
3
  from .basesdk import BaseSDK
4
4
  from dub import utils
5
5
  from dub._hooks import HookContext
6
- from dub.models import components, errors, operations
6
+ from dub.models import errors, operations
7
7
  from dub.types import BaseModel, OptionalNullable, UNSET
8
8
  from dub.utils.unmarshal_json_response import unmarshal_json_response
9
- from typing import Any, Mapping, Optional, Union, cast
9
+ from typing import Any, List, Mapping, Optional, Union, cast
10
10
 
11
11
 
12
- class Workspaces(BaseSDK):
13
- def get(
12
+ class Bounties(BaseSDK):
13
+ def list_submissions(
14
14
  self,
15
15
  *,
16
16
  request: Union[
17
- operations.GetWorkspaceRequest, operations.GetWorkspaceRequestTypedDict
17
+ operations.ListBountySubmissionsRequest,
18
+ operations.ListBountySubmissionsRequestTypedDict,
18
19
  ],
19
20
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
20
21
  server_url: Optional[str] = None,
21
22
  timeout_ms: Optional[int] = None,
22
23
  http_headers: Optional[Mapping[str, str]] = None,
23
- ) -> components.WorkspaceSchema:
24
- r"""Retrieve a workspace
24
+ ) -> List[operations.ListBountySubmissionsResponseBody]:
25
+ r"""List bounty submissions
25
26
 
26
- Retrieve a workspace for the authenticated user.
27
+ List all submissions for a specific bounty.
27
28
 
28
29
  :param request: The request object to send.
29
30
  :param retries: Override the default retry configuration for this method
@@ -42,12 +43,12 @@ class Workspaces(BaseSDK):
42
43
  base_url = self._get_url(base_url, url_variables)
43
44
 
44
45
  if not isinstance(request, BaseModel):
45
- request = utils.unmarshal(request, operations.GetWorkspaceRequest)
46
- request = cast(operations.GetWorkspaceRequest, request)
46
+ request = utils.unmarshal(request, operations.ListBountySubmissionsRequest)
47
+ request = cast(operations.ListBountySubmissionsRequest, request)
47
48
 
48
49
  req = self._build_request(
49
50
  method="GET",
50
- path="/workspaces/{idOrSlug}",
51
+ path="/bounties/{bountyId}/submissions",
51
52
  base_url=base_url,
52
53
  url_variables=url_variables,
53
54
  request=request,
@@ -74,7 +75,7 @@ class Workspaces(BaseSDK):
74
75
  hook_ctx=HookContext(
75
76
  config=self.sdk_configuration,
76
77
  base_url=base_url or "",
77
- operation_id="getWorkspace",
78
+ operation_id="listBountySubmissions",
78
79
  oauth2_scopes=None,
79
80
  security_source=self.sdk_configuration.security,
80
81
  ),
@@ -97,7 +98,9 @@ class Workspaces(BaseSDK):
97
98
 
98
99
  response_data: Any = None
99
100
  if utils.match_response(http_res, "200", "application/json"):
100
- return unmarshal_json_response(components.WorkspaceSchema, http_res)
101
+ return unmarshal_json_response(
102
+ List[operations.ListBountySubmissionsResponseBody], http_res
103
+ )
101
104
  if utils.match_response(http_res, "400", "application/json"):
102
105
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
103
106
  raise errors.BadRequest(response_data, http_res)
@@ -140,20 +143,21 @@ class Workspaces(BaseSDK):
140
143
 
141
144
  raise errors.SDKError("Unexpected response received", http_res)
142
145
 
143
- async def get_async(
146
+ async def list_submissions_async(
144
147
  self,
145
148
  *,
146
149
  request: Union[
147
- operations.GetWorkspaceRequest, operations.GetWorkspaceRequestTypedDict
150
+ operations.ListBountySubmissionsRequest,
151
+ operations.ListBountySubmissionsRequestTypedDict,
148
152
  ],
149
153
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
150
154
  server_url: Optional[str] = None,
151
155
  timeout_ms: Optional[int] = None,
152
156
  http_headers: Optional[Mapping[str, str]] = None,
153
- ) -> components.WorkspaceSchema:
154
- r"""Retrieve a workspace
157
+ ) -> List[operations.ListBountySubmissionsResponseBody]:
158
+ r"""List bounty submissions
155
159
 
156
- Retrieve a workspace for the authenticated user.
160
+ List all submissions for a specific bounty.
157
161
 
158
162
  :param request: The request object to send.
159
163
  :param retries: Override the default retry configuration for this method
@@ -172,12 +176,12 @@ class Workspaces(BaseSDK):
172
176
  base_url = self._get_url(base_url, url_variables)
173
177
 
174
178
  if not isinstance(request, BaseModel):
175
- request = utils.unmarshal(request, operations.GetWorkspaceRequest)
176
- request = cast(operations.GetWorkspaceRequest, request)
179
+ request = utils.unmarshal(request, operations.ListBountySubmissionsRequest)
180
+ request = cast(operations.ListBountySubmissionsRequest, request)
177
181
 
178
182
  req = self._build_request_async(
179
183
  method="GET",
180
- path="/workspaces/{idOrSlug}",
184
+ path="/bounties/{bountyId}/submissions",
181
185
  base_url=base_url,
182
186
  url_variables=url_variables,
183
187
  request=request,
@@ -204,7 +208,7 @@ class Workspaces(BaseSDK):
204
208
  hook_ctx=HookContext(
205
209
  config=self.sdk_configuration,
206
210
  base_url=base_url or "",
207
- operation_id="getWorkspace",
211
+ operation_id="listBountySubmissions",
208
212
  oauth2_scopes=None,
209
213
  security_source=self.sdk_configuration.security,
210
214
  ),
@@ -227,7 +231,9 @@ class Workspaces(BaseSDK):
227
231
 
228
232
  response_data: Any = None
229
233
  if utils.match_response(http_res, "200", "application/json"):
230
- return unmarshal_json_response(components.WorkspaceSchema, http_res)
234
+ return unmarshal_json_response(
235
+ List[operations.ListBountySubmissionsResponseBody], http_res
236
+ )
231
237
  if utils.match_response(http_res, "400", "application/json"):
232
238
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
233
239
  raise errors.BadRequest(response_data, http_res)
@@ -270,27 +276,23 @@ class Workspaces(BaseSDK):
270
276
 
271
277
  raise errors.SDKError("Unexpected response received", http_res)
272
278
 
273
- def update(
279
+ def approve_submission(
274
280
  self,
275
281
  *,
276
- id_or_slug: str,
277
- request_body: Optional[
278
- Union[
279
- operations.UpdateWorkspaceRequestBody,
280
- operations.UpdateWorkspaceRequestBodyTypedDict,
281
- ]
282
- ] = None,
282
+ request: Union[
283
+ operations.ApproveBountySubmissionRequest,
284
+ operations.ApproveBountySubmissionRequestTypedDict,
285
+ ],
283
286
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
284
287
  server_url: Optional[str] = None,
285
288
  timeout_ms: Optional[int] = None,
286
289
  http_headers: Optional[Mapping[str, str]] = None,
287
- ) -> components.WorkspaceSchema:
288
- r"""Update a workspace
290
+ ) -> operations.ApproveBountySubmissionResponseBody:
291
+ r"""Approve a bounty submission
289
292
 
290
- Update a workspace by ID or slug.
293
+ Approve a bounty submission. Optionally specify a custom reward amount.
291
294
 
292
- :param id_or_slug: The ID or slug of the workspace to update.
293
- :param request_body:
295
+ :param request: The request object to send.
294
296
  :param retries: Override the default retry configuration for this method
295
297
  :param server_url: Override the default server URL for this method
296
298
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -306,16 +308,15 @@ class Workspaces(BaseSDK):
306
308
  else:
307
309
  base_url = self._get_url(base_url, url_variables)
308
310
 
309
- request = operations.UpdateWorkspaceRequest(
310
- id_or_slug=id_or_slug,
311
- request_body=utils.get_pydantic_model(
312
- request_body, Optional[operations.UpdateWorkspaceRequestBody]
313
- ),
314
- )
311
+ if not isinstance(request, BaseModel):
312
+ request = utils.unmarshal(
313
+ request, operations.ApproveBountySubmissionRequest
314
+ )
315
+ request = cast(operations.ApproveBountySubmissionRequest, request)
315
316
 
316
317
  req = self._build_request(
317
- method="PATCH",
318
- path="/workspaces/{idOrSlug}",
318
+ method="POST",
319
+ path="/bounties/{bountyId}/submissions/{submissionId}/approve",
319
320
  base_url=base_url,
320
321
  url_variables=url_variables,
321
322
  request=request,
@@ -331,7 +332,7 @@ class Workspaces(BaseSDK):
331
332
  False,
332
333
  True,
333
334
  "json",
334
- Optional[operations.UpdateWorkspaceRequestBody],
335
+ Optional[operations.ApproveBountySubmissionRequestBody],
335
336
  ),
336
337
  allow_empty_value=None,
337
338
  timeout_ms=timeout_ms,
@@ -349,7 +350,7 @@ class Workspaces(BaseSDK):
349
350
  hook_ctx=HookContext(
350
351
  config=self.sdk_configuration,
351
352
  base_url=base_url or "",
352
- operation_id="updateWorkspace",
353
+ operation_id="approveBountySubmission",
353
354
  oauth2_scopes=None,
354
355
  security_source=self.sdk_configuration.security,
355
356
  ),
@@ -372,7 +373,9 @@ class Workspaces(BaseSDK):
372
373
 
373
374
  response_data: Any = None
374
375
  if utils.match_response(http_res, "200", "application/json"):
375
- return unmarshal_json_response(components.WorkspaceSchema, http_res)
376
+ return unmarshal_json_response(
377
+ operations.ApproveBountySubmissionResponseBody, http_res
378
+ )
376
379
  if utils.match_response(http_res, "400", "application/json"):
377
380
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
378
381
  raise errors.BadRequest(response_data, http_res)
@@ -415,27 +418,165 @@ class Workspaces(BaseSDK):
415
418
 
416
419
  raise errors.SDKError("Unexpected response received", http_res)
417
420
 
418
- async def update_async(
421
+ async def approve_submission_async(
422
+ self,
423
+ *,
424
+ request: Union[
425
+ operations.ApproveBountySubmissionRequest,
426
+ operations.ApproveBountySubmissionRequestTypedDict,
427
+ ],
428
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
429
+ server_url: Optional[str] = None,
430
+ timeout_ms: Optional[int] = None,
431
+ http_headers: Optional[Mapping[str, str]] = None,
432
+ ) -> operations.ApproveBountySubmissionResponseBody:
433
+ r"""Approve a bounty submission
434
+
435
+ Approve a bounty submission. Optionally specify a custom reward amount.
436
+
437
+ :param request: The request object to send.
438
+ :param retries: Override the default retry configuration for this method
439
+ :param server_url: Override the default server URL for this method
440
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
441
+ :param http_headers: Additional headers to set or replace on requests.
442
+ """
443
+ base_url = None
444
+ url_variables = None
445
+ if timeout_ms is None:
446
+ timeout_ms = self.sdk_configuration.timeout_ms
447
+
448
+ if server_url is not None:
449
+ base_url = server_url
450
+ else:
451
+ base_url = self._get_url(base_url, url_variables)
452
+
453
+ if not isinstance(request, BaseModel):
454
+ request = utils.unmarshal(
455
+ request, operations.ApproveBountySubmissionRequest
456
+ )
457
+ request = cast(operations.ApproveBountySubmissionRequest, request)
458
+
459
+ req = self._build_request_async(
460
+ method="POST",
461
+ path="/bounties/{bountyId}/submissions/{submissionId}/approve",
462
+ base_url=base_url,
463
+ url_variables=url_variables,
464
+ request=request,
465
+ request_body_required=False,
466
+ request_has_path_params=True,
467
+ request_has_query_params=True,
468
+ user_agent_header="user-agent",
469
+ accept_header_value="application/json",
470
+ http_headers=http_headers,
471
+ security=self.sdk_configuration.security,
472
+ get_serialized_body=lambda: utils.serialize_request_body(
473
+ request.request_body,
474
+ False,
475
+ True,
476
+ "json",
477
+ Optional[operations.ApproveBountySubmissionRequestBody],
478
+ ),
479
+ allow_empty_value=None,
480
+ timeout_ms=timeout_ms,
481
+ )
482
+
483
+ if retries == UNSET:
484
+ if self.sdk_configuration.retry_config is not UNSET:
485
+ retries = self.sdk_configuration.retry_config
486
+
487
+ retry_config = None
488
+ if isinstance(retries, utils.RetryConfig):
489
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
490
+
491
+ http_res = await self.do_request_async(
492
+ hook_ctx=HookContext(
493
+ config=self.sdk_configuration,
494
+ base_url=base_url or "",
495
+ operation_id="approveBountySubmission",
496
+ oauth2_scopes=None,
497
+ security_source=self.sdk_configuration.security,
498
+ ),
499
+ request=req,
500
+ error_status_codes=[
501
+ "400",
502
+ "401",
503
+ "403",
504
+ "404",
505
+ "409",
506
+ "410",
507
+ "422",
508
+ "429",
509
+ "4XX",
510
+ "500",
511
+ "5XX",
512
+ ],
513
+ retry_config=retry_config,
514
+ )
515
+
516
+ response_data: Any = None
517
+ if utils.match_response(http_res, "200", "application/json"):
518
+ return unmarshal_json_response(
519
+ operations.ApproveBountySubmissionResponseBody, http_res
520
+ )
521
+ if utils.match_response(http_res, "400", "application/json"):
522
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
523
+ raise errors.BadRequest(response_data, http_res)
524
+ if utils.match_response(http_res, "401", "application/json"):
525
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
526
+ raise errors.Unauthorized(response_data, http_res)
527
+ if utils.match_response(http_res, "403", "application/json"):
528
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
529
+ raise errors.Forbidden(response_data, http_res)
530
+ if utils.match_response(http_res, "404", "application/json"):
531
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
532
+ raise errors.NotFound(response_data, http_res)
533
+ if utils.match_response(http_res, "409", "application/json"):
534
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
535
+ raise errors.Conflict(response_data, http_res)
536
+ if utils.match_response(http_res, "410", "application/json"):
537
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
538
+ raise errors.InviteExpired(response_data, http_res)
539
+ if utils.match_response(http_res, "422", "application/json"):
540
+ response_data = unmarshal_json_response(
541
+ errors.UnprocessableEntityData, http_res
542
+ )
543
+ raise errors.UnprocessableEntity(response_data, http_res)
544
+ if utils.match_response(http_res, "429", "application/json"):
545
+ response_data = unmarshal_json_response(
546
+ errors.RateLimitExceededData, http_res
547
+ )
548
+ raise errors.RateLimitExceeded(response_data, http_res)
549
+ if utils.match_response(http_res, "500", "application/json"):
550
+ response_data = unmarshal_json_response(
551
+ errors.InternalServerErrorData, http_res
552
+ )
553
+ raise errors.InternalServerError(response_data, http_res)
554
+ if utils.match_response(http_res, "4XX", "*"):
555
+ http_res_text = await utils.stream_to_text_async(http_res)
556
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
557
+ if utils.match_response(http_res, "5XX", "*"):
558
+ http_res_text = await utils.stream_to_text_async(http_res)
559
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
560
+
561
+ raise errors.SDKError("Unexpected response received", http_res)
562
+
563
+ def reject_submission(
419
564
  self,
420
565
  *,
421
- id_or_slug: str,
422
- request_body: Optional[
423
- Union[
424
- operations.UpdateWorkspaceRequestBody,
425
- operations.UpdateWorkspaceRequestBodyTypedDict,
426
- ]
427
- ] = None,
566
+ request: Union[
567
+ operations.RejectBountySubmissionRequest,
568
+ operations.RejectBountySubmissionRequestTypedDict,
569
+ ],
428
570
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
429
571
  server_url: Optional[str] = None,
430
572
  timeout_ms: Optional[int] = None,
431
573
  http_headers: Optional[Mapping[str, str]] = None,
432
- ) -> components.WorkspaceSchema:
433
- r"""Update a workspace
574
+ ) -> operations.RejectBountySubmissionResponseBody:
575
+ r"""Reject a bounty submission
434
576
 
435
- Update a workspace by ID or slug.
577
+ Reject a bounty submission with a specified reason and optional note.
436
578
 
437
- :param id_or_slug: The ID or slug of the workspace to update.
438
- :param request_body:
579
+ :param request: The request object to send.
439
580
  :param retries: Override the default retry configuration for this method
440
581
  :param server_url: Override the default server URL for this method
441
582
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -451,16 +592,153 @@ class Workspaces(BaseSDK):
451
592
  else:
452
593
  base_url = self._get_url(base_url, url_variables)
453
594
 
454
- request = operations.UpdateWorkspaceRequest(
455
- id_or_slug=id_or_slug,
456
- request_body=utils.get_pydantic_model(
457
- request_body, Optional[operations.UpdateWorkspaceRequestBody]
595
+ if not isinstance(request, BaseModel):
596
+ request = utils.unmarshal(request, operations.RejectBountySubmissionRequest)
597
+ request = cast(operations.RejectBountySubmissionRequest, request)
598
+
599
+ req = self._build_request(
600
+ method="POST",
601
+ path="/bounties/{bountyId}/submissions/{submissionId}/reject",
602
+ base_url=base_url,
603
+ url_variables=url_variables,
604
+ request=request,
605
+ request_body_required=False,
606
+ request_has_path_params=True,
607
+ request_has_query_params=True,
608
+ user_agent_header="user-agent",
609
+ accept_header_value="application/json",
610
+ http_headers=http_headers,
611
+ security=self.sdk_configuration.security,
612
+ get_serialized_body=lambda: utils.serialize_request_body(
613
+ request.request_body,
614
+ False,
615
+ True,
616
+ "json",
617
+ Optional[operations.RejectBountySubmissionRequestBody],
458
618
  ),
619
+ allow_empty_value=None,
620
+ timeout_ms=timeout_ms,
459
621
  )
460
622
 
623
+ if retries == UNSET:
624
+ if self.sdk_configuration.retry_config is not UNSET:
625
+ retries = self.sdk_configuration.retry_config
626
+
627
+ retry_config = None
628
+ if isinstance(retries, utils.RetryConfig):
629
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
630
+
631
+ http_res = self.do_request(
632
+ hook_ctx=HookContext(
633
+ config=self.sdk_configuration,
634
+ base_url=base_url or "",
635
+ operation_id="rejectBountySubmission",
636
+ oauth2_scopes=None,
637
+ security_source=self.sdk_configuration.security,
638
+ ),
639
+ request=req,
640
+ error_status_codes=[
641
+ "400",
642
+ "401",
643
+ "403",
644
+ "404",
645
+ "409",
646
+ "410",
647
+ "422",
648
+ "429",
649
+ "4XX",
650
+ "500",
651
+ "5XX",
652
+ ],
653
+ retry_config=retry_config,
654
+ )
655
+
656
+ response_data: Any = None
657
+ if utils.match_response(http_res, "200", "application/json"):
658
+ return unmarshal_json_response(
659
+ operations.RejectBountySubmissionResponseBody, http_res
660
+ )
661
+ if utils.match_response(http_res, "400", "application/json"):
662
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
663
+ raise errors.BadRequest(response_data, http_res)
664
+ if utils.match_response(http_res, "401", "application/json"):
665
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
666
+ raise errors.Unauthorized(response_data, http_res)
667
+ if utils.match_response(http_res, "403", "application/json"):
668
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
669
+ raise errors.Forbidden(response_data, http_res)
670
+ if utils.match_response(http_res, "404", "application/json"):
671
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
672
+ raise errors.NotFound(response_data, http_res)
673
+ if utils.match_response(http_res, "409", "application/json"):
674
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
675
+ raise errors.Conflict(response_data, http_res)
676
+ if utils.match_response(http_res, "410", "application/json"):
677
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
678
+ raise errors.InviteExpired(response_data, http_res)
679
+ if utils.match_response(http_res, "422", "application/json"):
680
+ response_data = unmarshal_json_response(
681
+ errors.UnprocessableEntityData, http_res
682
+ )
683
+ raise errors.UnprocessableEntity(response_data, http_res)
684
+ if utils.match_response(http_res, "429", "application/json"):
685
+ response_data = unmarshal_json_response(
686
+ errors.RateLimitExceededData, http_res
687
+ )
688
+ raise errors.RateLimitExceeded(response_data, http_res)
689
+ if utils.match_response(http_res, "500", "application/json"):
690
+ response_data = unmarshal_json_response(
691
+ errors.InternalServerErrorData, http_res
692
+ )
693
+ raise errors.InternalServerError(response_data, http_res)
694
+ if utils.match_response(http_res, "4XX", "*"):
695
+ http_res_text = utils.stream_to_text(http_res)
696
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
697
+ if utils.match_response(http_res, "5XX", "*"):
698
+ http_res_text = utils.stream_to_text(http_res)
699
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
700
+
701
+ raise errors.SDKError("Unexpected response received", http_res)
702
+
703
+ async def reject_submission_async(
704
+ self,
705
+ *,
706
+ request: Union[
707
+ operations.RejectBountySubmissionRequest,
708
+ operations.RejectBountySubmissionRequestTypedDict,
709
+ ],
710
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
711
+ server_url: Optional[str] = None,
712
+ timeout_ms: Optional[int] = None,
713
+ http_headers: Optional[Mapping[str, str]] = None,
714
+ ) -> operations.RejectBountySubmissionResponseBody:
715
+ r"""Reject a bounty submission
716
+
717
+ Reject a bounty submission with a specified reason and optional note.
718
+
719
+ :param request: The request object to send.
720
+ :param retries: Override the default retry configuration for this method
721
+ :param server_url: Override the default server URL for this method
722
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
723
+ :param http_headers: Additional headers to set or replace on requests.
724
+ """
725
+ base_url = None
726
+ url_variables = None
727
+ if timeout_ms is None:
728
+ timeout_ms = self.sdk_configuration.timeout_ms
729
+
730
+ if server_url is not None:
731
+ base_url = server_url
732
+ else:
733
+ base_url = self._get_url(base_url, url_variables)
734
+
735
+ if not isinstance(request, BaseModel):
736
+ request = utils.unmarshal(request, operations.RejectBountySubmissionRequest)
737
+ request = cast(operations.RejectBountySubmissionRequest, request)
738
+
461
739
  req = self._build_request_async(
462
- method="PATCH",
463
- path="/workspaces/{idOrSlug}",
740
+ method="POST",
741
+ path="/bounties/{bountyId}/submissions/{submissionId}/reject",
464
742
  base_url=base_url,
465
743
  url_variables=url_variables,
466
744
  request=request,
@@ -476,7 +754,7 @@ class Workspaces(BaseSDK):
476
754
  False,
477
755
  True,
478
756
  "json",
479
- Optional[operations.UpdateWorkspaceRequestBody],
757
+ Optional[operations.RejectBountySubmissionRequestBody],
480
758
  ),
481
759
  allow_empty_value=None,
482
760
  timeout_ms=timeout_ms,
@@ -494,7 +772,7 @@ class Workspaces(BaseSDK):
494
772
  hook_ctx=HookContext(
495
773
  config=self.sdk_configuration,
496
774
  base_url=base_url or "",
497
- operation_id="updateWorkspace",
775
+ operation_id="rejectBountySubmission",
498
776
  oauth2_scopes=None,
499
777
  security_source=self.sdk_configuration.security,
500
778
  ),
@@ -517,7 +795,9 @@ class Workspaces(BaseSDK):
517
795
 
518
796
  response_data: Any = None
519
797
  if utils.match_response(http_res, "200", "application/json"):
520
- return unmarshal_json_response(components.WorkspaceSchema, http_res)
798
+ return unmarshal_json_response(
799
+ operations.RejectBountySubmissionResponseBody, http_res
800
+ )
521
801
  if utils.match_response(http_res, "400", "application/json"):
522
802
  response_data = unmarshal_json_response(errors.BadRequestData, http_res)
523
803
  raise errors.BadRequest(response_data, http_res)