-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.456.1
- Loading branch information
1 parent
648b56b
commit 602ac1f
Showing
22 changed files
with
431 additions
and
23 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# CustomerSession | ||
|
||
A customer session that can be used to authenticate as a customer. | ||
|
||
|
||
## Fields | ||
|
||
| Field | Type | Required | Description | | ||
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | | ||
| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Creation timestamp of the object. | | ||
| `modified_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Last modification timestamp of the object. | | ||
| `id` | *str* | :heavy_check_mark: | The ID of the object. | | ||
| `token` | *str* | :heavy_check_mark: | N/A | | ||
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | | ||
| `customer_id` | *str* | :heavy_check_mark: | N/A | | ||
| `customer` | [models.Customer](../models/customer.md) | :heavy_check_mark: | A customer in an organization. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# CustomerSessionCreate | ||
|
||
Schema for creating a customer session. | ||
|
||
|
||
## Fields | ||
|
||
| Field | Type | Required | Description | | ||
| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | | ||
| `customer_id` | *str* | :heavy_check_mark: | ID of the customer to create a session for. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# CustomerSessions | ||
(*customer_sessions*) | ||
|
||
## Overview | ||
|
||
### Available Operations | ||
|
||
* [create](#create) - Create Customer Session | ||
|
||
## create | ||
|
||
Create a customer session. | ||
|
||
### Example Usage | ||
|
||
```python | ||
from polar_sdk import Polar | ||
|
||
with Polar( | ||
access_token="<YOUR_BEARER_TOKEN_HERE>", | ||
) as polar: | ||
|
||
res = polar.customer_sessions.create(request={ | ||
"customer_id": "<value>", | ||
}) | ||
|
||
# Handle response | ||
print(res) | ||
|
||
``` | ||
|
||
### Parameters | ||
|
||
| Parameter | Type | Required | Description | | ||
| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | | ||
| `request` | [models.CustomerSessionCreate](../../models/customersessioncreate.md) | :heavy_check_mark: | The request object to use for the request. | | ||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ||
|
||
### Response | ||
|
||
**[models.CustomerSession](../../models/customersession.md)** | ||
|
||
### Errors | ||
|
||
| Error Type | Status Code | Content Type | | ||
| -------------------------- | -------------------------- | -------------------------- | | ||
| models.HTTPValidationError | 422 | application/json | | ||
| models.SDKError | 4XX, 5XX | \*/\* | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" | ||
|
||
from .basesdk import BaseSDK | ||
from polar_sdk import models, utils | ||
from polar_sdk._hooks import HookContext | ||
from polar_sdk.types import BaseModel, OptionalNullable, UNSET | ||
from typing import Any, Mapping, Optional, Union, cast | ||
|
||
|
||
class CustomerSessions(BaseSDK): | ||
def create( | ||
self, | ||
*, | ||
request: Union[ | ||
models.CustomerSessionCreate, models.CustomerSessionCreateTypedDict | ||
], | ||
retries: OptionalNullable[utils.RetryConfig] = UNSET, | ||
server_url: Optional[str] = None, | ||
timeout_ms: Optional[int] = None, | ||
http_headers: Optional[Mapping[str, str]] = None, | ||
) -> models.CustomerSession: | ||
r"""Create Customer Session | ||
Create a customer session. | ||
:param request: The request object to send. | ||
:param retries: Override the default retry configuration for this method | ||
:param server_url: Override the default server URL for this method | ||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds | ||
:param http_headers: Additional headers to set or replace on requests. | ||
""" | ||
base_url = None | ||
url_variables = None | ||
if timeout_ms is None: | ||
timeout_ms = self.sdk_configuration.timeout_ms | ||
|
||
if server_url is not None: | ||
base_url = server_url | ||
|
||
if not isinstance(request, BaseModel): | ||
request = utils.unmarshal(request, models.CustomerSessionCreate) | ||
request = cast(models.CustomerSessionCreate, request) | ||
|
||
req = self.build_request( | ||
method="POST", | ||
path="/v1/customer-sessions/", | ||
base_url=base_url, | ||
url_variables=url_variables, | ||
request=request, | ||
request_body_required=True, | ||
request_has_path_params=False, | ||
request_has_query_params=True, | ||
user_agent_header="user-agent", | ||
accept_header_value="application/json", | ||
http_headers=http_headers, | ||
security=self.sdk_configuration.security, | ||
get_serialized_body=lambda: utils.serialize_request_body( | ||
request, False, False, "json", models.CustomerSessionCreate | ||
), | ||
timeout_ms=timeout_ms, | ||
) | ||
|
||
if retries == UNSET: | ||
if self.sdk_configuration.retry_config is not UNSET: | ||
retries = self.sdk_configuration.retry_config | ||
|
||
retry_config = None | ||
if isinstance(retries, utils.RetryConfig): | ||
retry_config = (retries, ["429", "500", "502", "503", "504"]) | ||
|
||
http_res = self.do_request( | ||
hook_ctx=HookContext( | ||
operation_id="customer-sessions:create", | ||
oauth2_scopes=[], | ||
security_source=self.sdk_configuration.security, | ||
), | ||
request=req, | ||
error_status_codes=["422", "4XX", "5XX"], | ||
retry_config=retry_config, | ||
) | ||
|
||
data: Any = None | ||
if utils.match_response(http_res, "201", "application/json"): | ||
return utils.unmarshal_json(http_res.text, models.CustomerSession) | ||
if utils.match_response(http_res, "422", "application/json"): | ||
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData) | ||
raise models.HTTPValidationError(data=data) | ||
if utils.match_response(http_res, ["4XX", "5XX"], "*"): | ||
http_res_text = utils.stream_to_text(http_res) | ||
raise models.SDKError( | ||
"API error occurred", http_res.status_code, http_res_text, http_res | ||
) | ||
|
||
content_type = http_res.headers.get("Content-Type") | ||
http_res_text = utils.stream_to_text(http_res) | ||
raise models.SDKError( | ||
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", | ||
http_res.status_code, | ||
http_res_text, | ||
http_res, | ||
) | ||
|
||
async def create_async( | ||
self, | ||
*, | ||
request: Union[ | ||
models.CustomerSessionCreate, models.CustomerSessionCreateTypedDict | ||
], | ||
retries: OptionalNullable[utils.RetryConfig] = UNSET, | ||
server_url: Optional[str] = None, | ||
timeout_ms: Optional[int] = None, | ||
http_headers: Optional[Mapping[str, str]] = None, | ||
) -> models.CustomerSession: | ||
r"""Create Customer Session | ||
Create a customer session. | ||
:param request: The request object to send. | ||
:param retries: Override the default retry configuration for this method | ||
:param server_url: Override the default server URL for this method | ||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds | ||
:param http_headers: Additional headers to set or replace on requests. | ||
""" | ||
base_url = None | ||
url_variables = None | ||
if timeout_ms is None: | ||
timeout_ms = self.sdk_configuration.timeout_ms | ||
|
||
if server_url is not None: | ||
base_url = server_url | ||
|
||
if not isinstance(request, BaseModel): | ||
request = utils.unmarshal(request, models.CustomerSessionCreate) | ||
request = cast(models.CustomerSessionCreate, request) | ||
|
||
req = self.build_request_async( | ||
method="POST", | ||
path="/v1/customer-sessions/", | ||
base_url=base_url, | ||
url_variables=url_variables, | ||
request=request, | ||
request_body_required=True, | ||
request_has_path_params=False, | ||
request_has_query_params=True, | ||
user_agent_header="user-agent", | ||
accept_header_value="application/json", | ||
http_headers=http_headers, | ||
security=self.sdk_configuration.security, | ||
get_serialized_body=lambda: utils.serialize_request_body( | ||
request, False, False, "json", models.CustomerSessionCreate | ||
), | ||
timeout_ms=timeout_ms, | ||
) | ||
|
||
if retries == UNSET: | ||
if self.sdk_configuration.retry_config is not UNSET: | ||
retries = self.sdk_configuration.retry_config | ||
|
||
retry_config = None | ||
if isinstance(retries, utils.RetryConfig): | ||
retry_config = (retries, ["429", "500", "502", "503", "504"]) | ||
|
||
http_res = await self.do_request_async( | ||
hook_ctx=HookContext( | ||
operation_id="customer-sessions:create", | ||
oauth2_scopes=[], | ||
security_source=self.sdk_configuration.security, | ||
), | ||
request=req, | ||
error_status_codes=["422", "4XX", "5XX"], | ||
retry_config=retry_config, | ||
) | ||
|
||
data: Any = None | ||
if utils.match_response(http_res, "201", "application/json"): | ||
return utils.unmarshal_json(http_res.text, models.CustomerSession) | ||
if utils.match_response(http_res, "422", "application/json"): | ||
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData) | ||
raise models.HTTPValidationError(data=data) | ||
if utils.match_response(http_res, ["4XX", "5XX"], "*"): | ||
http_res_text = await utils.stream_to_text_async(http_res) | ||
raise models.SDKError( | ||
"API error occurred", http_res.status_code, http_res_text, http_res | ||
) | ||
|
||
content_type = http_res.headers.get("Content-Type") | ||
http_res_text = await utils.stream_to_text_async(http_res) | ||
raise models.SDKError( | ||
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", | ||
http_res.status_code, | ||
http_res_text, | ||
http_res, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.