Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.456.1
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot authored and frankie567 committed Dec 20, 2024
1 parent 648b56b commit 602ac1f
Show file tree
Hide file tree
Showing 22 changed files with 431 additions and 23 deletions.
29 changes: 22 additions & 7 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
python:
version: 0.11.0
version: 0.11.1
additionalDependencies:
dev:
pytest: ^8.3.3
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
speakeasyVersion: 1.456.0
speakeasyVersion: 1.456.1
sources:
Polar-OAS:
sourceNamespace: polar-oas
sourceRevisionDigest: sha256:bf5ff5b95a411e176747cc3d436aa5e5587c97a32cf7d19697fad3bbf66de6a2
sourceBlobDigest: sha256:937f1e89736ba0d1ed3c2affd965fdb1e7213012c7b7f15b20541a9e9f829620
sourceRevisionDigest: sha256:6c834590418d648bd10d0825628fe11bda41e355840bcb83319e3435ca322d5b
sourceBlobDigest: sha256:2fcb4a497110dfacf53652f840b4586fd532f15ddfa11dc8329db9987c54371a
tags:
- latest
- speakeasy-sdk-regen-1734426902
- speakeasy-sdk-regen-1734653531
- 0.1.0
targets:
polar:
source: Polar-OAS
sourceNamespace: polar-oas
sourceRevisionDigest: sha256:bf5ff5b95a411e176747cc3d436aa5e5587c97a32cf7d19697fad3bbf66de6a2
sourceBlobDigest: sha256:937f1e89736ba0d1ed3c2affd965fdb1e7213012c7b7f15b20541a9e9f829620
sourceRevisionDigest: sha256:6c834590418d648bd10d0825628fe11bda41e355840bcb83319e3435ca322d5b
sourceBlobDigest: sha256:2fcb4a497110dfacf53652f840b4586fd532f15ddfa11dc8329db9987c54371a
codeSamplesNamespace: polar-oas-code-samples
codeSamplesRevisionDigest: sha256:6d72157e60f4b6c750710d45f83796e1d03eec680f8aa712d0e076c995a8280c
codeSamplesRevisionDigest: sha256:8343363a8e0f25db3b3bdbcc73302d71c8c9b25ad9f0905047f680d6398fa774
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ def webhook():
* [update](docs/sdks/polarsubscriptions/README.md#update) - Update Subscription
* [cancel](docs/sdks/polarsubscriptions/README.md#cancel) - Cancel Subscription

### [customer_sessions](docs/sdks/customersessions/README.md)

* [create](docs/sdks/customersessions/README.md#create) - Create Customer Session

### [customers](docs/sdks/customers/README.md)

* [list](docs/sdks/customers/README.md#list) - List Customers
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,14 @@ Based on:
### Generated
- [python v0.11.0] .
### Releases
- [PyPI v0.11.0] https://pypi.org/project/polar-sdk/0.11.0 - .
- [PyPI v0.11.0] https://pypi.org/project/polar-sdk/0.11.0 - .

## 2024-12-20 00:12:07
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.456.1 (2.481.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.11.1] .
### Releases
- [PyPI v0.11.1] https://pypi.org/project/polar-sdk/0.11.1 - .
6 changes: 6 additions & 0 deletions codeSamples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ actions:
- "lang": "python"
"label": "update"
"source": "from polar_sdk import Polar\n\nwith Polar(\n access_token=\"<YOUR_BEARER_TOKEN_HERE>\",\n) as polar:\n\n res = polar.customer_portal.subscriptions.update(id=\"<value>\", customer_subscription_update={\n \"product_price_id\": \"<value>\",\n })\n\n # Handle response\n print(res)"
- target: $["paths"]["/v1/customer-sessions/"]["post"]
update:
"x-codeSamples":
- "lang": "python"
"label": "create"
"source": "from polar_sdk import Polar\n\nwith Polar(\n access_token=\"<YOUR_BEARER_TOKEN_HERE>\",\n) as polar:\n\n res = polar.customer_sessions.create(request={\n \"customer_id\": \"<value>\",\n })\n\n # Handle response\n print(res)"
- target: $["paths"]["/v1/customers/"]["get"]
update:
"x-codeSamples":
Expand Down
16 changes: 16 additions & 0 deletions docs/models/customersession.md
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. |
10 changes: 10 additions & 0 deletions docs/models/customersessioncreate.md
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. |
1 change: 1 addition & 0 deletions docs/models/scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
| `SUBSCRIPTIONS_WRITE` | subscriptions:write |
| `CUSTOMERS_READ` | customers:read |
| `CUSTOMERS_WRITE` | customers:write |
| `CUSTOMER_SESSIONS_WRITE` | customer_sessions:write |
| `ORDERS_READ` | orders:read |
| `METRICS_READ` | metrics:read |
| `WEBHOOKS_READ` | webhooks:read |
Expand Down
48 changes: 48 additions & 0 deletions docs/sdks/customersessions/README.md
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 | \*/\* |
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "polar-sdk"
version = "0.11.0"
version = "0.11.1"
description = "Polar SDK for Python"
authors = ["Polar",]
readme = "README-PYPI.md"
Expand Down
2 changes: 1 addition & 1 deletion src/polar_sdk/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import importlib.metadata

__title__: str = "polar-sdk"
__version__: str = "0.11.0"
__version__: str = "0.11.1"

try:
if __package__ is not None:
Expand Down
193 changes: 193 additions & 0 deletions src/polar_sdk/customer_sessions.py
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,
)
6 changes: 6 additions & 0 deletions src/polar_sdk/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@
CustomersListResponseTypedDict,
)
from .customers_updateop import CustomersUpdateRequest, CustomersUpdateRequestTypedDict
from .customersession import CustomerSession, CustomerSessionTypedDict
from .customersessioncreate import CustomerSessionCreate, CustomerSessionCreateTypedDict
from .customersortproperty import CustomerSortProperty
from .customersubscription import CustomerSubscription, CustomerSubscriptionTypedDict
from .customersubscriptionproduct import (
Expand Down Expand Up @@ -2222,6 +2224,10 @@
"CustomerPortalSubscriptionsListResponseTypedDict",
"CustomerPortalSubscriptionsUpdateRequest",
"CustomerPortalSubscriptionsUpdateRequestTypedDict",
"CustomerSession",
"CustomerSessionCreate",
"CustomerSessionCreateTypedDict",
"CustomerSessionTypedDict",
"CustomerSortProperty",
"CustomerSubscription",
"CustomerSubscriptionProduct",
Expand Down
Loading

0 comments on commit 602ac1f

Please sign in to comment.