Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"standardwebhooks": ">=1.0.1,<2"
}
},
"originGitCommit": "ff2450c6036035e738f20a7d3753e5fb1280dbce",
"originGitCommit": "eea321a91ed2676465b46487d515e3f8493188be",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "2.3.0",
Expand Down
8 changes: 7 additions & 1 deletion .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 28 additions & 4 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -11546,7 +11546,7 @@ client.bounty_submissions.submit(
<dl>
<dd>

Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
Lists the card transactions of an account or a user, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -11595,7 +11595,15 @@ client.card_transactions.list(
<dl>
<dd>

**account_id:** `typing.Optional[str]` — The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account.
**account_id:** `typing.Optional[str]` — The account whose card transactions to list, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

</dd>
</dl>

<dl>
<dd>

**user_id:** `typing.Optional[str]` — The user whose personal card transactions to list, prefixed `user_`. Provide this or `account_id`. Only that user can read them.

</dd>
</dl>
Expand Down Expand Up @@ -11772,7 +11780,15 @@ client.card_transactions.retrieve(
<dl>
<dd>

**account_id:** `typing.Optional[str]` — The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account.
**account_id:** `typing.Optional[str]` — The account that owns the transaction, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

</dd>
</dl>

<dl>
<dd>

**user_id:** `typing.Optional[str]` — The user that owns the transaction, prefixed `user_`. Provide this or `account_id`. Only that user can read it.

</dd>
</dl>
Expand Down Expand Up @@ -43188,7 +43204,7 @@ client.users.list()
<dl>
<dd>

Retrieves the authenticated user — the self view of the user object. Same shape as `GET /users/{id}`, with the self-only fields populated: `email` (email-read scope), `staff` (Whop staff only, staff-read scope), `balance` and `earnings_usd` (balance-read scope), the opt-in `balance_history`, and every linked social account.
Retrieves the authenticated user — the self view of the user object. Same shape as `GET /users/{id}`, with the self-only fields populated: `email` (email-read scope), `staff` (Whop staff only, staff-read scope), `balance`, `cards` and `earnings_usd` (balance-read scope), the opt-in `balance_history`, and every linked social account.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -52530,6 +52546,14 @@ client.users.preferences.update()
<dl>
<dd>

**cards_auto_top_up:** `typing.Optional[bool]` — Whether incoming funds, including pending balance, are automatically moved to the user's personal cards balance. Requires a cards balance and the `payout:account:update` permission.

</dd>
</dl>

<dl>
<dd>

**investigation_enabled:** `typing.Optional[bool]` — Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access.

</dd>
Expand Down
38 changes: 30 additions & 8 deletions src/whop_sdk/card_transactions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def list(
self,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
transaction_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
card_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
cardholder_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
Expand All @@ -47,12 +48,15 @@ def list(
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[CardTransaction, ListCardTransactionsResponse]:
"""
Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
Lists the card transactions of an account or a user, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.

Parameters
----------
account_id : typing.Optional[str]
The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account.
The account whose card transactions to list, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user whose personal card transactions to list, prefixed `user_`. Provide this or `account_id`. Only that user can read them.

transaction_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Return only these card transactions, each prefixed `citx_`. Repeat the parameter, or pass one comma-separated value.
Expand Down Expand Up @@ -120,6 +124,7 @@ def list(
"""
return self._raw_client.list(
account_id=account_id,
user_id=user_id,
transaction_ids=transaction_ids,
card_id=card_id,
cardholder_id=cardholder_id,
Expand All @@ -140,6 +145,7 @@ def retrieve(
id: str,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> CardTransaction:
"""
Expand All @@ -151,7 +157,10 @@ def retrieve(
The card transaction ID, prefixed `citx_`.

account_id : typing.Optional[str]
The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account.
The account that owns the transaction, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user that owns the transaction, prefixed `user_`. Provide this or `account_id`. Only that user can read it.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -174,7 +183,9 @@ def retrieve(
id="id",
)
"""
_response = self._raw_client.retrieve(id, account_id=account_id, request_options=request_options)
_response = self._raw_client.retrieve(
id, account_id=account_id, user_id=user_id, request_options=request_options
)
return _response.data


Expand All @@ -197,6 +208,7 @@ async def list(
self,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
transaction_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
card_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
cardholder_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
Expand All @@ -212,12 +224,15 @@ async def list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[CardTransaction, ListCardTransactionsResponse]:
"""
Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
Lists the card transactions of an account or a user, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.

Parameters
----------
account_id : typing.Optional[str]
The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account.
The account whose card transactions to list, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user whose personal card transactions to list, prefixed `user_`. Provide this or `account_id`. Only that user can read them.

transaction_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Return only these card transactions, each prefixed `citx_`. Repeat the parameter, or pass one comma-separated value.
Expand Down Expand Up @@ -294,6 +309,7 @@ async def main() -> None:
"""
return await self._raw_client.list(
account_id=account_id,
user_id=user_id,
transaction_ids=transaction_ids,
card_id=card_id,
cardholder_id=cardholder_id,
Expand All @@ -314,6 +330,7 @@ async def retrieve(
id: str,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> CardTransaction:
"""
Expand All @@ -325,7 +342,10 @@ async def retrieve(
The card transaction ID, prefixed `citx_`.

account_id : typing.Optional[str]
The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account.
The account that owns the transaction, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user that owns the transaction, prefixed `user_`. Provide this or `account_id`. Only that user can read it.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand Down Expand Up @@ -356,5 +376,7 @@ async def main() -> None:

asyncio.run(main())
"""
_response = await self._raw_client.retrieve(id, account_id=account_id, request_options=request_options)
_response = await self._raw_client.retrieve(
id, account_id=account_id, user_id=user_id, request_options=request_options
)
return _response.data
34 changes: 28 additions & 6 deletions src/whop_sdk/card_transactions/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def list(
self,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
transaction_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
card_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
cardholder_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
Expand All @@ -46,12 +47,15 @@ def list(
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[CardTransaction, ListCardTransactionsResponse]:
"""
Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
Lists the card transactions of an account or a user, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.

Parameters
----------
account_id : typing.Optional[str]
The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account.
The account whose card transactions to list, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user whose personal card transactions to list, prefixed `user_`. Provide this or `account_id`. Only that user can read them.

transaction_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Return only these card transactions, each prefixed `citx_`. Repeat the parameter, or pass one comma-separated value.
Expand Down Expand Up @@ -103,6 +107,7 @@ def list(
method="GET",
params={
"account_id": account_id,
"user_id": user_id,
"transaction_ids": transaction_ids,
"card_id": card_id,
"cardholder_id": cardholder_id,
Expand Down Expand Up @@ -135,6 +140,7 @@ def list(
_has_next = _parsed_next is not None and _parsed_next != ""
_get_next = lambda: self.list(
account_id=account_id,
user_id=user_id,
transaction_ids=transaction_ids,
card_id=card_id,
cardholder_id=cardholder_id,
Expand Down Expand Up @@ -197,6 +203,7 @@ def retrieve(
id: str,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CardTransaction]:
"""
Expand All @@ -208,7 +215,10 @@ def retrieve(
The card transaction ID, prefixed `citx_`.

account_id : typing.Optional[str]
The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account.
The account that owns the transaction, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user that owns the transaction, prefixed `user_`. Provide this or `account_id`. Only that user can read it.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -224,6 +234,7 @@ def retrieve(
method="GET",
params={
"account_id": account_id,
"user_id": user_id,
},
request_options=request_options,
)
Expand Down Expand Up @@ -288,6 +299,7 @@ async def list(
self,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
transaction_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
card_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
cardholder_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
Expand All @@ -303,12 +315,15 @@ async def list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[CardTransaction, ListCardTransactionsResponse]:
"""
Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.
Lists the card transactions of an account or a user, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them.

Parameters
----------
account_id : typing.Optional[str]
The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account.
The account whose card transactions to list, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user whose personal card transactions to list, prefixed `user_`. Provide this or `account_id`. Only that user can read them.

transaction_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Return only these card transactions, each prefixed `citx_`. Repeat the parameter, or pass one comma-separated value.
Expand Down Expand Up @@ -360,6 +375,7 @@ async def list(
method="GET",
params={
"account_id": account_id,
"user_id": user_id,
"transaction_ids": transaction_ids,
"card_id": card_id,
"cardholder_id": cardholder_id,
Expand Down Expand Up @@ -394,6 +410,7 @@ async def list(
async def _get_next():
return await self.list(
account_id=account_id,
user_id=user_id,
transaction_ids=transaction_ids,
card_id=card_id,
cardholder_id=cardholder_id,
Expand Down Expand Up @@ -457,6 +474,7 @@ async def retrieve(
id: str,
*,
account_id: typing.Optional[str] = None,
user_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CardTransaction]:
"""
Expand All @@ -468,7 +486,10 @@ async def retrieve(
The card transaction ID, prefixed `citx_`.

account_id : typing.Optional[str]
The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account.
The account that owns the transaction, prefixed `biz_`. Provide this or `user_id`. Defaults to the credential's account.

user_id : typing.Optional[str]
The user that owns the transaction, prefixed `user_`. Provide this or `account_id`. Only that user can read it.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -484,6 +505,7 @@ async def retrieve(
method="GET",
params={
"account_id": account_id,
"user_id": user_id,
},
request_options=request_options,
)
Expand Down
6 changes: 6 additions & 0 deletions src/whop_sdk/types/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .account_cards import AccountCards
from .trading_account import TradingAccount
from .user_balance import UserBalance
from .user_balance_history import UserBalanceHistory
Expand Down Expand Up @@ -34,6 +35,11 @@ class User(UniversalBaseModel):
The user's biography
"""

cards: typing.Optional[AccountCards] = pydantic.Field(default=None)
"""
Where the user's personal card application stands. Populated only on the self view (retrieved with the reserved id `me`) for callers with balance-read scope; `null` otherwise, or when the user has never applied for a card.
"""

created_at: str = pydantic.Field()
"""
When the user was created, as an ISO 8601 timestamp
Expand Down
Loading
Loading