diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d2ac0bd..de465041 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.0.26" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c48647fa..2b6db4a0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 165 +configured_endpoints: 170 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-333c68cc8619caa2ffdfed588a7d2b2c263f8910b7b682698da92c826932e7c7.yml openapi_spec_hash: 8e2cc20f1e06b43ea220edbdf16eddbe -config_hash: 3ab84ed28795a04f98c3a6187f1ed831 +config_hash: 48e5bec0f5659595abb38814aa0d9cc2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5512d6af..5597e723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.0.26 (2026-02-03) + +Full Changelog: [v0.1.0...v0.0.26](https://github.com/whopio/whopsdk-python/compare/v0.1.0...v0.0.26) + +### Features + +* **api:** manual updates ([54d5505](https://github.com/whopio/whopsdk-python/commit/54d5505d18a3a2b4a73dd56e7d0ac0ea5f670b87)) + ## 0.1.0 (2026-02-03) Full Changelog: [v0.0.25...v0.1.0](https://github.com/whopio/whopsdk-python/compare/v0.0.25...v0.1.0) diff --git a/api.md b/api.md index 30013720..91641174 100644 --- a/api.md +++ b/api.md @@ -139,9 +139,10 @@ Types: ```python from whop_sdk.types import ( + APIVersion, + Webhook, + WebhookEvent, WebhookCreateResponse, - WebhookRetrieveResponse, - WebhookUpdateResponse, WebhookListResponse, WebhookDeleteResponse, InvoiceCreatedWebhookEvent, @@ -178,8 +179,8 @@ from whop_sdk.types import ( Methods: - client.webhooks.create(\*\*params) -> WebhookCreateResponse -- client.webhooks.retrieve(id) -> WebhookRetrieveResponse -- client.webhooks.update(id, \*\*params) -> WebhookUpdateResponse +- client.webhooks.retrieve(id) -> Webhook +- client.webhooks.update(id, \*\*params) -> Webhook - client.webhooks.list(\*\*params) -> SyncCursorPage[WebhookListResponse] - client.webhooks.delete(id) -> WebhookDeleteResponse @@ -260,7 +261,7 @@ Methods: Types: ```python -from whop_sdk.types import MembershipListResponse +from whop_sdk.types import CancelOptions, MembershipListResponse ``` Methods: @@ -651,19 +652,18 @@ Types: ```python from whop_sdk.types import ( + Withdrawal, WithdrawalFeeTypes, WithdrawalSpeeds, WithdrawalStatus, - WithdrawalCreateResponse, - WithdrawalRetrieveResponse, WithdrawalListResponse, ) ``` Methods: -- client.withdrawals.create(\*\*params) -> WithdrawalCreateResponse -- client.withdrawals.retrieve(id) -> WithdrawalRetrieveResponse +- client.withdrawals.create(\*\*params) -> Withdrawal +- client.withdrawals.retrieve(id) -> Withdrawal - client.withdrawals.list(\*\*params) -> SyncCursorPage[WithdrawalListResponse] # AccountLinks @@ -728,7 +728,11 @@ Methods: Types: ```python -from whop_sdk.types import PayoutMethodRetrieveResponse, PayoutMethodListResponse +from whop_sdk.types import ( + PayoutDestinationCategory, + PayoutMethodRetrieveResponse, + PayoutMethodListResponse, +) ``` Methods: @@ -741,7 +745,7 @@ Methods: Types: ```python -from whop_sdk.types import VerificationRetrieveResponse +from whop_sdk.types import VerificationErrorCode, VerificationStatus, VerificationRetrieveResponse ``` Methods: @@ -753,19 +757,14 @@ Methods: Types: ```python -from whop_sdk.types import ( - LeadCreateResponse, - LeadRetrieveResponse, - LeadUpdateResponse, - LeadListResponse, -) +from whop_sdk.types import Lead, LeadListResponse ``` Methods: -- client.leads.create(\*\*params) -> LeadCreateResponse -- client.leads.retrieve(id) -> LeadRetrieveResponse -- client.leads.update(id, \*\*params) -> LeadUpdateResponse +- client.leads.create(\*\*params) -> Lead +- client.leads.retrieve(id) -> Lead +- client.leads.update(id, \*\*params) -> Lead - client.leads.list(\*\*params) -> SyncCursorPage[LeadListResponse] # Topups @@ -785,7 +784,7 @@ Methods: Types: ```python -from whop_sdk.types import FileCreateResponse, FileRetrieveResponse +from whop_sdk.types import UploadStatus, FileCreateResponse, FileRetrieveResponse ``` Methods: @@ -799,16 +798,16 @@ Types: ```python from whop_sdk.types import ( - CompanyTokenTransactionCreateResponse, - CompanyTokenTransactionRetrieveResponse, + BotTokenTransactionTypes, + CompanyTokenTransaction, CompanyTokenTransactionListResponse, ) ``` Methods: -- client.company_token_transactions.create(\*\*params) -> CompanyTokenTransactionCreateResponse -- client.company_token_transactions.retrieve(id) -> CompanyTokenTransactionRetrieveResponse +- client.company_token_transactions.create(\*\*params) -> CompanyTokenTransaction +- client.company_token_transactions.retrieve(id) -> CompanyTokenTransaction - client.company_token_transactions.list(\*\*params) -> SyncCursorPage[CompanyTokenTransactionListResponse] # DmMembers @@ -817,9 +816,9 @@ Types: ```python from whop_sdk.types import ( - DmMemberCreateResponse, - DmMemberRetrieveResponse, - DmMemberUpdateResponse, + DmFeedMemberNotificationPreferences, + DmFeedMemberStatuses, + DmMember, DmMemberListResponse, DmMemberDeleteResponse, ) @@ -827,9 +826,9 @@ from whop_sdk.types import ( Methods: -- client.dm_members.create(\*\*params) -> DmMemberCreateResponse -- client.dm_members.retrieve(id) -> DmMemberRetrieveResponse -- client.dm_members.update(id, \*\*params) -> DmMemberUpdateResponse +- client.dm_members.create(\*\*params) -> DmMember +- client.dm_members.retrieve(id) -> DmMember +- client.dm_members.update(id, \*\*params) -> DmMember - client.dm_members.list(\*\*params) -> SyncCursorPage[DmMemberListResponse] - client.dm_members.delete(id) -> DmMemberDeleteResponse @@ -838,19 +837,29 @@ Methods: Types: ```python -from whop_sdk.types import ( - AIChatCreateResponse, - AIChatRetrieveResponse, - AIChatUpdateResponse, - AIChatListResponse, - AIChatDeleteResponse, -) +from whop_sdk.types import AIChat, AIChatListResponse, AIChatDeleteResponse ``` Methods: -- client.ai_chats.create(\*\*params) -> AIChatCreateResponse -- client.ai_chats.retrieve(id) -> AIChatRetrieveResponse -- client.ai_chats.update(id, \*\*params) -> AIChatUpdateResponse +- client.ai_chats.create(\*\*params) -> AIChat +- client.ai_chats.retrieve(id) -> AIChat +- client.ai_chats.update(id, \*\*params) -> AIChat - client.ai_chats.list(\*\*params) -> SyncCursorPage[AIChatListResponse] - client.ai_chats.delete(id) -> AIChatDeleteResponse + +# DmChannels + +Types: + +```python +from whop_sdk.types import DmChannel, DmChannelListResponse, DmChannelDeleteResponse +``` + +Methods: + +- client.dm_channels.create(\*\*params) -> DmChannel +- client.dm_channels.retrieve(id) -> DmChannel +- client.dm_channels.update(id, \*\*params) -> DmChannel +- client.dm_channels.list(\*\*params) -> SyncCursorPage[DmChannelListResponse] +- client.dm_channels.delete(id) -> DmChannelDeleteResponse diff --git a/pyproject.toml b/pyproject.toml index 56574b77..c4c0f968 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "whop-sdk" -version = "0.1.0" +version = "0.0.26" 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 de6a7785..ea3a314a 100644 --- a/src/whop_sdk/_client.py +++ b/src/whop_sdk/_client.py @@ -57,6 +57,7 @@ transfers, app_builds, dm_members, + dm_channels, experiences, fee_markups, forum_posts, @@ -106,6 +107,7 @@ from .resources.transfers import TransfersResource, AsyncTransfersResource from .resources.app_builds import AppBuildsResource, AsyncAppBuildsResource from .resources.dm_members import DmMembersResource, AsyncDmMembersResource + from .resources.dm_channels import DmChannelsResource, AsyncDmChannelsResource from .resources.experiences import ExperiencesResource, AsyncExperiencesResource from .resources.fee_markups import FeeMarkupsResource, AsyncFeeMarkupsResource from .resources.forum_posts import ForumPostsResource, AsyncForumPostsResource @@ -497,6 +499,12 @@ def ai_chats(self) -> AIChatsResource: return AIChatsResource(self) + @cached_property + def dm_channels(self) -> DmChannelsResource: + from .resources.dm_channels import DmChannelsResource + + return DmChannelsResource(self) + @cached_property def with_raw_response(self) -> WhopWithRawResponse: return WhopWithRawResponse(self) @@ -973,6 +981,12 @@ def ai_chats(self) -> AsyncAIChatsResource: return AsyncAIChatsResource(self) + @cached_property + def dm_channels(self) -> AsyncDmChannelsResource: + from .resources.dm_channels import AsyncDmChannelsResource + + return AsyncDmChannelsResource(self) + @cached_property def with_raw_response(self) -> AsyncWhopWithRawResponse: return AsyncWhopWithRawResponse(self) @@ -1385,6 +1399,12 @@ def ai_chats(self) -> ai_chats.AIChatsResourceWithRawResponse: return AIChatsResourceWithRawResponse(self._client.ai_chats) + @cached_property + def dm_channels(self) -> dm_channels.DmChannelsResourceWithRawResponse: + from .resources.dm_channels import DmChannelsResourceWithRawResponse + + return DmChannelsResourceWithRawResponse(self._client.dm_channels) + class AsyncWhopWithRawResponse: _client: AsyncWhop @@ -1684,6 +1704,12 @@ def ai_chats(self) -> ai_chats.AsyncAIChatsResourceWithRawResponse: return AsyncAIChatsResourceWithRawResponse(self._client.ai_chats) + @cached_property + def dm_channels(self) -> dm_channels.AsyncDmChannelsResourceWithRawResponse: + from .resources.dm_channels import AsyncDmChannelsResourceWithRawResponse + + return AsyncDmChannelsResourceWithRawResponse(self._client.dm_channels) + class WhopWithStreamedResponse: _client: Whop @@ -1983,6 +2009,12 @@ def ai_chats(self) -> ai_chats.AIChatsResourceWithStreamingResponse: return AIChatsResourceWithStreamingResponse(self._client.ai_chats) + @cached_property + def dm_channels(self) -> dm_channels.DmChannelsResourceWithStreamingResponse: + from .resources.dm_channels import DmChannelsResourceWithStreamingResponse + + return DmChannelsResourceWithStreamingResponse(self._client.dm_channels) + class AsyncWhopWithStreamedResponse: _client: AsyncWhop @@ -2284,6 +2316,12 @@ def ai_chats(self) -> ai_chats.AsyncAIChatsResourceWithStreamingResponse: return AsyncAIChatsResourceWithStreamingResponse(self._client.ai_chats) + @cached_property + def dm_channels(self) -> dm_channels.AsyncDmChannelsResourceWithStreamingResponse: + from .resources.dm_channels import AsyncDmChannelsResourceWithStreamingResponse + + return AsyncDmChannelsResourceWithStreamingResponse(self._client.dm_channels) + Client = Whop diff --git a/src/whop_sdk/_version.py b/src/whop_sdk/_version.py index 162053b4..37853b3e 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.1.0" # x-release-please-version +__version__ = "0.0.26" # x-release-please-version diff --git a/src/whop_sdk/resources/__init__.py b/src/whop_sdk/resources/__init__.py index c0e66fbe..992733be 100644 --- a/src/whop_sdk/resources/__init__.py +++ b/src/whop_sdk/resources/__init__.py @@ -200,6 +200,14 @@ DmMembersResourceWithStreamingResponse, AsyncDmMembersResourceWithStreamingResponse, ) +from .dm_channels import ( + DmChannelsResource, + AsyncDmChannelsResource, + DmChannelsResourceWithRawResponse, + AsyncDmChannelsResourceWithRawResponse, + DmChannelsResourceWithStreamingResponse, + AsyncDmChannelsResourceWithStreamingResponse, +) from .experiences import ( ExperiencesResource, AsyncExperiencesResource, @@ -674,4 +682,10 @@ "AsyncAIChatsResourceWithRawResponse", "AIChatsResourceWithStreamingResponse", "AsyncAIChatsResourceWithStreamingResponse", + "DmChannelsResource", + "AsyncDmChannelsResource", + "DmChannelsResourceWithRawResponse", + "AsyncDmChannelsResourceWithRawResponse", + "DmChannelsResourceWithStreamingResponse", + "AsyncDmChannelsResourceWithStreamingResponse", ] diff --git a/src/whop_sdk/resources/ai_chats.py b/src/whop_sdk/resources/ai_chats.py index 0bdeb58d..d91d676c 100644 --- a/src/whop_sdk/resources/ai_chats.py +++ b/src/whop_sdk/resources/ai_chats.py @@ -19,11 +19,9 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.ai_chat import AIChat from ..types.ai_chat_list_response import AIChatListResponse -from ..types.ai_chat_create_response import AIChatCreateResponse from ..types.ai_chat_delete_response import AIChatDeleteResponse -from ..types.ai_chat_update_response import AIChatUpdateResponse -from ..types.ai_chat_retrieve_response import AIChatRetrieveResponse __all__ = ["AIChatsResource", "AsyncAIChatsResource"] @@ -58,7 +56,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatCreateResponse: + ) -> AIChat: """ Creates a new AI chat @@ -83,7 +81,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatCreateResponse, + cast_to=AIChat, ) def retrieve( @@ -96,7 +94,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatRetrieveResponse: + ) -> AIChat: """ Fetches a single AI chat by ID @@ -116,7 +114,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatRetrieveResponse, + cast_to=AIChat, ) def update( @@ -130,7 +128,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatUpdateResponse: + ) -> AIChat: """ Updates an AI chat @@ -157,7 +155,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatUpdateResponse, + cast_to=AIChat, ) def list( @@ -283,7 +281,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatCreateResponse: + ) -> AIChat: """ Creates a new AI chat @@ -308,7 +306,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatCreateResponse, + cast_to=AIChat, ) async def retrieve( @@ -321,7 +319,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatRetrieveResponse: + ) -> AIChat: """ Fetches a single AI chat by ID @@ -341,7 +339,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatRetrieveResponse, + cast_to=AIChat, ) async def update( @@ -355,7 +353,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AIChatUpdateResponse: + ) -> AIChat: """ Updates an AI chat @@ -382,7 +380,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AIChatUpdateResponse, + cast_to=AIChat, ) def list( diff --git a/src/whop_sdk/resources/company_token_transactions.py b/src/whop_sdk/resources/company_token_transactions.py index 42c8b570..fd8f3395 100644 --- a/src/whop_sdk/resources/company_token_transactions.py +++ b/src/whop_sdk/resources/company_token_transactions.py @@ -7,7 +7,11 @@ import httpx -from ..types import company_token_transaction_list_params, company_token_transaction_create_params +from ..types import ( + BotTokenTransactionTypes, + company_token_transaction_list_params, + company_token_transaction_create_params, +) from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import required_args, maybe_transform, async_maybe_transform from .._compat import cached_property @@ -20,9 +24,9 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.company_token_transaction import CompanyTokenTransaction +from ..types.bot_token_transaction_types import BotTokenTransactionTypes from ..types.company_token_transaction_list_response import CompanyTokenTransactionListResponse -from ..types.company_token_transaction_create_response import CompanyTokenTransactionCreateResponse -from ..types.company_token_transaction_retrieve_response import CompanyTokenTransactionRetrieveResponse __all__ = ["CompanyTokenTransactionsResource", "AsyncCompanyTokenTransactionsResource"] @@ -64,7 +68,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -113,7 +117,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -160,7 +164,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -211,7 +215,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: return self._post( "/company_token_transactions", body=maybe_transform( @@ -229,7 +233,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CompanyTokenTransactionCreateResponse, + cast_to=CompanyTokenTransaction, ) def retrieve( @@ -242,7 +246,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionRetrieveResponse: + ) -> CompanyTokenTransaction: """ Retrieves a token transaction by ID @@ -268,7 +272,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CompanyTokenTransactionRetrieveResponse, + cast_to=CompanyTokenTransaction, ) def list( @@ -279,7 +283,7 @@ def list( before: Optional[str] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, - transaction_type: Optional[Literal["add", "subtract", "transfer"]] | Omit = omit, + transaction_type: Optional[BotTokenTransactionTypes] | Omit = omit, user_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. @@ -382,7 +386,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -431,7 +435,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -478,7 +482,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: """ Create a token transaction (add/subtract/transfer) for a member @@ -529,7 +533,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionCreateResponse: + ) -> CompanyTokenTransaction: return await self._post( "/company_token_transactions", body=await async_maybe_transform( @@ -547,7 +551,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CompanyTokenTransactionCreateResponse, + cast_to=CompanyTokenTransaction, ) async def retrieve( @@ -560,7 +564,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CompanyTokenTransactionRetrieveResponse: + ) -> CompanyTokenTransaction: """ Retrieves a token transaction by ID @@ -586,7 +590,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CompanyTokenTransactionRetrieveResponse, + cast_to=CompanyTokenTransaction, ) def list( @@ -597,7 +601,7 @@ def list( before: Optional[str] | Omit = omit, first: Optional[int] | Omit = omit, last: Optional[int] | Omit = omit, - transaction_type: Optional[Literal["add", "subtract", "transfer"]] | Omit = omit, + transaction_type: Optional[BotTokenTransactionTypes] | Omit = omit, user_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. diff --git a/src/whop_sdk/resources/dm_channels.py b/src/whop_sdk/resources/dm_channels.py new file mode 100644 index 00000000..9876f527 --- /dev/null +++ b/src/whop_sdk/resources/dm_channels.py @@ -0,0 +1,606 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ..types import dm_channel_list_params, dm_channel_create_params, dm_channel_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from .._utils import maybe_transform, async_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.dm_channel import DmChannel +from ..types.dm_channel_list_response import DmChannelListResponse +from ..types.dm_channel_delete_response import DmChannelDeleteResponse + +__all__ = ["DmChannelsResource", "AsyncDmChannelsResource"] + + +class DmChannelsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DmChannelsResourceWithRawResponse: + """ + 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 DmChannelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DmChannelsResourceWithStreamingResponse: + """ + 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 DmChannelsResourceWithStreamingResponse(self) + + def create( + self, + *, + with_user_ids: SequenceNotStr[str], + company_id: Optional[str] | Omit = omit, + custom_name: 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, + ) -> DmChannel: + """Creates a DM channel + + Args: + with_user_ids: The user ids to create a DM with. + + Can be email, username or user_id (tag) + + company_id: The ID of the company to scope this DM channel to. + + custom_name: The custom name for the DM channel + + 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( + "/dm_channels", + body=maybe_transform( + { + "with_user_ids": with_user_ids, + "company_id": company_id, + "custom_name": custom_name, + }, + dm_channel_create_params.DmChannelCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + 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, + ) -> DmChannel: + """ + Retrieves a DM channel + + Required permissions: + + - `dms: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"/dm_channels/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + def update( + self, + id: str, + *, + custom_name: 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, + ) -> DmChannel: + """ + Updates a DM channel + + Required permissions: + + - `dms:channel:manage` + + Args: + custom_name: The custom name for the DM channel + + 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._patch( + f"/dm_channels/{id}", + body=maybe_transform({"custom_name": custom_name}, dm_channel_update_params.DmChannelUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, + first: Optional[int] | Omit = omit, + last: Optional[int] | 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[DmChannelListResponse]: + """ + Lists DM channels for the current user + + Required permissions: + + - `dms: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: Filter DM channels scoped to a specific company + + first: Returns the first _n_ elements from the list. + + last: Returns the last _n_ elements from the list. + + 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( + "/dm_channels", + page=SyncCursorPage[DmChannelListResponse], + 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, + "first": first, + "last": last, + }, + dm_channel_list_params.DmChannelListParams, + ), + ), + model=DmChannelListResponse, + ) + + def delete( + 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, + ) -> DmChannelDeleteResponse: + """ + Deletes a DM channel + + Required permissions: + + - `dms:channel:manage` + + 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._delete( + f"/dm_channels/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannelDeleteResponse, + ) + + +class AsyncDmChannelsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDmChannelsResourceWithRawResponse: + """ + 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 AsyncDmChannelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDmChannelsResourceWithStreamingResponse: + """ + 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 AsyncDmChannelsResourceWithStreamingResponse(self) + + async def create( + self, + *, + with_user_ids: SequenceNotStr[str], + company_id: Optional[str] | Omit = omit, + custom_name: 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, + ) -> DmChannel: + """Creates a DM channel + + Args: + with_user_ids: The user ids to create a DM with. + + Can be email, username or user_id (tag) + + company_id: The ID of the company to scope this DM channel to. + + custom_name: The custom name for the DM channel + + 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( + "/dm_channels", + body=await async_maybe_transform( + { + "with_user_ids": with_user_ids, + "company_id": company_id, + "custom_name": custom_name, + }, + dm_channel_create_params.DmChannelCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + 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, + ) -> DmChannel: + """ + Retrieves a DM channel + + Required permissions: + + - `dms: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"/dm_channels/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + async def update( + self, + id: str, + *, + custom_name: 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, + ) -> DmChannel: + """ + Updates a DM channel + + Required permissions: + + - `dms:channel:manage` + + Args: + custom_name: The custom name for the DM channel + + 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._patch( + f"/dm_channels/{id}", + body=await async_maybe_transform( + {"custom_name": custom_name}, dm_channel_update_params.DmChannelUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannel, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + company_id: Optional[str] | Omit = omit, + first: Optional[int] | Omit = omit, + last: Optional[int] | 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[DmChannelListResponse, AsyncCursorPage[DmChannelListResponse]]: + """ + Lists DM channels for the current user + + Required permissions: + + - `dms: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: Filter DM channels scoped to a specific company + + first: Returns the first _n_ elements from the list. + + last: Returns the last _n_ elements from the list. + + 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( + "/dm_channels", + page=AsyncCursorPage[DmChannelListResponse], + 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, + "first": first, + "last": last, + }, + dm_channel_list_params.DmChannelListParams, + ), + ), + model=DmChannelListResponse, + ) + + async def delete( + 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, + ) -> DmChannelDeleteResponse: + """ + Deletes a DM channel + + Required permissions: + + - `dms:channel:manage` + + 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._delete( + f"/dm_channels/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DmChannelDeleteResponse, + ) + + +class DmChannelsResourceWithRawResponse: + def __init__(self, dm_channels: DmChannelsResource) -> None: + self._dm_channels = dm_channels + + self.create = to_raw_response_wrapper( + dm_channels.create, + ) + self.retrieve = to_raw_response_wrapper( + dm_channels.retrieve, + ) + self.update = to_raw_response_wrapper( + dm_channels.update, + ) + self.list = to_raw_response_wrapper( + dm_channels.list, + ) + self.delete = to_raw_response_wrapper( + dm_channels.delete, + ) + + +class AsyncDmChannelsResourceWithRawResponse: + def __init__(self, dm_channels: AsyncDmChannelsResource) -> None: + self._dm_channels = dm_channels + + self.create = async_to_raw_response_wrapper( + dm_channels.create, + ) + self.retrieve = async_to_raw_response_wrapper( + dm_channels.retrieve, + ) + self.update = async_to_raw_response_wrapper( + dm_channels.update, + ) + self.list = async_to_raw_response_wrapper( + dm_channels.list, + ) + self.delete = async_to_raw_response_wrapper( + dm_channels.delete, + ) + + +class DmChannelsResourceWithStreamingResponse: + def __init__(self, dm_channels: DmChannelsResource) -> None: + self._dm_channels = dm_channels + + self.create = to_streamed_response_wrapper( + dm_channels.create, + ) + self.retrieve = to_streamed_response_wrapper( + dm_channels.retrieve, + ) + self.update = to_streamed_response_wrapper( + dm_channels.update, + ) + self.list = to_streamed_response_wrapper( + dm_channels.list, + ) + self.delete = to_streamed_response_wrapper( + dm_channels.delete, + ) + + +class AsyncDmChannelsResourceWithStreamingResponse: + def __init__(self, dm_channels: AsyncDmChannelsResource) -> None: + self._dm_channels = dm_channels + + self.create = async_to_streamed_response_wrapper( + dm_channels.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + dm_channels.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + dm_channels.update, + ) + self.list = async_to_streamed_response_wrapper( + dm_channels.list, + ) + self.delete = async_to_streamed_response_wrapper( + dm_channels.delete, + ) diff --git a/src/whop_sdk/resources/dm_members.py b/src/whop_sdk/resources/dm_members.py index 8a65b271..b20737e9 100644 --- a/src/whop_sdk/resources/dm_members.py +++ b/src/whop_sdk/resources/dm_members.py @@ -3,11 +3,16 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal import httpx -from ..types import dm_member_list_params, dm_member_create_params, dm_member_update_params +from ..types import ( + DmFeedMemberStatuses, + DmFeedMemberNotificationPreferences, + dm_member_list_params, + dm_member_create_params, + dm_member_update_params, +) from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property @@ -20,11 +25,11 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.dm_member import DmMember +from ..types.dm_feed_member_statuses import DmFeedMemberStatuses from ..types.dm_member_list_response import DmMemberListResponse -from ..types.dm_member_create_response import DmMemberCreateResponse from ..types.dm_member_delete_response import DmMemberDeleteResponse -from ..types.dm_member_update_response import DmMemberUpdateResponse -from ..types.dm_member_retrieve_response import DmMemberRetrieveResponse +from ..types.dm_feed_member_notification_preferences import DmFeedMemberNotificationPreferences __all__ = ["DmMembersResource", "AsyncDmMembersResource"] @@ -60,7 +65,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DmMemberCreateResponse: + ) -> DmMember: """ Adds a user to a DM channel @@ -93,7 +98,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberCreateResponse, + cast_to=DmMember, ) def retrieve( @@ -106,7 +111,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DmMemberRetrieveResponse: + ) -> DmMember: """ Retrieves a DM channel member @@ -130,22 +135,22 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberRetrieveResponse, + cast_to=DmMember, ) def update( self, id: str, *, - notification_preference: Optional[Literal["all", "mentions", "none"]] | Omit = omit, - status: Optional[Literal["requested", "accepted", "hidden", "closed", "archived"]] | Omit = omit, + notification_preference: Optional[DmFeedMemberNotificationPreferences] | Omit = omit, + status: Optional[DmFeedMemberStatuses] | 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, - ) -> DmMemberUpdateResponse: + ) -> DmMember: """ Updates a DM channel member's settings @@ -180,7 +185,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberUpdateResponse, + cast_to=DmMember, ) def list( @@ -315,7 +320,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DmMemberCreateResponse: + ) -> DmMember: """ Adds a user to a DM channel @@ -348,7 +353,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberCreateResponse, + cast_to=DmMember, ) async def retrieve( @@ -361,7 +366,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DmMemberRetrieveResponse: + ) -> DmMember: """ Retrieves a DM channel member @@ -385,22 +390,22 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberRetrieveResponse, + cast_to=DmMember, ) async def update( self, id: str, *, - notification_preference: Optional[Literal["all", "mentions", "none"]] | Omit = omit, - status: Optional[Literal["requested", "accepted", "hidden", "closed", "archived"]] | Omit = omit, + notification_preference: Optional[DmFeedMemberNotificationPreferences] | Omit = omit, + status: Optional[DmFeedMemberStatuses] | 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, - ) -> DmMemberUpdateResponse: + ) -> DmMember: """ Updates a DM channel member's settings @@ -435,7 +440,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DmMemberUpdateResponse, + cast_to=DmMember, ) def list( diff --git a/src/whop_sdk/resources/leads.py b/src/whop_sdk/resources/leads.py index fa83f393..67c29933 100644 --- a/src/whop_sdk/resources/leads.py +++ b/src/whop_sdk/resources/leads.py @@ -19,11 +19,9 @@ async_to_streamed_response_wrapper, ) from ..pagination import SyncCursorPage, AsyncCursorPage +from ..types.lead import Lead from .._base_client import AsyncPaginator, make_request_options from ..types.lead_list_response import LeadListResponse -from ..types.lead_create_response import LeadCreateResponse -from ..types.lead_update_response import LeadUpdateResponse -from ..types.lead_retrieve_response import LeadRetrieveResponse __all__ = ["LeadsResource", "AsyncLeadsResource"] @@ -62,7 +60,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadCreateResponse: + ) -> Lead: """ Creates a new lead @@ -108,7 +106,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadCreateResponse, + cast_to=Lead, ) def retrieve( @@ -121,7 +119,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadRetrieveResponse: + ) -> Lead: """ Retrieves a lead by ID @@ -148,7 +146,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadRetrieveResponse, + cast_to=Lead, ) def update( @@ -163,7 +161,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadUpdateResponse: + ) -> Lead: """ Updates a lead @@ -201,7 +199,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadUpdateResponse, + cast_to=Lead, ) def list( @@ -317,7 +315,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadCreateResponse: + ) -> Lead: """ Creates a new lead @@ -363,7 +361,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadCreateResponse, + cast_to=Lead, ) async def retrieve( @@ -376,7 +374,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadRetrieveResponse: + ) -> Lead: """ Retrieves a lead by ID @@ -403,7 +401,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadRetrieveResponse, + cast_to=Lead, ) async def update( @@ -418,7 +416,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LeadUpdateResponse: + ) -> Lead: """ Updates a lead @@ -456,7 +454,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LeadUpdateResponse, + cast_to=Lead, ) def list( diff --git a/src/whop_sdk/resources/memberships.py b/src/whop_sdk/resources/memberships.py index ced8002e..c284532f 100644 --- a/src/whop_sdk/resources/memberships.py +++ b/src/whop_sdk/resources/memberships.py @@ -26,6 +26,7 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.cancel_options import CancelOptions from ..types.shared.direction import Direction from ..types.shared.membership import Membership from ..types.membership_list_response import MembershipListResponse @@ -140,20 +141,7 @@ def list( *, after: Optional[str] | Omit = omit, before: Optional[str] | Omit = omit, - cancel_options: Optional[ - List[ - Literal[ - "too_expensive", - "switching", - "missing_features", - "technical_issues", - "bad_experience", - "other", - "testing", - ] - ] - ] - | Omit = omit, + cancel_options: Optional[List[CancelOptions]] | Omit = omit, company_id: Optional[str] | Omit = omit, created_after: Union[str, datetime, None] | Omit = omit, created_before: Union[str, datetime, None] | Omit = omit, @@ -528,20 +516,7 @@ def list( *, after: Optional[str] | Omit = omit, before: Optional[str] | Omit = omit, - cancel_options: Optional[ - List[ - Literal[ - "too_expensive", - "switching", - "missing_features", - "technical_issues", - "bad_experience", - "other", - "testing", - ] - ] - ] - | Omit = omit, + cancel_options: Optional[List[CancelOptions]] | Omit = omit, company_id: Optional[str] | Omit = omit, created_after: Union[str, datetime, None] | Omit = omit, created_before: Union[str, datetime, None] | Omit = omit, diff --git a/src/whop_sdk/resources/webhooks.py b/src/whop_sdk/resources/webhooks.py index 3b94500e..6b41c168 100644 --- a/src/whop_sdk/resources/webhooks.py +++ b/src/whop_sdk/resources/webhooks.py @@ -4,11 +4,10 @@ import json from typing import List, Mapping, Optional, cast -from typing_extensions import Literal import httpx -from ..types import webhook_list_params, webhook_create_params, webhook_update_params +from ..types import APIVersion, webhook_list_params, webhook_create_params, webhook_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property @@ -23,12 +22,13 @@ from ..pagination import SyncCursorPage, AsyncCursorPage from .._exceptions import WhopError from .._base_client import AsyncPaginator, make_request_options +from ..types.webhook import Webhook +from ..types.api_version import APIVersion +from ..types.webhook_event import WebhookEvent from ..types.unwrap_webhook_event import UnwrapWebhookEvent from ..types.webhook_list_response import WebhookListResponse from ..types.webhook_create_response import WebhookCreateResponse from ..types.webhook_delete_response import WebhookDeleteResponse -from ..types.webhook_update_response import WebhookUpdateResponse -from ..types.webhook_retrieve_response import WebhookRetrieveResponse __all__ = ["WebhooksResource", "AsyncWebhooksResource"] @@ -57,43 +57,10 @@ def create( self, *, url: str, - api_version: Optional[Literal["v1", "v2", "v5"]] | Omit = omit, + api_version: Optional[APIVersion] | Omit = omit, child_resource_events: Optional[bool] | Omit = omit, enabled: Optional[bool] | Omit = omit, - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] - | Omit = omit, + events: Optional[List[WebhookEvent]] | Omit = omit, resource_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. @@ -161,7 +128,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookRetrieveResponse: + ) -> Webhook: """ Retrieves a webhook by ID @@ -185,50 +152,17 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WebhookRetrieveResponse, + cast_to=Webhook, ) def update( self, id: str, *, - api_version: Optional[Literal["v1", "v2", "v5"]] | Omit = omit, + api_version: Optional[APIVersion] | Omit = omit, child_resource_events: Optional[bool] | Omit = omit, enabled: Optional[bool] | Omit = omit, - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] - | Omit = omit, + events: Optional[List[WebhookEvent]] | Omit = omit, url: 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. @@ -236,7 +170,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookUpdateResponse: + ) -> Webhook: """ Updates a webhook @@ -280,7 +214,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WebhookUpdateResponse, + cast_to=Webhook, ) def list( @@ -434,43 +368,10 @@ async def create( self, *, url: str, - api_version: Optional[Literal["v1", "v2", "v5"]] | Omit = omit, + api_version: Optional[APIVersion] | Omit = omit, child_resource_events: Optional[bool] | Omit = omit, enabled: Optional[bool] | Omit = omit, - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] - | Omit = omit, + events: Optional[List[WebhookEvent]] | Omit = omit, resource_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. @@ -538,7 +439,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookRetrieveResponse: + ) -> Webhook: """ Retrieves a webhook by ID @@ -562,50 +463,17 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WebhookRetrieveResponse, + cast_to=Webhook, ) async def update( self, id: str, *, - api_version: Optional[Literal["v1", "v2", "v5"]] | Omit = omit, + api_version: Optional[APIVersion] | Omit = omit, child_resource_events: Optional[bool] | Omit = omit, enabled: Optional[bool] | Omit = omit, - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] - | Omit = omit, + events: Optional[List[WebhookEvent]] | Omit = omit, url: 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. @@ -613,7 +481,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookUpdateResponse: + ) -> Webhook: """ Updates a webhook @@ -657,7 +525,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WebhookUpdateResponse, + cast_to=Webhook, ) def list( diff --git a/src/whop_sdk/resources/withdrawals.py b/src/whop_sdk/resources/withdrawals.py index ce89801e..4ef0a616 100644 --- a/src/whop_sdk/resources/withdrawals.py +++ b/src/whop_sdk/resources/withdrawals.py @@ -20,11 +20,10 @@ ) from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options +from ..types.withdrawal import Withdrawal from ..types.shared.currency import Currency from ..types.shared.direction import Direction from ..types.withdrawal_list_response import WithdrawalListResponse -from ..types.withdrawal_create_response import WithdrawalCreateResponse -from ..types.withdrawal_retrieve_response import WithdrawalRetrieveResponse __all__ = ["WithdrawalsResource", "AsyncWithdrawalsResource"] @@ -64,7 +63,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WithdrawalCreateResponse: + ) -> Withdrawal: """ Creates a withdrawal request for a ledger account @@ -111,7 +110,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WithdrawalCreateResponse, + cast_to=Withdrawal, ) def retrieve( @@ -124,7 +123,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WithdrawalRetrieveResponse: + ) -> Withdrawal: """ Retrieves a withdrawal by ID @@ -149,7 +148,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WithdrawalRetrieveResponse, + cast_to=Withdrawal, ) def list( @@ -263,7 +262,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WithdrawalCreateResponse: + ) -> Withdrawal: """ Creates a withdrawal request for a ledger account @@ -310,7 +309,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WithdrawalCreateResponse, + cast_to=Withdrawal, ) async def retrieve( @@ -323,7 +322,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WithdrawalRetrieveResponse: + ) -> Withdrawal: """ Retrieves a withdrawal by ID @@ -348,7 +347,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WithdrawalRetrieveResponse, + cast_to=Withdrawal, ) def list( diff --git a/src/whop_sdk/types/__init__.py b/src/whop_sdk/types/__init__.py index 54463bc8..e3829f54 100644 --- a/src/whop_sdk/types/__init__.py +++ b/src/whop_sdk/types/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .lead import Lead as Lead from .course import Course as Course from .lesson import Lesson as Lesson from .shared import ( @@ -66,16 +67,25 @@ EmailNotificationPreferences as EmailNotificationPreferences, CourseLessonInteractionListItem as CourseLessonInteractionListItem, ) +from .ai_chat import AIChat as AIChat from .dispute import Dispute as Dispute +from .webhook import Webhook as Webhook from .app_type import AppType as AppType +from .dm_member import DmMember as DmMember from .languages import Languages as Languages +from .dm_channel import DmChannel as DmChannel from .embed_type import EmbedType as EmbedType from .promo_code import PromoCode as PromoCode +from .withdrawal import Withdrawal as Withdrawal +from .api_version import APIVersion as APIVersion from .card_brands import CardBrands as CardBrands from .lesson_types import LessonTypes as LessonTypes from .setup_intent import SetupIntent as SetupIntent from .refund_status import RefundStatus as RefundStatus from .review_status import ReviewStatus as ReviewStatus +from .upload_status import UploadStatus as UploadStatus +from .webhook_event import WebhookEvent as WebhookEvent +from .cancel_options import CancelOptions as CancelOptions from .checkout_modes import CheckoutModes as CheckoutModes from .course_chapter import CourseChapter as CourseChapter from .promo_duration import PromoDuration as PromoDuration @@ -119,13 +129,12 @@ from .product_list_params import ProductListParams as ProductListParams from .setup_intent_status import SetupIntentStatus as SetupIntentStatus from .topup_create_params import TopupCreateParams as TopupCreateParams +from .verification_status import VerificationStatus as VerificationStatus from .webhook_list_params import WebhookListParams as WebhookListParams from .course_create_params import CourseCreateParams as CourseCreateParams from .course_list_response import CourseListResponse as CourseListResponse from .course_update_params import CourseUpdateParams as CourseUpdateParams from .file_create_response import FileCreateResponse as FileCreateResponse -from .lead_create_response import LeadCreateResponse as LeadCreateResponse -from .lead_update_response import LeadUpdateResponse as LeadUpdateResponse from .member_list_response import MemberListResponse as MemberListResponse from .payment_method_types import PaymentMethodTypes as PaymentMethodTypes from .plan_delete_response import PlanDeleteResponse as PlanDeleteResponse @@ -161,12 +170,12 @@ from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .course_delete_response import CourseDeleteResponse as CourseDeleteResponse +from .dm_channel_list_params import DmChannelListParams as DmChannelListParams from .entry_approve_response import EntryApproveResponse as EntryApproveResponse from .experience_list_params import ExperienceListParams as ExperienceListParams from .fee_markup_list_params import FeeMarkupListParams as FeeMarkupListParams from .file_retrieve_response import FileRetrieveResponse as FileRetrieveResponse from .forum_post_list_params import ForumPostListParams as ForumPostListParams -from .lead_retrieve_response import LeadRetrieveResponse as LeadRetrieveResponse from .membership_list_params import MembershipListParams as MembershipListParams from .promo_code_list_params import PromoCodeListParams as PromoCodeListParams from .reaction_create_params import ReactionCreateParams as ReactionCreateParams @@ -178,11 +187,10 @@ from .transfer_list_response import TransferListResponse as TransferListResponse from .user_retrieve_response import UserRetrieveResponse as UserRetrieveResponse from .withdrawal_list_params import WithdrawalListParams as WithdrawalListParams -from .ai_chat_create_response import AIChatCreateResponse as AIChatCreateResponse from .ai_chat_delete_response import AIChatDeleteResponse as AIChatDeleteResponse -from .ai_chat_update_response import AIChatUpdateResponse as AIChatUpdateResponse from .app_build_create_params import AppBuildCreateParams as AppBuildCreateParams from .app_build_list_response import AppBuildListResponse as AppBuildListResponse +from .dm_feed_member_statuses import DmFeedMemberStatuses as DmFeedMemberStatuses from .dm_member_create_params import DmMemberCreateParams as DmMemberCreateParams from .dm_member_list_response import DmMemberListResponse as DmMemberListResponse from .dm_member_update_params import DmMemberUpdateParams as DmMemberUpdateParams @@ -190,10 +198,13 @@ from .message_delete_response import MessageDeleteResponse as MessageDeleteResponse from .product_delete_response import ProductDeleteResponse as ProductDeleteResponse from .refund_reference_status import RefundReferenceStatus as RefundReferenceStatus +from .verification_error_code import VerificationErrorCode as VerificationErrorCode from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse -from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse from .chat_channel_list_params import ChatChannelListParams as ChatChannelListParams +from .dm_channel_create_params import DmChannelCreateParams as DmChannelCreateParams +from .dm_channel_list_response import DmChannelListResponse as DmChannelListResponse +from .dm_channel_update_params import DmChannelUpdateParams as DmChannelUpdateParams from .experience_attach_params import ExperienceAttachParams as ExperienceAttachParams from .experience_create_params import ExperienceCreateParams as ExperienceCreateParams from .experience_detach_params import ExperienceDetachParams as ExperienceDetachParams @@ -217,20 +228,18 @@ from .setup_intent_list_params import SetupIntentListParams as SetupIntentListParams from .withdrawal_create_params import WithdrawalCreateParams as WithdrawalCreateParams from .withdrawal_list_response import WithdrawalListResponse as WithdrawalListResponse -from .ai_chat_retrieve_response import AIChatRetrieveResponse as AIChatRetrieveResponse from .assessment_question_types import AssessmentQuestionTypes as AssessmentQuestionTypes +from .company_token_transaction import CompanyTokenTransaction as CompanyTokenTransaction from .course_lesson_list_params import CourseLessonListParams as CourseLessonListParams -from .dm_member_create_response import DmMemberCreateResponse as DmMemberCreateResponse from .dm_member_delete_response import DmMemberDeleteResponse as DmMemberDeleteResponse -from .dm_member_update_response import DmMemberUpdateResponse as DmMemberUpdateResponse from .payout_method_list_params import PayoutMethodListParams as PayoutMethodListParams -from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams from .account_link_create_params import AccountLinkCreateParams as AccountLinkCreateParams from .chat_channel_list_response import ChatChannelListResponse as ChatChannelListResponse from .chat_channel_update_params import ChatChannelUpdateParams as ChatChannelUpdateParams from .course_chapter_list_params import CourseChapterListParams as CourseChapterListParams from .course_student_list_params import CourseStudentListParams as CourseStudentListParams +from .dm_channel_delete_response import DmChannelDeleteResponse as DmChannelDeleteResponse from .entry_denied_webhook_event import EntryDeniedWebhookEvent as EntryDeniedWebhookEvent from .experience_delete_response import ExperienceDeleteResponse as ExperienceDeleteResponse from .fee_markup_create_response import FeeMarkupCreateResponse as FeeMarkupCreateResponse @@ -243,15 +252,15 @@ from .promo_code_delete_response import PromoCodeDeleteResponse as PromoCodeDeleteResponse from .setup_intent_list_response import SetupIntentListResponse as SetupIntentListResponse from .user_check_access_response import UserCheckAccessResponse as UserCheckAccessResponse -from .withdrawal_create_response import WithdrawalCreateResponse as WithdrawalCreateResponse from .authorized_user_list_params import AuthorizedUserListParams as AuthorizedUserListParams +from .bot_token_transaction_types import BotTokenTransactionTypes as BotTokenTransactionTypes from .course_lesson_create_params import CourseLessonCreateParams as CourseLessonCreateParams from .course_lesson_list_response import CourseLessonListResponse as CourseLessonListResponse from .course_lesson_update_params import CourseLessonUpdateParams as CourseLessonUpdateParams -from .dm_member_retrieve_response import DmMemberRetrieveResponse as DmMemberRetrieveResponse from .entry_created_webhook_event import EntryCreatedWebhookEvent as EntryCreatedWebhookEvent from .entry_deleted_webhook_event import EntryDeletedWebhookEvent as EntryDeletedWebhookEvent from .experience_duplicate_params import ExperienceDuplicateParams as ExperienceDuplicateParams +from .payout_destination_category import PayoutDestinationCategory as PayoutDestinationCategory from .payout_method_list_response import PayoutMethodListResponse as PayoutMethodListResponse from .support_channel_list_params import SupportChannelListParams as SupportChannelListParams from .access_token_create_response import AccessTokenCreateResponse as AccessTokenCreateResponse @@ -268,7 +277,6 @@ 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 .withdrawal_retrieve_response import WithdrawalRetrieveResponse as WithdrawalRetrieveResponse 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 @@ -315,21 +323,18 @@ from .company_token_transaction_list_response import ( CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse, ) +from .dm_feed_member_notification_preferences import ( + DmFeedMemberNotificationPreferences as DmFeedMemberNotificationPreferences, +) from .course_lesson_mark_as_completed_response import ( CourseLessonMarkAsCompletedResponse as CourseLessonMarkAsCompletedResponse, ) from .course_lesson_submit_assessment_response import ( CourseLessonSubmitAssessmentResponse as CourseLessonSubmitAssessmentResponse, ) -from .company_token_transaction_create_response import ( - CompanyTokenTransactionCreateResponse as CompanyTokenTransactionCreateResponse, -) from .setup_intent_requires_action_webhook_event import ( SetupIntentRequiresActionWebhookEvent as SetupIntentRequiresActionWebhookEvent, ) -from .company_token_transaction_retrieve_response import ( - CompanyTokenTransactionRetrieveResponse as CompanyTokenTransactionRetrieveResponse, -) from .course_lesson_interaction_completed_webhook_event import ( CourseLessonInteractionCompletedWebhookEvent as CourseLessonInteractionCompletedWebhookEvent, ) diff --git a/src/whop_sdk/types/ai_chat_create_response.py b/src/whop_sdk/types/ai_chat.py similarity index 91% rename from src/whop_sdk/types/ai_chat_create_response.py rename to src/whop_sdk/types/ai_chat.py index 8f74830a..fa0619e9 100644 --- a/src/whop_sdk/types/ai_chat_create_response.py +++ b/src/whop_sdk/types/ai_chat.py @@ -5,7 +5,7 @@ from .._models import BaseModel -__all__ = ["AIChatCreateResponse", "User"] +__all__ = ["AIChat", "User"] class User(BaseModel): @@ -15,7 +15,7 @@ class User(BaseModel): """The internal ID of the user.""" -class AIChatCreateResponse(BaseModel): +class AIChat(BaseModel): """An AI chat conversation belonging to a user""" id: str diff --git a/src/whop_sdk/types/ai_chat_retrieve_response.py b/src/whop_sdk/types/ai_chat_retrieve_response.py deleted file mode 100644 index b79c7d74..00000000 --- a/src/whop_sdk/types/ai_chat_retrieve_response.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from .._models import BaseModel - -__all__ = ["AIChatRetrieveResponse", "User"] - - -class User(BaseModel): - """The user who owns the AI chat""" - - id: str - """The internal ID of the user.""" - - -class AIChatRetrieveResponse(BaseModel): - """An AI chat conversation belonging to a user""" - - id: str - """The unique identifier for the AI chat""" - - blended_token_usage: str - """The total number of tokens used in the chat""" - - created_at: datetime - """When the AI chat was created""" - - last_message_at: Optional[datetime] = None - """When the last message was sent""" - - message_count: int - """The number of messages in the chat""" - - title: Optional[str] = None - """The title of the AI chat""" - - updated_at: datetime - """When the AI chat was last updated""" - - user: User - """The user who owns the AI chat""" diff --git a/src/whop_sdk/types/ai_chat_update_response.py b/src/whop_sdk/types/ai_chat_update_response.py deleted file mode 100644 index 22b359ea..00000000 --- a/src/whop_sdk/types/ai_chat_update_response.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from .._models import BaseModel - -__all__ = ["AIChatUpdateResponse", "User"] - - -class User(BaseModel): - """The user who owns the AI chat""" - - id: str - """The internal ID of the user.""" - - -class AIChatUpdateResponse(BaseModel): - """An AI chat conversation belonging to a user""" - - id: str - """The unique identifier for the AI chat""" - - blended_token_usage: str - """The total number of tokens used in the chat""" - - created_at: datetime - """When the AI chat was created""" - - last_message_at: Optional[datetime] = None - """When the last message was sent""" - - message_count: int - """The number of messages in the chat""" - - title: Optional[str] = None - """The title of the AI chat""" - - updated_at: datetime - """When the AI chat was last updated""" - - user: User - """The user who owns the AI chat""" diff --git a/src/whop_sdk/types/api_version.py b/src/whop_sdk/types/api_version.py new file mode 100644 index 00000000..9152c105 --- /dev/null +++ b/src/whop_sdk/types/api_version.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__ = ["APIVersion"] + +APIVersion: TypeAlias = Literal["v1", "v2", "v5"] diff --git a/src/whop_sdk/types/bot_token_transaction_types.py b/src/whop_sdk/types/bot_token_transaction_types.py new file mode 100644 index 00000000..b6e4930b --- /dev/null +++ b/src/whop_sdk/types/bot_token_transaction_types.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__ = ["BotTokenTransactionTypes"] + +BotTokenTransactionTypes: TypeAlias = Literal["add", "subtract", "transfer"] diff --git a/src/whop_sdk/types/cancel_options.py b/src/whop_sdk/types/cancel_options.py new file mode 100644 index 00000000..913c9746 --- /dev/null +++ b/src/whop_sdk/types/cancel_options.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__ = ["CancelOptions"] + +CancelOptions: TypeAlias = Literal[ + "too_expensive", "switching", "missing_features", "technical_issues", "bad_experience", "other", "testing" +] diff --git a/src/whop_sdk/types/company_token_transaction_create_response.py b/src/whop_sdk/types/company_token_transaction.py similarity index 86% rename from src/whop_sdk/types/company_token_transaction_create_response.py rename to src/whop_sdk/types/company_token_transaction.py index 7a95cb59..1eef6bbf 100644 --- a/src/whop_sdk/types/company_token_transaction_create_response.py +++ b/src/whop_sdk/types/company_token_transaction.py @@ -2,11 +2,11 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .bot_token_transaction_types import BotTokenTransactionTypes -__all__ = ["CompanyTokenTransactionCreateResponse", "Company", "Member", "User"] +__all__ = ["CompanyTokenTransaction", "Company", "Member", "User"] class Company(BaseModel): @@ -42,7 +42,7 @@ class User(BaseModel): """The username of the user from their Whop account.""" -class CompanyTokenTransactionCreateResponse(BaseModel): +class CompanyTokenTransaction(BaseModel): """A token transaction within a company""" id: str @@ -69,7 +69,7 @@ class CompanyTokenTransactionCreateResponse(BaseModel): member: Member """The member""" - transaction_type: Literal["add", "subtract", "transfer"] + transaction_type: BotTokenTransactionTypes """The type of transaction""" user: User diff --git a/src/whop_sdk/types/company_token_transaction_list_params.py b/src/whop_sdk/types/company_token_transaction_list_params.py index 78f53ecf..02fa7c4e 100644 --- a/src/whop_sdk/types/company_token_transaction_list_params.py +++ b/src/whop_sdk/types/company_token_transaction_list_params.py @@ -3,7 +3,9 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .bot_token_transaction_types import BotTokenTransactionTypes __all__ = ["CompanyTokenTransactionListParams"] @@ -24,7 +26,7 @@ class CompanyTokenTransactionListParams(TypedDict, total=False): last: Optional[int] """Returns the last _n_ elements from the list.""" - transaction_type: Optional[Literal["add", "subtract", "transfer"]] + transaction_type: Optional[BotTokenTransactionTypes] """The type of token transaction""" user_id: Optional[str] diff --git a/src/whop_sdk/types/company_token_transaction_list_response.py b/src/whop_sdk/types/company_token_transaction_list_response.py index c3a34a13..c3bf4583 100644 --- a/src/whop_sdk/types/company_token_transaction_list_response.py +++ b/src/whop_sdk/types/company_token_transaction_list_response.py @@ -2,9 +2,9 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .bot_token_transaction_types import BotTokenTransactionTypes __all__ = ["CompanyTokenTransactionListResponse", "Company", "Member", "User"] @@ -69,7 +69,7 @@ class CompanyTokenTransactionListResponse(BaseModel): member: Member """The member""" - transaction_type: Literal["add", "subtract", "transfer"] + transaction_type: BotTokenTransactionTypes """The type of transaction""" user: User diff --git a/src/whop_sdk/types/company_token_transaction_retrieve_response.py b/src/whop_sdk/types/company_token_transaction_retrieve_response.py deleted file mode 100644 index 93f1aa56..00000000 --- a/src/whop_sdk/types/company_token_transaction_retrieve_response.py +++ /dev/null @@ -1,76 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["CompanyTokenTransactionRetrieveResponse", "Company", "Member", "User"] - - -class Company(BaseModel): - """The company""" - - id: str - """The ID of the company""" - - route: str - """The slug/route of the company on the Whop site.""" - - title: str - """The written name of the company.""" - - -class Member(BaseModel): - """The member""" - - id: str - """The ID of the member""" - - -class User(BaseModel): - """The user whose balance changed""" - - id: str - """The internal ID of the user.""" - - name: Optional[str] = None - """The name of the user from their Whop account.""" - - username: str - """The username of the user from their Whop account.""" - - -class CompanyTokenTransactionRetrieveResponse(BaseModel): - """A token transaction within a company""" - - id: str - """The ID of the transaction""" - - amount: float - """The transaction amount (always positive)""" - - company: Company - """The company""" - - created_at: datetime - """When the transaction was created""" - - description: Optional[str] = None - """Optional description""" - - idempotency_key: Optional[str] = None - """Optional idempotency key to prevent duplicate transactions""" - - linked_transaction_id: Optional[str] = None - """For transfers, the ID of the linked transaction""" - - member: Member - """The member""" - - transaction_type: Literal["add", "subtract", "transfer"] - """The type of transaction""" - - user: User - """The user whose balance changed""" diff --git a/src/whop_sdk/types/dm_channel.py b/src/whop_sdk/types/dm_channel.py new file mode 100644 index 00000000..ca1ffcd2 --- /dev/null +++ b/src/whop_sdk/types/dm_channel.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .._models import BaseModel + +__all__ = ["DmChannel"] + + +class DmChannel(BaseModel): + """Represents a DM channel""" + + id: str + """The unique identifier for the entity""" + + created_at: str + """The time the entity was created (in milliseconds since Unix epoch)""" + + last_message_at: Optional[datetime] = None + """When the last message was sent""" + + name: Optional[str] = None + """The custom name of the DM channel, if any""" diff --git a/src/whop_sdk/types/dm_channel_create_params.py b/src/whop_sdk/types/dm_channel_create_params.py new file mode 100644 index 00000000..3d181397 --- /dev/null +++ b/src/whop_sdk/types/dm_channel_create_params.py @@ -0,0 +1,21 @@ +# 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 .._types import SequenceNotStr + +__all__ = ["DmChannelCreateParams"] + + +class DmChannelCreateParams(TypedDict, total=False): + with_user_ids: Required[SequenceNotStr[str]] + """The user ids to create a DM with. Can be email, username or user_id (tag)""" + + company_id: Optional[str] + """The ID of the company to scope this DM channel to.""" + + custom_name: Optional[str] + """The custom name for the DM channel""" diff --git a/src/whop_sdk/types/dm_channel_delete_response.py b/src/whop_sdk/types/dm_channel_delete_response.py new file mode 100644 index 00000000..219c5478 --- /dev/null +++ b/src/whop_sdk/types/dm_channel_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__ = ["DmChannelDeleteResponse"] + +DmChannelDeleteResponse: TypeAlias = bool diff --git a/src/whop_sdk/types/dm_channel_list_params.py b/src/whop_sdk/types/dm_channel_list_params.py new file mode 100644 index 00000000..871be02b --- /dev/null +++ b/src/whop_sdk/types/dm_channel_list_params.py @@ -0,0 +1,25 @@ +# 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__ = ["DmChannelListParams"] + + +class DmChannelListParams(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] + """Filter DM channels scoped to a specific company""" + + first: Optional[int] + """Returns the first _n_ elements from the list.""" + + last: Optional[int] + """Returns the last _n_ elements from the list.""" diff --git a/src/whop_sdk/types/dm_channel_list_response.py b/src/whop_sdk/types/dm_channel_list_response.py new file mode 100644 index 00000000..c2f8fcc1 --- /dev/null +++ b/src/whop_sdk/types/dm_channel_list_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .._models import BaseModel + +__all__ = ["DmChannelListResponse"] + + +class DmChannelListResponse(BaseModel): + """Represents a DM channel""" + + id: str + """The unique identifier for the entity""" + + created_at: str + """The time the entity was created (in milliseconds since Unix epoch)""" + + last_message_at: Optional[datetime] = None + """When the last message was sent""" + + name: Optional[str] = None + """The custom name of the DM channel, if any""" diff --git a/src/whop_sdk/types/dm_channel_update_params.py b/src/whop_sdk/types/dm_channel_update_params.py new file mode 100644 index 00000000..a98fda00 --- /dev/null +++ b/src/whop_sdk/types/dm_channel_update_params.py @@ -0,0 +1,13 @@ +# 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__ = ["DmChannelUpdateParams"] + + +class DmChannelUpdateParams(TypedDict, total=False): + custom_name: Optional[str] + """The custom name for the DM channel""" diff --git a/src/whop_sdk/types/dm_feed_member_notification_preferences.py b/src/whop_sdk/types/dm_feed_member_notification_preferences.py new file mode 100644 index 00000000..8320db4c --- /dev/null +++ b/src/whop_sdk/types/dm_feed_member_notification_preferences.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__ = ["DmFeedMemberNotificationPreferences"] + +DmFeedMemberNotificationPreferences: TypeAlias = Literal["all", "mentions", "none"] diff --git a/src/whop_sdk/types/dm_feed_member_statuses.py b/src/whop_sdk/types/dm_feed_member_statuses.py new file mode 100644 index 00000000..f225702f --- /dev/null +++ b/src/whop_sdk/types/dm_feed_member_statuses.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__ = ["DmFeedMemberStatuses"] + +DmFeedMemberStatuses: TypeAlias = Literal["requested", "accepted", "hidden", "closed", "archived"] diff --git a/src/whop_sdk/types/dm_member_update_response.py b/src/whop_sdk/types/dm_member.py similarity index 70% rename from src/whop_sdk/types/dm_member_update_response.py rename to src/whop_sdk/types/dm_member.py index 0153610d..7438449b 100644 --- a/src/whop_sdk/types/dm_member_update_response.py +++ b/src/whop_sdk/types/dm_member.py @@ -1,14 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from .._models import BaseModel +from .dm_feed_member_statuses import DmFeedMemberStatuses +from .dm_feed_member_notification_preferences import DmFeedMemberNotificationPreferences -__all__ = ["DmMemberUpdateResponse"] +__all__ = ["DmMember"] -class DmMemberUpdateResponse(BaseModel): +class DmMember(BaseModel): """Represents a member of a DM channel""" id: str @@ -23,10 +24,10 @@ class DmMemberUpdateResponse(BaseModel): epoch) """ - notification_preference: Literal["all", "mentions", "none"] + notification_preference: DmFeedMemberNotificationPreferences """The notification preference for this member (all, mentions, none)""" - status: Literal["requested", "accepted", "hidden", "closed", "archived"] + status: DmFeedMemberStatuses """The status of the membership (requested, accepted, rejected)""" user_id: str diff --git a/src/whop_sdk/types/dm_member_create_response.py b/src/whop_sdk/types/dm_member_create_response.py deleted file mode 100644 index 1122f0aa..00000000 --- a/src/whop_sdk/types/dm_member_create_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["DmMemberCreateResponse"] - - -class DmMemberCreateResponse(BaseModel): - """Represents a member of a DM channel""" - - id: str - """The unique identifier for the entity""" - - channel_id: str - """The ID of the DM channel""" - - last_viewed_at: Optional[str] = None - """ - Timestamp when the member last viewed the channel (in milliseconds since Unix - epoch) - """ - - notification_preference: Literal["all", "mentions", "none"] - """The notification preference for this member (all, mentions, none)""" - - status: Literal["requested", "accepted", "hidden", "closed", "archived"] - """The status of the membership (requested, accepted, rejected)""" - - user_id: str - """The ID of the user who is a member of the channel""" diff --git a/src/whop_sdk/types/dm_member_list_response.py b/src/whop_sdk/types/dm_member_list_response.py index b0974b61..0fac180c 100644 --- a/src/whop_sdk/types/dm_member_list_response.py +++ b/src/whop_sdk/types/dm_member_list_response.py @@ -1,9 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from .._models import BaseModel +from .dm_feed_member_statuses import DmFeedMemberStatuses __all__ = ["DmMemberListResponse"] @@ -23,7 +23,7 @@ class DmMemberListResponse(BaseModel): epoch) """ - status: Literal["requested", "accepted", "hidden", "closed", "archived"] + status: DmFeedMemberStatuses """The status of the membership (requested, accepted, rejected)""" user_id: str diff --git a/src/whop_sdk/types/dm_member_retrieve_response.py b/src/whop_sdk/types/dm_member_retrieve_response.py deleted file mode 100644 index edbec195..00000000 --- a/src/whop_sdk/types/dm_member_retrieve_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["DmMemberRetrieveResponse"] - - -class DmMemberRetrieveResponse(BaseModel): - """Represents a member of a DM channel""" - - id: str - """The unique identifier for the entity""" - - channel_id: str - """The ID of the DM channel""" - - last_viewed_at: Optional[str] = None - """ - Timestamp when the member last viewed the channel (in milliseconds since Unix - epoch) - """ - - notification_preference: Literal["all", "mentions", "none"] - """The notification preference for this member (all, mentions, none)""" - - status: Literal["requested", "accepted", "hidden", "closed", "archived"] - """The status of the membership (requested, accepted, rejected)""" - - user_id: str - """The ID of the user who is a member of the channel""" diff --git a/src/whop_sdk/types/dm_member_update_params.py b/src/whop_sdk/types/dm_member_update_params.py index 08e3f66e..3f7ba7f1 100644 --- a/src/whop_sdk/types/dm_member_update_params.py +++ b/src/whop_sdk/types/dm_member_update_params.py @@ -3,14 +3,17 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, TypedDict +from typing_extensions import TypedDict + +from .dm_feed_member_statuses import DmFeedMemberStatuses +from .dm_feed_member_notification_preferences import DmFeedMemberNotificationPreferences __all__ = ["DmMemberUpdateParams"] class DmMemberUpdateParams(TypedDict, total=False): - notification_preference: Optional[Literal["all", "mentions", "none"]] + notification_preference: Optional[DmFeedMemberNotificationPreferences] """The notification preferences for a DMs feed member""" - status: Optional[Literal["requested", "accepted", "hidden", "closed", "archived"]] + status: Optional[DmFeedMemberStatuses] """The statuses of a DMs feed member""" diff --git a/src/whop_sdk/types/file_create_response.py b/src/whop_sdk/types/file_create_response.py index af3160b6..9adc150a 100644 --- a/src/whop_sdk/types/file_create_response.py +++ b/src/whop_sdk/types/file_create_response.py @@ -1,9 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, Optional -from typing_extensions import Literal from .._models import BaseModel +from .upload_status import UploadStatus __all__ = ["FileCreateResponse"] @@ -26,7 +26,7 @@ class FileCreateResponse(BaseModel): upload_headers: Optional[Dict[str, object]] = None """Headers to include in the upload request (only on create)""" - upload_status: Literal["pending", "processing", "ready", "failed"] + upload_status: UploadStatus """The upload status of the file""" upload_url: Optional[str] = None diff --git a/src/whop_sdk/types/file_retrieve_response.py b/src/whop_sdk/types/file_retrieve_response.py index e4023559..8f7f267c 100644 --- a/src/whop_sdk/types/file_retrieve_response.py +++ b/src/whop_sdk/types/file_retrieve_response.py @@ -1,9 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from .._models import BaseModel +from .upload_status import UploadStatus __all__ = ["FileRetrieveResponse"] @@ -23,7 +23,7 @@ class FileRetrieveResponse(BaseModel): size: Optional[str] = None """The size of the file in bytes""" - upload_status: Literal["pending", "processing", "ready", "failed"] + upload_status: UploadStatus """The upload status of the file""" url: Optional[str] = None diff --git a/src/whop_sdk/types/lead_update_response.py b/src/whop_sdk/types/lead.py similarity index 94% rename from src/whop_sdk/types/lead_update_response.py rename to src/whop_sdk/types/lead.py index 51625e02..e85e3936 100644 --- a/src/whop_sdk/types/lead_update_response.py +++ b/src/whop_sdk/types/lead.py @@ -5,7 +5,7 @@ from .._models import BaseModel -__all__ = ["LeadUpdateResponse", "Member", "Product", "User"] +__all__ = ["Lead", "Member", "Product", "User"] class Member(BaseModel): @@ -41,7 +41,7 @@ class User(BaseModel): """The username of the user from their Whop account.""" -class LeadUpdateResponse(BaseModel): +class Lead(BaseModel): """An object representing a lead (someone who is interested in a whop).""" id: str diff --git a/src/whop_sdk/types/lead_create_response.py b/src/whop_sdk/types/lead_create_response.py deleted file mode 100644 index ea81f9d8..00000000 --- a/src/whop_sdk/types/lead_create_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from datetime import datetime - -from .._models import BaseModel - -__all__ = ["LeadCreateResponse", "Member", "Product", "User"] - - -class Member(BaseModel): - """The converted member, if any.""" - - id: str - """The ID of the member""" - - -class Product(BaseModel): - """The access pass the lead is interested in, if available.""" - - id: str - """The internal ID of the public product.""" - - title: str - """The title of the product. Use for Whop 4.0.""" - - -class User(BaseModel): - """The user who is the lead.""" - - id: str - """The internal ID of the user.""" - - email: Optional[str] = None - """The email of the user""" - - name: Optional[str] = None - """The name of the user from their Whop account.""" - - username: str - """The username of the user from their Whop account.""" - - -class LeadCreateResponse(BaseModel): - """An object representing a lead (someone who is interested in a whop).""" - - id: str - """The ID of the lead.""" - - created_at: datetime - """The timestamp of when the lead was created.""" - - member: Optional[Member] = None - """The converted member, if any.""" - - metadata: Optional[Dict[str, object]] = None - """Custom metadata for the lead.""" - - product: Optional[Product] = None - """The access pass the lead is interested in, if available.""" - - referrer: Optional[str] = None - """The referrer URL that brought this lead.""" - - updated_at: datetime - """The timestamp of when the lead was last updated.""" - - user: User - """The user who is the lead.""" diff --git a/src/whop_sdk/types/lead_retrieve_response.py b/src/whop_sdk/types/lead_retrieve_response.py deleted file mode 100644 index 621e7255..00000000 --- a/src/whop_sdk/types/lead_retrieve_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from datetime import datetime - -from .._models import BaseModel - -__all__ = ["LeadRetrieveResponse", "Member", "Product", "User"] - - -class Member(BaseModel): - """The converted member, if any.""" - - id: str - """The ID of the member""" - - -class Product(BaseModel): - """The access pass the lead is interested in, if available.""" - - id: str - """The internal ID of the public product.""" - - title: str - """The title of the product. Use for Whop 4.0.""" - - -class User(BaseModel): - """The user who is the lead.""" - - id: str - """The internal ID of the user.""" - - email: Optional[str] = None - """The email of the user""" - - name: Optional[str] = None - """The name of the user from their Whop account.""" - - username: str - """The username of the user from their Whop account.""" - - -class LeadRetrieveResponse(BaseModel): - """An object representing a lead (someone who is interested in a whop).""" - - id: str - """The ID of the lead.""" - - created_at: datetime - """The timestamp of when the lead was created.""" - - member: Optional[Member] = None - """The converted member, if any.""" - - metadata: Optional[Dict[str, object]] = None - """Custom metadata for the lead.""" - - product: Optional[Product] = None - """The access pass the lead is interested in, if available.""" - - referrer: Optional[str] = None - """The referrer URL that brought this lead.""" - - updated_at: datetime - """The timestamp of when the lead was last updated.""" - - user: User - """The user who is the lead.""" diff --git a/src/whop_sdk/types/ledger_account_retrieve_response.py b/src/whop_sdk/types/ledger_account_retrieve_response.py index 6be4b5dc..519d2349 100644 --- a/src/whop_sdk/types/ledger_account_retrieve_response.py +++ b/src/whop_sdk/types/ledger_account_retrieve_response.py @@ -6,6 +6,8 @@ from .._utils import PropertyInfo from .._models import BaseModel from .shared.currency import Currency +from .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode __all__ = [ "LedgerAccountRetrieveResponse", @@ -118,49 +120,13 @@ class PayoutAccountDetailsLatestVerification(BaseModel): id: str """A unique identifier for the verification.""" - last_error_code: Optional[ - Literal[ - "abandoned", - "consent_declined", - "country_not_supported", - "device_not_supported", - "document_expired", - "document_type_not_supported", - "document_unverified_other", - "email_unverified_other", - "email_verification_declined", - "id_number_insufficient_document_data", - "id_number_mismatch", - "id_number_unverified_other", - "phone_unverified_other", - "phone_verification_declined", - "selfie_document_missing_photo", - "selfie_face_mismatch", - "selfie_manipulated", - "selfie_unverified_other", - "under_supported_age", - ] - ] = None + last_error_code: Optional[VerificationErrorCode] = None """An error code for a verification attempt.""" last_error_reason: Optional[str] = None """The last error reason that occurred during the verification.""" - status: Literal[ - "requires_input", - "processing", - "verified", - "canceled", - "created", - "started", - "submitted", - "approved", - "declined", - "resubmission_requested", - "expired", - "abandoned", - "review", - ] + status: VerificationStatus """The status of the verification.""" diff --git a/src/whop_sdk/types/membership_list_params.py b/src/whop_sdk/types/membership_list_params.py index 65289194..ab95752d 100644 --- a/src/whop_sdk/types/membership_list_params.py +++ b/src/whop_sdk/types/membership_list_params.py @@ -8,6 +8,7 @@ from .._types import SequenceNotStr from .._utils import PropertyInfo +from .cancel_options import CancelOptions from .shared.direction import Direction from .shared.membership_status import MembershipStatus @@ -21,19 +22,7 @@ class MembershipListParams(TypedDict, total=False): before: Optional[str] """Returns the elements in the list that come before the specified cursor.""" - cancel_options: Optional[ - List[ - Literal[ - "too_expensive", - "switching", - "missing_features", - "technical_issues", - "bad_experience", - "other", - "testing", - ] - ] - ] + cancel_options: Optional[List[CancelOptions]] """The cancel options to filter the memberships by""" company_id: Optional[str] diff --git a/src/whop_sdk/types/membership_list_response.py b/src/whop_sdk/types/membership_list_response.py index 33edfd91..ae16484e 100644 --- a/src/whop_sdk/types/membership_list_response.py +++ b/src/whop_sdk/types/membership_list_response.py @@ -2,9 +2,9 @@ from typing import Dict, Optional from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .cancel_options import CancelOptions from .shared.currency import Currency from .shared.membership_status import MembershipStatus @@ -83,11 +83,7 @@ class MembershipListResponse(BaseModel): Only applies for memberships that have a renewal plan. """ - cancel_option: Optional[ - Literal[ - "too_expensive", "switching", "missing_features", "technical_issues", "bad_experience", "other", "testing" - ] - ] = None + cancel_option: Optional[CancelOptions] = None """ The different reasons a user can choose for why they are canceling their membership. diff --git a/src/whop_sdk/types/payout_destination_category.py b/src/whop_sdk/types/payout_destination_category.py new file mode 100644 index 00000000..03879408 --- /dev/null +++ b/src/whop_sdk/types/payout_destination_category.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__ = ["PayoutDestinationCategory"] + +PayoutDestinationCategory: TypeAlias = Literal[ + "crypto", "rtp", "next_day_bank", "bank_wire", "digital_wallet", "unknown" +] diff --git a/src/whop_sdk/types/payout_method_created_webhook_event.py b/src/whop_sdk/types/payout_method_created_webhook_event.py index c0adcc6b..b6a4acce 100644 --- a/src/whop_sdk/types/payout_method_created_webhook_event.py +++ b/src/whop_sdk/types/payout_method_created_webhook_event.py @@ -5,6 +5,7 @@ from typing_extensions import Literal from .._models import BaseModel +from .payout_destination_category import PayoutDestinationCategory __all__ = ["PayoutMethodCreatedWebhookEvent", "Data", "DataCompany", "DataDestination"] @@ -19,7 +20,7 @@ class DataCompany(BaseModel): class DataDestination(BaseModel): """The payout destination associated with the payout token""" - category: Literal["crypto", "rtp", "next_day_bank", "bank_wire", "digital_wallet", "unknown"] + category: PayoutDestinationCategory """The category of the payout destination""" country_code: str diff --git a/src/whop_sdk/types/payout_method_list_response.py b/src/whop_sdk/types/payout_method_list_response.py index 435746c8..629868e9 100644 --- a/src/whop_sdk/types/payout_method_list_response.py +++ b/src/whop_sdk/types/payout_method_list_response.py @@ -2,9 +2,9 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .payout_destination_category import PayoutDestinationCategory __all__ = ["PayoutMethodListResponse", "Company", "Destination"] @@ -19,7 +19,7 @@ class Company(BaseModel): class Destination(BaseModel): """The payout destination associated with the payout token""" - category: Literal["crypto", "rtp", "next_day_bank", "bank_wire", "digital_wallet", "unknown"] + category: PayoutDestinationCategory """The category of the payout destination""" country_code: str diff --git a/src/whop_sdk/types/payout_method_retrieve_response.py b/src/whop_sdk/types/payout_method_retrieve_response.py index 664966b9..33d0697d 100644 --- a/src/whop_sdk/types/payout_method_retrieve_response.py +++ b/src/whop_sdk/types/payout_method_retrieve_response.py @@ -2,9 +2,9 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .payout_destination_category import PayoutDestinationCategory __all__ = ["PayoutMethodRetrieveResponse", "Company", "Destination"] @@ -19,7 +19,7 @@ class Company(BaseModel): class Destination(BaseModel): """The payout destination associated with the payout token""" - category: Literal["crypto", "rtp", "next_day_bank", "bank_wire", "digital_wallet", "unknown"] + category: PayoutDestinationCategory """The category of the payout destination""" country_code: str diff --git a/src/whop_sdk/types/shared/membership.py b/src/whop_sdk/types/shared/membership.py index cb3f38cc..79223f3d 100644 --- a/src/whop_sdk/types/shared/membership.py +++ b/src/whop_sdk/types/shared/membership.py @@ -2,10 +2,10 @@ from typing import Dict, List, Optional from datetime import datetime -from typing_extensions import Literal from .currency import Currency from ..._models import BaseModel +from ..cancel_options import CancelOptions from .membership_status import MembershipStatus __all__ = ["Membership", "Company", "CustomFieldResponse", "Member", "Plan", "Product", "PromoCode", "User"] @@ -96,11 +96,7 @@ class Membership(BaseModel): Only applies for memberships that have a renewal plan. """ - cancel_option: Optional[ - Literal[ - "too_expensive", "switching", "missing_features", "technical_issues", "bad_experience", "other", "testing" - ] - ] = None + cancel_option: Optional[CancelOptions] = None """ The different reasons a user can choose for why they are canceling their membership. diff --git a/src/whop_sdk/types/upload_status.py b/src/whop_sdk/types/upload_status.py new file mode 100644 index 00000000..21ede894 --- /dev/null +++ b/src/whop_sdk/types/upload_status.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__ = ["UploadStatus"] + +UploadStatus: TypeAlias = Literal["pending", "processing", "ready", "failed"] diff --git a/src/whop_sdk/types/verification_error_code.py b/src/whop_sdk/types/verification_error_code.py new file mode 100644 index 00000000..c106b903 --- /dev/null +++ b/src/whop_sdk/types/verification_error_code.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["VerificationErrorCode"] + +VerificationErrorCode: TypeAlias = Literal[ + "abandoned", + "consent_declined", + "country_not_supported", + "device_not_supported", + "document_expired", + "document_type_not_supported", + "document_unverified_other", + "email_unverified_other", + "email_verification_declined", + "id_number_insufficient_document_data", + "id_number_mismatch", + "id_number_unverified_other", + "phone_unverified_other", + "phone_verification_declined", + "selfie_document_missing_photo", + "selfie_face_mismatch", + "selfie_manipulated", + "selfie_unverified_other", + "under_supported_age", +] diff --git a/src/whop_sdk/types/verification_retrieve_response.py b/src/whop_sdk/types/verification_retrieve_response.py index dda0fbc9..e4407ea2 100644 --- a/src/whop_sdk/types/verification_retrieve_response.py +++ b/src/whop_sdk/types/verification_retrieve_response.py @@ -1,9 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from .._models import BaseModel +from .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode __all__ = ["VerificationRetrieveResponse"] @@ -14,47 +15,11 @@ class VerificationRetrieveResponse(BaseModel): id: str """A unique identifier for the verification.""" - last_error_code: Optional[ - Literal[ - "abandoned", - "consent_declined", - "country_not_supported", - "device_not_supported", - "document_expired", - "document_type_not_supported", - "document_unverified_other", - "email_unverified_other", - "email_verification_declined", - "id_number_insufficient_document_data", - "id_number_mismatch", - "id_number_unverified_other", - "phone_unverified_other", - "phone_verification_declined", - "selfie_document_missing_photo", - "selfie_face_mismatch", - "selfie_manipulated", - "selfie_unverified_other", - "under_supported_age", - ] - ] = None + last_error_code: Optional[VerificationErrorCode] = None """An error code for a verification attempt.""" last_error_reason: Optional[str] = None """The last error reason that occurred during the verification.""" - status: Literal[ - "requires_input", - "processing", - "verified", - "canceled", - "created", - "started", - "submitted", - "approved", - "declined", - "resubmission_requested", - "expired", - "abandoned", - "review", - ] + status: VerificationStatus """The status of the verification.""" diff --git a/src/whop_sdk/types/verification_status.py b/src/whop_sdk/types/verification_status.py new file mode 100644 index 00000000..cbaf0501 --- /dev/null +++ b/src/whop_sdk/types/verification_status.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["VerificationStatus"] + +VerificationStatus: TypeAlias = Literal[ + "requires_input", + "processing", + "verified", + "canceled", + "created", + "started", + "submitted", + "approved", + "declined", + "resubmission_requested", + "expired", + "abandoned", + "review", +] diff --git a/src/whop_sdk/types/verification_succeeded_webhook_event.py b/src/whop_sdk/types/verification_succeeded_webhook_event.py index ea15925b..0f606c03 100644 --- a/src/whop_sdk/types/verification_succeeded_webhook_event.py +++ b/src/whop_sdk/types/verification_succeeded_webhook_event.py @@ -5,6 +5,8 @@ from typing_extensions import Literal from .._models import BaseModel +from .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode __all__ = ["VerificationSucceededWebhookEvent", "Data"] @@ -15,49 +17,13 @@ class Data(BaseModel): id: str """A unique identifier for the verification.""" - last_error_code: Optional[ - Literal[ - "abandoned", - "consent_declined", - "country_not_supported", - "device_not_supported", - "document_expired", - "document_type_not_supported", - "document_unverified_other", - "email_unverified_other", - "email_verification_declined", - "id_number_insufficient_document_data", - "id_number_mismatch", - "id_number_unverified_other", - "phone_unverified_other", - "phone_verification_declined", - "selfie_document_missing_photo", - "selfie_face_mismatch", - "selfie_manipulated", - "selfie_unverified_other", - "under_supported_age", - ] - ] = None + last_error_code: Optional[VerificationErrorCode] = None """An error code for a verification attempt.""" last_error_reason: Optional[str] = None """The last error reason that occurred during the verification.""" - status: Literal[ - "requires_input", - "processing", - "verified", - "canceled", - "created", - "started", - "submitted", - "approved", - "declined", - "resubmission_requested", - "expired", - "abandoned", - "review", - ] + status: VerificationStatus """The status of the verification.""" diff --git a/src/whop_sdk/types/webhook.py b/src/whop_sdk/types/webhook.py new file mode 100644 index 00000000..551ba069 --- /dev/null +++ b/src/whop_sdk/types/webhook.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime + +from .._models import BaseModel +from .api_version import APIVersion +from .webhook_event import WebhookEvent + +__all__ = ["Webhook"] + + +class Webhook(BaseModel): + """A webhook object, which can be configured to be sent updates about a company""" + + id: str + """The ID of the webhook""" + + api_version: APIVersion + """The API version for this webhook""" + + child_resource_events: bool + """Whether or not to send events for child resources. + + For example, if the webhook is created for a Company, enabling this will only + send events from the Company's sub-merchants (child companies). + """ + + created_at: datetime + """The timestamp of when the webhook was created""" + + enabled: bool + """Whether or not this webhook is turned on or not""" + + events: List[WebhookEvent] + """The number of events this webhooks is configured to receive""" + + resource_id: str + """The resource ID""" + + testable_events: List[WebhookEvent] + """The list of events that can be tested with this webhook""" + + url: str + """The URL the webhook events will be sent to""" diff --git a/src/whop_sdk/types/webhook_create_params.py b/src/whop_sdk/types/webhook_create_params.py index 0fe3c9ea..370ff6ae 100644 --- a/src/whop_sdk/types/webhook_create_params.py +++ b/src/whop_sdk/types/webhook_create_params.py @@ -3,7 +3,10 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .api_version import APIVersion +from .webhook_event import WebhookEvent __all__ = ["WebhookCreateParams"] @@ -12,7 +15,7 @@ class WebhookCreateParams(TypedDict, total=False): url: Required[str] """The URL to send the webhook to.""" - api_version: Optional[Literal["v1", "v2", "v5"]] + api_version: Optional[APIVersion] """The different API versions""" child_resource_events: Optional[bool] @@ -25,39 +28,7 @@ class WebhookCreateParams(TypedDict, total=False): enabled: Optional[bool] """Whether or not the webhook is enabled.""" - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] + events: Optional[List[WebhookEvent]] """The events to send the webhook for.""" resource_id: Optional[str] diff --git a/src/whop_sdk/types/webhook_create_response.py b/src/whop_sdk/types/webhook_create_response.py index af95f840..8df1f39d 100644 --- a/src/whop_sdk/types/webhook_create_response.py +++ b/src/whop_sdk/types/webhook_create_response.py @@ -2,9 +2,10 @@ from typing import List from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .api_version import APIVersion +from .webhook_event import WebhookEvent __all__ = ["WebhookCreateResponse"] @@ -15,7 +16,7 @@ class WebhookCreateResponse(BaseModel): id: str """The ID of the webhook""" - api_version: Literal["v1", "v2", "v5"] + api_version: APIVersion """The API version for this webhook""" child_resource_events: bool @@ -31,73 +32,13 @@ class WebhookCreateResponse(BaseModel): enabled: bool """Whether or not this webhook is turned on or not""" - events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] + events: List[WebhookEvent] """The number of events this webhooks is configured to receive""" resource_id: str """The resource ID""" - testable_events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] + testable_events: List[WebhookEvent] """The list of events that can be tested with this webhook""" url: str diff --git a/src/whop_sdk/types/webhook_event.py b/src/whop_sdk/types/webhook_event.py new file mode 100644 index 00000000..037338f4 --- /dev/null +++ b/src/whop_sdk/types/webhook_event.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WebhookEvent"] + +WebhookEvent: TypeAlias = Literal[ + "invoice.created", + "invoice.paid", + "invoice.past_due", + "invoice.voided", + "membership.activated", + "membership.deactivated", + "entry.created", + "entry.approved", + "entry.denied", + "entry.deleted", + "setup_intent.requires_action", + "setup_intent.succeeded", + "setup_intent.canceled", + "withdrawal.created", + "withdrawal.updated", + "course_lesson_interaction.completed", + "payout_method.created", + "verification.succeeded", + "payment.created", + "payment.succeeded", + "payment.failed", + "payment.pending", + "dispute.created", + "dispute.updated", + "refund.created", + "refund.updated", + "membership.cancel_at_period_end_changed", +] diff --git a/src/whop_sdk/types/webhook_list_response.py b/src/whop_sdk/types/webhook_list_response.py index 1c935f78..d2917d42 100644 --- a/src/whop_sdk/types/webhook_list_response.py +++ b/src/whop_sdk/types/webhook_list_response.py @@ -2,9 +2,10 @@ from typing import List from datetime import datetime -from typing_extensions import Literal from .._models import BaseModel +from .api_version import APIVersion +from .webhook_event import WebhookEvent __all__ = ["WebhookListResponse"] @@ -15,7 +16,7 @@ class WebhookListResponse(BaseModel): id: str """The ID of the webhook""" - api_version: Literal["v1", "v2", "v5"] + api_version: APIVersion """The API version for this webhook""" child_resource_events: bool @@ -31,37 +32,7 @@ class WebhookListResponse(BaseModel): enabled: bool """Whether or not this webhook is turned on or not""" - events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] + events: List[WebhookEvent] """The number of events this webhooks is configured to receive""" url: str diff --git a/src/whop_sdk/types/webhook_retrieve_response.py b/src/whop_sdk/types/webhook_retrieve_response.py deleted file mode 100644 index 48597e64..00000000 --- a/src/whop_sdk/types/webhook_retrieve_response.py +++ /dev/null @@ -1,104 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["WebhookRetrieveResponse"] - - -class WebhookRetrieveResponse(BaseModel): - """A webhook object, which can be configured to be sent updates about a company""" - - id: str - """The ID of the webhook""" - - api_version: Literal["v1", "v2", "v5"] - """The API version for this webhook""" - - child_resource_events: bool - """Whether or not to send events for child resources. - - For example, if the webhook is created for a Company, enabling this will only - send events from the Company's sub-merchants (child companies). - """ - - created_at: datetime - """The timestamp of when the webhook was created""" - - enabled: bool - """Whether or not this webhook is turned on or not""" - - events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - """The number of events this webhooks is configured to receive""" - - resource_id: str - """The resource ID""" - - testable_events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - """The list of events that can be tested with this webhook""" - - url: str - """The URL the webhook events will be sent to""" diff --git a/src/whop_sdk/types/webhook_update_params.py b/src/whop_sdk/types/webhook_update_params.py index bf9e8ab5..ef5e8273 100644 --- a/src/whop_sdk/types/webhook_update_params.py +++ b/src/whop_sdk/types/webhook_update_params.py @@ -3,13 +3,16 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal, TypedDict +from typing_extensions import TypedDict + +from .api_version import APIVersion +from .webhook_event import WebhookEvent __all__ = ["WebhookUpdateParams"] class WebhookUpdateParams(TypedDict, total=False): - api_version: Optional[Literal["v1", "v2", "v5"]] + api_version: Optional[APIVersion] """The different API versions""" child_resource_events: Optional[bool] @@ -18,39 +21,7 @@ class WebhookUpdateParams(TypedDict, total=False): enabled: Optional[bool] """Whether or not the webhook is enabled.""" - events: Optional[ - List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - ] + events: Optional[List[WebhookEvent]] """The events to send the webhook for.""" url: Optional[str] diff --git a/src/whop_sdk/types/webhook_update_response.py b/src/whop_sdk/types/webhook_update_response.py deleted file mode 100644 index 27ae8f1e..00000000 --- a/src/whop_sdk/types/webhook_update_response.py +++ /dev/null @@ -1,104 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["WebhookUpdateResponse"] - - -class WebhookUpdateResponse(BaseModel): - """A webhook object, which can be configured to be sent updates about a company""" - - id: str - """The ID of the webhook""" - - api_version: Literal["v1", "v2", "v5"] - """The API version for this webhook""" - - child_resource_events: bool - """Whether or not to send events for child resources. - - For example, if the webhook is created for a Company, enabling this will only - send events from the Company's sub-merchants (child companies). - """ - - created_at: datetime - """The timestamp of when the webhook was created""" - - enabled: bool - """Whether or not this webhook is turned on or not""" - - events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - """The number of events this webhooks is configured to receive""" - - resource_id: str - """The resource ID""" - - testable_events: List[ - Literal[ - "invoice.created", - "invoice.paid", - "invoice.past_due", - "invoice.voided", - "membership.activated", - "membership.deactivated", - "entry.created", - "entry.approved", - "entry.denied", - "entry.deleted", - "setup_intent.requires_action", - "setup_intent.succeeded", - "setup_intent.canceled", - "withdrawal.created", - "withdrawal.updated", - "course_lesson_interaction.completed", - "payout_method.created", - "verification.succeeded", - "payment.created", - "payment.succeeded", - "payment.failed", - "payment.pending", - "dispute.created", - "dispute.updated", - "refund.created", - "refund.updated", - "membership.cancel_at_period_end_changed", - ] - ] - """The list of events that can be tested with this webhook""" - - url: str - """The URL the webhook events will be sent to""" diff --git a/src/whop_sdk/types/withdrawal_create_response.py b/src/whop_sdk/types/withdrawal.py similarity index 97% rename from src/whop_sdk/types/withdrawal_create_response.py rename to src/whop_sdk/types/withdrawal.py index b0cf04f6..e0ad81b9 100644 --- a/src/whop_sdk/types/withdrawal_create_response.py +++ b/src/whop_sdk/types/withdrawal.py @@ -10,7 +10,7 @@ from .withdrawal_status import WithdrawalStatus from .withdrawal_fee_types import WithdrawalFeeTypes -__all__ = ["WithdrawalCreateResponse", "LedgerAccount", "PayoutToken"] +__all__ = ["Withdrawal", "LedgerAccount", "PayoutToken"] class LedgerAccount(BaseModel): @@ -48,7 +48,7 @@ class PayoutToken(BaseModel): """The name of the payer associated with the payout token.""" -class WithdrawalCreateResponse(BaseModel): +class Withdrawal(BaseModel): """A withdrawal request.""" id: str diff --git a/src/whop_sdk/types/withdrawal_created_webhook_event.py b/src/whop_sdk/types/withdrawal_created_webhook_event.py index db28aac4..77b61fba 100644 --- a/src/whop_sdk/types/withdrawal_created_webhook_event.py +++ b/src/whop_sdk/types/withdrawal_created_webhook_event.py @@ -5,155 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .shared.currency import Currency -from .withdrawal_speeds import WithdrawalSpeeds -from .withdrawal_status import WithdrawalStatus -from .withdrawal_fee_types import WithdrawalFeeTypes +from .withdrawal import Withdrawal -__all__ = ["WithdrawalCreatedWebhookEvent", "Data", "DataLedgerAccount", "DataPayoutToken"] - - -class DataLedgerAccount(BaseModel): - """The ledger account associated with the withdrawal.""" - - id: str - """The ID of the LedgerAccount.""" - - company_id: Optional[str] = None - """The ID of the company associated with this ledger account.""" - - -class DataPayoutToken(BaseModel): - """The payout token used for the withdrawal, if applicable.""" - - id: str - """The ID of the payout token""" - - created_at: datetime - """The date and time the payout token was created""" - - destination_currency_code: str - """The currency code of the payout destination. - - This is the currency that payouts will be made in for this token. - """ - - nickname: Optional[str] = None - """An optional nickname for the payout token to help the user identify it. - - This is not used by the provider and is only for the user's reference. - """ - - payer_name: Optional[str] = None - """The name of the payer associated with the payout token.""" - - -class Data(BaseModel): - """A withdrawal request.""" - - id: str - """Internal ID of the withdrawal request.""" - - amount: float - """How much money was attempted to be withdrawn, in a float type.""" - - created_at: datetime - """When the withdrawal request was created.""" - - currency: Currency - """The currency of the withdrawal request.""" - - error_code: Optional[ - Literal[ - "account_closed", - "account_does_not_exist", - "account_information_invalid", - "account_number_invalid_region", - "account_frozen", - "account_lookup_failed", - "account_not_found", - "amount_out_of_bounds", - "attributes_not_validated", - "b2b_payments_prohibited", - "bank_statement_required", - "compliance_review", - "currency_not_supported", - "deposit_canceled", - "deposit_failed", - "deposit_rejected", - "destination_unavailable", - "exceeded_account_limit", - "expired_quote", - "generic_payout_error", - "technical_problem", - "identification_number_invalid", - "invalid_account_number", - "invalid_bank_code", - "invalid_beneficiary", - "invalid_mailing_address", - "invalid_branch_number", - "invalid_branch_code", - "invalid_phone_number", - "invalid_routing_number", - "invalid_swift_code", - "invalid_company_details", - "manual_cancelation", - "misc_error", - "missing_city_and_country", - "missing_phone_number", - "missing_remittance_info", - "payee_name_invalid", - "receiving_account_locked", - "rejected_by_compliance", - "rtp_not_supported", - "non_transaction_account", - "source_token_insufficient_funds", - "ssn_invalid", - "wallet_screenshot_required", - "unsupported_region", - ] - ] = None - """The different error codes a payout can be in.""" - - error_message: Optional[str] = None - """The error message for the withdrawal, if any.""" - - estimated_availability: Optional[datetime] = None - """The estimated availability date for the withdrawal, if any.""" - - fee_amount: float - """The fee amount that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. - """ - - fee_type: Optional[WithdrawalFeeTypes] = None - """The different fee types for a withdrawal.""" - - ledger_account: DataLedgerAccount - """The ledger account associated with the withdrawal.""" - - markup_fee: float - """The markup fee that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. This only applies to - platform accounts using Whop Rails. - """ - - payout_token: Optional[DataPayoutToken] = None - """The payout token used for the withdrawal, if applicable.""" - - speed: WithdrawalSpeeds - """The speed of the withdrawal.""" - - status: WithdrawalStatus - """Status of the withdrawal.""" - - trace_code: Optional[str] = None - """The trace code for the payout, if applicable. - - Provided on ACH transactions when available. - """ +__all__ = ["WithdrawalCreatedWebhookEvent"] class WithdrawalCreatedWebhookEvent(BaseModel): @@ -163,7 +17,7 @@ class WithdrawalCreatedWebhookEvent(BaseModel): api_version: Literal["v1"] """The API version for this webhook""" - data: Data + data: Withdrawal """A withdrawal request.""" timestamp: datetime diff --git a/src/whop_sdk/types/withdrawal_retrieve_response.py b/src/whop_sdk/types/withdrawal_retrieve_response.py deleted file mode 100644 index c723afba..00000000 --- a/src/whop_sdk/types/withdrawal_retrieve_response.py +++ /dev/null @@ -1,156 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel -from .shared.currency import Currency -from .withdrawal_speeds import WithdrawalSpeeds -from .withdrawal_status import WithdrawalStatus -from .withdrawal_fee_types import WithdrawalFeeTypes - -__all__ = ["WithdrawalRetrieveResponse", "LedgerAccount", "PayoutToken"] - - -class LedgerAccount(BaseModel): - """The ledger account associated with the withdrawal.""" - - id: str - """The ID of the LedgerAccount.""" - - company_id: Optional[str] = None - """The ID of the company associated with this ledger account.""" - - -class PayoutToken(BaseModel): - """The payout token used for the withdrawal, if applicable.""" - - id: str - """The ID of the payout token""" - - created_at: datetime - """The date and time the payout token was created""" - - destination_currency_code: str - """The currency code of the payout destination. - - This is the currency that payouts will be made in for this token. - """ - - nickname: Optional[str] = None - """An optional nickname for the payout token to help the user identify it. - - This is not used by the provider and is only for the user's reference. - """ - - payer_name: Optional[str] = None - """The name of the payer associated with the payout token.""" - - -class WithdrawalRetrieveResponse(BaseModel): - """A withdrawal request.""" - - id: str - """Internal ID of the withdrawal request.""" - - amount: float - """How much money was attempted to be withdrawn, in a float type.""" - - created_at: datetime - """When the withdrawal request was created.""" - - currency: Currency - """The currency of the withdrawal request.""" - - error_code: Optional[ - Literal[ - "account_closed", - "account_does_not_exist", - "account_information_invalid", - "account_number_invalid_region", - "account_frozen", - "account_lookup_failed", - "account_not_found", - "amount_out_of_bounds", - "attributes_not_validated", - "b2b_payments_prohibited", - "bank_statement_required", - "compliance_review", - "currency_not_supported", - "deposit_canceled", - "deposit_failed", - "deposit_rejected", - "destination_unavailable", - "exceeded_account_limit", - "expired_quote", - "generic_payout_error", - "technical_problem", - "identification_number_invalid", - "invalid_account_number", - "invalid_bank_code", - "invalid_beneficiary", - "invalid_mailing_address", - "invalid_branch_number", - "invalid_branch_code", - "invalid_phone_number", - "invalid_routing_number", - "invalid_swift_code", - "invalid_company_details", - "manual_cancelation", - "misc_error", - "missing_city_and_country", - "missing_phone_number", - "missing_remittance_info", - "payee_name_invalid", - "receiving_account_locked", - "rejected_by_compliance", - "rtp_not_supported", - "non_transaction_account", - "source_token_insufficient_funds", - "ssn_invalid", - "wallet_screenshot_required", - "unsupported_region", - ] - ] = None - """The different error codes a payout can be in.""" - - error_message: Optional[str] = None - """The error message for the withdrawal, if any.""" - - estimated_availability: Optional[datetime] = None - """The estimated availability date for the withdrawal, if any.""" - - fee_amount: float - """The fee amount that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. - """ - - fee_type: Optional[WithdrawalFeeTypes] = None - """The different fee types for a withdrawal.""" - - ledger_account: LedgerAccount - """The ledger account associated with the withdrawal.""" - - markup_fee: float - """The markup fee that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. This only applies to - platform accounts using Whop Rails. - """ - - payout_token: Optional[PayoutToken] = None - """The payout token used for the withdrawal, if applicable.""" - - speed: WithdrawalSpeeds - """The speed of the withdrawal.""" - - status: WithdrawalStatus - """Status of the withdrawal.""" - - trace_code: Optional[str] = None - """The trace code for the payout, if applicable. - - Provided on ACH transactions when available. - """ diff --git a/src/whop_sdk/types/withdrawal_updated_webhook_event.py b/src/whop_sdk/types/withdrawal_updated_webhook_event.py index d1c8205f..4b54e987 100644 --- a/src/whop_sdk/types/withdrawal_updated_webhook_event.py +++ b/src/whop_sdk/types/withdrawal_updated_webhook_event.py @@ -5,155 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .shared.currency import Currency -from .withdrawal_speeds import WithdrawalSpeeds -from .withdrawal_status import WithdrawalStatus -from .withdrawal_fee_types import WithdrawalFeeTypes +from .withdrawal import Withdrawal -__all__ = ["WithdrawalUpdatedWebhookEvent", "Data", "DataLedgerAccount", "DataPayoutToken"] - - -class DataLedgerAccount(BaseModel): - """The ledger account associated with the withdrawal.""" - - id: str - """The ID of the LedgerAccount.""" - - company_id: Optional[str] = None - """The ID of the company associated with this ledger account.""" - - -class DataPayoutToken(BaseModel): - """The payout token used for the withdrawal, if applicable.""" - - id: str - """The ID of the payout token""" - - created_at: datetime - """The date and time the payout token was created""" - - destination_currency_code: str - """The currency code of the payout destination. - - This is the currency that payouts will be made in for this token. - """ - - nickname: Optional[str] = None - """An optional nickname for the payout token to help the user identify it. - - This is not used by the provider and is only for the user's reference. - """ - - payer_name: Optional[str] = None - """The name of the payer associated with the payout token.""" - - -class Data(BaseModel): - """A withdrawal request.""" - - id: str - """Internal ID of the withdrawal request.""" - - amount: float - """How much money was attempted to be withdrawn, in a float type.""" - - created_at: datetime - """When the withdrawal request was created.""" - - currency: Currency - """The currency of the withdrawal request.""" - - error_code: Optional[ - Literal[ - "account_closed", - "account_does_not_exist", - "account_information_invalid", - "account_number_invalid_region", - "account_frozen", - "account_lookup_failed", - "account_not_found", - "amount_out_of_bounds", - "attributes_not_validated", - "b2b_payments_prohibited", - "bank_statement_required", - "compliance_review", - "currency_not_supported", - "deposit_canceled", - "deposit_failed", - "deposit_rejected", - "destination_unavailable", - "exceeded_account_limit", - "expired_quote", - "generic_payout_error", - "technical_problem", - "identification_number_invalid", - "invalid_account_number", - "invalid_bank_code", - "invalid_beneficiary", - "invalid_mailing_address", - "invalid_branch_number", - "invalid_branch_code", - "invalid_phone_number", - "invalid_routing_number", - "invalid_swift_code", - "invalid_company_details", - "manual_cancelation", - "misc_error", - "missing_city_and_country", - "missing_phone_number", - "missing_remittance_info", - "payee_name_invalid", - "receiving_account_locked", - "rejected_by_compliance", - "rtp_not_supported", - "non_transaction_account", - "source_token_insufficient_funds", - "ssn_invalid", - "wallet_screenshot_required", - "unsupported_region", - ] - ] = None - """The different error codes a payout can be in.""" - - error_message: Optional[str] = None - """The error message for the withdrawal, if any.""" - - estimated_availability: Optional[datetime] = None - """The estimated availability date for the withdrawal, if any.""" - - fee_amount: float - """The fee amount that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. - """ - - fee_type: Optional[WithdrawalFeeTypes] = None - """The different fee types for a withdrawal.""" - - ledger_account: DataLedgerAccount - """The ledger account associated with the withdrawal.""" - - markup_fee: float - """The markup fee that was charged for the withdrawal. - - This is in the same currency as the withdrawal amount. This only applies to - platform accounts using Whop Rails. - """ - - payout_token: Optional[DataPayoutToken] = None - """The payout token used for the withdrawal, if applicable.""" - - speed: WithdrawalSpeeds - """The speed of the withdrawal.""" - - status: WithdrawalStatus - """Status of the withdrawal.""" - - trace_code: Optional[str] = None - """The trace code for the payout, if applicable. - - Provided on ACH transactions when available. - """ +__all__ = ["WithdrawalUpdatedWebhookEvent"] class WithdrawalUpdatedWebhookEvent(BaseModel): @@ -163,7 +17,7 @@ class WithdrawalUpdatedWebhookEvent(BaseModel): api_version: Literal["v1"] """The API version for this webhook""" - data: Data + data: Withdrawal """A withdrawal request.""" timestamp: datetime diff --git a/tests/api_resources/test_ai_chats.py b/tests/api_resources/test_ai_chats.py index a125ec4a..1db2d946 100644 --- a/tests/api_resources/test_ai_chats.py +++ b/tests/api_resources/test_ai_chats.py @@ -10,11 +10,9 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type from whop_sdk.types import ( + AIChat, AIChatListResponse, - AIChatCreateResponse, AIChatDeleteResponse, - AIChatUpdateResponse, - AIChatRetrieveResponse, ) from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -28,7 +26,7 @@ class TestAIChats: @parametrize def test_method_create(self, client: Whop) -> None: ai_chat = client.ai_chats.create() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -36,7 +34,7 @@ def test_method_create_with_all_params(self, client: Whop) -> None: ai_chat = client.ai_chats.create( title="title", ) - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -46,7 +44,7 @@ def test_raw_response_create(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = response.parse() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -56,7 +54,7 @@ def test_streaming_response_create(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = response.parse() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -66,7 +64,7 @@ def test_method_retrieve(self, client: Whop) -> None: ai_chat = client.ai_chats.retrieve( "aich_xxxxxxxxxxxxx", ) - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -78,7 +76,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" ai_chat = response.parse() - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -90,7 +88,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = response.parse() - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +106,7 @@ def test_method_update(self, client: Whop) -> None: ai_chat = client.ai_chats.update( id="aich_xxxxxxxxxxxxx", ) - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -117,7 +115,7 @@ def test_method_update_with_all_params(self, client: Whop) -> None: id="aich_xxxxxxxxxxxxx", title="title", ) - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -129,7 +127,7 @@ def test_raw_response_update(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = response.parse() - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -141,7 +139,7 @@ def test_streaming_response_update(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = response.parse() - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -244,7 +242,7 @@ class TestAsyncAIChats: @parametrize async def test_method_create(self, async_client: AsyncWhop) -> None: ai_chat = await async_client.ai_chats.create() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -252,7 +250,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> N ai_chat = await async_client.ai_chats.create( title="title", ) - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -262,7 +260,7 @@ async def test_raw_response_create(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = await response.parse() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -272,7 +270,7 @@ async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = await response.parse() - assert_matches_type(AIChatCreateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -282,7 +280,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: ai_chat = await async_client.ai_chats.retrieve( "aich_xxxxxxxxxxxxx", ) - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -294,7 +292,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" ai_chat = await response.parse() - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -306,7 +304,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = await response.parse() - assert_matches_type(AIChatRetrieveResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -324,7 +322,7 @@ async def test_method_update(self, async_client: AsyncWhop) -> None: ai_chat = await async_client.ai_chats.update( id="aich_xxxxxxxxxxxxx", ) - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -333,7 +331,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> N id="aich_xxxxxxxxxxxxx", title="title", ) - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -345,7 +343,7 @@ async def test_raw_response_update(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = await response.parse() - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -357,7 +355,7 @@ async def test_streaming_response_update(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ai_chat = await response.parse() - assert_matches_type(AIChatUpdateResponse, ai_chat, path=["response"]) + assert_matches_type(AIChat, ai_chat, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_company_token_transactions.py b/tests/api_resources/test_company_token_transactions.py index 2cd4020d..c62a20ed 100644 --- a/tests/api_resources/test_company_token_transactions.py +++ b/tests/api_resources/test_company_token_transactions.py @@ -10,9 +10,8 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type from whop_sdk.types import ( + CompanyTokenTransaction, CompanyTokenTransactionListResponse, - CompanyTokenTransactionCreateResponse, - CompanyTokenTransactionRetrieveResponse, ) from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -32,7 +31,7 @@ def test_method_create_overload_1(self, client: Whop) -> None: transaction_type="transfer", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -46,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Whop) -> None: description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -62,7 +61,7 @@ def test_raw_response_create_overload_1(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -78,7 +77,7 @@ def test_streaming_response_create_overload_1(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -91,7 +90,7 @@ def test_method_create_overload_2(self, client: Whop) -> None: transaction_type="add", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -104,7 +103,7 @@ def test_method_create_with_all_params_overload_2(self, client: Whop) -> None: description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -119,7 +118,7 @@ def test_raw_response_create_overload_2(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -134,7 +133,7 @@ def test_streaming_response_create_overload_2(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -147,7 +146,7 @@ def test_method_create_overload_3(self, client: Whop) -> None: transaction_type="subtract", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -160,7 +159,7 @@ def test_method_create_with_all_params_overload_3(self, client: Whop) -> None: description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -175,7 +174,7 @@ def test_raw_response_create_overload_3(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -190,7 +189,7 @@ def test_streaming_response_create_overload_3(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -200,7 +199,7 @@ def test_method_retrieve(self, client: Whop) -> None: company_token_transaction = client.company_token_transactions.retrieve( "id", ) - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -212,7 +211,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" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -224,7 +223,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = response.parse() - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -308,7 +307,7 @@ async def test_method_create_overload_1(self, async_client: AsyncWhop) -> None: transaction_type="transfer", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -322,7 +321,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -338,7 +337,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncWhop) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -354,7 +353,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncWho assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -367,7 +366,7 @@ async def test_method_create_overload_2(self, async_client: AsyncWhop) -> None: transaction_type="add", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -380,7 +379,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -395,7 +394,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncWhop) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -410,7 +409,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncWho assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -423,7 +422,7 @@ async def test_method_create_overload_3(self, async_client: AsyncWhop) -> None: transaction_type="subtract", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -436,7 +435,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn description="description", idempotency_key="idempotency_key", ) - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -451,7 +450,7 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncWhop) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -466,7 +465,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncWho assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionCreateResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True @@ -476,7 +475,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: company_token_transaction = await async_client.company_token_transactions.retrieve( "id", ) - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -488,7 +487,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" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -500,7 +499,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" company_token_transaction = await response.parse() - assert_matches_type(CompanyTokenTransactionRetrieveResponse, company_token_transaction, path=["response"]) + assert_matches_type(CompanyTokenTransaction, company_token_transaction, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_dm_channels.py b/tests/api_resources/test_dm_channels.py new file mode 100644 index 00000000..16981180 --- /dev/null +++ b/tests/api_resources/test_dm_channels.py @@ -0,0 +1,467 @@ +# 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 ( + DmChannel, + DmChannelListResponse, + DmChannelDeleteResponse, +) +from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDmChannels: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: Whop) -> None: + dm_channel = client.dm_channels.create( + with_user_ids=["string"], + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Whop) -> None: + dm_channel = client.dm_channels.create( + with_user_ids=["string"], + company_id="biz_xxxxxxxxxxxxxx", + custom_name="custom_name", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: Whop) -> None: + response = client.dm_channels.with_raw_response.create( + with_user_ids=["string"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Whop) -> None: + with client.dm_channels.with_streaming_response.create( + with_user_ids=["string"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_retrieve(self, client: Whop) -> None: + dm_channel = client.dm_channels.retrieve( + "id", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Whop) -> None: + response = client.dm_channels.with_raw_response.retrieve( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Whop) -> None: + with client.dm_channels.with_streaming_response.retrieve( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism 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.dm_channels.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update(self, client: Whop) -> None: + dm_channel = client.dm_channels.update( + id="id", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Whop) -> None: + dm_channel = client.dm_channels.update( + id="id", + custom_name="custom_name", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_update(self, client: Whop) -> None: + response = client.dm_channels.with_raw_response.update( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Whop) -> None: + with client.dm_channels.with_streaming_response.update( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_update(self, client: Whop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.dm_channels.with_raw_response.update( + id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Whop) -> None: + dm_channel = client.dm_channels.list() + assert_matches_type(SyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Whop) -> None: + dm_channel = client.dm_channels.list( + after="after", + before="before", + company_id="biz_xxxxxxxxxxxxxx", + first=42, + last=42, + ) + assert_matches_type(SyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Whop) -> None: + response = client.dm_channels.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = response.parse() + assert_matches_type(SyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Whop) -> None: + with client.dm_channels.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = response.parse() + assert_matches_type(SyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: Whop) -> None: + dm_channel = client.dm_channels.delete( + "id", + ) + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Whop) -> None: + response = client.dm_channels.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = response.parse() + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Whop) -> None: + with client.dm_channels.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = response.parse() + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism 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.dm_channels.with_raw_response.delete( + "", + ) + + +class TestAsyncDmChannels: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.create( + with_user_ids=["string"], + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.create( + with_user_ids=["string"], + company_id="biz_xxxxxxxxxxxxxx", + custom_name="custom_name", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncWhop) -> None: + response = await async_client.dm_channels.with_raw_response.create( + with_user_ids=["string"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: + async with async_client.dm_channels.with_streaming_response.create( + with_user_ids=["string"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.retrieve( + "id", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: + response = await async_client.dm_channels.with_raw_response.retrieve( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> None: + async with async_client.dm_channels.with_streaming_response.retrieve( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism 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.dm_channels.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.update( + id="id", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.update( + id="id", + custom_name="custom_name", + ) + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncWhop) -> None: + response = await async_client.dm_channels.with_raw_response.update( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncWhop) -> None: + async with async_client.dm_channels.with_streaming_response.update( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = await response.parse() + assert_matches_type(DmChannel, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncWhop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.dm_channels.with_raw_response.update( + id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.list() + assert_matches_type(AsyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.list( + after="after", + before="before", + company_id="biz_xxxxxxxxxxxxxx", + first=42, + last=42, + ) + assert_matches_type(AsyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncWhop) -> None: + response = await async_client.dm_channels.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = await response.parse() + assert_matches_type(AsyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncWhop) -> None: + async with async_client.dm_channels.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = await response.parse() + assert_matches_type(AsyncCursorPage[DmChannelListResponse], dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncWhop) -> None: + dm_channel = await async_client.dm_channels.delete( + "id", + ) + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncWhop) -> None: + response = await async_client.dm_channels.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dm_channel = await response.parse() + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncWhop) -> None: + async with async_client.dm_channels.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dm_channel = await response.parse() + assert_matches_type(DmChannelDeleteResponse, dm_channel, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism 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.dm_channels.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/test_dm_members.py b/tests/api_resources/test_dm_members.py index b18209bf..3ef4d5c0 100644 --- a/tests/api_resources/test_dm_members.py +++ b/tests/api_resources/test_dm_members.py @@ -10,11 +10,9 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type from whop_sdk.types import ( + DmMember, DmMemberListResponse, - DmMemberCreateResponse, DmMemberDeleteResponse, - DmMemberUpdateResponse, - DmMemberRetrieveResponse, ) from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -31,7 +29,7 @@ def test_method_create(self, client: Whop) -> None: channel_id="channel_id", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -44,7 +42,7 @@ def test_raw_response_create(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = response.parse() - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -57,7 +55,7 @@ def test_streaming_response_create(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = response.parse() - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +65,7 @@ def test_method_retrieve(self, client: Whop) -> None: dm_member = client.dm_members.retrieve( "id", ) - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -79,7 +77,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" dm_member = response.parse() - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -91,7 +89,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = response.parse() - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -109,7 +107,7 @@ def test_method_update(self, client: Whop) -> None: dm_member = client.dm_members.update( id="id", ) - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -119,7 +117,7 @@ def test_method_update_with_all_params(self, client: Whop) -> None: notification_preference="all", status="requested", ) - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -131,7 +129,7 @@ def test_raw_response_update(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = response.parse() - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -143,7 +141,7 @@ def test_streaming_response_update(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = response.parse() - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -256,7 +254,7 @@ async def test_method_create(self, async_client: AsyncWhop) -> None: channel_id="channel_id", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -269,7 +267,7 @@ async def test_raw_response_create(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = await response.parse() - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -282,7 +280,7 @@ async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = await response.parse() - assert_matches_type(DmMemberCreateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +290,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: dm_member = await async_client.dm_members.retrieve( "id", ) - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -304,7 +302,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" dm_member = await response.parse() - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -316,7 +314,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = await response.parse() - assert_matches_type(DmMemberRetrieveResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +332,7 @@ async def test_method_update(self, async_client: AsyncWhop) -> None: dm_member = await async_client.dm_members.update( id="id", ) - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -344,7 +342,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> N notification_preference="all", status="requested", ) - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -356,7 +354,7 @@ async def test_raw_response_update(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = await response.parse() - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -368,7 +366,7 @@ async def test_streaming_response_update(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dm_member = await response.parse() - assert_matches_type(DmMemberUpdateResponse, dm_member, path=["response"]) + assert_matches_type(DmMember, dm_member, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_leads.py b/tests/api_resources/test_leads.py index d9067e03..3be6ddfd 100644 --- a/tests/api_resources/test_leads.py +++ b/tests/api_resources/test_leads.py @@ -9,12 +9,7 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type -from whop_sdk.types import ( - LeadListResponse, - LeadCreateResponse, - LeadUpdateResponse, - LeadRetrieveResponse, -) +from whop_sdk.types import Lead, LeadListResponse from whop_sdk._utils import parse_datetime from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -30,7 +25,7 @@ def test_method_create(self, client: Whop) -> None: lead = client.leads.create( company_id="biz_xxxxxxxxxxxxxx", ) - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -42,7 +37,7 @@ def test_method_create_with_all_params(self, client: Whop) -> None: referrer="referrer", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -54,7 +49,7 @@ def test_raw_response_create(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = response.parse() - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -66,7 +61,7 @@ def test_streaming_response_create(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = response.parse() - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +71,7 @@ def test_method_retrieve(self, client: Whop) -> None: lead = client.leads.retrieve( "lead_xxxxxxxxxxxxx", ) - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -88,7 +83,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" lead = response.parse() - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -100,7 +95,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = response.parse() - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True @@ -118,7 +113,7 @@ def test_method_update(self, client: Whop) -> None: lead = client.leads.update( id="lead_xxxxxxxxxxxxx", ) - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -128,7 +123,7 @@ def test_method_update_with_all_params(self, client: Whop) -> None: metadata={"foo": "bar"}, referrer="referrer", ) - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -140,7 +135,7 @@ def test_raw_response_update(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = response.parse() - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -152,7 +147,7 @@ def test_streaming_response_update(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = response.parse() - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True @@ -225,7 +220,7 @@ async def test_method_create(self, async_client: AsyncWhop) -> None: lead = await async_client.leads.create( company_id="biz_xxxxxxxxxxxxxx", ) - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -237,7 +232,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> N referrer="referrer", user_id="user_xxxxxxxxxxxxx", ) - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -249,7 +244,7 @@ async def test_raw_response_create(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = await response.parse() - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -261,7 +256,7 @@ async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = await response.parse() - assert_matches_type(LeadCreateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True @@ -271,7 +266,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: lead = await async_client.leads.retrieve( "lead_xxxxxxxxxxxxx", ) - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -283,7 +278,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" lead = await response.parse() - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -295,7 +290,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = await response.parse() - assert_matches_type(LeadRetrieveResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True @@ -313,7 +308,7 @@ async def test_method_update(self, async_client: AsyncWhop) -> None: lead = await async_client.leads.update( id="lead_xxxxxxxxxxxxx", ) - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -323,7 +318,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> N metadata={"foo": "bar"}, referrer="referrer", ) - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -335,7 +330,7 @@ async def test_raw_response_update(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = await response.parse() - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -347,7 +342,7 @@ async def test_streaming_response_update(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lead = await response.parse() - assert_matches_type(LeadUpdateResponse, lead, path=["response"]) + assert_matches_type(Lead, lead, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py index 0b13e86c..7106ef79 100644 --- a/tests/api_resources/test_webhooks.py +++ b/tests/api_resources/test_webhooks.py @@ -12,11 +12,10 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type from whop_sdk.types import ( + Webhook, WebhookListResponse, WebhookCreateResponse, WebhookDeleteResponse, - WebhookUpdateResponse, - WebhookRetrieveResponse, ) from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -79,7 +78,7 @@ def test_method_retrieve(self, client: Whop) -> None: webhook = client.webhooks.retrieve( "hook_xxxxxxxxxxxxx", ) - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -91,7 +90,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" webhook = response.parse() - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -103,7 +102,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -121,7 +120,7 @@ def test_method_update(self, client: Whop) -> None: webhook = client.webhooks.update( id="hook_xxxxxxxxxxxxx", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -134,7 +133,7 @@ def test_method_update_with_all_params(self, client: Whop) -> None: events=["invoice.created"], url="https://example.com/path", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -146,7 +145,7 @@ def test_raw_response_update(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -158,7 +157,7 @@ def test_streaming_response_update(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,7 +344,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: webhook = await async_client.webhooks.retrieve( "hook_xxxxxxxxxxxxx", ) - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -357,7 +356,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" webhook = await response.parse() - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -369,7 +368,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookRetrieveResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -387,7 +386,7 @@ async def test_method_update(self, async_client: AsyncWhop) -> None: webhook = await async_client.webhooks.update( id="hook_xxxxxxxxxxxxx", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -400,7 +399,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncWhop) -> N events=["invoice.created"], url="https://example.com/path", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -412,7 +411,7 @@ async def test_raw_response_update(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -424,7 +423,7 @@ async def test_streaming_response_update(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Webhook, webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_withdrawals.py b/tests/api_resources/test_withdrawals.py index 01b619db..485f3c2d 100644 --- a/tests/api_resources/test_withdrawals.py +++ b/tests/api_resources/test_withdrawals.py @@ -9,11 +9,7 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type -from whop_sdk.types import ( - WithdrawalListResponse, - WithdrawalCreateResponse, - WithdrawalRetrieveResponse, -) +from whop_sdk.types import Withdrawal, WithdrawalListResponse from whop_sdk._utils import parse_datetime from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage @@ -31,7 +27,7 @@ def test_method_create(self, client: Whop) -> None: company_id="biz_xxxxxxxxxxxxxx", currency="usd", ) - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -44,7 +40,7 @@ def test_method_create_with_all_params(self, client: Whop) -> None: platform_covers_fees=True, statement_descriptor="statement_descriptor", ) - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -58,7 +54,7 @@ def test_raw_response_create(self, client: Whop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = response.parse() - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -72,7 +68,7 @@ def test_streaming_response_create(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = response.parse() - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +78,7 @@ def test_method_retrieve(self, client: Whop) -> None: withdrawal = client.withdrawals.retrieve( "wdrl_xxxxxxxxxxxxx", ) - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -94,7 +90,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" withdrawal = response.parse() - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -106,7 +102,7 @@ def test_streaming_response_retrieve(self, client: Whop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = response.parse() - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +177,7 @@ async def test_method_create(self, async_client: AsyncWhop) -> None: company_id="biz_xxxxxxxxxxxxxx", currency="usd", ) - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -194,7 +190,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncWhop) -> N platform_covers_fees=True, statement_descriptor="statement_descriptor", ) - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -208,7 +204,7 @@ async def test_raw_response_create(self, async_client: AsyncWhop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = await response.parse() - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -222,7 +218,7 @@ async def test_streaming_response_create(self, async_client: AsyncWhop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = await response.parse() - assert_matches_type(WithdrawalCreateResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) assert cast(Any, response.is_closed) is True @@ -232,7 +228,7 @@ async def test_method_retrieve(self, async_client: AsyncWhop) -> None: withdrawal = await async_client.withdrawals.retrieve( "wdrl_xxxxxxxxxxxxx", ) - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -244,7 +240,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" withdrawal = await response.parse() - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -256,7 +252,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" withdrawal = await response.parse() - assert_matches_type(WithdrawalRetrieveResponse, withdrawal, path=["response"]) + assert_matches_type(Withdrawal, withdrawal, path=["response"]) assert cast(Any, response.is_closed) is True