DonationResource (client.donation)¶
Endpoints: • donation.getManyPaginated (cursor-paginated) • donation.getTotalDonations
.collect_all()¶
Fetch all items across all pages concurrently using parallel time-slicing.
Signature¶
await client.donation.collect_all(**kwargs: 'typing.Any') -> 'list[Donation]'
Parameters¶
| Name | Type | Default |
|---|---|---|
kwargs |
Any |
Required |
Return Models¶
Donation¶
A donation made to a military unit, country, or party.
| Field | Type | Required |
|---|---|---|
_id |
string |
Optional |
__v |
integer |
Optional |
userId |
string |
Optional |
muId |
string |
Optional |
countryId |
string |
Optional |
partyId |
string |
Optional |
amount |
number |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
.get_paginated()¶
Get donations (cursor-paginated), filtered by target entity.
At least one of mu_id, country_id, or party_id is recommended.
Args:
direction: "forward" (default) or "backward" pagination.
Signature¶
await client.donation.get_paginated(*, mu_id: 'str | None' = None, country_id: 'str | None' = None, party_id: 'str | None' = None, limit: 'int' = 20, cursor: 'str | None' = None, direction: 'str | None' = None, auto_items: 'bool' = False, max_pages: 'int | float' = inf, cursor_end: 'str | None' = None) -> 'CursorPage[Donation] | AsyncIterator[Donation]'
Parameters¶
| Name | Type | Default |
|---|---|---|
mu_id |
str |
None |
country_id |
str |
None |
party_id |
str |
None |
limit |
int |
20 |
cursor |
str |
None |
direction |
str |
None |
auto_items |
bool |
False |
max_pages |
int | float |
inf |
cursor_end |
str |
None |
Return Models¶
CursorPage[Donation]¶
| Field | Type | Required |
|---|---|---|
_id |
string |
Optional |
__v |
integer |
Optional |
items |
array[Donation] |
Required |
nextCursor |
string |
Optional |
hasMore |
boolean |
Optional |
Donation¶
A donation made to a military unit, country, or party.
| Field | Type | Required |
|---|---|---|
_id |
string |
Optional |
__v |
integer |
Optional |
userId |
string |
Optional |
muId |
string |
Optional |
countryId |
string |
Optional |
partyId |
string |
Optional |
amount |
number |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
.get_totals()¶
Get aggregate donation totals (total amount and donor count) for a target.
Args: mu_id: Military unit to aggregate for. country_id: Country to aggregate for. party_id: Party to aggregate for.
Signature¶
await client.donation.get_totals(*, mu_id: 'str | None' = None, country_id: 'str | None' = None, party_id: 'str | None' = None) -> 'DonationTotals'
Parameters¶
| Name | Type | Default |
|---|---|---|
mu_id |
str |
None |
country_id |
str |
None |
party_id |
str |
None |
Return Models¶
DonationTotals¶
Aggregate donation totals for a target.
| Field | Type | Required |
|---|---|---|
_id |
string |
Optional |
__v |
integer |
Optional |
totalAmount |
number |
Optional |
donorCount |
integer |
Optional |
.invalidate_cache()¶
Clear the SWR cache for all resources.
Signature¶
await client.donation.invalidate_cache() -> 'None'