dub 0.33.0__py3-none-any.whl → 0.34.1__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 (65) hide show
  1. dub/_version.py +3 -3
  2. dub/analytics.py +2 -0
  3. dub/basesdk.py +6 -0
  4. dub/bounties.py +841 -0
  5. dub/commissions.py +4 -0
  6. dub/customers.py +8 -0
  7. dub/domains.py +12 -0
  8. dub/embed_tokens.py +2 -0
  9. dub/events.py +2 -0
  10. dub/folders.py +8 -0
  11. dub/links.py +20 -0
  12. dub/models/components/__init__.py +55 -149
  13. dub/models/components/commissioncreatedevent.py +29 -1
  14. dub/models/components/leadcreatedevent.py +8 -8
  15. dub/models/components/linkclickedevent.py +12 -12
  16. dub/models/components/linkerrorschema.py +12 -12
  17. dub/models/components/linkschema.py +3 -3
  18. dub/models/components/linktagschema.py +3 -3
  19. dub/models/components/linktagschemaoutput.py +38 -0
  20. dub/models/components/linkwebhookevent.py +8 -10
  21. dub/models/components/partnerenrolledevent.py +4 -4
  22. dub/models/components/salecreatedevent.py +8 -8
  23. dub/models/operations/__init__.py +223 -22
  24. dub/models/operations/approvebountysubmission.py +185 -0
  25. dub/models/operations/createpartner.py +4 -55
  26. dub/models/operations/createpartnerlink.py +0 -51
  27. dub/models/operations/createreferralsembedtoken.py +0 -51
  28. dub/models/operations/getcustomers.py +18 -0
  29. dub/models/operations/getlinkinfo.py +0 -2
  30. dub/models/operations/getlinks.py +2 -2
  31. dub/models/operations/getlinkscount.py +2 -2
  32. dub/models/operations/getqrcode.py +1 -1
  33. dub/models/operations/listbountysubmissions.py +212 -0
  34. dub/models/operations/listdomains.py +1 -1
  35. dub/models/operations/listevents.py +2016 -21
  36. dub/models/operations/listpartners.py +4 -4
  37. dub/models/operations/rejectbountysubmission.py +174 -0
  38. dub/models/operations/retrieveanalytics.py +16 -5
  39. dub/models/operations/retrievelinks.py +2 -2
  40. dub/models/operations/tracklead.py +4 -4
  41. dub/models/operations/updatecustomer.py +23 -11
  42. dub/models/operations/updatelink.py +0 -2
  43. dub/models/operations/updateworkspace.py +3 -3
  44. dub/models/operations/upsertpartnerlink.py +7 -65
  45. dub/partners.py +22 -4
  46. dub/qr_codes.py +2 -0
  47. dub/sdk.py +3 -0
  48. dub/tags.py +24 -12
  49. dub/track.py +4 -0
  50. dub/types/basemodel.py +41 -3
  51. dub/utils/__init__.py +0 -3
  52. dub/utils/enums.py +60 -0
  53. dub/utils/forms.py +21 -10
  54. dub/utils/queryparams.py +14 -2
  55. dub/utils/requestbodies.py +3 -3
  56. dub/utils/serializers.py +0 -20
  57. dub/workspaces.py +4 -0
  58. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/METADATA +20 -14
  59. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/RECORD +61 -60
  60. dub/models/components/clickevent.py +0 -557
  61. dub/models/components/continentcode.py +0 -16
  62. dub/models/components/leadevent.py +0 -681
  63. dub/models/components/saleevent.py +0 -780
  64. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/WHEEL +0 -0
  65. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/licenses/LICENSE +0 -0
dub/bounties.py ADDED
@@ -0,0 +1,841 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from dub import utils
5
+ from dub._hooks import HookContext
6
+ from dub.models import errors, operations
7
+ from dub.types import BaseModel, OptionalNullable, UNSET
8
+ from dub.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, List, Mapping, Optional, Union, cast
10
+
11
+
12
+ class Bounties(BaseSDK):
13
+ def list_submissions(
14
+ self,
15
+ *,
16
+ request: Union[
17
+ operations.ListBountySubmissionsRequest,
18
+ operations.ListBountySubmissionsRequestTypedDict,
19
+ ],
20
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
21
+ server_url: Optional[str] = None,
22
+ timeout_ms: Optional[int] = None,
23
+ http_headers: Optional[Mapping[str, str]] = None,
24
+ ) -> List[operations.ListBountySubmissionsResponseBody]:
25
+ r"""List bounty submissions
26
+
27
+ List all submissions for a specific bounty.
28
+
29
+ :param request: The request object to send.
30
+ :param retries: Override the default retry configuration for this method
31
+ :param server_url: Override the default server URL for this method
32
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
33
+ :param http_headers: Additional headers to set or replace on requests.
34
+ """
35
+ base_url = None
36
+ url_variables = None
37
+ if timeout_ms is None:
38
+ timeout_ms = self.sdk_configuration.timeout_ms
39
+
40
+ if server_url is not None:
41
+ base_url = server_url
42
+ else:
43
+ base_url = self._get_url(base_url, url_variables)
44
+
45
+ if not isinstance(request, BaseModel):
46
+ request = utils.unmarshal(request, operations.ListBountySubmissionsRequest)
47
+ request = cast(operations.ListBountySubmissionsRequest, request)
48
+
49
+ req = self._build_request(
50
+ method="GET",
51
+ path="/bounties/{bountyId}/submissions",
52
+ base_url=base_url,
53
+ url_variables=url_variables,
54
+ request=request,
55
+ request_body_required=False,
56
+ request_has_path_params=True,
57
+ request_has_query_params=True,
58
+ user_agent_header="user-agent",
59
+ accept_header_value="application/json",
60
+ http_headers=http_headers,
61
+ security=self.sdk_configuration.security,
62
+ allow_empty_value=None,
63
+ timeout_ms=timeout_ms,
64
+ )
65
+
66
+ if retries == UNSET:
67
+ if self.sdk_configuration.retry_config is not UNSET:
68
+ retries = self.sdk_configuration.retry_config
69
+
70
+ retry_config = None
71
+ if isinstance(retries, utils.RetryConfig):
72
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
73
+
74
+ http_res = self.do_request(
75
+ hook_ctx=HookContext(
76
+ config=self.sdk_configuration,
77
+ base_url=base_url or "",
78
+ operation_id="listBountySubmissions",
79
+ oauth2_scopes=None,
80
+ security_source=self.sdk_configuration.security,
81
+ ),
82
+ request=req,
83
+ error_status_codes=[
84
+ "400",
85
+ "401",
86
+ "403",
87
+ "404",
88
+ "409",
89
+ "410",
90
+ "422",
91
+ "429",
92
+ "4XX",
93
+ "500",
94
+ "5XX",
95
+ ],
96
+ retry_config=retry_config,
97
+ )
98
+
99
+ response_data: Any = None
100
+ if utils.match_response(http_res, "200", "application/json"):
101
+ return unmarshal_json_response(
102
+ List[operations.ListBountySubmissionsResponseBody], http_res
103
+ )
104
+ if utils.match_response(http_res, "400", "application/json"):
105
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
106
+ raise errors.BadRequest(response_data, http_res)
107
+ if utils.match_response(http_res, "401", "application/json"):
108
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
109
+ raise errors.Unauthorized(response_data, http_res)
110
+ if utils.match_response(http_res, "403", "application/json"):
111
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
112
+ raise errors.Forbidden(response_data, http_res)
113
+ if utils.match_response(http_res, "404", "application/json"):
114
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
115
+ raise errors.NotFound(response_data, http_res)
116
+ if utils.match_response(http_res, "409", "application/json"):
117
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
118
+ raise errors.Conflict(response_data, http_res)
119
+ if utils.match_response(http_res, "410", "application/json"):
120
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
121
+ raise errors.InviteExpired(response_data, http_res)
122
+ if utils.match_response(http_res, "422", "application/json"):
123
+ response_data = unmarshal_json_response(
124
+ errors.UnprocessableEntityData, http_res
125
+ )
126
+ raise errors.UnprocessableEntity(response_data, http_res)
127
+ if utils.match_response(http_res, "429", "application/json"):
128
+ response_data = unmarshal_json_response(
129
+ errors.RateLimitExceededData, http_res
130
+ )
131
+ raise errors.RateLimitExceeded(response_data, http_res)
132
+ if utils.match_response(http_res, "500", "application/json"):
133
+ response_data = unmarshal_json_response(
134
+ errors.InternalServerErrorData, http_res
135
+ )
136
+ raise errors.InternalServerError(response_data, http_res)
137
+ if utils.match_response(http_res, "4XX", "*"):
138
+ http_res_text = utils.stream_to_text(http_res)
139
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
140
+ if utils.match_response(http_res, "5XX", "*"):
141
+ http_res_text = utils.stream_to_text(http_res)
142
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
143
+
144
+ raise errors.SDKError("Unexpected response received", http_res)
145
+
146
+ async def list_submissions_async(
147
+ self,
148
+ *,
149
+ request: Union[
150
+ operations.ListBountySubmissionsRequest,
151
+ operations.ListBountySubmissionsRequestTypedDict,
152
+ ],
153
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
154
+ server_url: Optional[str] = None,
155
+ timeout_ms: Optional[int] = None,
156
+ http_headers: Optional[Mapping[str, str]] = None,
157
+ ) -> List[operations.ListBountySubmissionsResponseBody]:
158
+ r"""List bounty submissions
159
+
160
+ List all submissions for a specific bounty.
161
+
162
+ :param request: The request object to send.
163
+ :param retries: Override the default retry configuration for this method
164
+ :param server_url: Override the default server URL for this method
165
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
166
+ :param http_headers: Additional headers to set or replace on requests.
167
+ """
168
+ base_url = None
169
+ url_variables = None
170
+ if timeout_ms is None:
171
+ timeout_ms = self.sdk_configuration.timeout_ms
172
+
173
+ if server_url is not None:
174
+ base_url = server_url
175
+ else:
176
+ base_url = self._get_url(base_url, url_variables)
177
+
178
+ if not isinstance(request, BaseModel):
179
+ request = utils.unmarshal(request, operations.ListBountySubmissionsRequest)
180
+ request = cast(operations.ListBountySubmissionsRequest, request)
181
+
182
+ req = self._build_request_async(
183
+ method="GET",
184
+ path="/bounties/{bountyId}/submissions",
185
+ base_url=base_url,
186
+ url_variables=url_variables,
187
+ request=request,
188
+ request_body_required=False,
189
+ request_has_path_params=True,
190
+ request_has_query_params=True,
191
+ user_agent_header="user-agent",
192
+ accept_header_value="application/json",
193
+ http_headers=http_headers,
194
+ security=self.sdk_configuration.security,
195
+ allow_empty_value=None,
196
+ timeout_ms=timeout_ms,
197
+ )
198
+
199
+ if retries == UNSET:
200
+ if self.sdk_configuration.retry_config is not UNSET:
201
+ retries = self.sdk_configuration.retry_config
202
+
203
+ retry_config = None
204
+ if isinstance(retries, utils.RetryConfig):
205
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
206
+
207
+ http_res = await self.do_request_async(
208
+ hook_ctx=HookContext(
209
+ config=self.sdk_configuration,
210
+ base_url=base_url or "",
211
+ operation_id="listBountySubmissions",
212
+ oauth2_scopes=None,
213
+ security_source=self.sdk_configuration.security,
214
+ ),
215
+ request=req,
216
+ error_status_codes=[
217
+ "400",
218
+ "401",
219
+ "403",
220
+ "404",
221
+ "409",
222
+ "410",
223
+ "422",
224
+ "429",
225
+ "4XX",
226
+ "500",
227
+ "5XX",
228
+ ],
229
+ retry_config=retry_config,
230
+ )
231
+
232
+ response_data: Any = None
233
+ if utils.match_response(http_res, "200", "application/json"):
234
+ return unmarshal_json_response(
235
+ List[operations.ListBountySubmissionsResponseBody], http_res
236
+ )
237
+ if utils.match_response(http_res, "400", "application/json"):
238
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
239
+ raise errors.BadRequest(response_data, http_res)
240
+ if utils.match_response(http_res, "401", "application/json"):
241
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
242
+ raise errors.Unauthorized(response_data, http_res)
243
+ if utils.match_response(http_res, "403", "application/json"):
244
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
245
+ raise errors.Forbidden(response_data, http_res)
246
+ if utils.match_response(http_res, "404", "application/json"):
247
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
248
+ raise errors.NotFound(response_data, http_res)
249
+ if utils.match_response(http_res, "409", "application/json"):
250
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
251
+ raise errors.Conflict(response_data, http_res)
252
+ if utils.match_response(http_res, "410", "application/json"):
253
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
254
+ raise errors.InviteExpired(response_data, http_res)
255
+ if utils.match_response(http_res, "422", "application/json"):
256
+ response_data = unmarshal_json_response(
257
+ errors.UnprocessableEntityData, http_res
258
+ )
259
+ raise errors.UnprocessableEntity(response_data, http_res)
260
+ if utils.match_response(http_res, "429", "application/json"):
261
+ response_data = unmarshal_json_response(
262
+ errors.RateLimitExceededData, http_res
263
+ )
264
+ raise errors.RateLimitExceeded(response_data, http_res)
265
+ if utils.match_response(http_res, "500", "application/json"):
266
+ response_data = unmarshal_json_response(
267
+ errors.InternalServerErrorData, http_res
268
+ )
269
+ raise errors.InternalServerError(response_data, http_res)
270
+ if utils.match_response(http_res, "4XX", "*"):
271
+ http_res_text = await utils.stream_to_text_async(http_res)
272
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
273
+ if utils.match_response(http_res, "5XX", "*"):
274
+ http_res_text = await utils.stream_to_text_async(http_res)
275
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
276
+
277
+ raise errors.SDKError("Unexpected response received", http_res)
278
+
279
+ def approve_submission(
280
+ self,
281
+ *,
282
+ request: Union[
283
+ operations.ApproveBountySubmissionRequest,
284
+ operations.ApproveBountySubmissionRequestTypedDict,
285
+ ],
286
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
287
+ server_url: Optional[str] = None,
288
+ timeout_ms: Optional[int] = None,
289
+ http_headers: Optional[Mapping[str, str]] = None,
290
+ ) -> operations.ApproveBountySubmissionResponseBody:
291
+ r"""Approve a bounty submission
292
+
293
+ Approve a bounty submission. Optionally specify a custom reward amount.
294
+
295
+ :param request: The request object to send.
296
+ :param retries: Override the default retry configuration for this method
297
+ :param server_url: Override the default server URL for this method
298
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
299
+ :param http_headers: Additional headers to set or replace on requests.
300
+ """
301
+ base_url = None
302
+ url_variables = None
303
+ if timeout_ms is None:
304
+ timeout_ms = self.sdk_configuration.timeout_ms
305
+
306
+ if server_url is not None:
307
+ base_url = server_url
308
+ else:
309
+ base_url = self._get_url(base_url, url_variables)
310
+
311
+ if not isinstance(request, BaseModel):
312
+ request = utils.unmarshal(
313
+ request, operations.ApproveBountySubmissionRequest
314
+ )
315
+ request = cast(operations.ApproveBountySubmissionRequest, request)
316
+
317
+ req = self._build_request(
318
+ method="POST",
319
+ path="/bounties/{bountyId}/submissions/{submissionId}/approve",
320
+ base_url=base_url,
321
+ url_variables=url_variables,
322
+ request=request,
323
+ request_body_required=False,
324
+ request_has_path_params=True,
325
+ request_has_query_params=True,
326
+ user_agent_header="user-agent",
327
+ accept_header_value="application/json",
328
+ http_headers=http_headers,
329
+ security=self.sdk_configuration.security,
330
+ get_serialized_body=lambda: utils.serialize_request_body(
331
+ request.request_body,
332
+ False,
333
+ True,
334
+ "json",
335
+ Optional[operations.ApproveBountySubmissionRequestBody],
336
+ ),
337
+ allow_empty_value=None,
338
+ timeout_ms=timeout_ms,
339
+ )
340
+
341
+ if retries == UNSET:
342
+ if self.sdk_configuration.retry_config is not UNSET:
343
+ retries = self.sdk_configuration.retry_config
344
+
345
+ retry_config = None
346
+ if isinstance(retries, utils.RetryConfig):
347
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
348
+
349
+ http_res = self.do_request(
350
+ hook_ctx=HookContext(
351
+ config=self.sdk_configuration,
352
+ base_url=base_url or "",
353
+ operation_id="approveBountySubmission",
354
+ oauth2_scopes=None,
355
+ security_source=self.sdk_configuration.security,
356
+ ),
357
+ request=req,
358
+ error_status_codes=[
359
+ "400",
360
+ "401",
361
+ "403",
362
+ "404",
363
+ "409",
364
+ "410",
365
+ "422",
366
+ "429",
367
+ "4XX",
368
+ "500",
369
+ "5XX",
370
+ ],
371
+ retry_config=retry_config,
372
+ )
373
+
374
+ response_data: Any = None
375
+ if utils.match_response(http_res, "200", "application/json"):
376
+ return unmarshal_json_response(
377
+ operations.ApproveBountySubmissionResponseBody, http_res
378
+ )
379
+ if utils.match_response(http_res, "400", "application/json"):
380
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
381
+ raise errors.BadRequest(response_data, http_res)
382
+ if utils.match_response(http_res, "401", "application/json"):
383
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
384
+ raise errors.Unauthorized(response_data, http_res)
385
+ if utils.match_response(http_res, "403", "application/json"):
386
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
387
+ raise errors.Forbidden(response_data, http_res)
388
+ if utils.match_response(http_res, "404", "application/json"):
389
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
390
+ raise errors.NotFound(response_data, http_res)
391
+ if utils.match_response(http_res, "409", "application/json"):
392
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
393
+ raise errors.Conflict(response_data, http_res)
394
+ if utils.match_response(http_res, "410", "application/json"):
395
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
396
+ raise errors.InviteExpired(response_data, http_res)
397
+ if utils.match_response(http_res, "422", "application/json"):
398
+ response_data = unmarshal_json_response(
399
+ errors.UnprocessableEntityData, http_res
400
+ )
401
+ raise errors.UnprocessableEntity(response_data, http_res)
402
+ if utils.match_response(http_res, "429", "application/json"):
403
+ response_data = unmarshal_json_response(
404
+ errors.RateLimitExceededData, http_res
405
+ )
406
+ raise errors.RateLimitExceeded(response_data, http_res)
407
+ if utils.match_response(http_res, "500", "application/json"):
408
+ response_data = unmarshal_json_response(
409
+ errors.InternalServerErrorData, http_res
410
+ )
411
+ raise errors.InternalServerError(response_data, http_res)
412
+ if utils.match_response(http_res, "4XX", "*"):
413
+ http_res_text = utils.stream_to_text(http_res)
414
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
415
+ if utils.match_response(http_res, "5XX", "*"):
416
+ http_res_text = utils.stream_to_text(http_res)
417
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
418
+
419
+ raise errors.SDKError("Unexpected response received", http_res)
420
+
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(
564
+ self,
565
+ *,
566
+ request: Union[
567
+ operations.RejectBountySubmissionRequest,
568
+ operations.RejectBountySubmissionRequestTypedDict,
569
+ ],
570
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
571
+ server_url: Optional[str] = None,
572
+ timeout_ms: Optional[int] = None,
573
+ http_headers: Optional[Mapping[str, str]] = None,
574
+ ) -> operations.RejectBountySubmissionResponseBody:
575
+ r"""Reject a bounty submission
576
+
577
+ Reject a bounty submission with a specified reason and optional note.
578
+
579
+ :param request: The request object to send.
580
+ :param retries: Override the default retry configuration for this method
581
+ :param server_url: Override the default server URL for this method
582
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
583
+ :param http_headers: Additional headers to set or replace on requests.
584
+ """
585
+ base_url = None
586
+ url_variables = None
587
+ if timeout_ms is None:
588
+ timeout_ms = self.sdk_configuration.timeout_ms
589
+
590
+ if server_url is not None:
591
+ base_url = server_url
592
+ else:
593
+ base_url = self._get_url(base_url, url_variables)
594
+
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],
618
+ ),
619
+ allow_empty_value=None,
620
+ timeout_ms=timeout_ms,
621
+ )
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
+
739
+ req = self._build_request_async(
740
+ method="POST",
741
+ path="/bounties/{bountyId}/submissions/{submissionId}/reject",
742
+ base_url=base_url,
743
+ url_variables=url_variables,
744
+ request=request,
745
+ request_body_required=False,
746
+ request_has_path_params=True,
747
+ request_has_query_params=True,
748
+ user_agent_header="user-agent",
749
+ accept_header_value="application/json",
750
+ http_headers=http_headers,
751
+ security=self.sdk_configuration.security,
752
+ get_serialized_body=lambda: utils.serialize_request_body(
753
+ request.request_body,
754
+ False,
755
+ True,
756
+ "json",
757
+ Optional[operations.RejectBountySubmissionRequestBody],
758
+ ),
759
+ allow_empty_value=None,
760
+ timeout_ms=timeout_ms,
761
+ )
762
+
763
+ if retries == UNSET:
764
+ if self.sdk_configuration.retry_config is not UNSET:
765
+ retries = self.sdk_configuration.retry_config
766
+
767
+ retry_config = None
768
+ if isinstance(retries, utils.RetryConfig):
769
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
770
+
771
+ http_res = await self.do_request_async(
772
+ hook_ctx=HookContext(
773
+ config=self.sdk_configuration,
774
+ base_url=base_url or "",
775
+ operation_id="rejectBountySubmission",
776
+ oauth2_scopes=None,
777
+ security_source=self.sdk_configuration.security,
778
+ ),
779
+ request=req,
780
+ error_status_codes=[
781
+ "400",
782
+ "401",
783
+ "403",
784
+ "404",
785
+ "409",
786
+ "410",
787
+ "422",
788
+ "429",
789
+ "4XX",
790
+ "500",
791
+ "5XX",
792
+ ],
793
+ retry_config=retry_config,
794
+ )
795
+
796
+ response_data: Any = None
797
+ if utils.match_response(http_res, "200", "application/json"):
798
+ return unmarshal_json_response(
799
+ operations.RejectBountySubmissionResponseBody, http_res
800
+ )
801
+ if utils.match_response(http_res, "400", "application/json"):
802
+ response_data = unmarshal_json_response(errors.BadRequestData, http_res)
803
+ raise errors.BadRequest(response_data, http_res)
804
+ if utils.match_response(http_res, "401", "application/json"):
805
+ response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
806
+ raise errors.Unauthorized(response_data, http_res)
807
+ if utils.match_response(http_res, "403", "application/json"):
808
+ response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
809
+ raise errors.Forbidden(response_data, http_res)
810
+ if utils.match_response(http_res, "404", "application/json"):
811
+ response_data = unmarshal_json_response(errors.NotFoundData, http_res)
812
+ raise errors.NotFound(response_data, http_res)
813
+ if utils.match_response(http_res, "409", "application/json"):
814
+ response_data = unmarshal_json_response(errors.ConflictData, http_res)
815
+ raise errors.Conflict(response_data, http_res)
816
+ if utils.match_response(http_res, "410", "application/json"):
817
+ response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
818
+ raise errors.InviteExpired(response_data, http_res)
819
+ if utils.match_response(http_res, "422", "application/json"):
820
+ response_data = unmarshal_json_response(
821
+ errors.UnprocessableEntityData, http_res
822
+ )
823
+ raise errors.UnprocessableEntity(response_data, http_res)
824
+ if utils.match_response(http_res, "429", "application/json"):
825
+ response_data = unmarshal_json_response(
826
+ errors.RateLimitExceededData, http_res
827
+ )
828
+ raise errors.RateLimitExceeded(response_data, http_res)
829
+ if utils.match_response(http_res, "500", "application/json"):
830
+ response_data = unmarshal_json_response(
831
+ errors.InternalServerErrorData, http_res
832
+ )
833
+ raise errors.InternalServerError(response_data, http_res)
834
+ if utils.match_response(http_res, "4XX", "*"):
835
+ http_res_text = await utils.stream_to_text_async(http_res)
836
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
837
+ if utils.match_response(http_res, "5XX", "*"):
838
+ http_res_text = await utils.stream_to_text_async(http_res)
839
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
840
+
841
+ raise errors.SDKError("Unexpected response received", http_res)