dub 0.32.0__py3-none-any.whl → 0.33.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dub/_version.py +3 -3
- dub/analytics.py +4 -4
- dub/commissions.py +8 -8
- dub/customers.py +16 -313
- dub/domains.py +22 -26
- dub/embed_tokens.py +4 -4
- dub/events.py +4 -4
- dub/folders.py +16 -20
- dub/links.py +38 -54
- dub/models/components/__init__.py +32 -0
- dub/models/components/analyticstopurls.py +2 -2
- dub/models/components/clickevent.py +7 -6
- dub/models/components/leadcreatedevent.py +7 -6
- dub/models/components/leadevent.py +7 -6
- dub/models/components/linkclickedevent.py +7 -6
- dub/models/components/linkschema.py +6 -0
- dub/models/components/linkwebhookevent.py +7 -6
- dub/models/components/partnerapplicationsubmittedevent.py +269 -0
- dub/models/components/partnerenrolledevent.py +64 -4
- dub/models/components/salecreatedevent.py +7 -6
- dub/models/components/saleevent.py +7 -6
- dub/models/components/webhookevent.py +6 -0
- dub/models/components/workspaceschema.py +6 -0
- dub/models/operations/__init__.py +17 -35
- dub/models/operations/banpartner.py +83 -0
- dub/models/operations/createpartner.py +64 -4
- dub/models/operations/listcommissions.py +13 -2
- dub/models/operations/listevents.py +10 -0
- dub/models/operations/listpartners.py +71 -4
- dub/models/operations/retrieveanalytics.py +12 -0
- dub/models/operations/retrievelinks.py +42 -7
- dub/models/operations/retrievepartneranalytics.py +51 -11
- dub/models/operations/updatecommission.py +7 -2
- dub/partners.py +298 -24
- dub/qr_codes.py +2 -2
- dub/tags.py +16 -24
- dub/track.py +8 -16
- dub/utils/retries.py +69 -5
- dub/utils/unmarshal_json_response.py +15 -1
- dub/workspaces.py +8 -16
- {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/METADATA +2 -20
- {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/RECORD +44 -43
- dub/models/operations/createcustomer.py +0 -382
- {dub-0.32.0.dist-info → dub-0.33.0.dist-info}/WHEEL +0 -0
- {dub-0.32.0.dist-info → dub-0.33.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.
|
|
6
|
+
__version__: str = "0.33.0"
|
|
7
7
|
__openapi_doc_version__: str = "0.0.1"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.
|
|
8
|
+
__gen_version__: str = "2.763.3"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.33.0 2.763.3 0.0.1 dub"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
dub/analytics.py
CHANGED
|
@@ -21,7 +21,7 @@ class Analytics(BaseSDK):
|
|
|
21
21
|
server_url: Optional[str] = None,
|
|
22
22
|
timeout_ms: Optional[int] = None,
|
|
23
23
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
24
|
-
) ->
|
|
24
|
+
) -> operations.RetrieveAnalyticsResponseBody:
|
|
25
25
|
r"""Retrieve analytics for a link, a domain, or the authenticated workspace.
|
|
26
26
|
|
|
27
27
|
Retrieve analytics for a link, a domain, or the authenticated workspace. The response type depends on the `event` and `type` query parameters.
|
|
@@ -98,7 +98,7 @@ class Analytics(BaseSDK):
|
|
|
98
98
|
response_data: Any = None
|
|
99
99
|
if utils.match_response(http_res, "200", "application/json"):
|
|
100
100
|
return unmarshal_json_response(
|
|
101
|
-
|
|
101
|
+
operations.RetrieveAnalyticsResponseBody, http_res
|
|
102
102
|
)
|
|
103
103
|
if utils.match_response(http_res, "400", "application/json"):
|
|
104
104
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -153,7 +153,7 @@ class Analytics(BaseSDK):
|
|
|
153
153
|
server_url: Optional[str] = None,
|
|
154
154
|
timeout_ms: Optional[int] = None,
|
|
155
155
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
156
|
-
) ->
|
|
156
|
+
) -> operations.RetrieveAnalyticsResponseBody:
|
|
157
157
|
r"""Retrieve analytics for a link, a domain, or the authenticated workspace.
|
|
158
158
|
|
|
159
159
|
Retrieve analytics for a link, a domain, or the authenticated workspace. The response type depends on the `event` and `type` query parameters.
|
|
@@ -230,7 +230,7 @@ class Analytics(BaseSDK):
|
|
|
230
230
|
response_data: Any = None
|
|
231
231
|
if utils.match_response(http_res, "200", "application/json"):
|
|
232
232
|
return unmarshal_json_response(
|
|
233
|
-
|
|
233
|
+
operations.RetrieveAnalyticsResponseBody, http_res
|
|
234
234
|
)
|
|
235
235
|
if utils.match_response(http_res, "400", "application/json"):
|
|
236
236
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
dub/commissions.py
CHANGED
|
@@ -21,7 +21,7 @@ class Commissions(BaseSDK):
|
|
|
21
21
|
server_url: Optional[str] = None,
|
|
22
22
|
timeout_ms: Optional[int] = None,
|
|
23
23
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
24
|
-
) ->
|
|
24
|
+
) -> List[operations.ListCommissionsResponseBody]:
|
|
25
25
|
r"""Get commissions for a program.
|
|
26
26
|
|
|
27
27
|
Retrieve a list of commissions for a program.
|
|
@@ -98,7 +98,7 @@ class Commissions(BaseSDK):
|
|
|
98
98
|
response_data: Any = None
|
|
99
99
|
if utils.match_response(http_res, "200", "application/json"):
|
|
100
100
|
return unmarshal_json_response(
|
|
101
|
-
|
|
101
|
+
List[operations.ListCommissionsResponseBody], http_res
|
|
102
102
|
)
|
|
103
103
|
if utils.match_response(http_res, "400", "application/json"):
|
|
104
104
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -153,7 +153,7 @@ class Commissions(BaseSDK):
|
|
|
153
153
|
server_url: Optional[str] = None,
|
|
154
154
|
timeout_ms: Optional[int] = None,
|
|
155
155
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
156
|
-
) ->
|
|
156
|
+
) -> List[operations.ListCommissionsResponseBody]:
|
|
157
157
|
r"""Get commissions for a program.
|
|
158
158
|
|
|
159
159
|
Retrieve a list of commissions for a program.
|
|
@@ -230,7 +230,7 @@ class Commissions(BaseSDK):
|
|
|
230
230
|
response_data: Any = None
|
|
231
231
|
if utils.match_response(http_res, "200", "application/json"):
|
|
232
232
|
return unmarshal_json_response(
|
|
233
|
-
|
|
233
|
+
List[operations.ListCommissionsResponseBody], http_res
|
|
234
234
|
)
|
|
235
235
|
if utils.match_response(http_res, "400", "application/json"):
|
|
236
236
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -285,7 +285,7 @@ class Commissions(BaseSDK):
|
|
|
285
285
|
server_url: Optional[str] = None,
|
|
286
286
|
timeout_ms: Optional[int] = None,
|
|
287
287
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
288
|
-
) ->
|
|
288
|
+
) -> operations.UpdateCommissionResponseBody:
|
|
289
289
|
r"""Update a commission.
|
|
290
290
|
|
|
291
291
|
Update an existing commission amount. This is useful for handling refunds (partial or full) or fraudulent sales.
|
|
@@ -369,7 +369,7 @@ class Commissions(BaseSDK):
|
|
|
369
369
|
response_data: Any = None
|
|
370
370
|
if utils.match_response(http_res, "200", "application/json"):
|
|
371
371
|
return unmarshal_json_response(
|
|
372
|
-
|
|
372
|
+
operations.UpdateCommissionResponseBody, http_res
|
|
373
373
|
)
|
|
374
374
|
if utils.match_response(http_res, "400", "application/json"):
|
|
375
375
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -424,7 +424,7 @@ class Commissions(BaseSDK):
|
|
|
424
424
|
server_url: Optional[str] = None,
|
|
425
425
|
timeout_ms: Optional[int] = None,
|
|
426
426
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
427
|
-
) ->
|
|
427
|
+
) -> operations.UpdateCommissionResponseBody:
|
|
428
428
|
r"""Update a commission.
|
|
429
429
|
|
|
430
430
|
Update an existing commission amount. This is useful for handling refunds (partial or full) or fraudulent sales.
|
|
@@ -508,7 +508,7 @@ class Commissions(BaseSDK):
|
|
|
508
508
|
response_data: Any = None
|
|
509
509
|
if utils.match_response(http_res, "200", "application/json"):
|
|
510
510
|
return unmarshal_json_response(
|
|
511
|
-
|
|
511
|
+
operations.UpdateCommissionResponseBody, http_res
|
|
512
512
|
)
|
|
513
513
|
if utils.match_response(http_res, "400", "application/json"):
|
|
514
514
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
dub/customers.py
CHANGED
|
@@ -7,7 +7,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
9
|
from typing import Any, List, Mapping, Optional, Union, cast
|
|
10
|
-
from typing_extensions import deprecated
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
class Customers(BaseSDK):
|
|
@@ -21,7 +20,7 @@ class Customers(BaseSDK):
|
|
|
21
20
|
server_url: Optional[str] = None,
|
|
22
21
|
timeout_ms: Optional[int] = None,
|
|
23
22
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
24
|
-
) ->
|
|
23
|
+
) -> List[operations.GetCustomersResponseBody]:
|
|
25
24
|
r"""Retrieve a list of customers
|
|
26
25
|
|
|
27
26
|
Retrieve a list of customers for the authenticated workspace.
|
|
@@ -98,7 +97,7 @@ class Customers(BaseSDK):
|
|
|
98
97
|
response_data: Any = None
|
|
99
98
|
if utils.match_response(http_res, "200", "application/json"):
|
|
100
99
|
return unmarshal_json_response(
|
|
101
|
-
|
|
100
|
+
List[operations.GetCustomersResponseBody], http_res
|
|
102
101
|
)
|
|
103
102
|
if utils.match_response(http_res, "400", "application/json"):
|
|
104
103
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -152,7 +151,7 @@ class Customers(BaseSDK):
|
|
|
152
151
|
server_url: Optional[str] = None,
|
|
153
152
|
timeout_ms: Optional[int] = None,
|
|
154
153
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
155
|
-
) ->
|
|
154
|
+
) -> List[operations.GetCustomersResponseBody]:
|
|
156
155
|
r"""Retrieve a list of customers
|
|
157
156
|
|
|
158
157
|
Retrieve a list of customers for the authenticated workspace.
|
|
@@ -229,299 +228,7 @@ class Customers(BaseSDK):
|
|
|
229
228
|
response_data: Any = None
|
|
230
229
|
if utils.match_response(http_res, "200", "application/json"):
|
|
231
230
|
return unmarshal_json_response(
|
|
232
|
-
|
|
233
|
-
)
|
|
234
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
235
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
236
|
-
raise errors.BadRequest(response_data, http_res)
|
|
237
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
238
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
239
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
240
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
241
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
242
|
-
raise errors.Forbidden(response_data, http_res)
|
|
243
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
244
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
245
|
-
raise errors.NotFound(response_data, http_res)
|
|
246
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
247
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
248
|
-
raise errors.Conflict(response_data, http_res)
|
|
249
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
250
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
251
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
252
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
253
|
-
response_data = unmarshal_json_response(
|
|
254
|
-
errors.UnprocessableEntityData, http_res
|
|
255
|
-
)
|
|
256
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
257
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
258
|
-
response_data = unmarshal_json_response(
|
|
259
|
-
errors.RateLimitExceededData, http_res
|
|
260
|
-
)
|
|
261
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
262
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
263
|
-
response_data = unmarshal_json_response(
|
|
264
|
-
errors.InternalServerErrorData, http_res
|
|
265
|
-
)
|
|
266
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
267
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
268
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
269
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
270
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
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
|
-
|
|
274
|
-
raise errors.SDKError("Unexpected response received", http_res)
|
|
275
|
-
|
|
276
|
-
@deprecated(
|
|
277
|
-
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
278
|
-
)
|
|
279
|
-
def create(
|
|
280
|
-
self,
|
|
281
|
-
*,
|
|
282
|
-
request: Optional[
|
|
283
|
-
Union[
|
|
284
|
-
operations.CreateCustomerRequestBody,
|
|
285
|
-
operations.CreateCustomerRequestBodyTypedDict,
|
|
286
|
-
]
|
|
287
|
-
] = None,
|
|
288
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
289
|
-
server_url: Optional[str] = None,
|
|
290
|
-
timeout_ms: Optional[int] = None,
|
|
291
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
292
|
-
) -> Optional[operations.CreateCustomerResponseBody]:
|
|
293
|
-
r"""Create a customer
|
|
294
|
-
|
|
295
|
-
[Deprecated]: Customer creation can only be done via tracking a lead event. Use the /track/lead endpoint instead.
|
|
296
|
-
|
|
297
|
-
:param request: The request object to send.
|
|
298
|
-
:param retries: Override the default retry configuration for this method
|
|
299
|
-
:param server_url: Override the default server URL for this method
|
|
300
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
301
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
302
|
-
"""
|
|
303
|
-
base_url = None
|
|
304
|
-
url_variables = None
|
|
305
|
-
if timeout_ms is None:
|
|
306
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
307
|
-
|
|
308
|
-
if server_url is not None:
|
|
309
|
-
base_url = server_url
|
|
310
|
-
else:
|
|
311
|
-
base_url = self._get_url(base_url, url_variables)
|
|
312
|
-
|
|
313
|
-
if not isinstance(request, BaseModel):
|
|
314
|
-
request = utils.unmarshal(
|
|
315
|
-
request, Optional[operations.CreateCustomerRequestBody]
|
|
316
|
-
)
|
|
317
|
-
request = cast(Optional[operations.CreateCustomerRequestBody], request)
|
|
318
|
-
|
|
319
|
-
req = self._build_request(
|
|
320
|
-
method="POST",
|
|
321
|
-
path="/customers",
|
|
322
|
-
base_url=base_url,
|
|
323
|
-
url_variables=url_variables,
|
|
324
|
-
request=request,
|
|
325
|
-
request_body_required=False,
|
|
326
|
-
request_has_path_params=False,
|
|
327
|
-
request_has_query_params=True,
|
|
328
|
-
user_agent_header="user-agent",
|
|
329
|
-
accept_header_value="application/json",
|
|
330
|
-
http_headers=http_headers,
|
|
331
|
-
security=self.sdk_configuration.security,
|
|
332
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
333
|
-
request,
|
|
334
|
-
False,
|
|
335
|
-
True,
|
|
336
|
-
"json",
|
|
337
|
-
Optional[operations.CreateCustomerRequestBody],
|
|
338
|
-
),
|
|
339
|
-
timeout_ms=timeout_ms,
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
if retries == UNSET:
|
|
343
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
344
|
-
retries = self.sdk_configuration.retry_config
|
|
345
|
-
|
|
346
|
-
retry_config = None
|
|
347
|
-
if isinstance(retries, utils.RetryConfig):
|
|
348
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
349
|
-
|
|
350
|
-
http_res = self.do_request(
|
|
351
|
-
hook_ctx=HookContext(
|
|
352
|
-
config=self.sdk_configuration,
|
|
353
|
-
base_url=base_url or "",
|
|
354
|
-
operation_id="createCustomer",
|
|
355
|
-
oauth2_scopes=None,
|
|
356
|
-
security_source=self.sdk_configuration.security,
|
|
357
|
-
),
|
|
358
|
-
request=req,
|
|
359
|
-
error_status_codes=[
|
|
360
|
-
"400",
|
|
361
|
-
"401",
|
|
362
|
-
"403",
|
|
363
|
-
"404",
|
|
364
|
-
"409",
|
|
365
|
-
"410",
|
|
366
|
-
"422",
|
|
367
|
-
"429",
|
|
368
|
-
"4XX",
|
|
369
|
-
"500",
|
|
370
|
-
"5XX",
|
|
371
|
-
],
|
|
372
|
-
retry_config=retry_config,
|
|
373
|
-
)
|
|
374
|
-
|
|
375
|
-
response_data: Any = None
|
|
376
|
-
if utils.match_response(http_res, "201", "application/json"):
|
|
377
|
-
return unmarshal_json_response(
|
|
378
|
-
Optional[operations.CreateCustomerResponseBody], http_res
|
|
379
|
-
)
|
|
380
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
381
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
382
|
-
raise errors.BadRequest(response_data, http_res)
|
|
383
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
384
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
385
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
386
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
387
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
388
|
-
raise errors.Forbidden(response_data, http_res)
|
|
389
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
390
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
391
|
-
raise errors.NotFound(response_data, http_res)
|
|
392
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
393
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
394
|
-
raise errors.Conflict(response_data, http_res)
|
|
395
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
396
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
397
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
398
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
399
|
-
response_data = unmarshal_json_response(
|
|
400
|
-
errors.UnprocessableEntityData, http_res
|
|
401
|
-
)
|
|
402
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
403
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
404
|
-
response_data = unmarshal_json_response(
|
|
405
|
-
errors.RateLimitExceededData, http_res
|
|
406
|
-
)
|
|
407
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
408
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
409
|
-
response_data = unmarshal_json_response(
|
|
410
|
-
errors.InternalServerErrorData, http_res
|
|
411
|
-
)
|
|
412
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
413
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
414
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
415
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
416
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
417
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
418
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
419
|
-
|
|
420
|
-
raise errors.SDKError("Unexpected response received", http_res)
|
|
421
|
-
|
|
422
|
-
@deprecated(
|
|
423
|
-
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
424
|
-
)
|
|
425
|
-
async def create_async(
|
|
426
|
-
self,
|
|
427
|
-
*,
|
|
428
|
-
request: Optional[
|
|
429
|
-
Union[
|
|
430
|
-
operations.CreateCustomerRequestBody,
|
|
431
|
-
operations.CreateCustomerRequestBodyTypedDict,
|
|
432
|
-
]
|
|
433
|
-
] = None,
|
|
434
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
435
|
-
server_url: Optional[str] = None,
|
|
436
|
-
timeout_ms: Optional[int] = None,
|
|
437
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
438
|
-
) -> Optional[operations.CreateCustomerResponseBody]:
|
|
439
|
-
r"""Create a customer
|
|
440
|
-
|
|
441
|
-
[Deprecated]: Customer creation can only be done via tracking a lead event. Use the /track/lead endpoint instead.
|
|
442
|
-
|
|
443
|
-
:param request: The request object to send.
|
|
444
|
-
:param retries: Override the default retry configuration for this method
|
|
445
|
-
:param server_url: Override the default server URL for this method
|
|
446
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
447
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
448
|
-
"""
|
|
449
|
-
base_url = None
|
|
450
|
-
url_variables = None
|
|
451
|
-
if timeout_ms is None:
|
|
452
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
453
|
-
|
|
454
|
-
if server_url is not None:
|
|
455
|
-
base_url = server_url
|
|
456
|
-
else:
|
|
457
|
-
base_url = self._get_url(base_url, url_variables)
|
|
458
|
-
|
|
459
|
-
if not isinstance(request, BaseModel):
|
|
460
|
-
request = utils.unmarshal(
|
|
461
|
-
request, Optional[operations.CreateCustomerRequestBody]
|
|
462
|
-
)
|
|
463
|
-
request = cast(Optional[operations.CreateCustomerRequestBody], request)
|
|
464
|
-
|
|
465
|
-
req = self._build_request_async(
|
|
466
|
-
method="POST",
|
|
467
|
-
path="/customers",
|
|
468
|
-
base_url=base_url,
|
|
469
|
-
url_variables=url_variables,
|
|
470
|
-
request=request,
|
|
471
|
-
request_body_required=False,
|
|
472
|
-
request_has_path_params=False,
|
|
473
|
-
request_has_query_params=True,
|
|
474
|
-
user_agent_header="user-agent",
|
|
475
|
-
accept_header_value="application/json",
|
|
476
|
-
http_headers=http_headers,
|
|
477
|
-
security=self.sdk_configuration.security,
|
|
478
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
479
|
-
request,
|
|
480
|
-
False,
|
|
481
|
-
True,
|
|
482
|
-
"json",
|
|
483
|
-
Optional[operations.CreateCustomerRequestBody],
|
|
484
|
-
),
|
|
485
|
-
timeout_ms=timeout_ms,
|
|
486
|
-
)
|
|
487
|
-
|
|
488
|
-
if retries == UNSET:
|
|
489
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
490
|
-
retries = self.sdk_configuration.retry_config
|
|
491
|
-
|
|
492
|
-
retry_config = None
|
|
493
|
-
if isinstance(retries, utils.RetryConfig):
|
|
494
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
495
|
-
|
|
496
|
-
http_res = await self.do_request_async(
|
|
497
|
-
hook_ctx=HookContext(
|
|
498
|
-
config=self.sdk_configuration,
|
|
499
|
-
base_url=base_url or "",
|
|
500
|
-
operation_id="createCustomer",
|
|
501
|
-
oauth2_scopes=None,
|
|
502
|
-
security_source=self.sdk_configuration.security,
|
|
503
|
-
),
|
|
504
|
-
request=req,
|
|
505
|
-
error_status_codes=[
|
|
506
|
-
"400",
|
|
507
|
-
"401",
|
|
508
|
-
"403",
|
|
509
|
-
"404",
|
|
510
|
-
"409",
|
|
511
|
-
"410",
|
|
512
|
-
"422",
|
|
513
|
-
"429",
|
|
514
|
-
"4XX",
|
|
515
|
-
"500",
|
|
516
|
-
"5XX",
|
|
517
|
-
],
|
|
518
|
-
retry_config=retry_config,
|
|
519
|
-
)
|
|
520
|
-
|
|
521
|
-
response_data: Any = None
|
|
522
|
-
if utils.match_response(http_res, "201", "application/json"):
|
|
523
|
-
return unmarshal_json_response(
|
|
524
|
-
Optional[operations.CreateCustomerResponseBody], http_res
|
|
231
|
+
List[operations.GetCustomersResponseBody], http_res
|
|
525
232
|
)
|
|
526
233
|
if utils.match_response(http_res, "400", "application/json"):
|
|
527
234
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -575,7 +282,7 @@ class Customers(BaseSDK):
|
|
|
575
282
|
server_url: Optional[str] = None,
|
|
576
283
|
timeout_ms: Optional[int] = None,
|
|
577
284
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
578
|
-
) ->
|
|
285
|
+
) -> operations.GetCustomerResponseBody:
|
|
579
286
|
r"""Retrieve a customer
|
|
580
287
|
|
|
581
288
|
Retrieve a customer by ID for the authenticated workspace.
|
|
@@ -651,9 +358,7 @@ class Customers(BaseSDK):
|
|
|
651
358
|
|
|
652
359
|
response_data: Any = None
|
|
653
360
|
if utils.match_response(http_res, "200", "application/json"):
|
|
654
|
-
return unmarshal_json_response(
|
|
655
|
-
Optional[operations.GetCustomerResponseBody], http_res
|
|
656
|
-
)
|
|
361
|
+
return unmarshal_json_response(operations.GetCustomerResponseBody, http_res)
|
|
657
362
|
if utils.match_response(http_res, "400", "application/json"):
|
|
658
363
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
659
364
|
raise errors.BadRequest(response_data, http_res)
|
|
@@ -706,7 +411,7 @@ class Customers(BaseSDK):
|
|
|
706
411
|
server_url: Optional[str] = None,
|
|
707
412
|
timeout_ms: Optional[int] = None,
|
|
708
413
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
709
|
-
) ->
|
|
414
|
+
) -> operations.GetCustomerResponseBody:
|
|
710
415
|
r"""Retrieve a customer
|
|
711
416
|
|
|
712
417
|
Retrieve a customer by ID for the authenticated workspace.
|
|
@@ -782,9 +487,7 @@ class Customers(BaseSDK):
|
|
|
782
487
|
|
|
783
488
|
response_data: Any = None
|
|
784
489
|
if utils.match_response(http_res, "200", "application/json"):
|
|
785
|
-
return unmarshal_json_response(
|
|
786
|
-
Optional[operations.GetCustomerResponseBody], http_res
|
|
787
|
-
)
|
|
490
|
+
return unmarshal_json_response(operations.GetCustomerResponseBody, http_res)
|
|
788
491
|
if utils.match_response(http_res, "400", "application/json"):
|
|
789
492
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
790
493
|
raise errors.BadRequest(response_data, http_res)
|
|
@@ -837,7 +540,7 @@ class Customers(BaseSDK):
|
|
|
837
540
|
server_url: Optional[str] = None,
|
|
838
541
|
timeout_ms: Optional[int] = None,
|
|
839
542
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
840
|
-
) ->
|
|
543
|
+
) -> operations.UpdateCustomerResponseBody:
|
|
841
544
|
r"""Update a customer
|
|
842
545
|
|
|
843
546
|
Update a customer for the authenticated workspace.
|
|
@@ -921,7 +624,7 @@ class Customers(BaseSDK):
|
|
|
921
624
|
response_data: Any = None
|
|
922
625
|
if utils.match_response(http_res, "200", "application/json"):
|
|
923
626
|
return unmarshal_json_response(
|
|
924
|
-
|
|
627
|
+
operations.UpdateCustomerResponseBody, http_res
|
|
925
628
|
)
|
|
926
629
|
if utils.match_response(http_res, "400", "application/json"):
|
|
927
630
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -975,7 +678,7 @@ class Customers(BaseSDK):
|
|
|
975
678
|
server_url: Optional[str] = None,
|
|
976
679
|
timeout_ms: Optional[int] = None,
|
|
977
680
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
978
|
-
) ->
|
|
681
|
+
) -> operations.UpdateCustomerResponseBody:
|
|
979
682
|
r"""Update a customer
|
|
980
683
|
|
|
981
684
|
Update a customer for the authenticated workspace.
|
|
@@ -1059,7 +762,7 @@ class Customers(BaseSDK):
|
|
|
1059
762
|
response_data: Any = None
|
|
1060
763
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1061
764
|
return unmarshal_json_response(
|
|
1062
|
-
|
|
765
|
+
operations.UpdateCustomerResponseBody, http_res
|
|
1063
766
|
)
|
|
1064
767
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1065
768
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -1111,7 +814,7 @@ class Customers(BaseSDK):
|
|
|
1111
814
|
server_url: Optional[str] = None,
|
|
1112
815
|
timeout_ms: Optional[int] = None,
|
|
1113
816
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1114
|
-
) ->
|
|
817
|
+
) -> operations.DeleteCustomerResponseBody:
|
|
1115
818
|
r"""Delete a customer
|
|
1116
819
|
|
|
1117
820
|
Delete a customer from a workspace.
|
|
@@ -1188,7 +891,7 @@ class Customers(BaseSDK):
|
|
|
1188
891
|
response_data: Any = None
|
|
1189
892
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1190
893
|
return unmarshal_json_response(
|
|
1191
|
-
|
|
894
|
+
operations.DeleteCustomerResponseBody, http_res
|
|
1192
895
|
)
|
|
1193
896
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1194
897
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
@@ -1240,7 +943,7 @@ class Customers(BaseSDK):
|
|
|
1240
943
|
server_url: Optional[str] = None,
|
|
1241
944
|
timeout_ms: Optional[int] = None,
|
|
1242
945
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1243
|
-
) ->
|
|
946
|
+
) -> operations.DeleteCustomerResponseBody:
|
|
1244
947
|
r"""Delete a customer
|
|
1245
948
|
|
|
1246
949
|
Delete a customer from a workspace.
|
|
@@ -1317,7 +1020,7 @@ class Customers(BaseSDK):
|
|
|
1317
1020
|
response_data: Any = None
|
|
1318
1021
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1319
1022
|
return unmarshal_json_response(
|
|
1320
|
-
|
|
1023
|
+
operations.DeleteCustomerResponseBody, http_res
|
|
1321
1024
|
)
|
|
1322
1025
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1323
1026
|
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|