diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 41dea33..18a5b4e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.32" + ".": "0.0.33" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 00310ca..c14a369 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 178 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-187882c4d823394e3577f9843c288f4187e4f9b38646105c40b88e4e83b27979.yml -openapi_spec_hash: 16eb1c84681dc3ad39c987b7abf1e191 -config_hash: e9bda7cddca13f2b41d8f7521ad36cf5 +configured_endpoints: 180 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-51fb88de05d428f3ea78a4b7ba2d5c6e04ae039816961e810f99d9d5d29bc015.yml +openapi_spec_hash: d59179d7d9a835795741673012f20d79 +config_hash: a9229678a4146beeb5be82ed0ae3d4f1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 679984c..a6f353d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.0.33 (2026-03-12) + +Full Changelog: [v0.0.32...v0.0.33](https://github.com/whopio/whopsdk-python/compare/v0.0.32...v0.0.33) + +### Features + +* **api:** api update ([fa0be9f](https://github.com/whopio/whopsdk-python/commit/fa0be9f1a605b098278a59a92fb9cb297e19c5cc)) +* **api:** manual updates ([95a8539](https://github.com/whopio/whopsdk-python/commit/95a853935639b8d520d545b5e6e647ecc8c287b5)) + ## 0.0.32 (2026-03-11) Full Changelog: [v0.0.30...v0.0.32](https://github.com/whopio/whopsdk-python/compare/v0.0.30...v0.0.32) diff --git a/api.md b/api.md index 2627576..2ba4df4 100644 --- a/api.md +++ b/api.md @@ -161,6 +161,7 @@ from whop_sdk.types import ( CourseLessonInteractionCompletedWebhookEvent, PayoutMethodCreatedWebhookEvent, VerificationSucceededWebhookEvent, + PayoutAccountStatusUpdatedWebhookEvent, PaymentCreatedWebhookEvent, PaymentSucceededWebhookEvent, PaymentFailedWebhookEvent, @@ -749,12 +750,18 @@ Methods: Types: ```python -from whop_sdk.types import VerificationErrorCode, VerificationStatus, VerificationRetrieveResponse +from whop_sdk.types import ( + VerificationErrorCode, + VerificationStatus, + VerificationRetrieveResponse, + VerificationListResponse, +) ``` Methods: - client.verifications.retrieve(id) -> VerificationRetrieveResponse +- client.verifications.list(\*\*params) -> SyncCursorPage[VerificationListResponse] # Leads @@ -901,3 +908,15 @@ Methods: - client.resolution_center_cases.retrieve(id) -> ResolutionCenterCaseRetrieveResponse - client.resolution_center_cases.list(\*\*params) -> SyncCursorPage[ResolutionCenterCaseListResponse] + +# PayoutAccounts + +Types: + +```python +from whop_sdk.types import PayoutAccountCalculatedStatuses, PayoutAccountRetrieveResponse +``` + +Methods: + +- client.payout_accounts.retrieve(id) -> PayoutAccountRetrieveResponse diff --git a/pyproject.toml b/pyproject.toml index 0834754..a996e81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "whop-sdk" -version = "0.0.32" +version = "0.0.33" 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 b9c5cb2..0f28664 100644 --- a/src/whop_sdk/_client.py +++ b/src/whop_sdk/_client.py @@ -77,6 +77,7 @@ course_students, ledger_accounts, payment_methods, + payout_accounts, authorized_users, support_channels, checkout_configurations, @@ -129,6 +130,7 @@ from .resources.course_students import CourseStudentsResource, AsyncCourseStudentsResource from .resources.ledger_accounts import LedgerAccountsResource, AsyncLedgerAccountsResource from .resources.payment_methods import PaymentMethodsResource, AsyncPaymentMethodsResource + from .resources.payout_accounts import PayoutAccountsResource, AsyncPayoutAccountsResource from .resources.authorized_users import AuthorizedUsersResource, AsyncAuthorizedUsersResource from .resources.support_channels import SupportChannelsResource, AsyncSupportChannelsResource from .resources.checkout_configurations import CheckoutConfigurationsResource, AsyncCheckoutConfigurationsResource @@ -522,6 +524,13 @@ def resolution_center_cases(self) -> ResolutionCenterCasesResource: return ResolutionCenterCasesResource(self) + @cached_property + def payout_accounts(self) -> PayoutAccountsResource: + """Payout accounts""" + from .resources.payout_accounts import PayoutAccountsResource + + return PayoutAccountsResource(self) + @cached_property def with_raw_response(self) -> WhopWithRawResponse: return WhopWithRawResponse(self) @@ -1017,6 +1026,13 @@ def resolution_center_cases(self) -> AsyncResolutionCenterCasesResource: return AsyncResolutionCenterCasesResource(self) + @cached_property + def payout_accounts(self) -> AsyncPayoutAccountsResource: + """Payout accounts""" + from .resources.payout_accounts import AsyncPayoutAccountsResource + + return AsyncPayoutAccountsResource(self) + @cached_property def with_raw_response(self) -> AsyncWhopWithRawResponse: return AsyncWhopWithRawResponse(self) @@ -1448,6 +1464,13 @@ def resolution_center_cases(self) -> resolution_center_cases.ResolutionCenterCas return ResolutionCenterCasesResourceWithRawResponse(self._client.resolution_center_cases) + @cached_property + def payout_accounts(self) -> payout_accounts.PayoutAccountsResourceWithRawResponse: + """Payout accounts""" + from .resources.payout_accounts import PayoutAccountsResourceWithRawResponse + + return PayoutAccountsResourceWithRawResponse(self._client.payout_accounts) + class AsyncWhopWithRawResponse: _client: AsyncWhop @@ -1766,6 +1789,13 @@ def resolution_center_cases(self) -> resolution_center_cases.AsyncResolutionCent return AsyncResolutionCenterCasesResourceWithRawResponse(self._client.resolution_center_cases) + @cached_property + def payout_accounts(self) -> payout_accounts.AsyncPayoutAccountsResourceWithRawResponse: + """Payout accounts""" + from .resources.payout_accounts import AsyncPayoutAccountsResourceWithRawResponse + + return AsyncPayoutAccountsResourceWithRawResponse(self._client.payout_accounts) + class WhopWithStreamedResponse: _client: Whop @@ -2084,6 +2114,13 @@ def resolution_center_cases(self) -> resolution_center_cases.ResolutionCenterCas return ResolutionCenterCasesResourceWithStreamingResponse(self._client.resolution_center_cases) + @cached_property + def payout_accounts(self) -> payout_accounts.PayoutAccountsResourceWithStreamingResponse: + """Payout accounts""" + from .resources.payout_accounts import PayoutAccountsResourceWithStreamingResponse + + return PayoutAccountsResourceWithStreamingResponse(self._client.payout_accounts) + class AsyncWhopWithStreamedResponse: _client: AsyncWhop @@ -2406,6 +2443,13 @@ def resolution_center_cases( return AsyncResolutionCenterCasesResourceWithStreamingResponse(self._client.resolution_center_cases) + @cached_property + def payout_accounts(self) -> payout_accounts.AsyncPayoutAccountsResourceWithStreamingResponse: + """Payout accounts""" + from .resources.payout_accounts import AsyncPayoutAccountsResourceWithStreamingResponse + + return AsyncPayoutAccountsResourceWithStreamingResponse(self._client.payout_accounts) + Client = Whop diff --git a/src/whop_sdk/_version.py b/src/whop_sdk/_version.py index aa95ad5..74e0ab8 100644 --- a/src/whop_sdk/_version.py +++ b/src/whop_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "whop_sdk" -__version__ = "0.0.32" # x-release-please-version +__version__ = "0.0.33" # x-release-please-version diff --git a/src/whop_sdk/resources/__init__.py b/src/whop_sdk/resources/__init__.py index 42deaeb..9d6f232 100644 --- a/src/whop_sdk/resources/__init__.py +++ b/src/whop_sdk/resources/__init__.py @@ -360,6 +360,14 @@ PaymentMethodsResourceWithStreamingResponse, AsyncPaymentMethodsResourceWithStreamingResponse, ) +from .payout_accounts import ( + PayoutAccountsResource, + AsyncPayoutAccountsResource, + PayoutAccountsResourceWithRawResponse, + AsyncPayoutAccountsResourceWithRawResponse, + PayoutAccountsResourceWithStreamingResponse, + AsyncPayoutAccountsResourceWithStreamingResponse, +) from .authorized_users import ( AuthorizedUsersResource, AsyncAuthorizedUsersResource, @@ -716,4 +724,10 @@ "AsyncResolutionCenterCasesResourceWithRawResponse", "ResolutionCenterCasesResourceWithStreamingResponse", "AsyncResolutionCenterCasesResourceWithStreamingResponse", + "PayoutAccountsResource", + "AsyncPayoutAccountsResource", + "PayoutAccountsResourceWithRawResponse", + "AsyncPayoutAccountsResourceWithRawResponse", + "PayoutAccountsResourceWithStreamingResponse", + "AsyncPayoutAccountsResourceWithStreamingResponse", ] diff --git a/src/whop_sdk/resources/payout_accounts.py b/src/whop_sdk/resources/payout_accounts.py new file mode 100644 index 0000000..c59b88b --- /dev/null +++ b/src/whop_sdk/resources/payout_accounts.py @@ -0,0 +1,175 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import Body, Query, Headers, NotGiven, not_given +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 .._base_client import make_request_options +from ..types.payout_account_retrieve_response import PayoutAccountRetrieveResponse + +__all__ = ["PayoutAccountsResource", "AsyncPayoutAccountsResource"] + + +class PayoutAccountsResource(SyncAPIResource): + """Payout accounts""" + + @cached_property + def with_raw_response(self) -> PayoutAccountsResourceWithRawResponse: + """ + 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 PayoutAccountsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PayoutAccountsResourceWithStreamingResponse: + """ + 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 PayoutAccountsResourceWithStreamingResponse(self) + + def retrieve( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PayoutAccountRetrieveResponse: + """ + Retrieves the details of an existing payout account. + + Required permissions: + + - `payout:account: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"/payout_accounts/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PayoutAccountRetrieveResponse, + ) + + +class AsyncPayoutAccountsResource(AsyncAPIResource): + """Payout accounts""" + + @cached_property + def with_raw_response(self) -> AsyncPayoutAccountsResourceWithRawResponse: + """ + 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 AsyncPayoutAccountsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPayoutAccountsResourceWithStreamingResponse: + """ + 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 AsyncPayoutAccountsResourceWithStreamingResponse(self) + + async def retrieve( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PayoutAccountRetrieveResponse: + """ + Retrieves the details of an existing payout account. + + Required permissions: + + - `payout:account: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"/payout_accounts/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PayoutAccountRetrieveResponse, + ) + + +class PayoutAccountsResourceWithRawResponse: + def __init__(self, payout_accounts: PayoutAccountsResource) -> None: + self._payout_accounts = payout_accounts + + self.retrieve = to_raw_response_wrapper( + payout_accounts.retrieve, + ) + + +class AsyncPayoutAccountsResourceWithRawResponse: + def __init__(self, payout_accounts: AsyncPayoutAccountsResource) -> None: + self._payout_accounts = payout_accounts + + self.retrieve = async_to_raw_response_wrapper( + payout_accounts.retrieve, + ) + + +class PayoutAccountsResourceWithStreamingResponse: + def __init__(self, payout_accounts: PayoutAccountsResource) -> None: + self._payout_accounts = payout_accounts + + self.retrieve = to_streamed_response_wrapper( + payout_accounts.retrieve, + ) + + +class AsyncPayoutAccountsResourceWithStreamingResponse: + def __init__(self, payout_accounts: AsyncPayoutAccountsResource) -> None: + self._payout_accounts = payout_accounts + + self.retrieve = async_to_streamed_response_wrapper( + payout_accounts.retrieve, + ) diff --git a/src/whop_sdk/resources/verifications.py b/src/whop_sdk/resources/verifications.py index 02f4b65..54364d2 100644 --- a/src/whop_sdk/resources/verifications.py +++ b/src/whop_sdk/resources/verifications.py @@ -2,9 +2,13 @@ from __future__ import annotations +from typing import Optional + import httpx -from .._types import Body, Query, Headers, NotGiven, not_given +from ..types import verification_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -13,7 +17,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import make_request_options +from ..pagination import SyncCursorPage, AsyncCursorPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.verification_list_response import VerificationListResponse from ..types.verification_retrieve_response import VerificationRetrieveResponse __all__ = ["VerificationsResource", "AsyncVerificationsResource"] @@ -76,6 +82,70 @@ def retrieve( cast_to=VerificationRetrieveResponse, ) + def list( + self, + *, + payout_account_id: str, + after: Optional[str] | Omit = omit, + before: 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[VerificationListResponse]: + """ + Returns a list of identity verifications for a payout account, ordered by most + recent first. + + Required permissions: + + - `payout:account:read` + + Args: + payout_account_id: The unique identifier of the payout account to list verifications for. + + 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. + + 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( + "/verifications", + page=SyncCursorPage[VerificationListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "payout_account_id": payout_account_id, + "after": after, + "before": before, + "first": first, + "last": last, + }, + verification_list_params.VerificationListParams, + ), + ), + model=VerificationListResponse, + ) + class AsyncVerificationsResource(AsyncAPIResource): @cached_property @@ -134,6 +204,70 @@ async def retrieve( cast_to=VerificationRetrieveResponse, ) + def list( + self, + *, + payout_account_id: str, + after: Optional[str] | Omit = omit, + before: 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[VerificationListResponse, AsyncCursorPage[VerificationListResponse]]: + """ + Returns a list of identity verifications for a payout account, ordered by most + recent first. + + Required permissions: + + - `payout:account:read` + + Args: + payout_account_id: The unique identifier of the payout account to list verifications for. + + 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. + + 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( + "/verifications", + page=AsyncCursorPage[VerificationListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "payout_account_id": payout_account_id, + "after": after, + "before": before, + "first": first, + "last": last, + }, + verification_list_params.VerificationListParams, + ), + ), + model=VerificationListResponse, + ) + class VerificationsResourceWithRawResponse: def __init__(self, verifications: VerificationsResource) -> None: @@ -142,6 +276,9 @@ def __init__(self, verifications: VerificationsResource) -> None: self.retrieve = to_raw_response_wrapper( verifications.retrieve, ) + self.list = to_raw_response_wrapper( + verifications.list, + ) class AsyncVerificationsResourceWithRawResponse: @@ -151,6 +288,9 @@ def __init__(self, verifications: AsyncVerificationsResource) -> None: self.retrieve = async_to_raw_response_wrapper( verifications.retrieve, ) + self.list = async_to_raw_response_wrapper( + verifications.list, + ) class VerificationsResourceWithStreamingResponse: @@ -160,6 +300,9 @@ def __init__(self, verifications: VerificationsResource) -> None: self.retrieve = to_streamed_response_wrapper( verifications.retrieve, ) + self.list = to_streamed_response_wrapper( + verifications.list, + ) class AsyncVerificationsResourceWithStreamingResponse: @@ -169,3 +312,6 @@ def __init__(self, verifications: AsyncVerificationsResource) -> None: self.retrieve = async_to_streamed_response_wrapper( verifications.retrieve, ) + self.list = async_to_streamed_response_wrapper( + verifications.list, + ) diff --git a/src/whop_sdk/types/__init__.py b/src/whop_sdk/types/__init__.py index 54d1942..6c2549b 100644 --- a/src/whop_sdk/types/__init__.py +++ b/src/whop_sdk/types/__init__.py @@ -228,6 +228,7 @@ from .refund_retrieve_response import RefundRetrieveResponse as RefundRetrieveResponse from .review_retrieve_response import ReviewRetrieveResponse as ReviewRetrieveResponse from .setup_intent_list_params import SetupIntentListParams as SetupIntentListParams +from .verification_list_params import VerificationListParams as VerificationListParams from .withdrawal_create_params import WithdrawalCreateParams as WithdrawalCreateParams from .withdrawal_list_response import WithdrawalListResponse as WithdrawalListResponse from .assessment_question_types import AssessmentQuestionTypes as AssessmentQuestionTypes @@ -256,6 +257,7 @@ from .setup_intent_list_response import SetupIntentListResponse as SetupIntentListResponse from .user_check_access_response import UserCheckAccessResponse as UserCheckAccessResponse from .user_update_profile_params import UserUpdateProfileParams as UserUpdateProfileParams +from .verification_list_response import VerificationListResponse as VerificationListResponse from .authorized_user_list_params import AuthorizedUserListParams as AuthorizedUserListParams from .course_lesson_create_params import CourseLessonCreateParams as CourseLessonCreateParams from .course_lesson_list_response import CourseLessonListResponse as CourseLessonListResponse @@ -307,11 +309,13 @@ from .course_student_retrieve_response import CourseStudentRetrieveResponse as CourseStudentRetrieveResponse from .ledger_account_retrieve_response import LedgerAccountRetrieveResponse as LedgerAccountRetrieveResponse from .payment_method_retrieve_response import PaymentMethodRetrieveResponse as PaymentMethodRetrieveResponse +from .payout_account_retrieve_response import PayoutAccountRetrieveResponse as PayoutAccountRetrieveResponse from .withdrawal_created_webhook_event import WithdrawalCreatedWebhookEvent as WithdrawalCreatedWebhookEvent from .withdrawal_updated_webhook_event import WithdrawalUpdatedWebhookEvent as WithdrawalUpdatedWebhookEvent from .resolution_center_case_issue_type import ResolutionCenterCaseIssueType as ResolutionCenterCaseIssueType from .checkout_configuration_list_params import CheckoutConfigurationListParams as CheckoutConfigurationListParams from .membership_activated_webhook_event import MembershipActivatedWebhookEvent as MembershipActivatedWebhookEvent +from .payout_account_calculated_statuses import PayoutAccountCalculatedStatuses as PayoutAccountCalculatedStatuses from .resolution_center_case_list_params import ResolutionCenterCaseListParams as ResolutionCenterCaseListParams from .dispute_alert_created_webhook_event import DisputeAlertCreatedWebhookEvent as DisputeAlertCreatedWebhookEvent from .payout_method_created_webhook_event import PayoutMethodCreatedWebhookEvent as PayoutMethodCreatedWebhookEvent @@ -361,6 +365,9 @@ from .setup_intent_requires_action_webhook_event import ( SetupIntentRequiresActionWebhookEvent as SetupIntentRequiresActionWebhookEvent, ) +from .payout_account_status_updated_webhook_event import ( + PayoutAccountStatusUpdatedWebhookEvent as PayoutAccountStatusUpdatedWebhookEvent, +) from .course_lesson_interaction_completed_webhook_event import ( CourseLessonInteractionCompletedWebhookEvent as CourseLessonInteractionCompletedWebhookEvent, ) diff --git a/src/whop_sdk/types/ledger_account_retrieve_response.py b/src/whop_sdk/types/ledger_account_retrieve_response.py index 423eda6..50434cc 100644 --- a/src/whop_sdk/types/ledger_account_retrieve_response.py +++ b/src/whop_sdk/types/ledger_account_retrieve_response.py @@ -8,6 +8,7 @@ from .shared.currency import Currency from .verification_status import VerificationStatus from .verification_error_code import VerificationErrorCode +from .payout_account_calculated_statuses import PayoutAccountCalculatedStatuses __all__ = [ "LedgerAccountRetrieveResponse", @@ -165,6 +166,12 @@ class PayoutAccountDetails(BaseModel): phone: Optional[str] = None """The business representative's phone""" + status: Optional[PayoutAccountCalculatedStatuses] = None + """ + The granular calculated statuses reflecting payout account KYC and withdrawal + readiness. + """ + class LedgerAccountRetrieveResponse(BaseModel): """ diff --git a/src/whop_sdk/types/payout_account_calculated_statuses.py b/src/whop_sdk/types/payout_account_calculated_statuses.py new file mode 100644 index 0000000..0efd5f1 --- /dev/null +++ b/src/whop_sdk/types/payout_account_calculated_statuses.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__ = ["PayoutAccountCalculatedStatuses"] + +PayoutAccountCalculatedStatuses: TypeAlias = Literal[ + "connected", "disabled", "action_required", "pending_verification", "verification_failed", "not_started" +] diff --git a/src/whop_sdk/types/payout_account_retrieve_response.py b/src/whop_sdk/types/payout_account_retrieve_response.py new file mode 100644 index 0000000..e62f2df --- /dev/null +++ b/src/whop_sdk/types/payout_account_retrieve_response.py @@ -0,0 +1,101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode +from .payout_account_calculated_statuses import PayoutAccountCalculatedStatuses + +__all__ = ["PayoutAccountRetrieveResponse", "Address", "BusinessRepresentative", "LatestVerification"] + + +class Address(BaseModel): + """The physical address associated with this payout account""" + + city: Optional[str] = None + """The city of the address.""" + + country: Optional[str] = None + """The country of the address.""" + + line1: Optional[str] = None + """The line 1 of the address.""" + + line2: Optional[str] = None + """The line 2 of the address.""" + + postal_code: Optional[str] = None + """The postal code of the address.""" + + state: Optional[str] = None + """The state of the address.""" + + +class BusinessRepresentative(BaseModel): + """The business representative for this payout account""" + + date_of_birth: Optional[str] = None + """ + The date of birth of the business representative in ISO 8601 format + (YYYY-MM-DD). + """ + + first_name: Optional[str] = None + """The first name of the business representative.""" + + last_name: Optional[str] = None + """The last name of the business representative.""" + + middle_name: Optional[str] = None + """The middle name of the business representative.""" + + +class LatestVerification(BaseModel): + """The latest verification for the connected account.""" + + id: str + """The unique identifier for the verification.""" + + last_error_code: Optional[VerificationErrorCode] = None + """An error code for a verification attempt.""" + + last_error_reason: Optional[str] = None + """A human-readable explanation of the most recent verification error. + + Null if no error has occurred. + """ + + status: VerificationStatus + """The current status of this verification session.""" + + +class PayoutAccountRetrieveResponse(BaseModel): + """An object representing an account used for payouts.""" + + id: str + """The unique identifier for the payout account.""" + + address: Optional[Address] = None + """The physical address associated with this payout account""" + + business_name: Optional[str] = None + """The company's legal name""" + + business_representative: Optional[BusinessRepresentative] = None + """The business representative for this payout account""" + + email: Optional[str] = None + """The email address of the representative""" + + latest_verification: Optional[LatestVerification] = None + """The latest verification for the connected account.""" + + phone: Optional[str] = None + """The business representative's phone""" + + status: Optional[PayoutAccountCalculatedStatuses] = None + """ + The granular calculated statuses reflecting payout account KYC and withdrawal + readiness. + """ diff --git a/src/whop_sdk/types/payout_account_status_updated_webhook_event.py b/src/whop_sdk/types/payout_account_status_updated_webhook_event.py new file mode 100644 index 0000000..2c5cb05 --- /dev/null +++ b/src/whop_sdk/types/payout_account_status_updated_webhook_event.py @@ -0,0 +1,129 @@ +# 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 .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode +from .payout_account_calculated_statuses import PayoutAccountCalculatedStatuses + +__all__ = [ + "PayoutAccountStatusUpdatedWebhookEvent", + "Data", + "DataAddress", + "DataBusinessRepresentative", + "DataLatestVerification", +] + + +class DataAddress(BaseModel): + """The physical address associated with this payout account""" + + city: Optional[str] = None + """The city of the address.""" + + country: Optional[str] = None + """The country of the address.""" + + line1: Optional[str] = None + """The line 1 of the address.""" + + line2: Optional[str] = None + """The line 2 of the address.""" + + postal_code: Optional[str] = None + """The postal code of the address.""" + + state: Optional[str] = None + """The state of the address.""" + + +class DataBusinessRepresentative(BaseModel): + """The business representative for this payout account""" + + date_of_birth: Optional[str] = None + """ + The date of birth of the business representative in ISO 8601 format + (YYYY-MM-DD). + """ + + first_name: Optional[str] = None + """The first name of the business representative.""" + + last_name: Optional[str] = None + """The last name of the business representative.""" + + middle_name: Optional[str] = None + """The middle name of the business representative.""" + + +class DataLatestVerification(BaseModel): + """The latest verification for the connected account.""" + + id: str + """The unique identifier for the verification.""" + + last_error_code: Optional[VerificationErrorCode] = None + """An error code for a verification attempt.""" + + last_error_reason: Optional[str] = None + """A human-readable explanation of the most recent verification error. + + Null if no error has occurred. + """ + + status: VerificationStatus + """The current status of this verification session.""" + + +class Data(BaseModel): + """An object representing an account used for payouts.""" + + id: str + """The unique identifier for the payout account.""" + + address: Optional[DataAddress] = None + """The physical address associated with this payout account""" + + business_name: Optional[str] = None + """The company's legal name""" + + business_representative: Optional[DataBusinessRepresentative] = None + """The business representative for this payout account""" + + email: Optional[str] = None + """The email address of the representative""" + + latest_verification: Optional[DataLatestVerification] = None + """The latest verification for the connected account.""" + + phone: Optional[str] = None + """The business representative's phone""" + + status: Optional[PayoutAccountCalculatedStatuses] = None + """ + The granular calculated statuses reflecting payout account KYC and withdrawal + readiness. + """ + + +class PayoutAccountStatusUpdatedWebhookEvent(BaseModel): + id: str + """A unique ID for every single webhook request""" + + api_version: Literal["v1"] + """The API version for this webhook""" + + data: Data + """An object representing an account used for payouts.""" + + timestamp: datetime + """The timestamp in ISO 8601 format that the webhook was sent at on the server""" + + type: Literal["payout_account.status_updated"] + """The webhook event type""" + + company_id: Optional[str] = None + """The company ID that this webhook event is associated with""" diff --git a/src/whop_sdk/types/unwrap_webhook_event.py b/src/whop_sdk/types/unwrap_webhook_event.py index f2df30c..78041be 100644 --- a/src/whop_sdk/types/unwrap_webhook_event.py +++ b/src/whop_sdk/types/unwrap_webhook_event.py @@ -30,6 +30,7 @@ from .setup_intent_succeeded_webhook_event import SetupIntentSucceededWebhookEvent from .verification_succeeded_webhook_event import VerificationSucceededWebhookEvent from .setup_intent_requires_action_webhook_event import SetupIntentRequiresActionWebhookEvent +from .payout_account_status_updated_webhook_event import PayoutAccountStatusUpdatedWebhookEvent from .course_lesson_interaction_completed_webhook_event import CourseLessonInteractionCompletedWebhookEvent from .membership_cancel_at_period_end_changed_webhook_event import MembershipCancelAtPeriodEndChangedWebhookEvent @@ -55,6 +56,7 @@ CourseLessonInteractionCompletedWebhookEvent, PayoutMethodCreatedWebhookEvent, VerificationSucceededWebhookEvent, + PayoutAccountStatusUpdatedWebhookEvent, PaymentCreatedWebhookEvent, PaymentSucceededWebhookEvent, PaymentFailedWebhookEvent, diff --git a/src/whop_sdk/types/verification_list_params.py b/src/whop_sdk/types/verification_list_params.py new file mode 100644 index 0000000..64ad931 --- /dev/null +++ b/src/whop_sdk/types/verification_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 Required, TypedDict + +__all__ = ["VerificationListParams"] + + +class VerificationListParams(TypedDict, total=False): + payout_account_id: Required[str] + """The unique identifier of the payout account to list verifications for.""" + + 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.""" + + 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/verification_list_response.py b/src/whop_sdk/types/verification_list_response.py new file mode 100644 index 0000000..413c360 --- /dev/null +++ b/src/whop_sdk/types/verification_list_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .verification_status import VerificationStatus +from .verification_error_code import VerificationErrorCode + +__all__ = ["VerificationListResponse"] + + +class VerificationListResponse(BaseModel): + """ + An identity verification session used to confirm a person or entity's identity for payout account eligibility. + """ + + id: str + """The unique identifier for the verification.""" + + last_error_code: Optional[VerificationErrorCode] = None + """An error code for a verification attempt.""" + + last_error_reason: Optional[str] = None + """A human-readable explanation of the most recent verification error. + + Null if no error has occurred. + """ + + status: VerificationStatus + """The current status of this verification session.""" diff --git a/src/whop_sdk/types/webhook_event.py b/src/whop_sdk/types/webhook_event.py index aa7e050..e2a5415 100644 --- a/src/whop_sdk/types/webhook_event.py +++ b/src/whop_sdk/types/webhook_event.py @@ -23,6 +23,7 @@ "course_lesson_interaction.completed", "payout_method.created", "verification.succeeded", + "payout_account.status_updated", "payment.created", "payment.succeeded", "payment.failed", diff --git a/tests/api_resources/test_payout_accounts.py b/tests/api_resources/test_payout_accounts.py new file mode 100644 index 0000000..62f50bb --- /dev/null +++ b/tests/api_resources/test_payout_accounts.py @@ -0,0 +1,108 @@ +# 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 PayoutAccountRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPayoutAccounts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Whop) -> None: + payout_account = client.payout_accounts.retrieve( + "poact_xxxxxxxxxxxx", + ) + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Whop) -> None: + response = client.payout_accounts.with_raw_response.retrieve( + "poact_xxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + payout_account = response.parse() + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Whop) -> None: + with client.payout_accounts.with_streaming_response.retrieve( + "poact_xxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + payout_account = response.parse() + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_retrieve(self, client: Whop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.payout_accounts.with_raw_response.retrieve( + "", + ) + + +class TestAsyncPayoutAccounts: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncWhop) -> None: + payout_account = await async_client.payout_accounts.retrieve( + "poact_xxxxxxxxxxxx", + ) + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncWhop) -> None: + response = await async_client.payout_accounts.with_raw_response.retrieve( + "poact_xxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + payout_account = await response.parse() + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncWhop) -> None: + async with async_client.payout_accounts.with_streaming_response.retrieve( + "poact_xxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + payout_account = await response.parse() + assert_matches_type(PayoutAccountRetrieveResponse, payout_account, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncWhop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.payout_accounts.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_verifications.py b/tests/api_resources/test_verifications.py index fc53afc..e1499ae 100644 --- a/tests/api_resources/test_verifications.py +++ b/tests/api_resources/test_verifications.py @@ -9,7 +9,8 @@ from whop_sdk import Whop, AsyncWhop from tests.utils import assert_matches_type -from whop_sdk.types import VerificationRetrieveResponse +from whop_sdk.types import VerificationListResponse, VerificationRetrieveResponse +from whop_sdk.pagination import SyncCursorPage, AsyncCursorPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -59,6 +60,52 @@ def test_path_params_retrieve(self, client: Whop) -> None: "", ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Whop) -> None: + verification = client.verifications.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) + assert_matches_type(SyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Whop) -> None: + verification = client.verifications.list( + payout_account_id="poact_xxxxxxxxxxxx", + after="after", + before="before", + first=42, + last=42, + ) + assert_matches_type(SyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Whop) -> None: + response = client.verifications.with_raw_response.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(SyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Whop) -> None: + with client.verifications.with_streaming_response.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(SyncCursorPage[VerificationListResponse], verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncVerifications: parametrize = pytest.mark.parametrize( @@ -106,3 +153,49 @@ async def test_path_params_retrieve(self, async_client: AsyncWhop) -> None: await async_client.verifications.with_raw_response.retrieve( "", ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncWhop) -> None: + verification = await async_client.verifications.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) + assert_matches_type(AsyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncWhop) -> None: + verification = await async_client.verifications.list( + payout_account_id="poact_xxxxxxxxxxxx", + after="after", + before="before", + first=42, + last=42, + ) + assert_matches_type(AsyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncWhop) -> None: + response = await async_client.verifications.with_raw_response.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(AsyncCursorPage[VerificationListResponse], verification, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncWhop) -> None: + async with async_client.verifications.with_streaming_response.list( + payout_account_id="poact_xxxxxxxxxxxx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(AsyncCursorPage[VerificationListResponse], verification, path=["response"]) + + assert cast(Any, response.is_closed) is True