diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 34ac707..41dea33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.30" + ".": "0.0.32" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f91f6ee..00310ca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 173 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-cc6caefebc5d0c5b09a38a2ca3de9b07a8af8017a45a3a8ae4687eea30e5df93.yml -openapi_spec_hash: 384c511adb0c53319ac3ece08843f485 -config_hash: 8ac153ea57fa6460b13cded3f7c9c7a6 +configured_endpoints: 178 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-187882c4d823394e3577f9843c288f4187e4f9b38646105c40b88e4e83b27979.yml +openapi_spec_hash: 16eb1c84681dc3ad39c987b7abf1e191 +config_hash: e9bda7cddca13f2b41d8f7521ad36cf5 diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2e124..679984c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## 0.0.32 (2026-03-11) + +Full Changelog: [v0.0.30...v0.0.32](https://github.com/whopio/whopsdk-python/compare/v0.0.30...v0.0.32) + +### Features + +* **api:** api update ([99175a1](https://github.com/whopio/whopsdk-python/commit/99175a149a05f6c54b225447a163b958af8ae61c)) +* **api:** api update ([fe17d66](https://github.com/whopio/whopsdk-python/commit/fe17d66f82035b4e58f474bfd136bf78114aaeab)) +* **api:** api update ([2ee7fe7](https://github.com/whopio/whopsdk-python/commit/2ee7fe71e837e7f91ed021b58217abaf89782879)) +* **api:** api update ([260853e](https://github.com/whopio/whopsdk-python/commit/260853e5ec3e85481b25da49ec4252b8b773e81a)) +* **api:** api update ([dcef405](https://github.com/whopio/whopsdk-python/commit/dcef4059c4ce8e9fdffa7d2aba850f325c53fb57)) +* **api:** api update ([abc268f](https://github.com/whopio/whopsdk-python/commit/abc268f2c7a2d59ed01e6fd595aaf3559b831302)) +* **api:** api update ([2f4cd94](https://github.com/whopio/whopsdk-python/commit/2f4cd94cdca591d743dd905f9b325d25fe45acb8)) +* **api:** api update ([ad1d5b7](https://github.com/whopio/whopsdk-python/commit/ad1d5b78546c5efd4214e22c42aa7a64227bc34c)) +* **api:** api update ([c2f142d](https://github.com/whopio/whopsdk-python/commit/c2f142d7aebad6ec2b140d70a8b93aa3205290ec)) +* **api:** api update ([d62a4b7](https://github.com/whopio/whopsdk-python/commit/d62a4b7961c1264d9c4055a026238a72822b8b19)) +* **api:** api update ([c60ab1e](https://github.com/whopio/whopsdk-python/commit/c60ab1e6568cef6910ec61773887c8b9546c52d4)) +* **api:** api update ([020c181](https://github.com/whopio/whopsdk-python/commit/020c181cf53f7811401fe01d4382fe490e6e5398)) +* **api:** api update ([db6d90c](https://github.com/whopio/whopsdk-python/commit/db6d90cb90d173817cb3c8829dcd7d4ac091e53e)) +* **api:** api update ([74d75c5](https://github.com/whopio/whopsdk-python/commit/74d75c50c470970c3b7fdc0611dd58c518fcdb18)) +* **api:** api update ([2edf4bc](https://github.com/whopio/whopsdk-python/commit/2edf4bca49f261116a77e04d77da9157904367a5)) +* **api:** manual updates ([b162886](https://github.com/whopio/whopsdk-python/commit/b1628865df13ae4d703571e46e738405652ad150)) +* **api:** manual updates ([5488b95](https://github.com/whopio/whopsdk-python/commit/5488b953d0a7e6c4c6d08d9a6f0b88a8852a76d2)) + + +### Chores + +* **ci:** skip uploading artifacts on stainless-internal branches ([04a3a6d](https://github.com/whopio/whopsdk-python/commit/04a3a6d8263e34b42b476380846af4d4f31deedd)) +* **docs:** add missing descriptions ([beeb9ef](https://github.com/whopio/whopsdk-python/commit/beeb9efca946b1bc2e565239ac96d3d2d8642b6f)) +* **tests:** update webhook tests ([f740d3c](https://github.com/whopio/whopsdk-python/commit/f740d3c6d32e332ecea2ec902e9903c36055443e)) + ## 0.0.30 (2026-02-26) Full Changelog: [v0.0.29...v0.0.30](https://github.com/whopio/whopsdk-python/compare/v0.0.29...v0.0.30) diff --git a/api.md b/api.md index 679a9af..2627576 100644 --- a/api.md +++ b/api.md @@ -121,7 +121,7 @@ Methods: Types: ```python -from whop_sdk.types import CompanyListResponse +from whop_sdk.types import SocialLinkWebsites, CompanyListResponse ``` Methods: @@ -268,6 +268,7 @@ Methods: - client.memberships.retrieve(id) -> Membership - client.memberships.update(id, \*\*params) -> Membership - client.memberships.list(\*\*params) -> SyncCursorPage[MembershipListResponse] +- client.memberships.add_free_days(id, \*\*params) -> Membership - client.memberships.cancel(id, \*\*params) -> Membership - client.memberships.pause(id, \*\*params) -> Membership - client.memberships.resume(id) -> Membership @@ -278,13 +279,15 @@ Methods: Types: ```python -from whop_sdk.types import AuthorizedUserRetrieveResponse, AuthorizedUserListResponse +from whop_sdk.types import AuthorizedUser, AuthorizedUserListResponse, AuthorizedUserDeleteResponse ``` Methods: -- client.authorized_users.retrieve(id) -> AuthorizedUserRetrieveResponse +- client.authorized_users.create(\*\*params) -> AuthorizedUser +- client.authorized_users.retrieve(id) -> AuthorizedUser - client.authorized_users.list(\*\*params) -> SyncCursorPage[AuthorizedUserListResponse] +- client.authorized_users.delete(id, \*\*params) -> AuthorizedUserDeleteResponse # AppBuilds @@ -382,6 +385,7 @@ from whop_sdk.types import ( BillingReasons, CardBrands, PaymentMethodTypes, + ReceiptTaxBehavior, PaymentListResponse, PaymentListFeesResponse, ) @@ -876,3 +880,24 @@ Methods: - client.dispute_alerts.retrieve(id) -> DisputeAlertRetrieveResponse - client.dispute_alerts.list(\*\*params) -> SyncCursorPage[DisputeAlertListResponse] + +# ResolutionCenterCases + +Types: + +```python +from whop_sdk.types import ( + ResolutionCenterCaseCustomerResponse, + ResolutionCenterCaseIssueType, + ResolutionCenterCaseMerchantResponse, + ResolutionCenterCasePlatformResponse, + ResolutionCenterCaseStatus, + ResolutionCenterCaseRetrieveResponse, + ResolutionCenterCaseListResponse, +) +``` + +Methods: + +- client.resolution_center_cases.retrieve(id) -> ResolutionCenterCaseRetrieveResponse +- client.resolution_center_cases.list(\*\*params) -> SyncCursorPage[ResolutionCenterCaseListResponse] diff --git a/pyproject.toml b/pyproject.toml index 80fe526..0834754 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "whop-sdk" -version = "0.0.30" +version = "0.0.32" description = "The official Python library for the Whop API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/whop_sdk/_client.py b/src/whop_sdk/_client.py index 65a4f49..b9c5cb2 100644 --- a/src/whop_sdk/_client.py +++ b/src/whop_sdk/_client.py @@ -80,6 +80,7 @@ authorized_users, support_channels, checkout_configurations, + resolution_center_cases, company_token_transactions, course_lesson_interactions, ) @@ -131,6 +132,7 @@ from .resources.authorized_users import AuthorizedUsersResource, AsyncAuthorizedUsersResource from .resources.support_channels import SupportChannelsResource, AsyncSupportChannelsResource from .resources.checkout_configurations import CheckoutConfigurationsResource, AsyncCheckoutConfigurationsResource + from .resources.resolution_center_cases import ResolutionCenterCasesResource, AsyncResolutionCenterCasesResource from .resources.company_token_transactions import ( CompanyTokenTransactionsResource, AsyncCompanyTokenTransactionsResource, @@ -513,6 +515,13 @@ def dispute_alerts(self) -> DisputeAlertsResource: return DisputeAlertsResource(self) + @cached_property + def resolution_center_cases(self) -> ResolutionCenterCasesResource: + """Resolution center cases""" + from .resources.resolution_center_cases import ResolutionCenterCasesResource + + return ResolutionCenterCasesResource(self) + @cached_property def with_raw_response(self) -> WhopWithRawResponse: return WhopWithRawResponse(self) @@ -1001,6 +1010,13 @@ def dispute_alerts(self) -> AsyncDisputeAlertsResource: return AsyncDisputeAlertsResource(self) + @cached_property + def resolution_center_cases(self) -> AsyncResolutionCenterCasesResource: + """Resolution center cases""" + from .resources.resolution_center_cases import AsyncResolutionCenterCasesResource + + return AsyncResolutionCenterCasesResource(self) + @cached_property def with_raw_response(self) -> AsyncWhopWithRawResponse: return AsyncWhopWithRawResponse(self) @@ -1425,6 +1441,13 @@ def dispute_alerts(self) -> dispute_alerts.DisputeAlertsResourceWithRawResponse: return DisputeAlertsResourceWithRawResponse(self._client.dispute_alerts) + @cached_property + def resolution_center_cases(self) -> resolution_center_cases.ResolutionCenterCasesResourceWithRawResponse: + """Resolution center cases""" + from .resources.resolution_center_cases import ResolutionCenterCasesResourceWithRawResponse + + return ResolutionCenterCasesResourceWithRawResponse(self._client.resolution_center_cases) + class AsyncWhopWithRawResponse: _client: AsyncWhop @@ -1736,6 +1759,13 @@ def dispute_alerts(self) -> dispute_alerts.AsyncDisputeAlertsResourceWithRawResp return AsyncDisputeAlertsResourceWithRawResponse(self._client.dispute_alerts) + @cached_property + def resolution_center_cases(self) -> resolution_center_cases.AsyncResolutionCenterCasesResourceWithRawResponse: + """Resolution center cases""" + from .resources.resolution_center_cases import AsyncResolutionCenterCasesResourceWithRawResponse + + return AsyncResolutionCenterCasesResourceWithRawResponse(self._client.resolution_center_cases) + class WhopWithStreamedResponse: _client: Whop @@ -2047,6 +2077,13 @@ def dispute_alerts(self) -> dispute_alerts.DisputeAlertsResourceWithStreamingRes return DisputeAlertsResourceWithStreamingResponse(self._client.dispute_alerts) + @cached_property + def resolution_center_cases(self) -> resolution_center_cases.ResolutionCenterCasesResourceWithStreamingResponse: + """Resolution center cases""" + from .resources.resolution_center_cases import ResolutionCenterCasesResourceWithStreamingResponse + + return ResolutionCenterCasesResourceWithStreamingResponse(self._client.resolution_center_cases) + class AsyncWhopWithStreamedResponse: _client: AsyncWhop @@ -2360,6 +2397,15 @@ def dispute_alerts(self) -> dispute_alerts.AsyncDisputeAlertsResourceWithStreami return AsyncDisputeAlertsResourceWithStreamingResponse(self._client.dispute_alerts) + @cached_property + def resolution_center_cases( + self, + ) -> resolution_center_cases.AsyncResolutionCenterCasesResourceWithStreamingResponse: + """Resolution center cases""" + from .resources.resolution_center_cases import AsyncResolutionCenterCasesResourceWithStreamingResponse + + return AsyncResolutionCenterCasesResourceWithStreamingResponse(self._client.resolution_center_cases) + Client = Whop diff --git a/src/whop_sdk/_version.py b/src/whop_sdk/_version.py index c674ff5..aa95ad5 100644 --- a/src/whop_sdk/_version.py +++ b/src/whop_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "whop_sdk" -__version__ = "0.0.30" # x-release-please-version +__version__ = "0.0.32" # x-release-please-version diff --git a/src/whop_sdk/resources/__init__.py b/src/whop_sdk/resources/__init__.py index 798ec01..42deaeb 100644 --- a/src/whop_sdk/resources/__init__.py +++ b/src/whop_sdk/resources/__init__.py @@ -384,6 +384,14 @@ CheckoutConfigurationsResourceWithStreamingResponse, AsyncCheckoutConfigurationsResourceWithStreamingResponse, ) +from .resolution_center_cases import ( + ResolutionCenterCasesResource, + AsyncResolutionCenterCasesResource, + ResolutionCenterCasesResourceWithRawResponse, + AsyncResolutionCenterCasesResourceWithRawResponse, + ResolutionCenterCasesResourceWithStreamingResponse, + AsyncResolutionCenterCasesResourceWithStreamingResponse, +) from .company_token_transactions import ( CompanyTokenTransactionsResource, AsyncCompanyTokenTransactionsResource, @@ -702,4 +710,10 @@ "AsyncDisputeAlertsResourceWithRawResponse", "DisputeAlertsResourceWithStreamingResponse", "AsyncDisputeAlertsResourceWithStreamingResponse", + "ResolutionCenterCasesResource", + "AsyncResolutionCenterCasesResource", + "ResolutionCenterCasesResourceWithRawResponse", + "AsyncResolutionCenterCasesResourceWithRawResponse", + "ResolutionCenterCasesResourceWithStreamingResponse", + "AsyncResolutionCenterCasesResourceWithStreamingResponse", ] diff --git a/src/whop_sdk/resources/ai_chats.py b/src/whop_sdk/resources/ai_chats.py index cd24246..4eff698 100644 --- a/src/whop_sdk/resources/ai_chats.py +++ b/src/whop_sdk/resources/ai_chats.py @@ -199,6 +199,7 @@ def list( before: Optional[str] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, + only_active_crons: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -218,6 +219,8 @@ def list( last: Returns the last _n_ elements from the list. + only_active_crons: When true, returns only chats with an active cron schedule + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -240,6 +243,7 @@ def list( "before": before, "first": first, "last": last, + "only_active_crons": only_active_crons, }, ai_chat_list_params.AIChatListParams, ), @@ -457,6 +461,7 @@ def list( before: Optional[str] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, + only_active_crons: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -476,6 +481,8 @@ def list( last: Returns the last _n_ elements from the list. + only_active_crons: When true, returns only chats with an active cron schedule + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -498,6 +505,7 @@ def list( "before": before, "first": first, "last": last, + "only_active_crons": only_active_crons, }, ai_chat_list_params.AIChatListParams, ), diff --git a/src/whop_sdk/resources/authorized_users.py b/src/whop_sdk/resources/authorized_users.py index 91158b8..8ccdca5 100644 --- a/src/whop_sdk/resources/authorized_users.py +++ b/src/whop_sdk/resources/authorized_users.py @@ -7,9 +7,9 @@ import httpx -from ..types import authorized_user_list_params +from ..types import authorized_user_list_params, authorized_user_create_params, authorized_user_delete_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -20,14 +20,17 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.authorized_user import AuthorizedUser from ..types.shared.authorized_user_roles import AuthorizedUserRoles from ..types.authorized_user_list_response import AuthorizedUserListResponse -from ..types.authorized_user_retrieve_response import AuthorizedUserRetrieveResponse +from ..types.authorized_user_delete_response import AuthorizedUserDeleteResponse __all__ = ["AuthorizedUsersResource", "AsyncAuthorizedUsersResource"] class AuthorizedUsersResource(SyncAPIResource): + """Authorized users""" + @cached_property def with_raw_response(self) -> AuthorizedUsersResourceWithRawResponse: """ @@ -47,6 +50,64 @@ def with_streaming_response(self) -> AuthorizedUsersResourceWithStreamingRespons """ return AuthorizedUsersResourceWithStreamingResponse(self) + def create( + self, + *, + company_id: str, + role: AuthorizedUserRoles, + user_id: str, + send_emails: Optional[bool] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthorizedUser: + """ + Add a new authorized user to a company. + + Required permissions: + + - `authorized_user:create` + - `member:email:read` + + Args: + company_id: The ID of the company to add the authorized user to. + + role: + The role to assign to the authorized user within the company. Supported roles: + 'moderator', 'sales_manager'. + + user_id: The ID of the user to add as an authorized user. + + send_emails: Whether to send notification emails to the user on creation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/authorized_users", + body=maybe_transform( + { + "company_id": company_id, + "role": role, + "user_id": user_id, + "send_emails": send_emails, + }, + authorized_user_create_params.AuthorizedUserCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthorizedUser, + ) + def retrieve( self, id: str, @@ -57,7 +118,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AuthorizedUserRetrieveResponse: + ) -> AuthorizedUser: """ Retrieves the details of an existing authorized user. @@ -82,7 +143,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AuthorizedUserRetrieveResponse, + cast_to=AuthorizedUser, ) def list( @@ -167,8 +228,57 @@ def list( model=AuthorizedUserListResponse, ) + def delete( + self, + id: str, + *, + company_id: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthorizedUserDeleteResponse: + """ + Remove an authorized user from a company. + + Required permissions: + + - `authorized_user:delete` + + Args: + company_id: The ID of the company the authorized user belongs to. Optional if the authorized + user ID is provided. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._delete( + f"/authorized_users/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"company_id": company_id}, authorized_user_delete_params.AuthorizedUserDeleteParams + ), + ), + cast_to=AuthorizedUserDeleteResponse, + ) + class AsyncAuthorizedUsersResource(AsyncAPIResource): + """Authorized users""" + @cached_property def with_raw_response(self) -> AsyncAuthorizedUsersResourceWithRawResponse: """ @@ -188,6 +298,64 @@ def with_streaming_response(self) -> AsyncAuthorizedUsersResourceWithStreamingRe """ return AsyncAuthorizedUsersResourceWithStreamingResponse(self) + async def create( + self, + *, + company_id: str, + role: AuthorizedUserRoles, + user_id: str, + send_emails: Optional[bool] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthorizedUser: + """ + Add a new authorized user to a company. + + Required permissions: + + - `authorized_user:create` + - `member:email:read` + + Args: + company_id: The ID of the company to add the authorized user to. + + role: + The role to assign to the authorized user within the company. Supported roles: + 'moderator', 'sales_manager'. + + user_id: The ID of the user to add as an authorized user. + + send_emails: Whether to send notification emails to the user on creation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/authorized_users", + body=await async_maybe_transform( + { + "company_id": company_id, + "role": role, + "user_id": user_id, + "send_emails": send_emails, + }, + authorized_user_create_params.AuthorizedUserCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthorizedUser, + ) + async def retrieve( self, id: str, @@ -198,7 +366,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AuthorizedUserRetrieveResponse: + ) -> AuthorizedUser: """ Retrieves the details of an existing authorized user. @@ -223,7 +391,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AuthorizedUserRetrieveResponse, + cast_to=AuthorizedUser, ) def list( @@ -308,50 +476,121 @@ def list( model=AuthorizedUserListResponse, ) + async def delete( + self, + id: str, + *, + company_id: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthorizedUserDeleteResponse: + """ + Remove an authorized user from a company. + + Required permissions: + + - `authorized_user:delete` + + Args: + company_id: The ID of the company the authorized user belongs to. Optional if the authorized + user ID is provided. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._delete( + f"/authorized_users/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"company_id": company_id}, authorized_user_delete_params.AuthorizedUserDeleteParams + ), + ), + cast_to=AuthorizedUserDeleteResponse, + ) + class AuthorizedUsersResourceWithRawResponse: def __init__(self, authorized_users: AuthorizedUsersResource) -> None: self._authorized_users = authorized_users + self.create = to_raw_response_wrapper( + authorized_users.create, + ) self.retrieve = to_raw_response_wrapper( authorized_users.retrieve, ) self.list = to_raw_response_wrapper( authorized_users.list, ) + self.delete = to_raw_response_wrapper( + authorized_users.delete, + ) class AsyncAuthorizedUsersResourceWithRawResponse: def __init__(self, authorized_users: AsyncAuthorizedUsersResource) -> None: self._authorized_users = authorized_users + self.create = async_to_raw_response_wrapper( + authorized_users.create, + ) self.retrieve = async_to_raw_response_wrapper( authorized_users.retrieve, ) self.list = async_to_raw_response_wrapper( authorized_users.list, ) + self.delete = async_to_raw_response_wrapper( + authorized_users.delete, + ) class AuthorizedUsersResourceWithStreamingResponse: def __init__(self, authorized_users: AuthorizedUsersResource) -> None: self._authorized_users = authorized_users + self.create = to_streamed_response_wrapper( + authorized_users.create, + ) self.retrieve = to_streamed_response_wrapper( authorized_users.retrieve, ) self.list = to_streamed_response_wrapper( authorized_users.list, ) + self.delete = to_streamed_response_wrapper( + authorized_users.delete, + ) class AsyncAuthorizedUsersResourceWithStreamingResponse: def __init__(self, authorized_users: AsyncAuthorizedUsersResource) -> None: self._authorized_users = authorized_users + self.create = async_to_streamed_response_wrapper( + authorized_users.create, + ) self.retrieve = async_to_streamed_response_wrapper( authorized_users.retrieve, ) self.list = async_to_streamed_response_wrapper( authorized_users.list, ) + self.delete = async_to_streamed_response_wrapper( + authorized_users.delete, + ) diff --git a/src/whop_sdk/resources/products.py b/src/whop_sdk/resources/products.py index a4b6793..6909de0 100644 --- a/src/whop_sdk/resources/products.py +++ b/src/whop_sdk/resources/products.py @@ -74,6 +74,7 @@ def create( product_tax_code_id: Optional[str] | Omit = omit, redirect_purchase_url: Optional[str] | Omit = omit, route: Optional[str] | Omit = omit, + send_welcome_message: Optional[bool] | Omit = omit, visibility: Optional[Visibility] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -132,6 +133,9 @@ def create( route: The URL slug for the product's public link. + send_welcome_message: Whether to send an automated welcome message via support chat when a user joins + this product. Defaults to true. + visibility: Visibility of a resource extra_headers: Send extra headers @@ -163,6 +167,7 @@ def create( "product_tax_code_id": product_tax_code_id, "redirect_purchase_url": redirect_purchase_url, "route": route, + "send_welcome_message": send_welcome_message, "visibility": visibility, }, product_create_params.ProductCreateParams, @@ -228,6 +233,7 @@ def update( product_tax_code_id: Optional[str] | Omit = omit, redirect_purchase_url: Optional[str] | Omit = omit, route: Optional[str] | Omit = omit, + send_welcome_message: Optional[bool] | Omit = omit, store_page_config: Optional[product_update_params.StorePageConfig] | Omit = omit, title: Optional[str] | Omit = omit, visibility: Optional[Visibility] | Omit = omit, @@ -280,6 +286,9 @@ def update( route: The URL slug for the product's public link. + send_welcome_message: Whether to send an automated welcome message via support chat when a user joins + this product. + store_page_config: Layout and display configuration for this product on the company's store page. title: The display name of the product. Maximum 40 characters. @@ -314,6 +323,7 @@ def update( "product_tax_code_id": product_tax_code_id, "redirect_purchase_url": redirect_purchase_url, "route": route, + "send_welcome_message": send_welcome_message, "store_page_config": store_page_config, "title": title, "visibility": visibility, @@ -492,6 +502,7 @@ async def create( product_tax_code_id: Optional[str] | Omit = omit, redirect_purchase_url: Optional[str] | Omit = omit, route: Optional[str] | Omit = omit, + send_welcome_message: Optional[bool] | Omit = omit, visibility: Optional[Visibility] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -550,6 +561,9 @@ async def create( route: The URL slug for the product's public link. + send_welcome_message: Whether to send an automated welcome message via support chat when a user joins + this product. Defaults to true. + visibility: Visibility of a resource extra_headers: Send extra headers @@ -581,6 +595,7 @@ async def create( "product_tax_code_id": product_tax_code_id, "redirect_purchase_url": redirect_purchase_url, "route": route, + "send_welcome_message": send_welcome_message, "visibility": visibility, }, product_create_params.ProductCreateParams, @@ -646,6 +661,7 @@ async def update( product_tax_code_id: Optional[str] | Omit = omit, redirect_purchase_url: Optional[str] | Omit = omit, route: Optional[str] | Omit = omit, + send_welcome_message: Optional[bool] | Omit = omit, store_page_config: Optional[product_update_params.StorePageConfig] | Omit = omit, title: Optional[str] | Omit = omit, visibility: Optional[Visibility] | Omit = omit, @@ -698,6 +714,9 @@ async def update( route: The URL slug for the product's public link. + send_welcome_message: Whether to send an automated welcome message via support chat when a user joins + this product. + store_page_config: Layout and display configuration for this product on the company's store page. title: The display name of the product. Maximum 40 characters. @@ -732,6 +751,7 @@ async def update( "product_tax_code_id": product_tax_code_id, "redirect_purchase_url": redirect_purchase_url, "route": route, + "send_welcome_message": send_welcome_message, "store_page_config": store_page_config, "title": title, "visibility": visibility, diff --git a/src/whop_sdk/resources/resolution_center_cases.py b/src/whop_sdk/resources/resolution_center_cases.py new file mode 100644 index 0000000..3563f15 --- /dev/null +++ b/src/whop_sdk/resources/resolution_center_cases.py @@ -0,0 +1,356 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime + +import httpx + +from ..types import resolution_center_case_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncCursorPage, AsyncCursorPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.shared.direction import Direction +from ..types.resolution_center_case_status import ResolutionCenterCaseStatus +from ..types.resolution_center_case_list_response import ResolutionCenterCaseListResponse +from ..types.resolution_center_case_retrieve_response import ResolutionCenterCaseRetrieveResponse + +__all__ = ["ResolutionCenterCasesResource", "AsyncResolutionCenterCasesResource"] + + +class ResolutionCenterCasesResource(SyncAPIResource): + """Resolution center cases""" + + @cached_property + def with_raw_response(self) -> ResolutionCenterCasesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers + """ + return ResolutionCenterCasesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResolutionCenterCasesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response + """ + return ResolutionCenterCasesResourceWithStreamingResponse(self) + + def retrieve( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResolutionCenterCaseRetrieveResponse: + """ + Retrieves the details of an existing resolution center case. + + Required permissions: + + - `payment:resolution_center_case:read` + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/resolution_center_cases/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResolutionCenterCaseRetrieveResponse, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, + created_after: Union[str, datetime, None] | Omit = omit, + created_before: Union[str, datetime, None] | Omit = omit, + direction: Optional[Direction] | Omit = omit, + first: Optional[int] | Omit = omit, + last: Optional[int] | Omit = omit, + statuses: Optional[List[ResolutionCenterCaseStatus]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncCursorPage[ResolutionCenterCaseListResponse]: + """ + Returns a paginated list of resolution center cases, with optional filtering by + company, status, and creation date. + + Required permissions: + + - `payment:resolution_center_case:read` + + Args: + after: Returns the elements in the list that come after the specified cursor. + + before: Returns the elements in the list that come before the specified cursor. + + company_id: The unique identifier of the company to list resolution center cases for. + + created_after: Only return cases created after this timestamp. + + created_before: Only return cases created before this timestamp. + + direction: The direction of the sort. + + first: Returns the first _n_ elements from the list. + + last: Returns the last _n_ elements from the list. + + statuses: Filter by resolution center case status. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/resolution_center_cases", + page=SyncCursorPage[ResolutionCenterCaseListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "after": after, + "before": before, + "company_id": company_id, + "created_after": created_after, + "created_before": created_before, + "direction": direction, + "first": first, + "last": last, + "statuses": statuses, + }, + resolution_center_case_list_params.ResolutionCenterCaseListParams, + ), + ), + model=ResolutionCenterCaseListResponse, + ) + + +class AsyncResolutionCenterCasesResource(AsyncAPIResource): + """Resolution center cases""" + + @cached_property + def with_raw_response(self) -> AsyncResolutionCenterCasesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncResolutionCenterCasesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResolutionCenterCasesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response + """ + return AsyncResolutionCenterCasesResourceWithStreamingResponse(self) + + async def retrieve( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResolutionCenterCaseRetrieveResponse: + """ + Retrieves the details of an existing resolution center case. + + Required permissions: + + - `payment:resolution_center_case:read` + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/resolution_center_cases/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResolutionCenterCaseRetrieveResponse, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, + created_after: Union[str, datetime, None] | Omit = omit, + created_before: Union[str, datetime, None] | Omit = omit, + direction: Optional[Direction] | Omit = omit, + first: Optional[int] | Omit = omit, + last: Optional[int] | Omit = omit, + statuses: Optional[List[ResolutionCenterCaseStatus]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[ResolutionCenterCaseListResponse, AsyncCursorPage[ResolutionCenterCaseListResponse]]: + """ + Returns a paginated list of resolution center cases, with optional filtering by + company, status, and creation date. + + Required permissions: + + - `payment:resolution_center_case:read` + + Args: + after: Returns the elements in the list that come after the specified cursor. + + before: Returns the elements in the list that come before the specified cursor. + + company_id: The unique identifier of the company to list resolution center cases for. + + created_after: Only return cases created after this timestamp. + + created_before: Only return cases created before this timestamp. + + direction: The direction of the sort. + + first: Returns the first _n_ elements from the list. + + last: Returns the last _n_ elements from the list. + + statuses: Filter by resolution center case status. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/resolution_center_cases", + page=AsyncCursorPage[ResolutionCenterCaseListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "after": after, + "before": before, + "company_id": company_id, + "created_after": created_after, + "created_before": created_before, + "direction": direction, + "first": first, + "last": last, + "statuses": statuses, + }, + resolution_center_case_list_params.ResolutionCenterCaseListParams, + ), + ), + model=ResolutionCenterCaseListResponse, + ) + + +class ResolutionCenterCasesResourceWithRawResponse: + def __init__(self, resolution_center_cases: ResolutionCenterCasesResource) -> None: + self._resolution_center_cases = resolution_center_cases + + self.retrieve = to_raw_response_wrapper( + resolution_center_cases.retrieve, + ) + self.list = to_raw_response_wrapper( + resolution_center_cases.list, + ) + + +class AsyncResolutionCenterCasesResourceWithRawResponse: + def __init__(self, resolution_center_cases: AsyncResolutionCenterCasesResource) -> None: + self._resolution_center_cases = resolution_center_cases + + self.retrieve = async_to_raw_response_wrapper( + resolution_center_cases.retrieve, + ) + self.list = async_to_raw_response_wrapper( + resolution_center_cases.list, + ) + + +class ResolutionCenterCasesResourceWithStreamingResponse: + def __init__(self, resolution_center_cases: ResolutionCenterCasesResource) -> None: + self._resolution_center_cases = resolution_center_cases + + self.retrieve = to_streamed_response_wrapper( + resolution_center_cases.retrieve, + ) + self.list = to_streamed_response_wrapper( + resolution_center_cases.list, + ) + + +class AsyncResolutionCenterCasesResourceWithStreamingResponse: + def __init__(self, resolution_center_cases: AsyncResolutionCenterCasesResource) -> None: + self._resolution_center_cases = resolution_center_cases + + self.retrieve = async_to_streamed_response_wrapper( + resolution_center_cases.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + resolution_center_cases.list, + ) diff --git a/src/whop_sdk/types/__init__.py b/src/whop_sdk/types/__init__.py index 6d305f1..54d1942 100644 --- a/src/whop_sdk/types/__init__.py +++ b/src/whop_sdk/types/__init__.py @@ -89,6 +89,7 @@ from .course_chapter import CourseChapter as CourseChapter from .promo_duration import PromoDuration as PromoDuration from .app_list_params import AppListParams as AppListParams +from .authorized_user import AuthorizedUser as AuthorizedUser from .billing_reasons import BillingReasons as BillingReasons from .fee_markup_type import FeeMarkupType as FeeMarkupType from .dispute_statuses import DisputeStatuses as DisputeStatuses @@ -139,9 +140,11 @@ from .payment_method_types import PaymentMethodTypes as PaymentMethodTypes from .plan_delete_response import PlanDeleteResponse as PlanDeleteResponse from .reaction_list_params import ReactionListParams as ReactionListParams +from .receipt_tax_behavior import ReceiptTaxBehavior as ReceiptTaxBehavior from .refund_list_response import RefundListResponse as RefundListResponse from .review_list_response import ReviewListResponse as ReviewListResponse from .shipment_list_params import ShipmentListParams as ShipmentListParams +from .social_link_websites import SocialLinkWebsites as SocialLinkWebsites from .transfer_list_params import TransferListParams as TransferListParams from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent from .withdrawal_fee_types import WithdrawalFeeTypes as WithdrawalFeeTypes @@ -278,6 +281,8 @@ from .payment_method_list_response import PaymentMethodListResponse as PaymentMethodListResponse from .refund_created_webhook_event import RefundCreatedWebhookEvent as RefundCreatedWebhookEvent from .refund_updated_webhook_event import RefundUpdatedWebhookEvent as RefundUpdatedWebhookEvent +from .authorized_user_create_params import AuthorizedUserCreateParams as AuthorizedUserCreateParams +from .authorized_user_delete_params import AuthorizedUserDeleteParams as AuthorizedUserDeleteParams from .authorized_user_list_response import AuthorizedUserListResponse as AuthorizedUserListResponse from .course_lesson_delete_response import CourseLessonDeleteResponse as CourseLessonDeleteResponse from .dispute_created_webhook_event import DisputeCreatedWebhookEvent as DisputeCreatedWebhookEvent @@ -285,6 +290,7 @@ from .invoice_created_webhook_event import InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent from .payment_created_webhook_event import PaymentCreatedWebhookEvent as PaymentCreatedWebhookEvent from .payment_pending_webhook_event import PaymentPendingWebhookEvent as PaymentPendingWebhookEvent +from .resolution_center_case_status import ResolutionCenterCaseStatus as ResolutionCenterCaseStatus from .support_channel_create_params import SupportChannelCreateParams as SupportChannelCreateParams from .support_channel_list_response import SupportChannelListResponse as SupportChannelListResponse from .company_token_transaction_type import CompanyTokenTransactionType as CompanyTokenTransactionType @@ -293,7 +299,9 @@ from .invoice_past_due_webhook_event import InvoicePastDueWebhookEvent as InvoicePastDueWebhookEvent from .payment_method_retrieve_params import PaymentMethodRetrieveParams as PaymentMethodRetrieveParams from .verification_retrieve_response import VerificationRetrieveResponse as VerificationRetrieveResponse +from .authorized_user_delete_response import AuthorizedUserDeleteResponse as AuthorizedUserDeleteResponse from .dispute_alert_retrieve_response import DisputeAlertRetrieveResponse as DisputeAlertRetrieveResponse +from .membership_add_free_days_params import MembershipAddFreeDaysParams as MembershipAddFreeDaysParams from .payment_succeeded_webhook_event import PaymentSucceededWebhookEvent as PaymentSucceededWebhookEvent from .payout_method_retrieve_response import PayoutMethodRetrieveResponse as PayoutMethodRetrieveResponse from .course_student_retrieve_response import CourseStudentRetrieveResponse as CourseStudentRetrieveResponse @@ -301,15 +309,17 @@ from .payment_method_retrieve_response import PaymentMethodRetrieveResponse as PaymentMethodRetrieveResponse from .withdrawal_created_webhook_event import WithdrawalCreatedWebhookEvent as WithdrawalCreatedWebhookEvent from .withdrawal_updated_webhook_event import WithdrawalUpdatedWebhookEvent as WithdrawalUpdatedWebhookEvent -from .authorized_user_retrieve_response import AuthorizedUserRetrieveResponse as AuthorizedUserRetrieveResponse +from .resolution_center_case_issue_type import ResolutionCenterCaseIssueType as ResolutionCenterCaseIssueType from .checkout_configuration_list_params import CheckoutConfigurationListParams as CheckoutConfigurationListParams from .membership_activated_webhook_event import MembershipActivatedWebhookEvent as MembershipActivatedWebhookEvent +from .resolution_center_case_list_params import ResolutionCenterCaseListParams as ResolutionCenterCaseListParams from .dispute_alert_created_webhook_event import DisputeAlertCreatedWebhookEvent as DisputeAlertCreatedWebhookEvent from .payout_method_created_webhook_event import PayoutMethodCreatedWebhookEvent as PayoutMethodCreatedWebhookEvent from .setup_intent_canceled_webhook_event import SetupIntentCanceledWebhookEvent as SetupIntentCanceledWebhookEvent from .checkout_configuration_create_params import CheckoutConfigurationCreateParams as CheckoutConfigurationCreateParams from .checkout_configuration_list_response import CheckoutConfigurationListResponse as CheckoutConfigurationListResponse from .membership_deactivated_webhook_event import MembershipDeactivatedWebhookEvent as MembershipDeactivatedWebhookEvent +from .resolution_center_case_list_response import ResolutionCenterCaseListResponse as ResolutionCenterCaseListResponse from .setup_intent_succeeded_webhook_event import SetupIntentSucceededWebhookEvent as SetupIntentSucceededWebhookEvent from .verification_succeeded_webhook_event import VerificationSucceededWebhookEvent as VerificationSucceededWebhookEvent from .company_token_transaction_list_params import ( @@ -336,6 +346,18 @@ from .course_lesson_submit_assessment_response import ( CourseLessonSubmitAssessmentResponse as CourseLessonSubmitAssessmentResponse, ) +from .resolution_center_case_customer_response import ( + ResolutionCenterCaseCustomerResponse as ResolutionCenterCaseCustomerResponse, +) +from .resolution_center_case_merchant_response import ( + ResolutionCenterCaseMerchantResponse as ResolutionCenterCaseMerchantResponse, +) +from .resolution_center_case_platform_response import ( + ResolutionCenterCasePlatformResponse as ResolutionCenterCasePlatformResponse, +) +from .resolution_center_case_retrieve_response import ( + ResolutionCenterCaseRetrieveResponse as ResolutionCenterCaseRetrieveResponse, +) from .setup_intent_requires_action_webhook_event import ( SetupIntentRequiresActionWebhookEvent as SetupIntentRequiresActionWebhookEvent, ) diff --git a/src/whop_sdk/types/ai_chat_list_params.py b/src/whop_sdk/types/ai_chat_list_params.py index f32eaa9..81fa78a 100644 --- a/src/whop_sdk/types/ai_chat_list_params.py +++ b/src/whop_sdk/types/ai_chat_list_params.py @@ -20,3 +20,6 @@ class AIChatListParams(TypedDict, total=False): last: Optional[int] """Returns the last _n_ elements from the list.""" + + only_active_crons: Optional[bool] + """When true, returns only chats with an active cron schedule""" diff --git a/src/whop_sdk/types/authorized_user_retrieve_response.py b/src/whop_sdk/types/authorized_user.py similarity index 92% rename from src/whop_sdk/types/authorized_user_retrieve_response.py rename to src/whop_sdk/types/authorized_user.py index bd6ab0b..b34b41a 100644 --- a/src/whop_sdk/types/authorized_user_retrieve_response.py +++ b/src/whop_sdk/types/authorized_user.py @@ -5,7 +5,7 @@ from .._models import BaseModel from .shared.authorized_user_roles import AuthorizedUserRoles -__all__ = ["AuthorizedUserRetrieveResponse", "Company", "User"] +__all__ = ["AuthorizedUser", "Company", "User"] class Company(BaseModel): @@ -37,7 +37,7 @@ class User(BaseModel): """The user's unique username shown on their public profile.""" -class AuthorizedUserRetrieveResponse(BaseModel): +class AuthorizedUser(BaseModel): """ A user who has been granted administrative access to manage a company's dashboard and settings. """ diff --git a/src/whop_sdk/types/authorized_user_create_params.py b/src/whop_sdk/types/authorized_user_create_params.py new file mode 100644 index 0000000..b2b538a --- /dev/null +++ b/src/whop_sdk/types/authorized_user_create_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +from .shared.authorized_user_roles import AuthorizedUserRoles + +__all__ = ["AuthorizedUserCreateParams"] + + +class AuthorizedUserCreateParams(TypedDict, total=False): + company_id: Required[str] + """The ID of the company to add the authorized user to.""" + + role: Required[AuthorizedUserRoles] + """The role to assign to the authorized user within the company. + + Supported roles: 'moderator', 'sales_manager'. + """ + + user_id: Required[str] + """The ID of the user to add as an authorized user.""" + + send_emails: Optional[bool] + """Whether to send notification emails to the user on creation.""" diff --git a/src/whop_sdk/types/authorized_user_delete_params.py b/src/whop_sdk/types/authorized_user_delete_params.py new file mode 100644 index 0000000..ead84a1 --- /dev/null +++ b/src/whop_sdk/types/authorized_user_delete_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["AuthorizedUserDeleteParams"] + + +class AuthorizedUserDeleteParams(TypedDict, total=False): + company_id: Optional[str] + """The ID of the company the authorized user belongs to. + + Optional if the authorized user ID is provided. + """ diff --git a/src/whop_sdk/types/authorized_user_delete_response.py b/src/whop_sdk/types/authorized_user_delete_response.py new file mode 100644 index 0000000..b71b66f --- /dev/null +++ b/src/whop_sdk/types/authorized_user_delete_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["AuthorizedUserDeleteResponse"] + +AuthorizedUserDeleteResponse: TypeAlias = bool diff --git a/src/whop_sdk/types/membership_add_free_days_params.py b/src/whop_sdk/types/membership_add_free_days_params.py new file mode 100644 index 0000000..568b654 --- /dev/null +++ b/src/whop_sdk/types/membership_add_free_days_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["MembershipAddFreeDaysParams"] + + +class MembershipAddFreeDaysParams(TypedDict, total=False): + free_days: Required[int] + """The number of free days to add (1-1095). + + Extends the billing period, expiration date, or Stripe trial depending on plan + type. + """ diff --git a/src/whop_sdk/types/product_create_params.py b/src/whop_sdk/types/product_create_params.py index 50d20c4..ea86cc0 100644 --- a/src/whop_sdk/types/product_create_params.py +++ b/src/whop_sdk/types/product_create_params.py @@ -81,6 +81,12 @@ class ProductCreateParams(TypedDict, total=False): route: Optional[str] """The URL slug for the product's public link.""" + send_welcome_message: Optional[bool] + """ + Whether to send an automated welcome message via support chat when a user joins + this product. Defaults to true. + """ + visibility: Optional[Visibility] """Visibility of a resource""" diff --git a/src/whop_sdk/types/product_update_params.py b/src/whop_sdk/types/product_update_params.py index 53038d5..d7e9dca 100644 --- a/src/whop_sdk/types/product_update_params.py +++ b/src/whop_sdk/types/product_update_params.py @@ -68,6 +68,12 @@ class ProductUpdateParams(TypedDict, total=False): route: Optional[str] """The URL slug for the product's public link.""" + send_welcome_message: Optional[bool] + """ + Whether to send an automated welcome message via support chat when a user joins + this product. + """ + store_page_config: Optional[StorePageConfig] """Layout and display configuration for this product on the company's store page.""" diff --git a/src/whop_sdk/types/receipt_tax_behavior.py b/src/whop_sdk/types/receipt_tax_behavior.py new file mode 100644 index 0000000..3d0ea68 --- /dev/null +++ b/src/whop_sdk/types/receipt_tax_behavior.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ReceiptTaxBehavior"] + +ReceiptTaxBehavior: TypeAlias = Literal["exclusive", "inclusive", "unspecified", "unable_to_collect"] diff --git a/src/whop_sdk/types/resolution_center_case_customer_response.py b/src/whop_sdk/types/resolution_center_case_customer_response.py new file mode 100644 index 0000000..32dff81 --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_customer_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResolutionCenterCaseCustomerResponse"] + +ResolutionCenterCaseCustomerResponse: TypeAlias = Literal["respond", "appeal", "withdraw"] diff --git a/src/whop_sdk/types/resolution_center_case_issue_type.py b/src/whop_sdk/types/resolution_center_case_issue_type.py new file mode 100644 index 0000000..fc24d14 --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_issue_type.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResolutionCenterCaseIssueType"] + +ResolutionCenterCaseIssueType: TypeAlias = Literal[ + "forgot_to_cancel", + "item_not_received", + "significantly_not_as_described", + "unauthorized_transaction", + "product_unacceptable", +] diff --git a/src/whop_sdk/types/resolution_center_case_list_params.py b/src/whop_sdk/types/resolution_center_case_list_params.py new file mode 100644 index 0000000..9d511dd --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_list_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo +from .shared.direction import Direction +from .resolution_center_case_status import ResolutionCenterCaseStatus + +__all__ = ["ResolutionCenterCaseListParams"] + + +class ResolutionCenterCaseListParams(TypedDict, total=False): + after: Optional[str] + """Returns the elements in the list that come after the specified cursor.""" + + before: Optional[str] + """Returns the elements in the list that come before the specified cursor.""" + + company_id: Optional[str] + """The unique identifier of the company to list resolution center cases for.""" + + created_after: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Only return cases created after this timestamp.""" + + created_before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Only return cases created before this timestamp.""" + + direction: Optional[Direction] + """The direction of the sort.""" + + first: Optional[int] + """Returns the first _n_ elements from the list.""" + + last: Optional[int] + """Returns the last _n_ elements from the list.""" + + statuses: Optional[List[ResolutionCenterCaseStatus]] + """Filter by resolution center case status.""" diff --git a/src/whop_sdk/types/resolution_center_case_list_response.py b/src/whop_sdk/types/resolution_center_case_list_response.py new file mode 100644 index 0000000..02cbdbc --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_list_response.py @@ -0,0 +1,99 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .._models import BaseModel +from .resolution_center_case_status import ResolutionCenterCaseStatus +from .resolution_center_case_issue_type import ResolutionCenterCaseIssueType +from .resolution_center_case_customer_response import ResolutionCenterCaseCustomerResponse +from .resolution_center_case_merchant_response import ResolutionCenterCaseMerchantResponse + +__all__ = ["ResolutionCenterCaseListResponse", "Company", "Payment", "User"] + + +class Company(BaseModel): + """The company involved in this resolution case. + + Null if the company no longer exists. + """ + + id: str + """The unique identifier for the company.""" + + title: str + """The display name of the company shown to customers.""" + + +class Payment(BaseModel): + """The payment record that is the subject of this resolution case.""" + + id: str + """The unique identifier for the payment.""" + + +class User(BaseModel): + """The customer (buyer) who filed this resolution case.""" + + id: str + """The unique identifier for the user.""" + + name: Optional[str] = None + """The user's display name shown on their public profile.""" + + username: str + """The user's unique username shown on their public profile.""" + + +class ResolutionCenterCaseListResponse(BaseModel): + """ + A resolution center case is a dispute or support case between a user and a company, tracking the issue, status, and outcome. + """ + + id: str + """The unique identifier for the resolution.""" + + company: Optional[Company] = None + """The company involved in this resolution case. + + Null if the company no longer exists. + """ + + created_at: datetime + """The datetime the resolution was created.""" + + customer_appealed: bool + """Whether the customer has filed an appeal after the initial resolution decision.""" + + customer_response_actions: List[ResolutionCenterCaseCustomerResponse] + """The list of actions currently available to the customer.""" + + due_date: Optional[datetime] = None + """The deadline by which the next response is required. + + Null if no deadline is currently active. As a Unix timestamp. + """ + + issue: ResolutionCenterCaseIssueType + """The category of the dispute.""" + + merchant_appealed: bool + """Whether the merchant has filed an appeal after the initial resolution decision.""" + + merchant_response_actions: List[ResolutionCenterCaseMerchantResponse] + """The list of actions currently available to the merchant.""" + + payment: Payment + """The payment record that is the subject of this resolution case.""" + + status: ResolutionCenterCaseStatus + """ + The current status of the resolution case, indicating which party needs to + respond or if the case is closed. + """ + + updated_at: datetime + """The datetime the resolution was last updated.""" + + user: User + """The customer (buyer) who filed this resolution case.""" diff --git a/src/whop_sdk/types/resolution_center_case_merchant_response.py b/src/whop_sdk/types/resolution_center_case_merchant_response.py new file mode 100644 index 0000000..d6d45d0 --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_merchant_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResolutionCenterCaseMerchantResponse"] + +ResolutionCenterCaseMerchantResponse: TypeAlias = Literal["accept", "deny", "request_more_info", "appeal", "respond"] diff --git a/src/whop_sdk/types/resolution_center_case_platform_response.py b/src/whop_sdk/types/resolution_center_case_platform_response.py new file mode 100644 index 0000000..0dce38a --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_platform_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResolutionCenterCasePlatformResponse"] + +ResolutionCenterCasePlatformResponse: TypeAlias = Literal[ + "request_buyer_info", "request_merchant_info", "merchant_wins", "platform_refund", "merchant_refund" +] diff --git a/src/whop_sdk/types/resolution_center_case_retrieve_response.py b/src/whop_sdk/types/resolution_center_case_retrieve_response.py new file mode 100644 index 0000000..8fab35f --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_retrieve_response.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .shared.currency import Currency +from .resolution_center_case_status import ResolutionCenterCaseStatus +from .resolution_center_case_issue_type import ResolutionCenterCaseIssueType +from .resolution_center_case_customer_response import ResolutionCenterCaseCustomerResponse +from .resolution_center_case_merchant_response import ResolutionCenterCaseMerchantResponse +from .resolution_center_case_platform_response import ResolutionCenterCasePlatformResponse + +__all__ = ["ResolutionCenterCaseRetrieveResponse", "Company", "Member", "Payment", "ResolutionEvent", "User"] + + +class Company(BaseModel): + """The company involved in this resolution case. + + Null if the company no longer exists. + """ + + id: str + """The unique identifier for the company.""" + + title: str + """The display name of the company shown to customers.""" + + +class Member(BaseModel): + """The membership record associated with the disputed payment. + + Null if the membership no longer exists. + """ + + id: str + """The unique identifier for the extra public member.""" + + +class Payment(BaseModel): + """The payment record that is the subject of this resolution case.""" + + id: str + """The unique identifier for the payment.""" + + created_at: datetime + """The datetime the payment was created.""" + + currency: Optional[Currency] = None + """The available currencies on the platform""" + + paid_at: Optional[datetime] = None + """The time at which this payment was successfully collected. + + Null if the payment has not yet succeeded. As a Unix timestamp. + """ + + subtotal: Optional[float] = None + """The payment amount before taxes and discounts are applied. + + In the currency specified by the currency field. + """ + + total: float + """ + The total amount charged to the customer for this payment, including taxes and + after any discounts. In the currency specified by the currency field. + """ + + +class ResolutionEvent(BaseModel): + """ + A resolution event is a message or action within a resolution case, such as a response, escalation, or status change. + """ + + id: str + """The unique identifier for the resolution event.""" + + action: Literal[ + "created", + "responded", + "accepted", + "denied", + "appealed", + "withdrew", + "requested_more_info", + "escalated", + "dispute_opened", + "dispute_customer_won", + "dispute_merchant_won", + ] + """The type of action recorded in this event.""" + + created_at: datetime + """The datetime the resolution event was created.""" + + details: Optional[str] = None + """The message body or additional context provided with this resolution event. + + Null if no details were included. + """ + + reporter_type: Literal["merchant", "customer", "platform", "system"] + """The party who performed this action.""" + + +class User(BaseModel): + """The customer (buyer) who filed this resolution case.""" + + id: str + """The unique identifier for the user.""" + + name: Optional[str] = None + """The user's display name shown on their public profile.""" + + username: str + """The user's unique username shown on their public profile.""" + + +class ResolutionCenterCaseRetrieveResponse(BaseModel): + """ + A resolution center case is a dispute or support case between a user and a company, tracking the issue, status, and outcome. + """ + + id: str + """The unique identifier for the resolution.""" + + company: Optional[Company] = None + """The company involved in this resolution case. + + Null if the company no longer exists. + """ + + created_at: datetime + """The datetime the resolution was created.""" + + customer_appealed: bool + """Whether the customer has filed an appeal after the initial resolution decision.""" + + customer_response_actions: List[ResolutionCenterCaseCustomerResponse] + """The list of actions currently available to the customer.""" + + due_date: Optional[datetime] = None + """The deadline by which the next response is required. + + Null if no deadline is currently active. As a Unix timestamp. + """ + + issue: ResolutionCenterCaseIssueType + """The category of the dispute.""" + + member: Optional[Member] = None + """The membership record associated with the disputed payment. + + Null if the membership no longer exists. + """ + + merchant_appealed: bool + """Whether the merchant has filed an appeal after the initial resolution decision.""" + + merchant_response_actions: List[ResolutionCenterCaseMerchantResponse] + """The list of actions currently available to the merchant.""" + + payment: Payment + """The payment record that is the subject of this resolution case.""" + + platform_response_actions: List[ResolutionCenterCasePlatformResponse] + """ + The list of actions currently available to the Whop platform for moderating this + resolution. + """ + + resolution_events: List[ResolutionEvent] + """ + The most recent 50 messages, actions, and status changes that have occurred + during this resolution case. + """ + + status: ResolutionCenterCaseStatus + """ + The current status of the resolution case, indicating which party needs to + respond or if the case is closed. + """ + + updated_at: datetime + """The datetime the resolution was last updated.""" + + user: User + """The customer (buyer) who filed this resolution case.""" diff --git a/src/whop_sdk/types/resolution_center_case_status.py b/src/whop_sdk/types/resolution_center_case_status.py new file mode 100644 index 0000000..7da17bf --- /dev/null +++ b/src/whop_sdk/types/resolution_center_case_status.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResolutionCenterCaseStatus"] + +ResolutionCenterCaseStatus: TypeAlias = Literal[ + "merchant_response_needed", + "customer_response_needed", + "merchant_info_needed", + "customer_info_needed", + "under_platform_review", + "customer_won", + "merchant_won", + "customer_withdrew", +] diff --git a/src/whop_sdk/types/shared/payment.py b/src/whop_sdk/types/shared/payment.py index 07f5c8d..c9403c4 100644 --- a/src/whop_sdk/types/shared/payment.py +++ b/src/whop_sdk/types/shared/payment.py @@ -14,6 +14,11 @@ from .membership_status import MembershipStatus from ..payment_method_types import PaymentMethodTypes from .friendly_receipt_status import FriendlyReceiptStatus +from ..resolution_center_case_status import ResolutionCenterCaseStatus +from ..resolution_center_case_issue_type import ResolutionCenterCaseIssueType +from ..resolution_center_case_customer_response import ResolutionCenterCaseCustomerResponse +from ..resolution_center_case_merchant_response import ResolutionCenterCaseMerchantResponse +from ..resolution_center_case_platform_response import ResolutionCenterCasePlatformResponse __all__ = [ "Payment", @@ -286,7 +291,7 @@ class PromoCode(BaseModel): class Resolution(BaseModel): """ - A resolution is a dispute or support case between a buyer and seller, tracking the issue, status, and outcome. + A resolution center case is a dispute or support case between a user and a company, tracking the issue, status, and outcome. """ id: str @@ -295,7 +300,7 @@ class Resolution(BaseModel): customer_appealed: bool """Whether the customer has filed an appeal after the initial resolution decision.""" - customer_response_actions: List[Literal["respond", "appeal", "withdraw"]] + customer_response_actions: List[ResolutionCenterCaseCustomerResponse] """The list of actions currently available to the customer.""" due_date: Optional[datetime] = None @@ -304,39 +309,22 @@ class Resolution(BaseModel): Null if no deadline is currently active. As a Unix timestamp. """ - issue: Literal[ - "forgot_to_cancel", - "item_not_received", - "significantly_not_as_described", - "unauthorized_transaction", - "product_unacceptable", - ] + issue: ResolutionCenterCaseIssueType """The category of the dispute.""" merchant_appealed: bool """Whether the merchant has filed an appeal after the initial resolution decision.""" - merchant_response_actions: List[Literal["accept", "deny", "request_more_info", "appeal", "respond"]] + merchant_response_actions: List[ResolutionCenterCaseMerchantResponse] """The list of actions currently available to the merchant.""" - platform_response_actions: List[ - Literal["request_buyer_info", "request_merchant_info", "merchant_wins", "platform_refund", "merchant_refund"] - ] + platform_response_actions: List[ResolutionCenterCasePlatformResponse] """ The list of actions currently available to the Whop platform for moderating this resolution. """ - status: Literal[ - "merchant_response_needed", - "customer_response_needed", - "merchant_info_needed", - "customer_info_needed", - "under_platform_review", - "customer_won", - "merchant_won", - "customer_withdrew", - ] + status: ResolutionCenterCaseStatus """ The current status of the resolution case, indicating which party needs to respond or if the case is closed. diff --git a/src/whop_sdk/types/social_link_websites.py b/src/whop_sdk/types/social_link_websites.py new file mode 100644 index 0000000..7e96a15 --- /dev/null +++ b/src/whop_sdk/types/social_link_websites.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SocialLinkWebsites"] + +SocialLinkWebsites: TypeAlias = Literal[ + "x", "instagram", "facebook", "tiktok", "youtube", "linkedin", "twitch", "website", "custom" +] diff --git a/tests/api_resources/test_ai_chats.py b/tests/api_resources/test_ai_chats.py index 8681f57..6de8558 100644 --- a/tests/api_resources/test_ai_chats.py +++ b/tests/api_resources/test_ai_chats.py @@ -176,6 +176,7 @@ def test_method_list_with_all_params(self, client: Whop) -> None: before="before", first=42, last=42, + only_active_crons=True, ) assert_matches_type(SyncCursorPage[AIChatListResponse], ai_chat, path=["response"]) @@ -403,6 +404,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncWhop) -> Non before="before", first=42, last=42, + only_active_crons=True, ) assert_matches_type(AsyncCursorPage[AIChatListResponse], ai_chat, path=["response"]) diff --git a/tests/api_resources/test_authorized_users.py b/tests/api_resources/test_authorized_users.py index a0e6a63..007f3d4 100644 --- a/tests/api_resources/test_authorized_users.py +++ b/tests/api_resources/test_authorized_users.py @@ -10,8 +10,9 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type from whop_sdk.types import ( + AuthorizedUser, AuthorizedUserListResponse, - AuthorizedUserRetrieveResponse, + AuthorizedUserDeleteResponse, ) from whop_sdk._utils import parse_datetime from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -22,13 +23,64 @@ class TestAuthorizedUsers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Whop) -> None: + authorized_user = client.authorized_users.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Whop) -> None: + authorized_user = client.authorized_users.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + send_emails=True, + ) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Whop) -> None: + response = client.authorized_users.with_raw_response.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + authorized_user = response.parse() + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Whop) -> None: + with client.authorized_users.with_streaming_response.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + authorized_user = response.parse() + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Whop) -> None: authorized_user = client.authorized_users.retrieve( "ausr_xxxxxxxxxxxxx", ) - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -40,7 +92,7 @@ def test_raw_response_retrieve(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" authorized_user = response.parse() - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -52,7 +104,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" authorized_user = response.parse() - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,19 +160,121 @@ def test_streaming_response_list(self, client: Whop) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Whop) -> None: + authorized_user = client.authorized_users.delete( + id="ausr_xxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete_with_all_params(self, client: Whop) -> None: + authorized_user = client.authorized_users.delete( + id="ausr_xxxxxxxxxxxxx", + company_id="biz_xxxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Whop) -> None: + response = client.authorized_users.with_raw_response.delete( + id="ausr_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + authorized_user = response.parse() + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Whop) -> None: + with client.authorized_users.with_streaming_response.delete( + id="ausr_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + authorized_user = response.parse() + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_delete(self, client: Whop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.authorized_users.with_raw_response.delete( + id="", + ) + class TestAsyncAuthorizedUsers: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncWhop) -> None: + authorized_user = await async_client.authorized_users.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> None: + authorized_user = await async_client.authorized_users.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + send_emails=True, + ) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncWhop) -> None: + response = await async_client.authorized_users.with_raw_response.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + authorized_user = await response.parse() + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: + async with async_client.authorized_users.with_streaming_response.create( + company_id="biz_xxxxxxxxxxxxxx", + role="owner", + user_id="user_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + authorized_user = await response.parse() + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncWhop) -> None: authorized_user = await async_client.authorized_users.retrieve( "ausr_xxxxxxxxxxxxx", ) - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -132,7 +286,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" authorized_user = await response.parse() - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -144,7 +298,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" authorized_user = await response.parse() - assert_matches_type(AuthorizedUserRetrieveResponse, authorized_user, path=["response"]) + assert_matches_type(AuthorizedUser, authorized_user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -199,3 +353,54 @@ async def test_streaming_response_list(self, async_client: AsyncWhop) -> None: assert_matches_type(AsyncCursorPage[AuthorizedUserListResponse], authorized_user, path=["response"]) assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncWhop) -> None: + authorized_user = await async_client.authorized_users.delete( + id="ausr_xxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncWhop) -> None: + authorized_user = await async_client.authorized_users.delete( + id="ausr_xxxxxxxxxxxxx", + company_id="biz_xxxxxxxxxxxxxx", + ) + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncWhop) -> None: + response = await async_client.authorized_users.with_raw_response.delete( + id="ausr_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + authorized_user = await response.parse() + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncWhop) -> None: + async with async_client.authorized_users.with_streaming_response.delete( + id="ausr_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + authorized_user = await response.parse() + assert_matches_type(AuthorizedUserDeleteResponse, authorized_user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncWhop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.authorized_users.with_raw_response.delete( + id="", + ) diff --git a/tests/api_resources/test_products.py b/tests/api_resources/test_products.py index b2498e7..19403ed 100644 --- a/tests/api_resources/test_products.py +++ b/tests/api_resources/test_products.py @@ -70,6 +70,7 @@ def test_method_create_with_all_params(self, client: Whop) -> None: product_tax_code_id="ptc_xxxxxxxxxxxxxx", redirect_purchase_url="redirect_purchase_url", route="route", + send_welcome_message=True, visibility="visible", ) assert_matches_type(Product, product, path=["response"]) @@ -171,6 +172,7 @@ def test_method_update_with_all_params(self, client: Whop) -> None: product_tax_code_id="ptc_xxxxxxxxxxxxxx", redirect_purchase_url="redirect_purchase_url", route="route", + send_welcome_message=True, store_page_config={ "custom_cta": "custom_cta", "show_price": True, @@ -362,6 +364,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> N product_tax_code_id="ptc_xxxxxxxxxxxxxx", redirect_purchase_url="redirect_purchase_url", route="route", + send_welcome_message=True, visibility="visible", ) assert_matches_type(Product, product, path=["response"]) @@ -463,6 +466,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> N product_tax_code_id="ptc_xxxxxxxxxxxxxx", redirect_purchase_url="redirect_purchase_url", route="route", + send_welcome_message=True, store_page_config={ "custom_cta": "custom_cta", "show_price": True, diff --git a/tests/api_resources/test_resolution_center_cases.py b/tests/api_resources/test_resolution_center_cases.py new file mode 100644 index 0000000..88bde78 --- /dev/null +++ b/tests/api_resources/test_resolution_center_cases.py @@ -0,0 +1,211 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from whop_sdk import Whop, AsyncWhop +from tests.utils import assert_matches_type +from whop_sdk.types import ( + ResolutionCenterCaseListResponse, + ResolutionCenterCaseRetrieveResponse, +) +from whop_sdk._utils import parse_datetime +from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestResolutionCenterCases: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Whop) -> None: + resolution_center_case = client.resolution_center_cases.retrieve( + "reso_xxxxxxxxxxxxx", + ) + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Whop) -> None: + response = client.resolution_center_cases.with_raw_response.retrieve( + "reso_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resolution_center_case = response.parse() + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Whop) -> None: + with client.resolution_center_cases.with_streaming_response.retrieve( + "reso_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resolution_center_case = response.parse() + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_retrieve(self, client: Whop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.resolution_center_cases.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Whop) -> None: + resolution_center_case = client.resolution_center_cases.list() + assert_matches_type(SyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Whop) -> None: + resolution_center_case = client.resolution_center_cases.list( + after="after", + before="before", + company_id="biz_xxxxxxxxxxxxxx", + created_after=parse_datetime("2023-12-01T05:00:00.401Z"), + created_before=parse_datetime("2023-12-01T05:00:00.401Z"), + direction="asc", + first=42, + last=42, + statuses=["merchant_response_needed"], + ) + assert_matches_type(SyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Whop) -> None: + response = client.resolution_center_cases.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resolution_center_case = response.parse() + assert_matches_type(SyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Whop) -> None: + with client.resolution_center_cases.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resolution_center_case = response.parse() + assert_matches_type( + SyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"] + ) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncResolutionCenterCases: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncWhop) -> None: + resolution_center_case = await async_client.resolution_center_cases.retrieve( + "reso_xxxxxxxxxxxxx", + ) + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: + response = await async_client.resolution_center_cases.with_raw_response.retrieve( + "reso_xxxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resolution_center_case = await response.parse() + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> None: + async with async_client.resolution_center_cases.with_streaming_response.retrieve( + "reso_xxxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resolution_center_case = await response.parse() + assert_matches_type(ResolutionCenterCaseRetrieveResponse, resolution_center_case, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncWhop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.resolution_center_cases.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncWhop) -> None: + resolution_center_case = await async_client.resolution_center_cases.list() + assert_matches_type( + AsyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncWhop) -> None: + resolution_center_case = await async_client.resolution_center_cases.list( + after="after", + before="before", + company_id="biz_xxxxxxxxxxxxxx", + created_after=parse_datetime("2023-12-01T05:00:00.401Z"), + created_before=parse_datetime("2023-12-01T05:00:00.401Z"), + direction="asc", + first=42, + last=42, + statuses=["merchant_response_needed"], + ) + assert_matches_type( + AsyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncWhop) -> None: + response = await async_client.resolution_center_cases.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resolution_center_case = await response.parse() + assert_matches_type( + AsyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncWhop) -> None: + async with async_client.resolution_center_cases.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resolution_center_case = await response.parse() + assert_matches_type( + AsyncCursorPage[ResolutionCenterCaseListResponse], resolution_center_case, path=["response"] + ) + + assert cast(Any, response.is_closed) is True