From d81def31c6a38ad5972605a6054bf701bcaad6be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 07:55:50 +0000 Subject: [PATCH 01/20] chore: remove custom code --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index befbd83..3956d52 100644 --- a/uv.lock +++ b/uv.lock @@ -770,7 +770,7 @@ wheels = [ [[package]] name = "neptune-api-v2" -version = "0.0.1" +version = "0.1.0" source = { editable = "." } dependencies = [ { name = "anyio" }, From 64bfdf0f0f702d71e05b37a490f1ced871af27d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 02:31:07 +0000 Subject: [PATCH 02/20] feat(api): api update --- .stats.yml | 4 +- api.md | 3 - ..._get_loans_originated_by_asset_response.py | 5 +- .../history_get_loans_originated_response.py | 2 - .../market_get_current_state_response.py | 2 - .../nept_unlocks_distribution_response.py | 2 - .../types/asset_get_price_history_response.py | 2 - .../types/asset_list_prices_response.py | 2 - .../types/asset_list_response.py | 2 - .../types/asset_price_history.py | 3 +- .../types/asset_rate_history.py | 3 +- src/neptune_api_v2/types/error_kind.py | 1 - .../market_get_merged_by_asset_response.py | 2 - .../types/market_get_merged_response.py | 2 - .../types/market_get_overview_response.py | 2 - .../types/market_get_params_response.py | 2 - .../borrow/borrow_collateral_market.py | 2 + .../markets/borrow/borrow_debt_market.py | 2 + .../collateral_get_by_asset_response.py | 3 +- .../borrow/collateral_list_response.py | 2 - .../borrow/debt_get_by_asset_response.py | 3 +- .../markets/borrow/debt_list_response.py | 2 - .../markets/borrow_get_overview_response.py | 2 - .../borrow_get_rate_history_response.py | 2 - .../markets/lend_get_by_asset_response.py | 3 +- .../markets/lend_get_rate_history_response.py | 2 - .../types/markets/lend_list_response.py | 2 - .../types/markets/lend_market.py | 2 + .../types/nept_get_params_response.py | 2 - .../nept_get_staking_overview_response.py | 7 +- .../types/nept_get_state_response.py | 2 - src/neptune_api_v2/types/nept_params.py | 8 +- src/neptune_api_v2/types/nept_state.py | 2 +- src/neptune_api_v2/types/staking_pool_full.py | 2 +- ...unt_get_subaccount_collaterals_response.py | 2 - ...ubaccount_get_subaccount_debts_response.py | 2 - ...baccount_get_subaccount_health_response.py | 2 - .../subaccount_get_subaccount_response.py | 3 +- .../borrow/user_borrow_market_account.py | 2 + .../borrow/user_collateral_account_pool.py | 7 + .../market/borrow/user_debt_account_pool.py | 7 + ...t_collateral_accounts_by_asset_response.py | 2 - .../borrow_get_collateral_totals_response.py | 2 - ...row_get_debt_accounts_by_asset_response.py | 2 - .../borrow_get_debts_totals_response.py | 2 - .../market/borrow_get_portfolio_response.py | 2 - .../user/market/lend_get_by_asset_response.py | 177 +++++++++++++++++- .../types/user/market/lend_list_response.py | 6 +- .../types/user/market/user_lend_market.py | 175 ++++++++++++++++- .../market_get_merged_by_asset_response.py | 2 - .../types/user/market_get_merged_response.py | 2 - .../user/market_get_portfolio_response.py | 2 - .../nept/staking_get_overview_response.py | 2 - .../nept/staking_get_staking_pool_response.py | 2 - .../staking_get_staking_pools_response.py | 2 - .../nept/staking_get_unstaking_response.py | 2 - .../types/user/nept/user_stake_pool.py | 2 +- .../types/user/nept_get_unlocks_response.py | 2 - .../types/user/user_merged_market.py | 144 ++++++++++---- .../types/user/wallet_balance.py | 2 + .../wallet_get_balance_by_asset_response.py | 3 +- .../user/wallet_get_balances_response.py | 2 - .../types/user_get_tx_history_response.py | 2 - .../types/user_get_user_response.py | 2 - 64 files changed, 504 insertions(+), 151 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6e0347a..9a6794e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-5768d4f43166406f5b74235f2dd9e91082bd67a7b182ca05d5df55604ebedd7e.yml -openapi_spec_hash: 2c5da98fd945fbfc68611634b7aa7042 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-09b5978b7e7d59cea96f054720bdf341353c0678caacf5ba5a1667027805e60d.yml +openapi_spec_hash: 67359dbd4d14a0f1a5c11e25084c33f0 config_hash: fa0efc29593602eac57523d55bc83fa6 diff --git a/api.md b/api.md index 7fbed9f..6ada779 100644 --- a/api.md +++ b/api.md @@ -7,13 +7,10 @@ from neptune_api_v2.types import ( ErrorData, ErrorDataVariants, ErrorKind, - ErrorResponseVariants, ErrorScope, FieldValidationError, Interval, IntervalUnit, - ListErrorResponse, - ObjErrorResponse, ValidationErrorData, ValidationFieldSource, ) diff --git a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py index d54dbe9..47c68d0 100644 --- a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py +++ b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py @@ -55,6 +55,8 @@ class DataSeriesPoint(BaseModel): class DataSeries(BaseModel): + """Item and associated points""" + asset: AssetSpec """Provides a unique identifier for an asset for use throughout the Neptune API. @@ -77,12 +79,9 @@ class Data(BaseModel): """ series: List[DataSeries] - """Pairs of items and their associated points""" class HistoryGetLoansOriginatedByAssetResponse(BaseModel): - """Object data success response""" - data: Data """Historical cumulative lend value for assets""" diff --git a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py index 1cd56be..ebe9adc 100644 --- a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py +++ b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py @@ -57,8 +57,6 @@ class Data(BaseModel): class HistoryGetLoansOriginatedResponse(BaseModel): - """Object data success response""" - data: Data """Historical cumulative lend value for assets""" diff --git a/src/neptune_api_v2/types/analytics/market_get_current_state_response.py b/src/neptune_api_v2/types/analytics/market_get_current_state_response.py index 1690a67..42751c6 100644 --- a/src/neptune_api_v2/types/analytics/market_get_current_state_response.py +++ b/src/neptune_api_v2/types/analytics/market_get_current_state_response.py @@ -57,8 +57,6 @@ class Data(BaseModel): class MarketGetCurrentStateResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/analytics/nept_unlocks_distribution_response.py b/src/neptune_api_v2/types/analytics/nept_unlocks_distribution_response.py index ab881cc..0e7116f 100644 --- a/src/neptune_api_v2/types/analytics/nept_unlocks_distribution_response.py +++ b/src/neptune_api_v2/types/analytics/nept_unlocks_distribution_response.py @@ -13,8 +13,6 @@ class Data(BaseModel): class NeptUnlocksDistributionResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/asset_get_price_history_response.py b/src/neptune_api_v2/types/asset_get_price_history_response.py index ed9ddeb..eec3a6d 100644 --- a/src/neptune_api_v2/types/asset_get_price_history_response.py +++ b/src/neptune_api_v2/types/asset_get_price_history_response.py @@ -7,8 +7,6 @@ class AssetGetPriceHistoryResponse(BaseModel): - """Object data success response""" - data: AssetPriceHistory """Historical prices for assets""" diff --git a/src/neptune_api_v2/types/asset_list_prices_response.py b/src/neptune_api_v2/types/asset_list_prices_response.py index 993366a..a10a7fd 100644 --- a/src/neptune_api_v2/types/asset_list_prices_response.py +++ b/src/neptune_api_v2/types/asset_list_prices_response.py @@ -41,8 +41,6 @@ class Data(BaseModel): class AssetListPricesResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/asset_list_response.py b/src/neptune_api_v2/types/asset_list_response.py index b3d758d..9909471 100644 --- a/src/neptune_api_v2/types/asset_list_response.py +++ b/src/neptune_api_v2/types/asset_list_response.py @@ -9,8 +9,6 @@ class AssetListResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/asset_price_history.py b/src/neptune_api_v2/types/asset_price_history.py index cc8a290..5415461 100644 --- a/src/neptune_api_v2/types/asset_price_history.py +++ b/src/neptune_api_v2/types/asset_price_history.py @@ -48,6 +48,8 @@ class SeriesPoint(BaseModel): class Series(BaseModel): + """Item and associated points""" + asset: AssetSpec """Provides a unique identifier for an asset for use throughout the Neptune API. @@ -70,4 +72,3 @@ class AssetPriceHistory(BaseModel): """ series: List[Series] - """Pairs of items and their associated points""" diff --git a/src/neptune_api_v2/types/asset_rate_history.py b/src/neptune_api_v2/types/asset_rate_history.py index 8e9e2e0..5efe115 100644 --- a/src/neptune_api_v2/types/asset_rate_history.py +++ b/src/neptune_api_v2/types/asset_rate_history.py @@ -48,6 +48,8 @@ class SeriesPoint(BaseModel): class Series(BaseModel): + """Item and associated points""" + asset: AssetSpec """Provides a unique identifier for an asset for use throughout the Neptune API. @@ -70,4 +72,3 @@ class AssetRateHistory(BaseModel): """ series: List[Series] - """Pairs of items and their associated points""" diff --git a/src/neptune_api_v2/types/error_kind.py b/src/neptune_api_v2/types/error_kind.py index 22bfb93..4234456 100644 --- a/src/neptune_api_v2/types/error_kind.py +++ b/src/neptune_api_v2/types/error_kind.py @@ -17,6 +17,5 @@ "json_decode", "json_body_deserialize_failure", "content_type_unsupported", - "validation", "internal", ] diff --git a/src/neptune_api_v2/types/market_get_merged_by_asset_response.py b/src/neptune_api_v2/types/market_get_merged_by_asset_response.py index f4f7b41..68237f2 100644 --- a/src/neptune_api_v2/types/market_get_merged_by_asset_response.py +++ b/src/neptune_api_v2/types/market_get_merged_by_asset_response.py @@ -7,8 +7,6 @@ class MarketGetMergedByAssetResponse(BaseModel): - """Object data success response""" - data: MergedMarket """Data for all of an assets markets""" diff --git a/src/neptune_api_v2/types/market_get_merged_response.py b/src/neptune_api_v2/types/market_get_merged_response.py index 48030cf..5e9f7b9 100644 --- a/src/neptune_api_v2/types/market_get_merged_response.py +++ b/src/neptune_api_v2/types/market_get_merged_response.py @@ -9,8 +9,6 @@ class MarketGetMergedResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/market_get_overview_response.py b/src/neptune_api_v2/types/market_get_overview_response.py index 27c0c45..16d25d2 100644 --- a/src/neptune_api_v2/types/market_get_overview_response.py +++ b/src/neptune_api_v2/types/market_get_overview_response.py @@ -22,8 +22,6 @@ class Data(BaseModel): class MarketGetOverviewResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/market_get_params_response.py b/src/neptune_api_v2/types/market_get_params_response.py index 6f08b8a..abb8df0 100644 --- a/src/neptune_api_v2/types/market_get_params_response.py +++ b/src/neptune_api_v2/types/market_get_params_response.py @@ -7,8 +7,6 @@ class MarketGetParamsResponse(BaseModel): - """Object data success response""" - data: GlobalMarketConfig error: None = None diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_market.py b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_market.py index 04432a7..46e793f 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_market.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_market.py @@ -9,6 +9,8 @@ class BorrowCollateralMarket(BaseModel): + """Borrowing market, collateral info""" + asset_info: AssetInfo """Asset identifiers with associated metadata""" diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py index 4adf326..6299a63 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py @@ -12,6 +12,8 @@ class BorrowDebtMarket(BaseModel): + """Borrowing market, debt info""" + asset_info: AssetInfo """Asset identifiers with associated metadata""" diff --git a/src/neptune_api_v2/types/markets/borrow/collateral_get_by_asset_response.py b/src/neptune_api_v2/types/markets/borrow/collateral_get_by_asset_response.py index 1ef8032..30b484d 100644 --- a/src/neptune_api_v2/types/markets/borrow/collateral_get_by_asset_response.py +++ b/src/neptune_api_v2/types/markets/borrow/collateral_get_by_asset_response.py @@ -7,9 +7,8 @@ class CollateralGetByAssetResponse(BaseModel): - """Object data success response""" - data: BorrowCollateralMarket + """Borrowing market, collateral info""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py b/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py index f1e49c6..1a0e9be 100644 --- a/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py +++ b/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py @@ -9,8 +9,6 @@ class CollateralListResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/markets/borrow/debt_get_by_asset_response.py b/src/neptune_api_v2/types/markets/borrow/debt_get_by_asset_response.py index 8ef143a..7386a7e 100644 --- a/src/neptune_api_v2/types/markets/borrow/debt_get_by_asset_response.py +++ b/src/neptune_api_v2/types/markets/borrow/debt_get_by_asset_response.py @@ -7,9 +7,8 @@ class DebtGetByAssetResponse(BaseModel): - """Object data success response""" - data: BorrowDebtMarket + """Borrowing market, debt info""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/borrow/debt_list_response.py b/src/neptune_api_v2/types/markets/borrow/debt_list_response.py index 4c79060..080479d 100644 --- a/src/neptune_api_v2/types/markets/borrow/debt_list_response.py +++ b/src/neptune_api_v2/types/markets/borrow/debt_list_response.py @@ -9,8 +9,6 @@ class DebtListResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/markets/borrow_get_overview_response.py b/src/neptune_api_v2/types/markets/borrow_get_overview_response.py index 027ed45..7b0da01 100644 --- a/src/neptune_api_v2/types/markets/borrow_get_overview_response.py +++ b/src/neptune_api_v2/types/markets/borrow_get_overview_response.py @@ -7,8 +7,6 @@ class BorrowGetOverviewResponse(BaseModel): - """Object data success response""" - data: BorrowMarketOverview error: None = None diff --git a/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py b/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py index cb43c85..60dcfba 100644 --- a/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py +++ b/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py @@ -7,8 +7,6 @@ class BorrowGetRateHistoryResponse(BaseModel): - """Object data success response""" - data: AssetRateHistory """Historical rates for assets""" diff --git a/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py b/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py index 9b7c1f2..6f99e48 100644 --- a/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py +++ b/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py @@ -7,9 +7,8 @@ class LendGetByAssetResponse(BaseModel): - """Object data success response""" - data: LendMarket + """Lending market overview""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py b/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py index 59deeae..095ea67 100644 --- a/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py +++ b/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py @@ -7,8 +7,6 @@ class LendGetRateHistoryResponse(BaseModel): - """Object data success response""" - data: AssetRateHistory """Historical rates for assets""" diff --git a/src/neptune_api_v2/types/markets/lend_list_response.py b/src/neptune_api_v2/types/markets/lend_list_response.py index 40d25fd..4d013b0 100644 --- a/src/neptune_api_v2/types/markets/lend_list_response.py +++ b/src/neptune_api_v2/types/markets/lend_list_response.py @@ -9,8 +9,6 @@ class LendListResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/markets/lend_market.py b/src/neptune_api_v2/types/markets/lend_market.py index 77c468f..748ce43 100644 --- a/src/neptune_api_v2/types/markets/lend_market.py +++ b/src/neptune_api_v2/types/markets/lend_market.py @@ -11,6 +11,8 @@ class LendMarket(BaseModel): + """Lending market overview""" + asset_info: AssetInfo """Asset identifiers with associated metadata""" diff --git a/src/neptune_api_v2/types/nept_get_params_response.py b/src/neptune_api_v2/types/nept_get_params_response.py index e246773..fab0c56 100644 --- a/src/neptune_api_v2/types/nept_get_params_response.py +++ b/src/neptune_api_v2/types/nept_get_params_response.py @@ -7,8 +7,6 @@ class NeptGetParamsResponse(BaseModel): - """Object data success response""" - data: NeptParams error: None = None diff --git a/src/neptune_api_v2/types/nept_get_staking_overview_response.py b/src/neptune_api_v2/types/nept_get_staking_overview_response.py index 8badf4a..ce0c503 100644 --- a/src/neptune_api_v2/types/nept_get_staking_overview_response.py +++ b/src/neptune_api_v2/types/nept_get_staking_overview_response.py @@ -56,15 +56,10 @@ class Data(BaseModel): """Staking state values that are not directly associated to a pool""" pools: List[StakingPoolFull] - """Staking pool contract parameter. - - List of available staking pools - """ + """List of available staking pools""" class NeptGetStakingOverviewResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/nept_get_state_response.py b/src/neptune_api_v2/types/nept_get_state_response.py index 8594aa7..3c00f4f 100644 --- a/src/neptune_api_v2/types/nept_get_state_response.py +++ b/src/neptune_api_v2/types/nept_get_state_response.py @@ -7,8 +7,6 @@ class NeptGetStateResponse(BaseModel): - """Object data success response""" - data: NeptState error: None = None diff --git a/src/neptune_api_v2/types/nept_params.py b/src/neptune_api_v2/types/nept_params.py index 714a0a2..24c9519 100644 --- a/src/neptune_api_v2/types/nept_params.py +++ b/src/neptune_api_v2/types/nept_params.py @@ -3,6 +3,7 @@ from typing import List, Optional from .._models import BaseModel +from .asset_info import AssetInfo from .staking_pool_params import StakingPoolParams __all__ = [ @@ -89,7 +90,7 @@ class StakingPoolExtra(BaseModel): class StakingPool(BaseModel): - """Merges `StakingPool` with `StakingPoolParams`""" + """Staking pool contents along with associated pool params""" duration: int """The lockup duration for this pool in seconds""" @@ -104,13 +105,16 @@ class StakingPool(BaseModel): class NeptParams(BaseModel): + asset_info: AssetInfo + """Asset identifiers with associated metadata""" + emission_rate: str """The emission rate of NEPT in tokens per year""" extra: Extra staking_pools: List[StakingPool] - """Staking pools (pool params are included)""" + """Staking pools""" tokens_per_weight: int """Weight:token scaling factor diff --git a/src/neptune_api_v2/types/nept_state.py b/src/neptune_api_v2/types/nept_state.py index 59c6a2a..522d55d 100644 --- a/src/neptune_api_v2/types/nept_state.py +++ b/src/neptune_api_v2/types/nept_state.py @@ -107,7 +107,7 @@ class StakingExtra(BaseModel): class Staking(BaseModel): - """Merges `StakingPool` with `StakingPoolState`""" + """Staking pool contents along with associated pool state""" duration: int """The lockup duration for this pool in seconds""" diff --git a/src/neptune_api_v2/types/staking_pool_full.py b/src/neptune_api_v2/types/staking_pool_full.py index bd003a1..c99c563 100644 --- a/src/neptune_api_v2/types/staking_pool_full.py +++ b/src/neptune_api_v2/types/staking_pool_full.py @@ -29,7 +29,7 @@ class Extra(BaseModel): class StakingPoolFull(BaseModel): - """Merges `StakingPool` with both `StakingPoolWithParams` and `StakingPoolState`""" + """Staking pool contents along with associated pool state and pool params""" duration: int """The lockup duration for this pool in seconds""" diff --git a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_collaterals_response.py b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_collaterals_response.py index 6cb10c5..82094b3 100644 --- a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_collaterals_response.py +++ b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_collaterals_response.py @@ -9,8 +9,6 @@ class SubaccountGetSubaccountCollateralsResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_debts_response.py b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_debts_response.py index d6709bf..fb9f516 100644 --- a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_debts_response.py +++ b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_debts_response.py @@ -9,8 +9,6 @@ class SubaccountGetSubaccountDebtsResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_health_response.py b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_health_response.py index fd48d28..a4c9991 100644 --- a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_health_response.py +++ b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_health_response.py @@ -7,8 +7,6 @@ class SubaccountGetSubaccountHealthResponse(BaseModel): - """Object data success response""" - data: UserAccountHealth error: None = None diff --git a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_response.py b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_response.py index 993fcb7..7fff0f1 100644 --- a/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_response.py +++ b/src/neptune_api_v2/types/user/market/borrow/subaccount_get_subaccount_response.py @@ -7,9 +7,8 @@ class SubaccountGetSubaccountResponse(BaseModel): - """Object data success response""" - data: UserBorrowMarketAccount + """User borrowing subaccount""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py b/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py index 19ebffd..9d05d50 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py @@ -11,6 +11,8 @@ class UserBorrowMarketAccount(BaseModel): + """User borrowing subaccount""" + collaterals: List[UserCollateralAssetPool] """Account collateral allocations""" diff --git a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py index 67f11af..a6236f4 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py @@ -59,6 +59,13 @@ class Extra(BaseModel): class UserCollateralAccountPool(BaseModel): + """Associates a subaccount's index with it's inner allocations for a given asset. + + This type is identical to `UserCollateralAssetPool`, except the asset association is interchanged for an account index. + + Typically used in contexts where multiple subaccounts with a shared underlying asset are batched together. + """ + amount: str """Amount of this asset which is actively collateralized""" diff --git a/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py index 74931f5..4025779 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py @@ -71,6 +71,13 @@ class Extra(BaseModel): class UserDebtAccountPool(BaseModel): + """Associates a subaccount's index with it's inner allocations for a given asset. + + This type is identical to `UserDebtAssetPool`, except the asset association is interchanged for an account index. + + Typically used in contexts where multiple subaccounts with a shared underlying asset are batched together. + """ + debt: str """Sum open debt amount (this is simply the principal + interest)""" diff --git a/src/neptune_api_v2/types/user/market/borrow_get_collateral_accounts_by_asset_response.py b/src/neptune_api_v2/types/user/market/borrow_get_collateral_accounts_by_asset_response.py index 61c4f7d..b0a66ef 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_collateral_accounts_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_collateral_accounts_by_asset_response.py @@ -18,8 +18,6 @@ class Data(BaseModel): class BorrowGetCollateralAccountsByAssetResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/user/market/borrow_get_collateral_totals_response.py b/src/neptune_api_v2/types/user/market/borrow_get_collateral_totals_response.py index 392c30f..f59d2c4 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_collateral_totals_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_collateral_totals_response.py @@ -9,8 +9,6 @@ class BorrowGetCollateralTotalsResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py b/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py index c13cb66..8228f4b 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py @@ -18,8 +18,6 @@ class Data(BaseModel): class BorrowGetDebtAccountsByAssetResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/user/market/borrow_get_debts_totals_response.py b/src/neptune_api_v2/types/user/market/borrow_get_debts_totals_response.py index 0280984..c00b48d 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_debts_totals_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_debts_totals_response.py @@ -9,8 +9,6 @@ class BorrowGetDebtsTotalsResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/market/borrow_get_portfolio_response.py b/src/neptune_api_v2/types/user/market/borrow_get_portfolio_response.py index b85f86d..61f8ac1 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_portfolio_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_portfolio_response.py @@ -7,8 +7,6 @@ class BorrowGetPortfolioResponse(BaseModel): - """Object data success response""" - data: UserBorrowMarket error: None = None diff --git a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py index c19d8e3..db63946 100644 --- a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py @@ -1,15 +1,182 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from ...._models import BaseModel -from .borrow.user_debt_asset_pool import UserDebtAssetPool +from ...asset_info import AssetInfo -__all__ = ["LendGetByAssetResponse"] +__all__ = [ + "LendGetByAssetResponse", + "Data", + "DataOriginEquivalent", + "DataOriginEquivalentExtra", + "DataOriginEquivalentExtraText", + "DataReceiptAmounts", + "DataReceiptAmountsExtra", + "DataReceiptAmountsExtraText", + "DataReceiptAmountsExtraValue", + "DataReceiptAmountsExtraValueExtra", + "DataReceiptAmountsExtraValueExtraText", +] -class LendGetByAssetResponse(BaseModel): - """Object data success response""" +class DataOriginEquivalentExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class DataOriginEquivalentExtra(BaseModel): + text: Optional[DataOriginEquivalentExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DataOriginEquivalent(BaseModel): + """ + The lending amounts converted into the equivalent for the receipt token's origin/source asset + """ + + collateralized: str + """ + Total equivalent amount of origin token collateralized across this user's + borrowing portfolio + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` + """ + + extra: DataOriginEquivalentExtra + + held: str + """Total equivalent amount of origin token held in address balance + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_held = receipt_held / receipt_redemption_ratio` + """ + + total: str + """Total of held and collateralized equivalent for origin asset + + Or, more formally: + `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` + """ + + +class DataReceiptAmountsExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class DataReceiptAmountsExtraValueExtraText(BaseModel): + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ - data: UserDebtAssetPool + collateralized: str + + held: str + + total: str + + +class DataReceiptAmountsExtraValueExtra(BaseModel): + text: Optional[DataReceiptAmountsExtraValueExtraText] = None + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ + + +class DataReceiptAmountsExtraValue(BaseModel): + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + """ + + collateralized: str + + extra: DataReceiptAmountsExtraValueExtra + + held: str + + total: str + + +class DataReceiptAmountsExtra(BaseModel): + text: Optional[DataReceiptAmountsExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + value: Optional[DataReceiptAmountsExtraValue] = None + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + """ + + +class DataReceiptAmounts(BaseModel): + """The lending amounts in the original receipt token amounts""" + + collateralized: str + """ + Total amount of receipt token collateralized across this user's borrowing + portfolio + """ + + extra: DataReceiptAmountsExtra + + held: str + """Total amount of receipt token held in address balance""" + + total: str + """Sum of receipt amount held and receipt amount collateralized""" + + +class Data(BaseModel): + asset_info: AssetInfo + """Asset identifiers with associated metadata""" + + origin_equivalent: DataOriginEquivalent + """ + The lending amounts converted into the equivalent for the receipt token's + origin/source asset + """ + + receipt_amounts: DataReceiptAmounts + """The lending amounts in the original receipt token amounts""" + + +class LendGetByAssetResponse(BaseModel): + data: Data error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/market/lend_list_response.py b/src/neptune_api_v2/types/user/market/lend_list_response.py index f90512d..8996586 100644 --- a/src/neptune_api_v2/types/user/market/lend_list_response.py +++ b/src/neptune_api_v2/types/user/market/lend_list_response.py @@ -3,18 +3,16 @@ from typing import List from ...._models import BaseModel -from .borrow.user_debt_asset_pool import UserDebtAssetPool +from .user_lend_market import UserLendMarket __all__ = ["LendListResponse"] class LendListResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" - data: List[UserDebtAssetPool] + data: List[UserLendMarket] error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/market/user_lend_market.py b/src/neptune_api_v2/types/user/market/user_lend_market.py index 0263e20..4c0531a 100644 --- a/src/neptune_api_v2/types/user/market/user_lend_market.py +++ b/src/neptune_api_v2/types/user/market/user_lend_market.py @@ -1,13 +1,180 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from ...._models import BaseModel -from .borrow.user_debt_asset_pool import UserDebtAssetPool +from ...asset_info import AssetInfo -__all__ = ["UserLendMarket"] +__all__ = [ + "UserLendMarket", + "AssetPool", + "AssetPoolOriginEquivalent", + "AssetPoolOriginEquivalentExtra", + "AssetPoolOriginEquivalentExtraText", + "AssetPoolReceiptAmounts", + "AssetPoolReceiptAmountsExtra", + "AssetPoolReceiptAmountsExtraText", + "AssetPoolReceiptAmountsExtraValue", + "AssetPoolReceiptAmountsExtraValueExtra", + "AssetPoolReceiptAmountsExtraValueExtraText", +] + + +class AssetPoolOriginEquivalentExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class AssetPoolOriginEquivalentExtra(BaseModel): + text: Optional[AssetPoolOriginEquivalentExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class AssetPoolOriginEquivalent(BaseModel): + """ + The lending amounts converted into the equivalent for the receipt token's origin/source asset + """ + + collateralized: str + """ + Total equivalent amount of origin token collateralized across this user's + borrowing portfolio + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` + """ + + extra: AssetPoolOriginEquivalentExtra + + held: str + """Total equivalent amount of origin token held in address balance + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_held = receipt_held / receipt_redemption_ratio` + """ + + total: str + """Total of held and collateralized equivalent for origin asset + + Or, more formally: + `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` + """ + + +class AssetPoolReceiptAmountsExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class AssetPoolReceiptAmountsExtraValueExtraText(BaseModel): + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ + + collateralized: str + + held: str + + total: str + + +class AssetPoolReceiptAmountsExtraValueExtra(BaseModel): + text: Optional[AssetPoolReceiptAmountsExtraValueExtraText] = None + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ + + +class AssetPoolReceiptAmountsExtraValue(BaseModel): + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + """ + + collateralized: str + + extra: AssetPoolReceiptAmountsExtraValueExtra + + held: str + + total: str + + +class AssetPoolReceiptAmountsExtra(BaseModel): + text: Optional[AssetPoolReceiptAmountsExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + value: Optional[AssetPoolReceiptAmountsExtraValue] = None + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + """ + + +class AssetPoolReceiptAmounts(BaseModel): + """The lending amounts in the original receipt token amounts""" + + collateralized: str + """ + Total amount of receipt token collateralized across this user's borrowing + portfolio + """ + + extra: AssetPoolReceiptAmountsExtra + + held: str + """Total amount of receipt token held in address balance""" + + total: str + """Sum of receipt amount held and receipt amount collateralized""" + + +class AssetPool(BaseModel): + asset_info: AssetInfo + """Asset identifiers with associated metadata""" + + origin_equivalent: AssetPoolOriginEquivalent + """ + The lending amounts converted into the equivalent for the receipt token's + origin/source asset + """ + + receipt_amounts: AssetPoolReceiptAmounts + """The lending amounts in the original receipt token amounts""" class UserLendMarket(BaseModel): - asset_pools: List[UserDebtAssetPool] + asset_pools: List[AssetPool] """User lending allocations""" diff --git a/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py b/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py index 061fd50..7898897 100644 --- a/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py @@ -7,8 +7,6 @@ class MarketGetMergedByAssetResponse(BaseModel): - """Object data success response""" - data: UserMergedMarket error: None = None diff --git a/src/neptune_api_v2/types/user/market_get_merged_response.py b/src/neptune_api_v2/types/user/market_get_merged_response.py index faeb17f..fb68ff2 100644 --- a/src/neptune_api_v2/types/user/market_get_merged_response.py +++ b/src/neptune_api_v2/types/user/market_get_merged_response.py @@ -9,8 +9,6 @@ class MarketGetMergedResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/market_get_portfolio_response.py b/src/neptune_api_v2/types/user/market_get_portfolio_response.py index 11eb072..e41a091 100644 --- a/src/neptune_api_v2/types/user/market_get_portfolio_response.py +++ b/src/neptune_api_v2/types/user/market_get_portfolio_response.py @@ -7,8 +7,6 @@ class MarketGetPortfolioResponse(BaseModel): - """Object data success response""" - data: UserMarket error: None = None diff --git a/src/neptune_api_v2/types/user/nept/staking_get_overview_response.py b/src/neptune_api_v2/types/user/nept/staking_get_overview_response.py index 6c3e290..c774232 100644 --- a/src/neptune_api_v2/types/user/nept/staking_get_overview_response.py +++ b/src/neptune_api_v2/types/user/nept/staking_get_overview_response.py @@ -7,8 +7,6 @@ class StakingGetOverviewResponse(BaseModel): - """Object data success response""" - data: UserStake error: None = None diff --git a/src/neptune_api_v2/types/user/nept/staking_get_staking_pool_response.py b/src/neptune_api_v2/types/user/nept/staking_get_staking_pool_response.py index 609b590..ec01fef 100644 --- a/src/neptune_api_v2/types/user/nept/staking_get_staking_pool_response.py +++ b/src/neptune_api_v2/types/user/nept/staking_get_staking_pool_response.py @@ -7,8 +7,6 @@ class StakingGetStakingPoolResponse(BaseModel): - """Object data success response""" - data: UserStakePool error: None = None diff --git a/src/neptune_api_v2/types/user/nept/staking_get_staking_pools_response.py b/src/neptune_api_v2/types/user/nept/staking_get_staking_pools_response.py index 1689c3d..b58a39f 100644 --- a/src/neptune_api_v2/types/user/nept/staking_get_staking_pools_response.py +++ b/src/neptune_api_v2/types/user/nept/staking_get_staking_pools_response.py @@ -9,8 +9,6 @@ class StakingGetStakingPoolsResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user/nept/staking_get_unstaking_response.py b/src/neptune_api_v2/types/user/nept/staking_get_unstaking_response.py index 7f9f8b9..ebfe72f 100644 --- a/src/neptune_api_v2/types/user/nept/staking_get_unstaking_response.py +++ b/src/neptune_api_v2/types/user/nept/staking_get_unstaking_response.py @@ -25,8 +25,6 @@ class Data(BaseModel): class StakingGetUnstakingResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/user/nept/user_stake_pool.py b/src/neptune_api_v2/types/user/nept/user_stake_pool.py index 73728fc..2ffc84d 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake_pool.py +++ b/src/neptune_api_v2/types/user/nept/user_stake_pool.py @@ -69,7 +69,7 @@ class UserStakePool(BaseModel): """ common: StakingPoolFull - """Merges `StakingPool` with both `StakingPoolWithParams` and `StakingPoolState`""" + """Staking pool contents along with associated pool state and pool params""" contents: List[UserStakeBondingEntry] """Bonding/stake entries diff --git a/src/neptune_api_v2/types/user/nept_get_unlocks_response.py b/src/neptune_api_v2/types/user/nept_get_unlocks_response.py index 3988e5d..dfb9f10 100644 --- a/src/neptune_api_v2/types/user/nept_get_unlocks_response.py +++ b/src/neptune_api_v2/types/user/nept_get_unlocks_response.py @@ -7,8 +7,6 @@ class NeptGetUnlocksResponse(BaseModel): - """Object data success response""" - data: UserUnlockOverview error: None = None diff --git a/src/neptune_api_v2/types/user/user_merged_market.py b/src/neptune_api_v2/types/user/user_merged_market.py index 41aab6d..7d22870 100644 --- a/src/neptune_api_v2/types/user/user_merged_market.py +++ b/src/neptune_api_v2/types/user/user_merged_market.py @@ -20,11 +20,15 @@ "BorrowDebtExtraValueExtra", "BorrowDebtExtraValueExtraText", "Lend", - "LendExtra", - "LendExtraText", - "LendExtraValue", - "LendExtraValueExtra", - "LendExtraValueExtraText", + "LendOriginEquivalent", + "LendOriginEquivalentExtra", + "LendOriginEquivalentExtraText", + "LendReceiptAmounts", + "LendReceiptAmountsExtra", + "LendReceiptAmountsExtraText", + "LendReceiptAmountsExtraValue", + "LendReceiptAmountsExtraValueExtra", + "LendReceiptAmountsExtraValueExtraText", ] @@ -168,82 +172,158 @@ class BorrowDebt(BaseModel): """Initial amount borrowed (of debts which have not yet been repaid)""" -class LendExtraText(BaseModel): +class LendOriginEquivalentExtraText(BaseModel): """Human-readable field variants. Will not be null when query param `with_text` is `true`. """ - debt: str + collateralized: str - interest: str + held: str - principal: str + total: str + + +class LendOriginEquivalentExtra(BaseModel): + text: Optional[LendOriginEquivalentExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class LendOriginEquivalent(BaseModel): + """ + The lending amounts converted into the equivalent for the receipt token's origin/source asset + """ + + collateralized: str + """ + Total equivalent amount of origin token collateralized across this user's + borrowing portfolio + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. -class LendExtraValueExtraText(BaseModel): + Or, more formally: + `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` + """ + + extra: LendOriginEquivalentExtra + + held: str + """Total equivalent amount of origin token held in address balance + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_held = receipt_held / receipt_redemption_ratio` + """ + + total: str + """Total of held and collateralized equivalent for origin asset + + Or, more formally: + `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` + """ + + +class LendReceiptAmountsExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class LendReceiptAmountsExtraValueExtraText(BaseModel): """Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. """ - debt: str + collateralized: str - interest: str + held: str - principal: str + total: str -class LendExtraValueExtra(BaseModel): - text: Optional[LendExtraValueExtraText] = None +class LendReceiptAmountsExtraValueExtra(BaseModel): + text: Optional[LendReceiptAmountsExtraValueExtraText] = None """Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. """ -class LendExtraValue(BaseModel): +class LendReceiptAmountsExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. """ - debt: str + collateralized: str - extra: LendExtraValueExtra + extra: LendReceiptAmountsExtraValueExtra - interest: str + held: str - principal: str + total: str -class LendExtra(BaseModel): - text: Optional[LendExtraText] = None +class LendReceiptAmountsExtra(BaseModel): + text: Optional[LendReceiptAmountsExtraText] = None """Human-readable field variants. Will not be null when query param `with_text` is `true`. """ - value: Optional[LendExtraValue] = None + value: Optional[LendReceiptAmountsExtraValue] = None """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. """ -class Lend(BaseModel): - """User contirbution for asset's lending market, if one exists""" +class LendReceiptAmounts(BaseModel): + """The lending amounts in the original receipt token amounts""" - debt: str - """Sum open debt amount (this is simply the principal + interest)""" + collateralized: str + """ + Total amount of receipt token collateralized across this user's borrowing + portfolio + """ - extra: LendExtra + extra: LendReceiptAmountsExtra - interest: str - """Sum of accrued interest for open debt position""" + held: str + """Total amount of receipt token held in address balance""" - principal: str - """Initial amount borrowed (of debts which have not yet been repaid)""" + total: str + """Sum of receipt amount held and receipt amount collateralized""" + + +class Lend(BaseModel): + """User contirbution for asset's lending market, if one exists""" + + origin_equivalent: LendOriginEquivalent + """ + The lending amounts converted into the equivalent for the receipt token's + origin/source asset + """ + + receipt_amounts: LendReceiptAmounts + """The lending amounts in the original receipt token amounts""" class UserMergedMarket(BaseModel): diff --git a/src/neptune_api_v2/types/user/wallet_balance.py b/src/neptune_api_v2/types/user/wallet_balance.py index 558a560..845f4e5 100644 --- a/src/neptune_api_v2/types/user/wallet_balance.py +++ b/src/neptune_api_v2/types/user/wallet_balance.py @@ -8,6 +8,8 @@ class WalletBalance(BaseModel): + """Asset and balance contents for a given wallet""" + asset: AssetSpec """Provides a unique identifier for an asset for use throughout the Neptune API. diff --git a/src/neptune_api_v2/types/user/wallet_get_balance_by_asset_response.py b/src/neptune_api_v2/types/user/wallet_get_balance_by_asset_response.py index 325172a..b4eaff8 100644 --- a/src/neptune_api_v2/types/user/wallet_get_balance_by_asset_response.py +++ b/src/neptune_api_v2/types/user/wallet_get_balance_by_asset_response.py @@ -7,9 +7,8 @@ class WalletGetBalanceByAssetResponse(BaseModel): - """Object data success response""" - data: WalletBalance + """Asset and balance contents for a given wallet""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/wallet_get_balances_response.py b/src/neptune_api_v2/types/user/wallet_get_balances_response.py index 3e6bf1f..9e2dc22 100644 --- a/src/neptune_api_v2/types/user/wallet_get_balances_response.py +++ b/src/neptune_api_v2/types/user/wallet_get_balances_response.py @@ -23,8 +23,6 @@ class Data(BaseModel): class WalletGetBalancesResponse(BaseModel): - """Object data success response""" - data: Data error: None = None diff --git a/src/neptune_api_v2/types/user_get_tx_history_response.py b/src/neptune_api_v2/types/user_get_tx_history_response.py index 74154dc..d8f5875 100644 --- a/src/neptune_api_v2/types/user_get_tx_history_response.py +++ b/src/neptune_api_v2/types/user_get_tx_history_response.py @@ -9,8 +9,6 @@ class UserGetTxHistoryResponse(BaseModel): - """List data success response""" - count: int """Total number of objects irrespective of any pagination parameters.""" diff --git a/src/neptune_api_v2/types/user_get_user_response.py b/src/neptune_api_v2/types/user_get_user_response.py index 8449c66..bd37b72 100644 --- a/src/neptune_api_v2/types/user_get_user_response.py +++ b/src/neptune_api_v2/types/user_get_user_response.py @@ -7,8 +7,6 @@ class UserGetUserResponse(BaseModel): - """Object data success response""" - data: User error: None = None From a2daaa306f5c0ea3c17d2816d25ab9eaf90f058c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 16:46:25 +0000 Subject: [PATCH 03/20] feat(api): api update --- .stats.yml | 4 +- src/neptune_api_v2/types/asset_price.py | 4 +- .../borrow/borrow_collateral_config.py | 22 +- .../markets/borrow/borrow_collateral_state.py | 20 ++ .../markets/borrow/borrow_debt_config.py | 22 +- .../markets/borrow/borrow_debt_market.py | 4 +- .../markets/borrow/borrow_debt_market_data.py | 4 +- .../types/markets/borrow/borrow_debt_state.py | 41 ++-- .../types/markets/lend_market.py | 4 +- .../types/markets/lend_market_data.py | 4 +- .../types/markets/lend_market_state.py | 20 ++ src/neptune_api_v2/types/nept_params.py | 20 ++ src/neptune_api_v2/types/nept_state.py | 20 ++ .../types/nept_unlock_distribution_group.py | 20 ++ .../types/staking_pool_state.py | 20 ++ .../borrow/user_borrow_market_account.py | 4 + .../borrow/user_collateral_account_pool.py | 20 ++ .../borrow/user_collateral_asset_pool.py | 20 ++ .../market/borrow/user_debt_account_pool.py | 42 ++-- .../market/borrow/user_debt_asset_pool.py | 44 ++-- ...row_get_debt_accounts_by_asset_response.py | 4 + .../user/market/lend_get_by_asset_response.py | 24 +++ .../user/market/user_borrow_market_pools.py | 4 + .../types/user/market/user_lend_market.py | 27 +++ .../market_get_merged_by_asset_response.py | 5 + .../types/user/nept/user_stake.py | 20 ++ .../user/nept/user_stake_bonding_entry.py | 20 ++ .../types/user/nept/user_stake_pool.py | 20 ++ .../types/user/nept/user_stake_unbonding.py | 20 ++ .../user/nept/user_stake_unbonding_entry.py | 20 ++ .../types/user/user_merged_market.py | 188 +++--------------- .../types/user/user_unlock_amounts.py | 25 ++- .../types/user/wallet_asset_known.py | 20 ++ src/neptune_api_v2/types/user_tx.py | 34 +++- 34 files changed, 557 insertions(+), 233 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9a6794e..e470ef9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-09b5978b7e7d59cea96f054720bdf341353c0678caacf5ba5a1667027805e60d.yml -openapi_spec_hash: 67359dbd4d14a0f1a5c11e25084c33f0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-3e68b318eeaab1241ee6ed696300829c9eae836a937905e7389788413f9daa8a.yml +openapi_spec_hash: b76569f104863b1e7b3c5271f53df840 config_hash: fa0efc29593602eac57523d55bc83fa6 diff --git a/src/neptune_api_v2/types/asset_price.py b/src/neptune_api_v2/types/asset_price.py index c635ba1..159eaae 100644 --- a/src/neptune_api_v2/types/asset_price.py +++ b/src/neptune_api_v2/types/asset_price.py @@ -11,7 +11,7 @@ class ExtraText(BaseModel): """Human-readable field variants. - Will not be null when query param `with-text` is `true`. + Will not be null when query param `with_text` is `true`. """ last_updated_at: str @@ -23,7 +23,7 @@ class Extra(BaseModel): text: Optional[ExtraText] = None """Human-readable field variants. - Will not be null when query param `with-text` is `true`. + Will not be null when query param `with_text` is `true`. """ diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_config.py b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_config.py index 93dfddf..121952a 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_config.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_config.py @@ -30,7 +30,10 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - collateral_cap: str + collateral_cap: Optional[str] = None + + price: Optional[str] = None + """Text representation of price""" class ExtraValueExtra(BaseModel): @@ -45,12 +48,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ collateral_cap: Optional[str] = None extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -63,6 +75,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py index 0d4167d..aaa3ea4 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py @@ -24,6 +24,9 @@ class ExtraValueExtraText(BaseModel): collateral_sum: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -37,12 +40,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ collateral_sum: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -55,6 +67,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_config.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_config.py index be2bcf8..337d8e9 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_config.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_config.py @@ -26,7 +26,10 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - borrow_cap: str + borrow_cap: Optional[str] = None + + price: Optional[str] = None + """Text representation of price""" class ExtraValueExtra(BaseModel): @@ -41,12 +44,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ borrow_cap: Optional[str] = None extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -59,6 +71,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py index 6299a63..e013ffa 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market.py @@ -1,7 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ...._models import BaseModel from ...asset_info import AssetInfo from ...market_rate import MarketRate @@ -20,7 +18,7 @@ class BorrowDebtMarket(BaseModel): config: BorrowDebtConfig """Debt market configuration parameters""" - rate: Optional[MarketRate] = None + rate: MarketRate """Market rates""" state: BorrowDebtState diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market_data.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market_data.py index 385251b..3c2babc 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_market_data.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_market_data.py @@ -1,7 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ...._models import BaseModel from ...market_rate import MarketRate from .borrow_debt_state import BorrowDebtState @@ -14,7 +12,7 @@ class BorrowDebtMarketData(BaseModel): config: BorrowDebtConfig """Debt market configuration parameters""" - rate: Optional[MarketRate] = None + rate: MarketRate """Market rates""" state: BorrowDebtState diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py index a4ce271..0beda87 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py @@ -14,9 +14,7 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - debt_sum: str - - interest_sum: str + balance_sum: str principal_sum: str @@ -29,9 +27,10 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - debt_sum: str + balance_sum: str - interest_sum: str + price: str + """Text representation of price""" principal_sum: str @@ -48,13 +47,20 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ - debt_sum: str + balance_sum: str extra: ExtraValueExtra - interest_sum: str + price: str + """Price used in value calculations""" principal_sum: str @@ -70,26 +76,23 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ class BorrowDebtState(BaseModel): - debt_sum: str - """Sum open debt amount (this is simply the principal sum + interest sum)""" + balance_sum: str extra: Extra - interest_sum: str - """ - Sum of accrued interest for all open debts (those which have not yet been - repaid) - """ - principal_sum: str - """ - Sum of initial amount borrowed for all open debts (those which have not yet been - repaid) - """ time_last_distributed_interest: datetime """Timestamp used to keep track of the last time interest was distributed.""" diff --git a/src/neptune_api_v2/types/markets/lend_market.py b/src/neptune_api_v2/types/markets/lend_market.py index 748ce43..b35de99 100644 --- a/src/neptune_api_v2/types/markets/lend_market.py +++ b/src/neptune_api_v2/types/markets/lend_market.py @@ -1,7 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ..._models import BaseModel from ..asset_info import AssetInfo from ..market_rate import MarketRate @@ -16,7 +14,7 @@ class LendMarket(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" - rate: Optional[MarketRate] = None + rate: MarketRate """Lending market rates""" state: LendMarketState diff --git a/src/neptune_api_v2/types/markets/lend_market_data.py b/src/neptune_api_v2/types/markets/lend_market_data.py index de79a04..ad5fdbc 100644 --- a/src/neptune_api_v2/types/markets/lend_market_data.py +++ b/src/neptune_api_v2/types/markets/lend_market_data.py @@ -1,7 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ..._models import BaseModel from ..market_rate import MarketRate from .lend_market_state import LendMarketState @@ -10,7 +8,7 @@ class LendMarketData(BaseModel): - rate: Optional[MarketRate] = None + rate: MarketRate """Lending market rates""" state: LendMarketState diff --git a/src/neptune_api_v2/types/markets/lend_market_state.py b/src/neptune_api_v2/types/markets/lend_market_state.py index 6ec5fd0..ca69ef7 100644 --- a/src/neptune_api_v2/types/markets/lend_market_state.py +++ b/src/neptune_api_v2/types/markets/lend_market_state.py @@ -26,6 +26,9 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ + price: str + """Text representation of price""" + principal_sum: str @@ -41,10 +44,19 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ extra: ExtraValueExtra + price: str + """Price used in value calculations""" + principal_sum: str @@ -59,6 +71,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/nept_params.py b/src/neptune_api_v2/types/nept_params.py index 24c9519..a1db93d 100644 --- a/src/neptune_api_v2/types/nept_params.py +++ b/src/neptune_api_v2/types/nept_params.py @@ -36,6 +36,9 @@ class ExtraValueExtraText(BaseModel): emission_rate: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -49,12 +52,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ emission_rate: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -67,6 +79,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/nept_state.py b/src/neptune_api_v2/types/nept_state.py index 522d55d..75ad550 100644 --- a/src/neptune_api_v2/types/nept_state.py +++ b/src/neptune_api_v2/types/nept_state.py @@ -39,6 +39,9 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ + price: str + """Text representation of price""" + total_claimed: str total_issued: str @@ -60,10 +63,19 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ extra: ExtraValueExtra + price: str + """Price used in value calculations""" + total_claimed: str total_issued: str @@ -84,6 +96,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/nept_unlock_distribution_group.py b/src/neptune_api_v2/types/nept_unlock_distribution_group.py index 9316443..ea2ff96 100644 --- a/src/neptune_api_v2/types/nept_unlock_distribution_group.py +++ b/src/neptune_api_v2/types/nept_unlock_distribution_group.py @@ -117,6 +117,9 @@ class ExtraValueExtraText(BaseModel): amount_unlocked: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -130,6 +133,12 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str @@ -152,6 +161,9 @@ class ExtraValue(BaseModel): extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): percent: Optional[ExtraPercent] = None @@ -171,6 +183,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/staking_pool_state.py b/src/neptune_api_v2/types/staking_pool_state.py index 93e331f..573b6b9 100644 --- a/src/neptune_api_v2/types/staking_pool_state.py +++ b/src/neptune_api_v2/types/staking_pool_state.py @@ -22,6 +22,9 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ + price: str + """Text representation of price""" + total_bonded: str @@ -37,10 +40,19 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ extra: ExtraValueExtra + price: str + """Price used in value calculations""" + total_bonded: str @@ -55,6 +67,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py b/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py index 9d05d50..bae1640 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_borrow_market_account.py @@ -3,6 +3,7 @@ from typing import List, Optional from ....._models import BaseModel +from ....market_rate import MarketRate from .user_account_health import UserAccountHealth from .user_debt_asset_pool import UserDebtAssetPool from .user_collateral_asset_pool import UserCollateralAssetPool @@ -19,6 +20,9 @@ class UserBorrowMarketAccount(BaseModel): debts: List[UserDebtAssetPool] """Account debt allocations""" + debts_net_rate: MarketRate + """Account debt net rate""" + health: Optional[UserAccountHealth] = None """Health data for this account""" diff --git a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py index a6236f4..f34e6b4 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py @@ -24,6 +24,9 @@ class ExtraValueExtraText(BaseModel): amount: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -37,12 +40,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -55,6 +67,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py index 008db8c..58a54db 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py @@ -25,6 +25,9 @@ class ExtraValueExtraText(BaseModel): amount: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -38,12 +41,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -56,6 +68,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py index 4025779..001dc54 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_debt_account_pool.py @@ -13,12 +13,10 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - debt: str - - interest: str - principal: str + shares: str + class ExtraValueExtraText(BaseModel): """Human-readable variants of USD values. @@ -26,12 +24,13 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - debt: str - - interest: str + price: str + """Text representation of price""" principal: str + shares: str + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -45,16 +44,23 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. - """ - debt: str + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. + """ extra: ExtraValueExtra - interest: str + price: str + """Price used in value calculations""" principal: str + shares: str + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -67,6 +73,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -78,16 +92,12 @@ class UserDebtAccountPool(BaseModel): Typically used in contexts where multiple subaccounts with a shared underlying asset are batched together. """ - debt: str - """Sum open debt amount (this is simply the principal + interest)""" - extra: Extra index: int """Account index""" - interest: str - """Sum of accrued interest for open debt position""" - principal: str """Initial amount borrowed (of debts which have not yet been repaid)""" + + shares: str diff --git a/src/neptune_api_v2/types/user/market/borrow/user_debt_asset_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_debt_asset_pool.py index b66bde3..b091c12 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_debt_asset_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_debt_asset_pool.py @@ -4,6 +4,7 @@ from ....._models import BaseModel from ....asset_info import AssetInfo +from ....market_rate import MarketRate __all__ = ["UserDebtAssetPool", "Extra", "ExtraText", "ExtraValue", "ExtraValueExtra", "ExtraValueExtraText"] @@ -14,12 +15,10 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - debt: str - - interest: str - principal: str + shares: str + class ExtraValueExtraText(BaseModel): """Human-readable variants of USD values. @@ -27,12 +26,13 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - debt: str - - interest: str + price: str + """Text representation of price""" principal: str + shares: str + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -46,16 +46,23 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. - """ - debt: str + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. + """ extra: ExtraValueExtra - interest: str + price: str + """Price used in value calculations""" principal: str + shares: str + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -68,6 +75,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -75,13 +90,12 @@ class UserDebtAssetPool(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" - debt: str - """Sum open debt amount (this is simply the principal + interest)""" - extra: Extra - interest: str - """Sum of accrued interest for open debt position""" + market_rate: MarketRate + """Current market borrowing rate""" principal: str """Initial amount borrowed (of debts which have not yet been repaid)""" + + shares: str diff --git a/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py b/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py index 8228f4b..0936a9d 100644 --- a/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/borrow_get_debt_accounts_by_asset_response.py @@ -4,6 +4,7 @@ from ...._models import BaseModel from ...asset_info import AssetInfo +from ...market_rate import MarketRate from .borrow.user_debt_account_pool import UserDebtAccountPool __all__ = ["BorrowGetDebtAccountsByAssetResponse", "Data"] @@ -16,6 +17,9 @@ class Data(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" + market_rate: MarketRate + """Current market borrowing rate""" + class BorrowGetDebtAccountsByAssetResponse(BaseModel): data: Data diff --git a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py index db63946..2718dd3 100644 --- a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py @@ -4,6 +4,7 @@ from ...._models import BaseModel from ...asset_info import AssetInfo +from ...market_rate import MarketRate __all__ = [ "LendGetByAssetResponse", @@ -103,6 +104,9 @@ class DataReceiptAmountsExtraValueExtraText(BaseModel): held: str + price: str + """Text representation of price""" + total: str @@ -118,6 +122,12 @@ class DataReceiptAmountsExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ collateralized: str @@ -126,6 +136,9 @@ class DataReceiptAmountsExtraValue(BaseModel): held: str + price: str + """Price used in value calculations""" + total: str @@ -140,6 +153,14 @@ class DataReceiptAmountsExtra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -165,6 +186,9 @@ class Data(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" + market_rate: MarketRate + """Current market lending rate""" + origin_equivalent: DataOriginEquivalent """ The lending amounts converted into the equivalent for the receipt token's diff --git a/src/neptune_api_v2/types/user/market/user_borrow_market_pools.py b/src/neptune_api_v2/types/user/market/user_borrow_market_pools.py index e5b253c..ddaf106 100644 --- a/src/neptune_api_v2/types/user/market/user_borrow_market_pools.py +++ b/src/neptune_api_v2/types/user/market/user_borrow_market_pools.py @@ -3,6 +3,7 @@ from typing import List from ...._models import BaseModel +from ...market_rate import MarketRate from .borrow.user_debt_asset_pool import UserDebtAssetPool from .borrow.user_collateral_asset_pool import UserCollateralAssetPool @@ -15,3 +16,6 @@ class UserBorrowMarketPools(BaseModel): debts: List[UserDebtAssetPool] """Account debt allocations""" + + debts_net_rate: MarketRate + """Account debt net rate""" diff --git a/src/neptune_api_v2/types/user/market/user_lend_market.py b/src/neptune_api_v2/types/user/market/user_lend_market.py index 4c0531a..e0cab74 100644 --- a/src/neptune_api_v2/types/user/market/user_lend_market.py +++ b/src/neptune_api_v2/types/user/market/user_lend_market.py @@ -4,6 +4,7 @@ from ...._models import BaseModel from ...asset_info import AssetInfo +from ...market_rate import MarketRate __all__ = [ "UserLendMarket", @@ -103,6 +104,9 @@ class AssetPoolReceiptAmountsExtraValueExtraText(BaseModel): held: str + price: str + """Text representation of price""" + total: str @@ -118,6 +122,12 @@ class AssetPoolReceiptAmountsExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ collateralized: str @@ -126,6 +136,9 @@ class AssetPoolReceiptAmountsExtraValue(BaseModel): held: str + price: str + """Price used in value calculations""" + total: str @@ -140,6 +153,14 @@ class AssetPoolReceiptAmountsExtra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -165,6 +186,9 @@ class AssetPool(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" + market_rate: MarketRate + """Current market lending rate""" + origin_equivalent: AssetPoolOriginEquivalent """ The lending amounts converted into the equivalent for the receipt token's @@ -178,3 +202,6 @@ class AssetPool(BaseModel): class UserLendMarket(BaseModel): asset_pools: List[AssetPool] """User lending allocations""" + + net_rate: MarketRate + """Account debt net rate""" diff --git a/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py b/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py index 7898897..6a75376 100644 --- a/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py @@ -8,6 +8,11 @@ class MarketGetMergedByAssetResponse(BaseModel): data: UserMergedMarket + """User market allocations grouped by asset. + + **Note**: because of the inverted structure of merged market accounts, account + health cannot be represented and is excluded in the merged structures. + """ error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/nept/user_stake.py b/src/neptune_api_v2/types/user/nept/user_stake.py index 42fedb9..9502998 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake.py +++ b/src/neptune_api_v2/types/user/nept/user_stake.py @@ -37,6 +37,9 @@ class ExtraValueExtraText(BaseModel): claimable_unbonding: str + price: str + """Text representation of price""" + unclaimed: str @@ -52,6 +55,12 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ bonding_sum: str @@ -62,6 +71,9 @@ class ExtraValue(BaseModel): extra: ExtraValueExtra + price: str + """Price used in value calculations""" + unclaimed: str @@ -76,6 +88,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/nept/user_stake_bonding_entry.py b/src/neptune_api_v2/types/user/nept/user_stake_bonding_entry.py index 053900f..7a614f5 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake_bonding_entry.py +++ b/src/neptune_api_v2/types/user/nept/user_stake_bonding_entry.py @@ -27,6 +27,9 @@ class ExtraValueExtraText(BaseModel): amount: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -40,12 +43,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -58,6 +70,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/nept/user_stake_pool.py b/src/neptune_api_v2/types/user/nept/user_stake_pool.py index 2ffc84d..612dbb7 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake_pool.py +++ b/src/neptune_api_v2/types/user/nept/user_stake_pool.py @@ -26,6 +26,9 @@ class ExtraValueExtraText(BaseModel): amount_sum: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -39,12 +42,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount_sum: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -57,6 +69,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/nept/user_stake_unbonding.py b/src/neptune_api_v2/types/user/nept/user_stake_unbonding.py index 75a21ca..f3ac341 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake_unbonding.py +++ b/src/neptune_api_v2/types/user/nept/user_stake_unbonding.py @@ -25,6 +25,9 @@ class ExtraValueExtraText(BaseModel): amount_sum: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -38,12 +41,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount_sum: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -56,6 +68,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/nept/user_stake_unbonding_entry.py b/src/neptune_api_v2/types/user/nept/user_stake_unbonding_entry.py index fd7b230..b1207d0 100644 --- a/src/neptune_api_v2/types/user/nept/user_stake_unbonding_entry.py +++ b/src/neptune_api_v2/types/user/nept/user_stake_unbonding_entry.py @@ -27,6 +27,9 @@ class ExtraValueExtraText(BaseModel): amount: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -40,12 +43,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -58,6 +70,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/user_merged_market.py b/src/neptune_api_v2/types/user/user_merged_market.py index 7d22870..83a0cc0 100644 --- a/src/neptune_api_v2/types/user/user_merged_market.py +++ b/src/neptune_api_v2/types/user/user_merged_market.py @@ -4,21 +4,11 @@ from ..._models import BaseModel from ..asset_info import AssetInfo +from .market.borrow.user_debt_account_pool import UserDebtAccountPool +from .market.borrow.user_collateral_account_pool import UserCollateralAccountPool __all__ = [ "UserMergedMarket", - "BorrowCollateral", - "BorrowCollateralExtra", - "BorrowCollateralExtraText", - "BorrowCollateralExtraValue", - "BorrowCollateralExtraValueExtra", - "BorrowCollateralExtraValueExtraText", - "BorrowDebt", - "BorrowDebtExtra", - "BorrowDebtExtraText", - "BorrowDebtExtraValue", - "BorrowDebtExtraValueExtra", - "BorrowDebtExtraValueExtraText", "Lend", "LendOriginEquivalent", "LendOriginEquivalentExtra", @@ -32,146 +22,6 @@ ] -class BorrowCollateralExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - amount: str - - -class BorrowCollateralExtraValueExtraText(BaseModel): - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - amount: str - - -class BorrowCollateralExtraValueExtra(BaseModel): - text: Optional[BorrowCollateralExtraValueExtraText] = None - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - -class BorrowCollateralExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - """ - - amount: str - - extra: BorrowCollateralExtraValueExtra - - -class BorrowCollateralExtra(BaseModel): - text: Optional[BorrowCollateralExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[BorrowCollateralExtraValue] = None - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - """ - - -class BorrowCollateral(BaseModel): - amount: str - """Amount of this asset which is actively collateralized""" - - extra: BorrowCollateralExtra - - index: int - """Account index""" - - -class BorrowDebtExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - debt: str - - interest: str - - principal: str - - -class BorrowDebtExtraValueExtraText(BaseModel): - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - debt: str - - interest: str - - principal: str - - -class BorrowDebtExtraValueExtra(BaseModel): - text: Optional[BorrowDebtExtraValueExtraText] = None - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - -class BorrowDebtExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - """ - - debt: str - - extra: BorrowDebtExtraValueExtra - - interest: str - - principal: str - - -class BorrowDebtExtra(BaseModel): - text: Optional[BorrowDebtExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[BorrowDebtExtraValue] = None - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - """ - - -class BorrowDebt(BaseModel): - debt: str - """Sum open debt amount (this is simply the principal + interest)""" - - extra: BorrowDebtExtra - - index: int - """Account index""" - - interest: str - """Sum of accrued interest for open debt position""" - - principal: str - """Initial amount borrowed (of debts which have not yet been repaid)""" - - class LendOriginEquivalentExtraText(BaseModel): """Human-readable field variants. @@ -255,6 +105,9 @@ class LendReceiptAmountsExtraValueExtraText(BaseModel): held: str + price: str + """Text representation of price""" + total: str @@ -270,6 +123,12 @@ class LendReceiptAmountsExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ collateralized: str @@ -278,6 +137,9 @@ class LendReceiptAmountsExtraValue(BaseModel): held: str + price: str + """Price used in value calculations""" + total: str @@ -292,6 +154,14 @@ class LendReceiptAmountsExtra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -314,7 +184,7 @@ class LendReceiptAmounts(BaseModel): class Lend(BaseModel): - """User contirbution for asset's lending market, if one exists""" + """User contribution for asset's lending market, if one exists""" origin_equivalent: LendOriginEquivalent """ @@ -327,14 +197,20 @@ class Lend(BaseModel): class UserMergedMarket(BaseModel): + """User market allocations grouped by asset. + + **Note**: because of the inverted structure of merged market accounts, account + health cannot be represented and is excluded in the merged structures. + """ + asset_info: AssetInfo """Asset identifiers with associated metadata""" - borrow_collateral: List[BorrowCollateral] + borrow_collateral: List[UserCollateralAccountPool] """User collateral contribution for asset in borrow market, listed by subaccount""" - borrow_debt: List[BorrowDebt] + borrow_debt: List[UserDebtAccountPool] """User debt contribution for asset in borrow market, listed by subaccount""" lend: Optional[Lend] = None - """User contirbution for asset's lending market, if one exists""" + """User contribution for asset's lending market, if one exists""" diff --git a/src/neptune_api_v2/types/user/user_unlock_amounts.py b/src/neptune_api_v2/types/user/user_unlock_amounts.py index 1b99d5d..78bd4a7 100644 --- a/src/neptune_api_v2/types/user/user_unlock_amounts.py +++ b/src/neptune_api_v2/types/user/user_unlock_amounts.py @@ -45,7 +45,7 @@ class ExtraPercentExtra(BaseModel): class ExtraPercent(BaseModel): """Percentages for unlock amounts. - Will not be null when query param `with_percent` is `true`. + These do not factor in the `amount_staked` or `amount_held` values. Will not be null when query param `with_percent` is `true`. """ claimable: str @@ -96,6 +96,9 @@ class ExtraValueExtraText(BaseModel): locked: str + price: str + """Text representation of price""" + reclaimed: str @@ -111,6 +114,12 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str @@ -125,6 +134,9 @@ class ExtraValue(BaseModel): locked: str + price: str + """Price used in value calculations""" + reclaimed: str @@ -132,7 +144,8 @@ class Extra(BaseModel): percent: Optional[ExtraPercent] = None """Percentages for unlock amounts. - Will not be null when query param `with_percent` is `true`. + These do not factor in the `amount_staked` or `amount_held` values. Will not be + null when query param `with_percent` is `true`. """ text: Optional[ExtraText] = None @@ -145,6 +158,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user/wallet_asset_known.py b/src/neptune_api_v2/types/user/wallet_asset_known.py index 54cc172..a99c207 100644 --- a/src/neptune_api_v2/types/user/wallet_asset_known.py +++ b/src/neptune_api_v2/types/user/wallet_asset_known.py @@ -26,6 +26,9 @@ class ExtraValueExtraText(BaseModel): amount: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -39,12 +42,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: str extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -57,6 +69,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ diff --git a/src/neptune_api_v2/types/user_tx.py b/src/neptune_api_v2/types/user_tx.py index 61da072..cb02278 100644 --- a/src/neptune_api_v2/types/user_tx.py +++ b/src/neptune_api_v2/types/user_tx.py @@ -22,9 +22,9 @@ class ExtraText(BaseModel): event_time: str - price: str + historic_price: str - value: str + historic_value: str class ExtraValueExtraText(BaseModel): @@ -35,6 +35,9 @@ class ExtraValueExtraText(BaseModel): amount: Optional[str] = None + price: Optional[str] = None + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -48,12 +51,21 @@ class ExtraValue(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. """ amount: Optional[str] = None extra: ExtraValueExtra + price: str + """Price used in value calculations""" + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -66,6 +78,14 @@ class Extra(BaseModel): """USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. """ @@ -122,7 +142,7 @@ class UserTx(BaseModel): extra: Extra - price: Union[str, float, None] = None + historic_price: Union[str, float, None] = None """The price of the associated asset at the time of the transaction. This value will be set for all currently implemented action types. It is set as @@ -130,10 +150,7 @@ class UserTx(BaseModel): an associated amount. """ - tx_hash: str - """Transaction hash""" - - value: Union[str, float, None] = None + historic_value: Union[str, float, None] = None """The USD value at the time of the transaction. Derived using the amount and historical price of the associated asset. @@ -142,3 +159,6 @@ class UserTx(BaseModel): nullable for forwards compatibility for future action types which may not have an associated amount. """ + + tx_hash: str + """Transaction hash""" From 1aa9a590bdc800e554100b00a41b552add478bce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 17:56:40 +0000 Subject: [PATCH 04/20] feat(api): add missing models, pagination impls --- .stats.yml | 4 +- README.md | 81 +++++ api.md | 51 ++-- src/neptune_api_v2/_client.py | 39 ++- src/neptune_api_v2/pagination.py | 259 ++++++++++++++++ src/neptune_api_v2/resources/__init__.py | 14 + .../resources/analytics/market/history.py | 48 +-- src/neptune_api_v2/resources/assets.py | 23 +- .../resources/markets/borrow/borrow.py | 23 +- src/neptune_api_v2/resources/markets/lend.py | 23 +- src/neptune_api_v2/resources/swap/__init__.py | 33 ++ src/neptune_api_v2/resources/swap/routes.py | 286 ++++++++++++++++++ src/neptune_api_v2/resources/swap/swap.py | 102 +++++++ src/neptune_api_v2/resources/user/user.py | 23 +- src/neptune_api_v2/types/__init__.py | 2 - ..._get_loans_originated_by_asset_response.py | 80 +---- .../history_get_loans_originated_response.py | 64 +--- .../types/asset_get_price_history_response.py | 24 -- src/neptune_api_v2/types/markets/__init__.py | 2 - .../borrow_get_rate_history_response.py | 24 -- src/neptune_api_v2/types/swap/__init__.py | 9 + .../types/swap/route_list_all_params.py | 12 + .../route_list_all_response.py} | 10 +- .../types/swap/route_list_by_denom_params.py | 19 ++ .../route_list_by_denom_response.py} | 9 +- .../types/swap/swap_route_target_set.py | 15 + .../types/user/market/__init__.py | 3 + .../user/market/lend_get_by_asset_response.py | 199 +----------- .../types/user/market/user_lend_asset_pool.py | 26 ++ .../types/user/market/user_lend_market.py | 198 +----------- .../user/market/user_lend_origin_amounts.py | 63 ++++ .../user/market/user_lend_receipt_amounts.py | 106 +++++++ .../types/user/user_merged_market.py | 181 +---------- .../analytics/market/test_history.py | 48 ++- tests/api_resources/markets/test_borrow.py | 19 +- tests/api_resources/markets/test_lend.py | 19 +- tests/api_resources/swap/__init__.py | 1 + tests/api_resources/swap/test_routes.py | 169 +++++++++++ tests/api_resources/test_assets.py | 19 +- tests/api_resources/test_user.py | 19 +- 40 files changed, 1452 insertions(+), 897 deletions(-) create mode 100644 src/neptune_api_v2/pagination.py create mode 100644 src/neptune_api_v2/resources/swap/__init__.py create mode 100644 src/neptune_api_v2/resources/swap/routes.py create mode 100644 src/neptune_api_v2/resources/swap/swap.py delete mode 100644 src/neptune_api_v2/types/asset_get_price_history_response.py delete mode 100644 src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py create mode 100644 src/neptune_api_v2/types/swap/__init__.py create mode 100644 src/neptune_api_v2/types/swap/route_list_all_params.py rename src/neptune_api_v2/types/{user_get_tx_history_response.py => swap/route_list_all_response.py} (72%) create mode 100644 src/neptune_api_v2/types/swap/route_list_by_denom_params.py rename src/neptune_api_v2/types/{markets/lend_get_rate_history_response.py => swap/route_list_by_denom_response.py} (67%) create mode 100644 src/neptune_api_v2/types/swap/swap_route_target_set.py create mode 100644 src/neptune_api_v2/types/user/market/user_lend_asset_pool.py create mode 100644 src/neptune_api_v2/types/user/market/user_lend_origin_amounts.py create mode 100644 src/neptune_api_v2/types/user/market/user_lend_receipt_amounts.py create mode 100644 tests/api_resources/swap/__init__.py create mode 100644 tests/api_resources/swap/test_routes.py diff --git a/.stats.yml b/.stats.yml index e470ef9..98e43d6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 48 +configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-3e68b318eeaab1241ee6ed696300829c9eae836a937905e7389788413f9daa8a.yml openapi_spec_hash: b76569f104863b1e7b3c5271f53df840 -config_hash: fa0efc29593602eac57523d55bc83fa6 +config_hash: a6c5cf005205fb3c675ac298b416cf14 diff --git a/README.md b/README.md index 89bf3ae..1dd464e 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,87 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. +## Pagination + +List methods in the Neptune API V2 API are paginated. + +This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: + +```python +from neptune_api_v2 import NeptuneAPIV2 + +client = NeptuneAPIV2() + +all_assets = [] +# Automatically fetches more pages as needed. +for asset in client.assets.get_price_history( + end=0, + period="h", + start=0, +): + # Do something with asset here + all_assets.append(asset) +print(all_assets) +``` + +Or, asynchronously: + +```python +import asyncio +from neptune_api_v2 import AsyncNeptuneAPIV2 + +client = AsyncNeptuneAPIV2() + + +async def main() -> None: + all_assets = [] + # Iterate through items across all pages, issuing requests as needed. + async for asset in client.assets.get_price_history( + end=0, + period="h", + start=0, + ): + all_assets.append(asset) + print(all_assets) + + +asyncio.run(main()) +``` + +Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: + +```python +first_page = await client.assets.get_price_history( + end=0, + period="h", + start=0, +) +if first_page.has_next_page(): + print(f"will fetch next page using these details: {first_page.next_page_info()}") + next_page = await first_page.get_next_page() + print(f"number of items we just fetched: {len(next_page.data.series)}") + +# Remove `await` for non-async usage. +``` + +Or just work directly with the returned data: + +```python +first_page = await client.assets.get_price_history( + end=0, + period="h", + start=0, +) + +print( + f"the current start offset for this page: {first_page.data.pagination.next_offset}" +) # => "the current start offset for this page: 1" +for asset in first_page.data.series: + print(asset.asset) + +# Remove `await` for non-async usage. +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `neptune_api_v2.APIConnectionError` is raised. diff --git a/api.md b/api.md index 6ada779..1cd34dc 100644 --- a/api.md +++ b/api.md @@ -7,6 +7,7 @@ from neptune_api_v2.types import ( ErrorData, ErrorDataVariants, ErrorKind, + ErrorResponse, ErrorScope, FieldValidationError, Interval, @@ -42,7 +43,6 @@ from neptune_api_v2.types import ( AssetRateHistory, AssetSpec, AssetListResponse, - AssetGetPriceHistoryResponse, AssetListPricesResponse, ) ``` @@ -50,7 +50,7 @@ from neptune_api_v2.types import ( Methods: - client.assets.list() -> AssetListResponse -- client.assets.get_price_history(\*\*params) -> AssetGetPriceHistoryResponse +- client.assets.get_price_history(\*\*params) -> SyncIntervalMultiPage[Series] - client.assets.list_prices(\*\*params) -> AssetListPricesResponse # Markets @@ -87,7 +87,6 @@ from neptune_api_v2.types.markets import ( LendMarketState, LendListResponse, LendGetByAssetResponse, - LendGetRateHistoryResponse, ) ``` @@ -95,24 +94,20 @@ Methods: - client.markets.lend.list(\*\*params) -> LendListResponse - client.markets.lend.get_by_asset(\*\*params) -> LendGetByAssetResponse -- client.markets.lend.get_rate_history(\*\*params) -> LendGetRateHistoryResponse +- client.markets.lend.get_rate_history(\*\*params) -> SyncIntervalMultiPage[Series] ## Borrow Types: ```python -from neptune_api_v2.types.markets import ( - BorrowMarketOverview, - BorrowGetOverviewResponse, - BorrowGetRateHistoryResponse, -) +from neptune_api_v2.types.markets import BorrowMarketOverview, BorrowGetOverviewResponse ``` Methods: - client.markets.borrow.get_overview(\*\*params) -> BorrowGetOverviewResponse -- client.markets.borrow.get_rate_history(\*\*params) -> BorrowGetRateHistoryResponse +- client.markets.borrow.get_rate_history(\*\*params) -> SyncIntervalMultiPage[Series] ### Collaterals @@ -183,18 +178,12 @@ Methods: Types: ```python -from neptune_api_v2.types import ( - EventAction, - User, - UserTx, - UserGetTxHistoryResponse, - UserGetUserResponse, -) +from neptune_api_v2.types import EventAction, User, UserTx, UserGetUserResponse ``` Methods: -- client.user.get_tx_history(address, \*\*params) -> UserGetTxHistoryResponse +- client.user.get_tx_history(address, \*\*params) -> SyncTxHistoryPage[UserTx] - client.user.get_user(address, \*\*params) -> UserGetUserResponse ## Market @@ -223,7 +212,10 @@ Types: ```python from neptune_api_v2.types.user.market import ( + UserLendAssetPool, UserLendMarket, + UserLendOriginAmounts, + UserLendReceiptAmounts, LendListResponse, LendGetByAssetResponse, ) @@ -376,8 +368,8 @@ from neptune_api_v2.types.analytics.market import ( Methods: -- client.analytics.market.history.get_loans_originated(\*\*params) -> HistoryGetLoansOriginatedResponse -- client.analytics.market.history.get_loans_originated_by_asset(\*\*params) -> HistoryGetLoansOriginatedByAssetResponse +- client.analytics.market.history.get_loans_originated(\*\*params) -> SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse] +- client.analytics.market.history.get_loans_originated_by_asset(\*\*params) -> SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse] ## Nept @@ -404,3 +396,22 @@ from neptune_api_v2.types.integrations import BantrGetTransactionsResponse Methods: - client.integrations.bantr.get_transactions(\*\*params) -> BantrGetTransactionsResponse + +# Swap + +## Routes + +Types: + +```python +from neptune_api_v2.types.swap import ( + SwapRouteTargetSet, + RouteListAllResponse, + RouteListByDenomResponse, +) +``` + +Methods: + +- client.swap.routes.list_all(\*\*params) -> RouteListAllResponse +- client.swap.routes.list_by_denom(\*\*params) -> RouteListByDenomResponse diff --git a/src/neptune_api_v2/_client.py b/src/neptune_api_v2/_client.py index d42d07c..c688768 100644 --- a/src/neptune_api_v2/_client.py +++ b/src/neptune_api_v2/_client.py @@ -31,10 +31,11 @@ ) if TYPE_CHECKING: - from .resources import nept, user, assets, status, markets, analytics, integrations + from .resources import nept, swap, user, assets, status, markets, analytics, integrations from .resources.nept import NeptResource, AsyncNeptResource from .resources.assets import AssetsResource, AsyncAssetsResource from .resources.status import StatusResource, AsyncStatusResource + from .resources.swap.swap import SwapResource, AsyncSwapResource from .resources.user.user import UserResource, AsyncUserResource from .resources.markets.markets import MarketsResource, AsyncMarketsResource from .resources.analytics.analytics import AnalyticsResource, AsyncAnalyticsResource @@ -136,6 +137,12 @@ def integrations(self) -> IntegrationsResource: return IntegrationsResource(self) + @cached_property + def swap(self) -> SwapResource: + from .resources.swap import SwapResource + + return SwapResource(self) + @cached_property def with_raw_response(self) -> NeptuneAPIV2WithRawResponse: return NeptuneAPIV2WithRawResponse(self) @@ -325,6 +332,12 @@ def integrations(self) -> AsyncIntegrationsResource: return AsyncIntegrationsResource(self) + @cached_property + def swap(self) -> AsyncSwapResource: + from .resources.swap import AsyncSwapResource + + return AsyncSwapResource(self) + @cached_property def with_raw_response(self) -> AsyncNeptuneAPIV2WithRawResponse: return AsyncNeptuneAPIV2WithRawResponse(self) @@ -478,6 +491,12 @@ def integrations(self) -> integrations.IntegrationsResourceWithRawResponse: return IntegrationsResourceWithRawResponse(self._client.integrations) + @cached_property + def swap(self) -> swap.SwapResourceWithRawResponse: + from .resources.swap import SwapResourceWithRawResponse + + return SwapResourceWithRawResponse(self._client.swap) + class AsyncNeptuneAPIV2WithRawResponse: _client: AsyncNeptuneAPIV2 @@ -527,6 +546,12 @@ def integrations(self) -> integrations.AsyncIntegrationsResourceWithRawResponse: return AsyncIntegrationsResourceWithRawResponse(self._client.integrations) + @cached_property + def swap(self) -> swap.AsyncSwapResourceWithRawResponse: + from .resources.swap import AsyncSwapResourceWithRawResponse + + return AsyncSwapResourceWithRawResponse(self._client.swap) + class NeptuneAPIV2WithStreamedResponse: _client: NeptuneAPIV2 @@ -576,6 +601,12 @@ def integrations(self) -> integrations.IntegrationsResourceWithStreamingResponse return IntegrationsResourceWithStreamingResponse(self._client.integrations) + @cached_property + def swap(self) -> swap.SwapResourceWithStreamingResponse: + from .resources.swap import SwapResourceWithStreamingResponse + + return SwapResourceWithStreamingResponse(self._client.swap) + class AsyncNeptuneAPIV2WithStreamedResponse: _client: AsyncNeptuneAPIV2 @@ -625,6 +656,12 @@ def integrations(self) -> integrations.AsyncIntegrationsResourceWithStreamingRes return AsyncIntegrationsResourceWithStreamingResponse(self._client.integrations) + @cached_property + def swap(self) -> swap.AsyncSwapResourceWithStreamingResponse: + from .resources.swap import AsyncSwapResourceWithStreamingResponse + + return AsyncSwapResourceWithStreamingResponse(self._client.swap) + Client = NeptuneAPIV2 diff --git a/src/neptune_api_v2/pagination.py b/src/neptune_api_v2/pagination.py new file mode 100644 index 0000000..c81813b --- /dev/null +++ b/src/neptune_api_v2/pagination.py @@ -0,0 +1,259 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Any, List, Generic, TypeVar, Optional, cast +from typing_extensions import Protocol, override, runtime_checkable + +from ._models import BaseModel, GenericModel +from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage + +__all__ = [ + "SyncTxHistoryPage", + "AsyncTxHistoryPage", + "IntervalMultiPageData", + "IntervalMultiPagePagination", + "SyncIntervalMultiPage", + "AsyncIntervalMultiPage", + "IntervalSinglePageData", + "IntervalSinglePagePagination", + "SyncIntervalSinglePage", + "AsyncIntervalSinglePage", +] + +_T = TypeVar("_T") + + +@runtime_checkable +class TxHistoryPageItem(Protocol): + event_uuid: str + + +class SyncTxHistoryPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + data = self.data + if not data: + return None + + item = cast(Any, data[-1]) + if not isinstance(item, TxHistoryPageItem) or item.event_uuid is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"prev_event_uuid": item.event_uuid}) + + +class AsyncTxHistoryPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + data = self.data + if not data: + return None + + item = cast(Any, data[-1]) + if not isinstance(item, TxHistoryPageItem) or item.event_uuid is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"prev_event_uuid": item.event_uuid}) + + +class IntervalMultiPagePagination(BaseModel): + interval_count: Optional[int] = None + + next_offset: Optional[int] = None + + +class IntervalMultiPageData(GenericModel, Generic[_T]): + pagination: Optional[IntervalMultiPagePagination] = None + + series: Optional[List[_T]] = None + + +class SyncIntervalMultiPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + data: Optional[IntervalMultiPageData[_T]] = None + + @override + def _get_page_items(self) -> List[_T]: + series = None + if self.data is not None: + if self.data.series is not None: + series = self.data.series + if not series: + return [] + return series + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_offset = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.next_offset is not None: + next_offset = self.data.pagination.next_offset + if next_offset is None: + return None # type: ignore[unreachable] + + length = len(self._get_page_items()) + current_count = next_offset + length + + interval_count = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.interval_count is not None: + interval_count = self.data.pagination.interval_count + if interval_count is None: + return None + + if current_count < interval_count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncIntervalMultiPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + data: Optional[IntervalMultiPageData[_T]] = None + + @override + def _get_page_items(self) -> List[_T]: + series = None + if self.data is not None: + if self.data.series is not None: + series = self.data.series + if not series: + return [] + return series + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_offset = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.next_offset is not None: + next_offset = self.data.pagination.next_offset + if next_offset is None: + return None # type: ignore[unreachable] + + length = len(self._get_page_items()) + current_count = next_offset + length + + interval_count = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.interval_count is not None: + interval_count = self.data.pagination.interval_count + if interval_count is None: + return None + + if current_count < interval_count: + return PageInfo(params={"offset": current_count}) + + return None + + +class IntervalSinglePagePagination(BaseModel): + interval_count: Optional[int] = None + + next_offset: Optional[int] = None + + +class IntervalSinglePageData(GenericModel, Generic[_T]): + pagination: Optional[IntervalSinglePagePagination] = None + + points: Optional[List[_T]] = None + + +class SyncIntervalSinglePage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + data: Optional[IntervalSinglePageData[_T]] = None + + @override + def _get_page_items(self) -> List[_T]: + points = None + if self.data is not None: + if self.data.points is not None: + points = self.data.points + if not points: + return [] + return points + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_offset = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.next_offset is not None: + next_offset = self.data.pagination.next_offset + if next_offset is None: + return None # type: ignore[unreachable] + + length = len(self._get_page_items()) + current_count = next_offset + length + + interval_count = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.interval_count is not None: + interval_count = self.data.pagination.interval_count + if interval_count is None: + return None + + if current_count < interval_count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncIntervalSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + data: Optional[IntervalSinglePageData[_T]] = None + + @override + def _get_page_items(self) -> List[_T]: + points = None + if self.data is not None: + if self.data.points is not None: + points = self.data.points + if not points: + return [] + return points + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_offset = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.next_offset is not None: + next_offset = self.data.pagination.next_offset + if next_offset is None: + return None # type: ignore[unreachable] + + length = len(self._get_page_items()) + current_count = next_offset + length + + interval_count = None + if self.data is not None: + if self.data.pagination is not None: + if self.data.pagination.interval_count is not None: + interval_count = self.data.pagination.interval_count + if interval_count is None: + return None + + if current_count < interval_count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/neptune_api_v2/resources/__init__.py b/src/neptune_api_v2/resources/__init__.py index 6597944..b40c1e0 100644 --- a/src/neptune_api_v2/resources/__init__.py +++ b/src/neptune_api_v2/resources/__init__.py @@ -8,6 +8,14 @@ NeptResourceWithStreamingResponse, AsyncNeptResourceWithStreamingResponse, ) +from .swap import ( + SwapResource, + AsyncSwapResource, + SwapResourceWithRawResponse, + AsyncSwapResourceWithRawResponse, + SwapResourceWithStreamingResponse, + AsyncSwapResourceWithStreamingResponse, +) from .user import ( UserResource, AsyncUserResource, @@ -100,4 +108,10 @@ "AsyncIntegrationsResourceWithRawResponse", "IntegrationsResourceWithStreamingResponse", "AsyncIntegrationsResourceWithStreamingResponse", + "SwapResource", + "AsyncSwapResource", + "SwapResourceWithRawResponse", + "AsyncSwapResourceWithRawResponse", + "SwapResourceWithStreamingResponse", + "AsyncSwapResourceWithStreamingResponse", ] diff --git a/src/neptune_api_v2/resources/analytics/market/history.py b/src/neptune_api_v2/resources/analytics/market/history.py index e054aa0..eb97087 100644 --- a/src/neptune_api_v2/resources/analytics/market/history.py +++ b/src/neptune_api_v2/resources/analytics/market/history.py @@ -8,7 +8,7 @@ from ....types import IntervalUnit from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -17,7 +17,13 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import ( + SyncIntervalMultiPage, + AsyncIntervalMultiPage, + SyncIntervalSinglePage, + AsyncIntervalSinglePage, +) +from ...._base_client import AsyncPaginator, make_request_options from ....types.interval_unit import IntervalUnit from ....types.analytics.market import history_get_loans_originated_params, history_get_loans_originated_by_asset_params from ....types.analytics.market.history_get_loans_originated_response import HistoryGetLoansOriginatedResponse @@ -63,7 +69,7 @@ def get_loans_originated( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> HistoryGetLoansOriginatedResponse: + ) -> SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse]: """ Get cumulative lending value history independent of assets @@ -110,8 +116,9 @@ def get_loans_originated( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/api/v1/analytics/market/history/loans-originated", + page=SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -129,7 +136,7 @@ def get_loans_originated( history_get_loans_originated_params.HistoryGetLoansOriginatedParams, ), ), - cast_to=HistoryGetLoansOriginatedResponse, + model=HistoryGetLoansOriginatedResponse, ) def get_loans_originated_by_asset( @@ -148,7 +155,7 @@ def get_loans_originated_by_asset( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> HistoryGetLoansOriginatedByAssetResponse: + ) -> SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse]: """ Get cumulative lending value history assets @@ -198,8 +205,9 @@ def get_loans_originated_by_asset( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/api/v1/analytics/market/history/loans-originated/by-asset", + page=SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -218,7 +226,7 @@ def get_loans_originated_by_asset( history_get_loans_originated_by_asset_params.HistoryGetLoansOriginatedByAssetParams, ), ), - cast_to=HistoryGetLoansOriginatedByAssetResponse, + model=HistoryGetLoansOriginatedByAssetResponse, ) @@ -242,7 +250,7 @@ def with_streaming_response(self) -> AsyncHistoryResourceWithStreamingResponse: """ return AsyncHistoryResourceWithStreamingResponse(self) - async def get_loans_originated( + def get_loans_originated( self, *, end: int, @@ -257,7 +265,7 @@ async def get_loans_originated( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> HistoryGetLoansOriginatedResponse: + ) -> AsyncPaginator[HistoryGetLoansOriginatedResponse, AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse]]: """ Get cumulative lending value history independent of assets @@ -304,14 +312,15 @@ async def get_loans_originated( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/api/v1/analytics/market/history/loans-originated", + page=AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "end": end, "period": period, @@ -323,10 +332,10 @@ async def get_loans_originated( history_get_loans_originated_params.HistoryGetLoansOriginatedParams, ), ), - cast_to=HistoryGetLoansOriginatedResponse, + model=HistoryGetLoansOriginatedResponse, ) - async def get_loans_originated_by_asset( + def get_loans_originated_by_asset( self, *, end: int, @@ -342,7 +351,9 @@ async def get_loans_originated_by_asset( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> HistoryGetLoansOriginatedByAssetResponse: + ) -> AsyncPaginator[ + HistoryGetLoansOriginatedByAssetResponse, AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse] + ]: """ Get cumulative lending value history assets @@ -392,14 +403,15 @@ async def get_loans_originated_by_asset( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/api/v1/analytics/market/history/loans-originated/by-asset", + page=AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "end": end, "period": period, @@ -412,7 +424,7 @@ async def get_loans_originated_by_asset( history_get_loans_originated_by_asset_params.HistoryGetLoansOriginatedByAssetParams, ), ), - cast_to=HistoryGetLoansOriginatedByAssetResponse, + model=HistoryGetLoansOriginatedByAssetResponse, ) diff --git a/src/neptune_api_v2/resources/assets.py b/src/neptune_api_v2/resources/assets.py index ba20705..d64da3d 100644 --- a/src/neptune_api_v2/resources/assets.py +++ b/src/neptune_api_v2/resources/assets.py @@ -17,11 +17,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import make_request_options +from ..pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage +from .._base_client import AsyncPaginator, make_request_options from ..types.interval_unit import IntervalUnit from ..types.asset_list_response import AssetListResponse +from ..types.asset_price_history import Series from ..types.asset_list_prices_response import AssetListPricesResponse -from ..types.asset_get_price_history_response import AssetGetPriceHistoryResponse __all__ = ["AssetsResource", "AsyncAssetsResource"] @@ -81,7 +82,7 @@ def get_price_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AssetGetPriceHistoryResponse: + ) -> SyncIntervalMultiPage[Series]: """ Get historical prices for assets @@ -131,8 +132,9 @@ def get_price_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/api/v1/assets/price-history", + page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,7 +153,7 @@ def get_price_history( asset_get_price_history_params.AssetGetPriceHistoryParams, ), ), - cast_to=AssetGetPriceHistoryResponse, + model=Series, ) def list_prices( @@ -231,7 +233,7 @@ async def list( cast_to=AssetListResponse, ) - async def get_price_history( + def get_price_history( self, *, end: int, @@ -247,7 +249,7 @@ async def get_price_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AssetGetPriceHistoryResponse: + ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: """ Get historical prices for assets @@ -297,14 +299,15 @@ async def get_price_history( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/api/v1/assets/price-history", + page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "end": end, "period": period, @@ -317,7 +320,7 @@ async def get_price_history( asset_get_price_history_params.AssetGetPriceHistoryParams, ), ), - cast_to=AssetGetPriceHistoryResponse, + model=Series, ) async def list_prices( diff --git a/src/neptune_api_v2/resources/markets/borrow/borrow.py b/src/neptune_api_v2/resources/markets/borrow/borrow.py index de746b2..558d0f3 100644 --- a/src/neptune_api_v2/resources/markets/borrow/borrow.py +++ b/src/neptune_api_v2/resources/markets/borrow/borrow.py @@ -33,11 +33,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage +from ...._base_client import AsyncPaginator, make_request_options from ....types.markets import borrow_get_overview_params, borrow_get_rate_history_params from ....types.interval_unit import IntervalUnit +from ....types.asset_rate_history import Series from ....types.markets.borrow_get_overview_response import BorrowGetOverviewResponse -from ....types.markets.borrow_get_rate_history_response import BorrowGetRateHistoryResponse __all__ = ["BorrowResource", "AsyncBorrowResource"] @@ -132,7 +133,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BorrowGetRateHistoryResponse: + ) -> SyncIntervalMultiPage[Series]: """ Get historical borrowing rates for assets @@ -182,8 +183,9 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/api/v1/markets/borrow/rate-history", + page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -202,7 +204,7 @@ def get_rate_history( borrow_get_rate_history_params.BorrowGetRateHistoryParams, ), ), - cast_to=BorrowGetRateHistoryResponse, + model=Series, ) @@ -280,7 +282,7 @@ async def get_overview( cast_to=BorrowGetOverviewResponse, ) - async def get_rate_history( + def get_rate_history( self, *, end: int, @@ -296,7 +298,7 @@ async def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BorrowGetRateHistoryResponse: + ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: """ Get historical borrowing rates for assets @@ -346,14 +348,15 @@ async def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/api/v1/markets/borrow/rate-history", + page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "end": end, "period": period, @@ -366,7 +369,7 @@ async def get_rate_history( borrow_get_rate_history_params.BorrowGetRateHistoryParams, ), ), - cast_to=BorrowGetRateHistoryResponse, + model=Series, ) diff --git a/src/neptune_api_v2/resources/markets/lend.py b/src/neptune_api_v2/resources/markets/lend.py index 67de206..fd28004 100644 --- a/src/neptune_api_v2/resources/markets/lend.py +++ b/src/neptune_api_v2/resources/markets/lend.py @@ -17,12 +17,13 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.markets import lend_list_params, lend_get_by_asset_params, lend_get_rate_history_params from ...types.interval_unit import IntervalUnit +from ...types.asset_rate_history import Series from ...types.markets.lend_list_response import LendListResponse from ...types.markets.lend_get_by_asset_response import LendGetByAssetResponse -from ...types.markets.lend_get_rate_history_response import LendGetRateHistoryResponse __all__ = ["LendResource", "AsyncLendResource"] @@ -159,7 +160,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LendGetRateHistoryResponse: + ) -> SyncIntervalMultiPage[Series]: """ Get historical lending rates for assets @@ -209,8 +210,9 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/api/v1/markets/lend/rate-history", + page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +231,7 @@ def get_rate_history( lend_get_rate_history_params.LendGetRateHistoryParams, ), ), - cast_to=LendGetRateHistoryResponse, + model=Series, ) @@ -349,7 +351,7 @@ async def get_by_asset( cast_to=LendGetByAssetResponse, ) - async def get_rate_history( + def get_rate_history( self, *, end: int, @@ -365,7 +367,7 @@ async def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LendGetRateHistoryResponse: + ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: """ Get historical lending rates for assets @@ -415,14 +417,15 @@ async def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/api/v1/markets/lend/rate-history", + page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "end": end, "period": period, @@ -435,7 +438,7 @@ async def get_rate_history( lend_get_rate_history_params.LendGetRateHistoryParams, ), ), - cast_to=LendGetRateHistoryResponse, + model=Series, ) diff --git a/src/neptune_api_v2/resources/swap/__init__.py b/src/neptune_api_v2/resources/swap/__init__.py new file mode 100644 index 0000000..d1dadde --- /dev/null +++ b/src/neptune_api_v2/resources/swap/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .swap import ( + SwapResource, + AsyncSwapResource, + SwapResourceWithRawResponse, + AsyncSwapResourceWithRawResponse, + SwapResourceWithStreamingResponse, + AsyncSwapResourceWithStreamingResponse, +) +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, +) + +__all__ = [ + "RoutesResource", + "AsyncRoutesResource", + "RoutesResourceWithRawResponse", + "AsyncRoutesResourceWithRawResponse", + "RoutesResourceWithStreamingResponse", + "AsyncRoutesResourceWithStreamingResponse", + "SwapResource", + "AsyncSwapResource", + "SwapResourceWithRawResponse", + "AsyncSwapResourceWithRawResponse", + "SwapResourceWithStreamingResponse", + "AsyncSwapResourceWithStreamingResponse", +] diff --git a/src/neptune_api_v2/resources/swap/routes.py b/src/neptune_api_v2/resources/swap/routes.py new file mode 100644 index 0000000..ad70a0d --- /dev/null +++ b/src/neptune_api_v2/resources/swap/routes.py @@ -0,0 +1,286 @@ +# 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 ..._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 ...types.swap import route_list_all_params, route_list_by_denom_params +from ..._base_client import make_request_options +from ...types.swap.route_list_all_response import RouteListAllResponse +from ...types.swap.route_list_by_denom_response import RouteListByDenomResponse + +__all__ = ["RoutesResource", "AsyncRoutesResource"] + + +class RoutesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutesResourceWithRawResponse: + """ + 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/cryptechdev/neptune-api-v2-python#accessing-raw-response-data-eg-headers + """ + return RoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cryptechdev/neptune-api-v2-python#with_streaming_response + """ + return RoutesResourceWithStreamingResponse(self) + + def list_all( + self, + *, + contract_address: 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, + ) -> RouteListAllResponse: + """ + Get swap routes for all denoms + + Args: + contract_address: Swap contract address + + 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/v1/swap/routes/all", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"contract_address": contract_address}, route_list_all_params.RouteListAllParams), + ), + cast_to=RouteListAllResponse, + ) + + def list_by_denom( + self, + *, + contract_address: str, + source_denom: 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, + ) -> RouteListByDenomResponse: + """ + Get swap routes for a denom + + Args: + contract_address: Swap contract address + + source_denom: Source asset denom to fetch target routes for + + **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. + E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + + 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/v1/swap/routes", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "contract_address": contract_address, + "source_denom": source_denom, + }, + route_list_by_denom_params.RouteListByDenomParams, + ), + ), + cast_to=RouteListByDenomResponse, + ) + + +class AsyncRoutesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + """ + 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/cryptechdev/neptune-api-v2-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cryptechdev/neptune-api-v2-python#with_streaming_response + """ + return AsyncRoutesResourceWithStreamingResponse(self) + + async def list_all( + self, + *, + contract_address: 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, + ) -> RouteListAllResponse: + """ + Get swap routes for all denoms + + Args: + contract_address: Swap contract address + + 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._get( + "/api/v1/swap/routes/all", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"contract_address": contract_address}, route_list_all_params.RouteListAllParams + ), + ), + cast_to=RouteListAllResponse, + ) + + async def list_by_denom( + self, + *, + contract_address: str, + source_denom: 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, + ) -> RouteListByDenomResponse: + """ + Get swap routes for a denom + + Args: + contract_address: Swap contract address + + source_denom: Source asset denom to fetch target routes for + + **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. + E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + + 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._get( + "/api/v1/swap/routes", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "contract_address": contract_address, + "source_denom": source_denom, + }, + route_list_by_denom_params.RouteListByDenomParams, + ), + ), + cast_to=RouteListByDenomResponse, + ) + + +class RoutesResourceWithRawResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.list_all = to_raw_response_wrapper( + routes.list_all, + ) + self.list_by_denom = to_raw_response_wrapper( + routes.list_by_denom, + ) + + +class AsyncRoutesResourceWithRawResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.list_all = async_to_raw_response_wrapper( + routes.list_all, + ) + self.list_by_denom = async_to_raw_response_wrapper( + routes.list_by_denom, + ) + + +class RoutesResourceWithStreamingResponse: + def __init__(self, routes: RoutesResource) -> None: + self._routes = routes + + self.list_all = to_streamed_response_wrapper( + routes.list_all, + ) + self.list_by_denom = to_streamed_response_wrapper( + routes.list_by_denom, + ) + + +class AsyncRoutesResourceWithStreamingResponse: + def __init__(self, routes: AsyncRoutesResource) -> None: + self._routes = routes + + self.list_all = async_to_streamed_response_wrapper( + routes.list_all, + ) + self.list_by_denom = async_to_streamed_response_wrapper( + routes.list_by_denom, + ) diff --git a/src/neptune_api_v2/resources/swap/swap.py b/src/neptune_api_v2/resources/swap/swap.py new file mode 100644 index 0000000..d44836e --- /dev/null +++ b/src/neptune_api_v2/resources/swap/swap.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .routes import ( + RoutesResource, + AsyncRoutesResource, + RoutesResourceWithRawResponse, + AsyncRoutesResourceWithRawResponse, + RoutesResourceWithStreamingResponse, + AsyncRoutesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["SwapResource", "AsyncSwapResource"] + + +class SwapResource(SyncAPIResource): + @cached_property + def routes(self) -> RoutesResource: + return RoutesResource(self._client) + + @cached_property + def with_raw_response(self) -> SwapResourceWithRawResponse: + """ + 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/cryptechdev/neptune-api-v2-python#accessing-raw-response-data-eg-headers + """ + return SwapResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SwapResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cryptechdev/neptune-api-v2-python#with_streaming_response + """ + return SwapResourceWithStreamingResponse(self) + + +class AsyncSwapResource(AsyncAPIResource): + @cached_property + def routes(self) -> AsyncRoutesResource: + return AsyncRoutesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSwapResourceWithRawResponse: + """ + 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/cryptechdev/neptune-api-v2-python#accessing-raw-response-data-eg-headers + """ + return AsyncSwapResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSwapResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cryptechdev/neptune-api-v2-python#with_streaming_response + """ + return AsyncSwapResourceWithStreamingResponse(self) + + +class SwapResourceWithRawResponse: + def __init__(self, swap: SwapResource) -> None: + self._swap = swap + + @cached_property + def routes(self) -> RoutesResourceWithRawResponse: + return RoutesResourceWithRawResponse(self._swap.routes) + + +class AsyncSwapResourceWithRawResponse: + def __init__(self, swap: AsyncSwapResource) -> None: + self._swap = swap + + @cached_property + def routes(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self._swap.routes) + + +class SwapResourceWithStreamingResponse: + def __init__(self, swap: SwapResource) -> None: + self._swap = swap + + @cached_property + def routes(self) -> RoutesResourceWithStreamingResponse: + return RoutesResourceWithStreamingResponse(self._swap.routes) + + +class AsyncSwapResourceWithStreamingResponse: + def __init__(self, swap: AsyncSwapResource) -> None: + self._swap = swap + + @cached_property + def routes(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self._swap.routes) diff --git a/src/neptune_api_v2/resources/user/user.py b/src/neptune_api_v2/resources/user/user.py index bd92efc..22bc1d7 100644 --- a/src/neptune_api_v2/resources/user/user.py +++ b/src/neptune_api_v2/resources/user/user.py @@ -34,6 +34,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from ...pagination import SyncTxHistoryPage, AsyncTxHistoryPage from .market.market import ( MarketResource, AsyncMarketResource, @@ -42,10 +43,10 @@ MarketResourceWithStreamingResponse, AsyncMarketResourceWithStreamingResponse, ) -from ..._base_client import make_request_options +from ..._base_client import AsyncPaginator, make_request_options +from ...types.user_tx import UserTx from ...types.event_action import EventAction from ...types.user_get_user_response import UserGetUserResponse -from ...types.user_get_tx_history_response import UserGetTxHistoryResponse __all__ = ["UserResource", "AsyncUserResource"] @@ -98,7 +99,7 @@ def get_tx_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserGetTxHistoryResponse: + ) -> SyncTxHistoryPage[UserTx]: """ Get user tx history @@ -137,8 +138,9 @@ def get_tx_history( """ if not address: raise ValueError(f"Expected a non-empty value for `address` but received {address!r}") - return self._get( + return self._get_api_list( path_template("/api/v1/users/{address}/tx-history", address=address), + page=SyncTxHistoryPage[UserTx], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -156,7 +158,7 @@ def get_tx_history( user_get_tx_history_params.UserGetTxHistoryParams, ), ), - cast_to=UserGetTxHistoryResponse, + model=UserTx, ) def get_user( @@ -247,7 +249,7 @@ def with_streaming_response(self) -> AsyncUserResourceWithStreamingResponse: """ return AsyncUserResourceWithStreamingResponse(self) - async def get_tx_history( + def get_tx_history( self, address: str, *, @@ -263,7 +265,7 @@ async def get_tx_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserGetTxHistoryResponse: + ) -> AsyncPaginator[UserTx, AsyncTxHistoryPage[UserTx]]: """ Get user tx history @@ -302,14 +304,15 @@ async def get_tx_history( """ if not address: raise ValueError(f"Expected a non-empty value for `address` but received {address!r}") - return await self._get( + return self._get_api_list( path_template("/api/v1/users/{address}/tx-history", address=address), + page=AsyncTxHistoryPage[UserTx], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "action": action, "limit": limit, @@ -321,7 +324,7 @@ async def get_tx_history( user_get_tx_history_params.UserGetTxHistoryParams, ), ), - cast_to=UserGetTxHistoryResponse, + model=UserTx, ) async def get_user( diff --git a/src/neptune_api_v2/types/__init__.py b/src/neptune_api_v2/types/__init__.py index 78878e1..0b2619f 100644 --- a/src/neptune_api_v2/types/__init__.py +++ b/src/neptune_api_v2/types/__init__.py @@ -42,10 +42,8 @@ from .user_get_tx_history_params import UserGetTxHistoryParams as UserGetTxHistoryParams from .market_get_overview_response import MarketGetOverviewResponse as MarketGetOverviewResponse from .status_check_health_response import StatusCheckHealthResponse as StatusCheckHealthResponse -from .user_get_tx_history_response import UserGetTxHistoryResponse as UserGetTxHistoryResponse from .asset_get_price_history_params import AssetGetPriceHistoryParams as AssetGetPriceHistoryParams from .nept_unlock_distribution_group import NeptUnlockDistributionGroup as NeptUnlockDistributionGroup -from .asset_get_price_history_response import AssetGetPriceHistoryResponse as AssetGetPriceHistoryResponse from .nept_get_staking_overview_params import NeptGetStakingOverviewParams as NeptGetStakingOverviewParams from .market_get_merged_by_asset_params import MarketGetMergedByAssetParams as MarketGetMergedByAssetParams from .nept_get_staking_overview_response import NeptGetStakingOverviewResponse as NeptGetStakingOverviewResponse diff --git a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py index 47c68d0..593264b 100644 --- a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py +++ b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py @@ -1,52 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Union from datetime import datetime from ...._models import BaseModel -from ...interval import Interval from ...asset_spec import AssetSpec -__all__ = [ - "HistoryGetLoansOriginatedByAssetResponse", - "Data", - "DataPagination", - "DataRange", - "DataSeries", - "DataSeriesPoint", -] +__all__ = ["HistoryGetLoansOriginatedByAssetResponse", "Point"] -class DataPagination(BaseModel): - """Values used for paginating the time series data""" - - interval_count: int - """ - The total number of intervals/buckets for the provided interval parameters - (size, period, start, end) - """ - - next_offset: Optional[int] = None - """ - The offset a client should use to fetch the next page of intervals (so long as - limit remains unchanged) - """ - - -class DataRange(BaseModel): - """ - Provides values for the requested range in it's entire width, regardless of page/limit. - """ - - end: datetime - - interval: Interval - """Interval period & size""" - - start: datetime - - -class DataSeriesPoint(BaseModel): +class Point(BaseModel): """Time + value pair representing a point in time for use with time series""" t: datetime @@ -54,7 +17,7 @@ class DataSeriesPoint(BaseModel): v: Union[str, float, None] = None -class DataSeries(BaseModel): +class HistoryGetLoansOriginatedByAssetResponse(BaseModel): """Item and associated points""" asset: AssetSpec @@ -63,37 +26,4 @@ class DataSeries(BaseModel): IDs are unique across asset domains (contract tokens, native denoms, etc) """ - points: List[DataSeriesPoint] - - -class Data(BaseModel): - """Historical cumulative lend value for assets""" - - pagination: DataPagination - """Values used for paginating the time series data""" - - range: DataRange - """ - Provides values for the requested range in it's entire width, regardless of - page/limit. - """ - - series: List[DataSeries] - - -class HistoryGetLoansOriginatedByAssetResponse(BaseModel): - data: Data - """Historical cumulative lend value for assets""" - - error: None = None - """Error data. Guaranteed `null` for successful response.""" - - status: int - """HTTP status. - - Successful responses are guaranteed to be < `400`. Conversely, error responses - are guaranteed to be >= `400`. - """ - - status_text: str - """HTTP status text""" + points: List[Point] diff --git a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py index ebe9adc..2c6cb53 100644 --- a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py +++ b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_response.py @@ -1,74 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Union from datetime import datetime from ...._models import BaseModel -from ...interval import Interval -__all__ = ["HistoryGetLoansOriginatedResponse", "Data", "DataPagination", "DataPoint", "DataRange"] +__all__ = ["HistoryGetLoansOriginatedResponse"] -class DataPagination(BaseModel): - """Pagination parameters for the interval response""" - - interval_count: int - """ - The total number of intervals/buckets for the provided interval parameters - (size, period, start, end) - """ - - next_offset: Optional[int] = None - """ - The offset a client should use to fetch the next page of intervals (so long as - limit remains unchanged) - """ - - -class DataPoint(BaseModel): +class HistoryGetLoansOriginatedResponse(BaseModel): """Time + value pair representing a point in time for use with time series""" t: datetime v: Union[str, float, None] = None - - -class DataRange(BaseModel): - """Interval window parameters""" - - end: datetime - - interval: Interval - """Interval period & size""" - - start: datetime - - -class Data(BaseModel): - """Historical cumulative lend value for assets""" - - pagination: DataPagination - """Pagination parameters for the interval response""" - - points: List[DataPoint] - - range: DataRange - """Interval window parameters""" - - -class HistoryGetLoansOriginatedResponse(BaseModel): - data: Data - """Historical cumulative lend value for assets""" - - error: None = None - """Error data. Guaranteed `null` for successful response.""" - - status: int - """HTTP status. - - Successful responses are guaranteed to be < `400`. Conversely, error responses - are guaranteed to be >= `400`. - """ - - status_text: str - """HTTP status text""" diff --git a/src/neptune_api_v2/types/asset_get_price_history_response.py b/src/neptune_api_v2/types/asset_get_price_history_response.py deleted file mode 100644 index eec3a6d..0000000 --- a/src/neptune_api_v2/types/asset_get_price_history_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .._models import BaseModel -from .asset_price_history import AssetPriceHistory - -__all__ = ["AssetGetPriceHistoryResponse"] - - -class AssetGetPriceHistoryResponse(BaseModel): - data: AssetPriceHistory - """Historical prices for assets""" - - error: None = None - """Error data. Guaranteed `null` for successful response.""" - - status: int - """HTTP status. - - Successful responses are guaranteed to be < `400`. Conversely, error responses - are guaranteed to be >= `400`. - """ - - status_text: str - """HTTP status text""" diff --git a/src/neptune_api_v2/types/markets/__init__.py b/src/neptune_api_v2/types/markets/__init__.py index d64c771..fd36e56 100644 --- a/src/neptune_api_v2/types/markets/__init__.py +++ b/src/neptune_api_v2/types/markets/__init__.py @@ -14,5 +14,3 @@ from .borrow_get_overview_response import BorrowGetOverviewResponse as BorrowGetOverviewResponse from .lend_get_rate_history_params import LendGetRateHistoryParams as LendGetRateHistoryParams from .borrow_get_rate_history_params import BorrowGetRateHistoryParams as BorrowGetRateHistoryParams -from .lend_get_rate_history_response import LendGetRateHistoryResponse as LendGetRateHistoryResponse -from .borrow_get_rate_history_response import BorrowGetRateHistoryResponse as BorrowGetRateHistoryResponse diff --git a/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py b/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py deleted file mode 100644 index 60dcfba..0000000 --- a/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel -from ..asset_rate_history import AssetRateHistory - -__all__ = ["BorrowGetRateHistoryResponse"] - - -class BorrowGetRateHistoryResponse(BaseModel): - data: AssetRateHistory - """Historical rates for assets""" - - error: None = None - """Error data. Guaranteed `null` for successful response.""" - - status: int - """HTTP status. - - Successful responses are guaranteed to be < `400`. Conversely, error responses - are guaranteed to be >= `400`. - """ - - status_text: str - """HTTP status text""" diff --git a/src/neptune_api_v2/types/swap/__init__.py b/src/neptune_api_v2/types/swap/__init__.py new file mode 100644 index 0000000..b45ceb6 --- /dev/null +++ b/src/neptune_api_v2/types/swap/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .route_list_all_params import RouteListAllParams as RouteListAllParams +from .swap_route_target_set import SwapRouteTargetSet as SwapRouteTargetSet +from .route_list_all_response import RouteListAllResponse as RouteListAllResponse +from .route_list_by_denom_params import RouteListByDenomParams as RouteListByDenomParams +from .route_list_by_denom_response import RouteListByDenomResponse as RouteListByDenomResponse diff --git a/src/neptune_api_v2/types/swap/route_list_all_params.py b/src/neptune_api_v2/types/swap/route_list_all_params.py new file mode 100644 index 0000000..5178679 --- /dev/null +++ b/src/neptune_api_v2/types/swap/route_list_all_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteListAllParams"] + + +class RouteListAllParams(TypedDict, total=False): + contract_address: Required[str] + """Swap contract address""" diff --git a/src/neptune_api_v2/types/user_get_tx_history_response.py b/src/neptune_api_v2/types/swap/route_list_all_response.py similarity index 72% rename from src/neptune_api_v2/types/user_get_tx_history_response.py rename to src/neptune_api_v2/types/swap/route_list_all_response.py index d8f5875..d52044b 100644 --- a/src/neptune_api_v2/types/user_get_tx_history_response.py +++ b/src/neptune_api_v2/types/swap/route_list_all_response.py @@ -2,17 +2,17 @@ from typing import List -from .user_tx import UserTx -from .._models import BaseModel +from ..._models import BaseModel +from .swap_route_target_set import SwapRouteTargetSet -__all__ = ["UserGetTxHistoryResponse"] +__all__ = ["RouteListAllResponse"] -class UserGetTxHistoryResponse(BaseModel): +class RouteListAllResponse(BaseModel): count: int """Total number of objects irrespective of any pagination parameters.""" - data: List[UserTx] + data: List[SwapRouteTargetSet] error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/swap/route_list_by_denom_params.py b/src/neptune_api_v2/types/swap/route_list_by_denom_params.py new file mode 100644 index 0000000..3ea3190 --- /dev/null +++ b/src/neptune_api_v2/types/swap/route_list_by_denom_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouteListByDenomParams"] + + +class RouteListByDenomParams(TypedDict, total=False): + contract_address: Required[str] + """Swap contract address""" + + source_denom: Required[str] + """Source asset denom to fetch target routes for + + **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. + E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + """ diff --git a/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py b/src/neptune_api_v2/types/swap/route_list_by_denom_response.py similarity index 67% rename from src/neptune_api_v2/types/markets/lend_get_rate_history_response.py rename to src/neptune_api_v2/types/swap/route_list_by_denom_response.py index 095ea67..fc92cad 100644 --- a/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py +++ b/src/neptune_api_v2/types/swap/route_list_by_denom_response.py @@ -1,14 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from ..._models import BaseModel -from ..asset_rate_history import AssetRateHistory +from .swap_route_target_set import SwapRouteTargetSet -__all__ = ["LendGetRateHistoryResponse"] +__all__ = ["RouteListByDenomResponse"] -class LendGetRateHistoryResponse(BaseModel): - data: AssetRateHistory - """Historical rates for assets""" +class RouteListByDenomResponse(BaseModel): + data: SwapRouteTargetSet error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/swap/swap_route_target_set.py b/src/neptune_api_v2/types/swap/swap_route_target_set.py new file mode 100644 index 0000000..0a174c9 --- /dev/null +++ b/src/neptune_api_v2/types/swap/swap_route_target_set.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["SwapRouteTargetSet"] + + +class SwapRouteTargetSet(BaseModel): + source: str + """Source denom for swap routes""" + + targets: List[str] + """List of target denoms for available swap routes""" diff --git a/src/neptune_api_v2/types/user/market/__init__.py b/src/neptune_api_v2/types/user/market/__init__.py index 0f686ae..d83553d 100644 --- a/src/neptune_api_v2/types/user/market/__init__.py +++ b/src/neptune_api_v2/types/user/market/__init__.py @@ -6,8 +6,11 @@ from .user_lend_market import UserLendMarket as UserLendMarket from .lend_list_response import LendListResponse as LendListResponse from .user_borrow_market import UserBorrowMarket as UserBorrowMarket +from .user_lend_asset_pool import UserLendAssetPool as UserLendAssetPool from .lend_get_by_asset_params import LendGetByAssetParams as LendGetByAssetParams from .user_borrow_market_pools import UserBorrowMarketPools as UserBorrowMarketPools +from .user_lend_origin_amounts import UserLendOriginAmounts as UserLendOriginAmounts +from .user_lend_receipt_amounts import UserLendReceiptAmounts as UserLendReceiptAmounts from .lend_get_by_asset_response import LendGetByAssetResponse as LendGetByAssetResponse from .borrow_get_portfolio_params import BorrowGetPortfolioParams as BorrowGetPortfolioParams from .borrow_get_portfolio_response import BorrowGetPortfolioResponse as BorrowGetPortfolioResponse diff --git a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py index 2718dd3..21db54e 100644 --- a/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py +++ b/src/neptune_api_v2/types/user/market/lend_get_by_asset_response.py @@ -1,206 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ...._models import BaseModel -from ...asset_info import AssetInfo -from ...market_rate import MarketRate - -__all__ = [ - "LendGetByAssetResponse", - "Data", - "DataOriginEquivalent", - "DataOriginEquivalentExtra", - "DataOriginEquivalentExtraText", - "DataReceiptAmounts", - "DataReceiptAmountsExtra", - "DataReceiptAmountsExtraText", - "DataReceiptAmountsExtraValue", - "DataReceiptAmountsExtraValueExtra", - "DataReceiptAmountsExtraValueExtraText", -] - - -class DataOriginEquivalentExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class DataOriginEquivalentExtra(BaseModel): - text: Optional[DataOriginEquivalentExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - -class DataOriginEquivalent(BaseModel): - """ - The lending amounts converted into the equivalent for the receipt token's origin/source asset - """ - - collateralized: str - """ - Total equivalent amount of origin token collateralized across this user's - borrowing portfolio - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` - """ - - extra: DataOriginEquivalentExtra - - held: str - """Total equivalent amount of origin token held in address balance - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_held = receipt_held / receipt_redemption_ratio` - """ - - total: str - """Total of held and collateralized equivalent for origin asset - - Or, more formally: - `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` - """ - - -class DataReceiptAmountsExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class DataReceiptAmountsExtraValueExtraText(BaseModel): - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - collateralized: str - - held: str - - price: str - """Text representation of price""" - - total: str - - -class DataReceiptAmountsExtraValueExtra(BaseModel): - text: Optional[DataReceiptAmountsExtraValueExtraText] = None - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - -class DataReceiptAmountsExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used in value calculation). - - The embedded text group will contain the text variant if `with_text` was specified as well. - """ - - collateralized: str - - extra: DataReceiptAmountsExtraValueExtra - - held: str - - price: str - """Price used in value calculations""" - - total: str - - -class DataReceiptAmountsExtra(BaseModel): - text: Optional[DataReceiptAmountsExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[DataReceiptAmountsExtraValue] = None - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used - in value calculation). - - The embedded text group will contain the text variant if `with_text` was - specified as well. - """ - - -class DataReceiptAmounts(BaseModel): - """The lending amounts in the original receipt token amounts""" - - collateralized: str - """ - Total amount of receipt token collateralized across this user's borrowing - portfolio - """ - - extra: DataReceiptAmountsExtra - - held: str - """Total amount of receipt token held in address balance""" - - total: str - """Sum of receipt amount held and receipt amount collateralized""" - - -class Data(BaseModel): - asset_info: AssetInfo - """Asset identifiers with associated metadata""" - - market_rate: MarketRate - """Current market lending rate""" - - origin_equivalent: DataOriginEquivalent - """ - The lending amounts converted into the equivalent for the receipt token's - origin/source asset - """ +from .user_lend_asset_pool import UserLendAssetPool - receipt_amounts: DataReceiptAmounts - """The lending amounts in the original receipt token amounts""" +__all__ = ["LendGetByAssetResponse"] class LendGetByAssetResponse(BaseModel): - data: Data + data: UserLendAssetPool error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/user/market/user_lend_asset_pool.py b/src/neptune_api_v2/types/user/market/user_lend_asset_pool.py new file mode 100644 index 0000000..807bd6d --- /dev/null +++ b/src/neptune_api_v2/types/user/market/user_lend_asset_pool.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel +from ...asset_info import AssetInfo +from ...market_rate import MarketRate +from .user_lend_origin_amounts import UserLendOriginAmounts +from .user_lend_receipt_amounts import UserLendReceiptAmounts + +__all__ = ["UserLendAssetPool"] + + +class UserLendAssetPool(BaseModel): + asset_info: AssetInfo + """Asset identifiers with associated metadata""" + + market_rate: MarketRate + """Current market lending rate""" + + origin_equivalent: UserLendOriginAmounts + """ + The lending amounts converted into the equivalent for the receipt token's + origin/source asset + """ + + receipt_amounts: UserLendReceiptAmounts + """The lending amounts in the original receipt token amounts""" diff --git a/src/neptune_api_v2/types/user/market/user_lend_market.py b/src/neptune_api_v2/types/user/market/user_lend_market.py index e0cab74..26e8984 100644 --- a/src/neptune_api_v2/types/user/market/user_lend_market.py +++ b/src/neptune_api_v2/types/user/market/user_lend_market.py @@ -1,206 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from ...._models import BaseModel -from ...asset_info import AssetInfo from ...market_rate import MarketRate +from .user_lend_asset_pool import UserLendAssetPool -__all__ = [ - "UserLendMarket", - "AssetPool", - "AssetPoolOriginEquivalent", - "AssetPoolOriginEquivalentExtra", - "AssetPoolOriginEquivalentExtraText", - "AssetPoolReceiptAmounts", - "AssetPoolReceiptAmountsExtra", - "AssetPoolReceiptAmountsExtraText", - "AssetPoolReceiptAmountsExtraValue", - "AssetPoolReceiptAmountsExtraValueExtra", - "AssetPoolReceiptAmountsExtraValueExtraText", -] - - -class AssetPoolOriginEquivalentExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class AssetPoolOriginEquivalentExtra(BaseModel): - text: Optional[AssetPoolOriginEquivalentExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - -class AssetPoolOriginEquivalent(BaseModel): - """ - The lending amounts converted into the equivalent for the receipt token's origin/source asset - """ - - collateralized: str - """ - Total equivalent amount of origin token collateralized across this user's - borrowing portfolio - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` - """ - - extra: AssetPoolOriginEquivalentExtra - - held: str - """Total equivalent amount of origin token held in address balance - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_held = receipt_held / receipt_redemption_ratio` - """ - - total: str - """Total of held and collateralized equivalent for origin asset - - Or, more formally: - `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` - """ - - -class AssetPoolReceiptAmountsExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class AssetPoolReceiptAmountsExtraValueExtraText(BaseModel): - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - collateralized: str - - held: str - - price: str - """Text representation of price""" - - total: str - - -class AssetPoolReceiptAmountsExtraValueExtra(BaseModel): - text: Optional[AssetPoolReceiptAmountsExtraValueExtraText] = None - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - -class AssetPoolReceiptAmountsExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used in value calculation). - - The embedded text group will contain the text variant if `with_text` was specified as well. - """ - - collateralized: str - - extra: AssetPoolReceiptAmountsExtraValueExtra - - held: str - - price: str - """Price used in value calculations""" - - total: str - - -class AssetPoolReceiptAmountsExtra(BaseModel): - text: Optional[AssetPoolReceiptAmountsExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[AssetPoolReceiptAmountsExtraValue] = None - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used - in value calculation). - - The embedded text group will contain the text variant if `with_text` was - specified as well. - """ - - -class AssetPoolReceiptAmounts(BaseModel): - """The lending amounts in the original receipt token amounts""" - - collateralized: str - """ - Total amount of receipt token collateralized across this user's borrowing - portfolio - """ - - extra: AssetPoolReceiptAmountsExtra - - held: str - """Total amount of receipt token held in address balance""" - - total: str - """Sum of receipt amount held and receipt amount collateralized""" - - -class AssetPool(BaseModel): - asset_info: AssetInfo - """Asset identifiers with associated metadata""" - - market_rate: MarketRate - """Current market lending rate""" - - origin_equivalent: AssetPoolOriginEquivalent - """ - The lending amounts converted into the equivalent for the receipt token's - origin/source asset - """ - - receipt_amounts: AssetPoolReceiptAmounts - """The lending amounts in the original receipt token amounts""" +__all__ = ["UserLendMarket"] class UserLendMarket(BaseModel): - asset_pools: List[AssetPool] + asset_pools: List[UserLendAssetPool] """User lending allocations""" net_rate: MarketRate diff --git a/src/neptune_api_v2/types/user/market/user_lend_origin_amounts.py b/src/neptune_api_v2/types/user/market/user_lend_origin_amounts.py new file mode 100644 index 0000000..92ddddf --- /dev/null +++ b/src/neptune_api_v2/types/user/market/user_lend_origin_amounts.py @@ -0,0 +1,63 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["UserLendOriginAmounts", "Extra", "ExtraText"] + + +class ExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class Extra(BaseModel): + text: Optional[ExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class UserLendOriginAmounts(BaseModel): + collateralized: str + """ + Total equivalent amount of origin token collateralized across this user's + borrowing portfolio + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` + """ + + extra: Extra + + held: str + """Total equivalent amount of origin token held in address balance + + **NOTE:** This is **not** the amount of the origin asset that the user holds, + but the amount held in the receipt token rendered as the equivalent amount in + the origin asset. + + Or, more formally: + `origin_equivalent_held = receipt_held / receipt_redemption_ratio` + """ + + total: str + """Total of held and collateralized equivalent for origin asset + + Or, more formally: + `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` + """ diff --git a/src/neptune_api_v2/types/user/market/user_lend_receipt_amounts.py b/src/neptune_api_v2/types/user/market/user_lend_receipt_amounts.py new file mode 100644 index 0000000..b4e3157 --- /dev/null +++ b/src/neptune_api_v2/types/user/market/user_lend_receipt_amounts.py @@ -0,0 +1,106 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["UserLendReceiptAmounts", "Extra", "ExtraText", "ExtraValue", "ExtraValueExtra", "ExtraValueExtraText"] + + +class ExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + collateralized: str + + held: str + + total: str + + +class ExtraValueExtraText(BaseModel): + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ + + collateralized: str + + held: str + + price: str + """Text representation of price""" + + total: str + + +class ExtraValueExtra(BaseModel): + text: Optional[ExtraValueExtraText] = None + """Human-readable variants of USD values. + + Will not be null when query params `with_text` and `with_value` are `true`. + """ + + +class ExtraValue(BaseModel): + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used in value calculation). + + The embedded text group will contain the text variant if `with_text` was specified as well. + """ + + collateralized: str + + extra: ExtraValueExtra + + held: str + + price: str + """Price used in value calculations""" + + total: str + + +class Extra(BaseModel): + text: Optional[ExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + value: Optional[ExtraValue] = None + """USD values for the corresponding amounts above. + + Will not be null when query param `with_value` is `true`. + + ### Note + + This variant group contains an additional `price` field (set to the number used + in value calculation). + + The embedded text group will contain the text variant if `with_text` was + specified as well. + """ + + +class UserLendReceiptAmounts(BaseModel): + collateralized: str + """ + Total amount of receipt token collateralized across this user's borrowing + portfolio + """ + + extra: Extra + + held: str + """Total amount of receipt token held in address balance""" + + total: str + """Sum of receipt amount held and receipt amount collateralized""" diff --git a/src/neptune_api_v2/types/user/user_merged_market.py b/src/neptune_api_v2/types/user/user_merged_market.py index 83a0cc0..0e5cc1f 100644 --- a/src/neptune_api_v2/types/user/user_merged_market.py +++ b/src/neptune_api_v2/types/user/user_merged_market.py @@ -4,195 +4,24 @@ from ..._models import BaseModel from ..asset_info import AssetInfo +from .market.user_lend_origin_amounts import UserLendOriginAmounts +from .market.user_lend_receipt_amounts import UserLendReceiptAmounts from .market.borrow.user_debt_account_pool import UserDebtAccountPool from .market.borrow.user_collateral_account_pool import UserCollateralAccountPool -__all__ = [ - "UserMergedMarket", - "Lend", - "LendOriginEquivalent", - "LendOriginEquivalentExtra", - "LendOriginEquivalentExtraText", - "LendReceiptAmounts", - "LendReceiptAmountsExtra", - "LendReceiptAmountsExtraText", - "LendReceiptAmountsExtraValue", - "LendReceiptAmountsExtraValueExtra", - "LendReceiptAmountsExtraValueExtraText", -] - - -class LendOriginEquivalentExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class LendOriginEquivalentExtra(BaseModel): - text: Optional[LendOriginEquivalentExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - -class LendOriginEquivalent(BaseModel): - """ - The lending amounts converted into the equivalent for the receipt token's origin/source asset - """ - - collateralized: str - """ - Total equivalent amount of origin token collateralized across this user's - borrowing portfolio - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` - """ - - extra: LendOriginEquivalentExtra - - held: str - """Total equivalent amount of origin token held in address balance - - **NOTE:** This is **not** the amount of the origin asset that the user holds, - but the amount held in the receipt token rendered as the equivalent amount in - the origin asset. - - Or, more formally: - `origin_equivalent_held = receipt_held / receipt_redemption_ratio` - """ - - total: str - """Total of held and collateralized equivalent for origin asset - - Or, more formally: - `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` - """ - - -class LendReceiptAmountsExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - collateralized: str - - held: str - - total: str - - -class LendReceiptAmountsExtraValueExtraText(BaseModel): - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - collateralized: str - - held: str - - price: str - """Text representation of price""" - - total: str - - -class LendReceiptAmountsExtraValueExtra(BaseModel): - text: Optional[LendReceiptAmountsExtraValueExtraText] = None - """Human-readable variants of USD values. - - Will not be null when query params `with_text` and `with_value` are `true`. - """ - - -class LendReceiptAmountsExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used in value calculation). - - The embedded text group will contain the text variant if `with_text` was specified as well. - """ - - collateralized: str - - extra: LendReceiptAmountsExtraValueExtra - - held: str - - price: str - """Price used in value calculations""" - - total: str - - -class LendReceiptAmountsExtra(BaseModel): - text: Optional[LendReceiptAmountsExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[LendReceiptAmountsExtraValue] = None - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. - - ### Note - - This variant group contains an additional `price` field (set to the number used - in value calculation). - - The embedded text group will contain the text variant if `with_text` was - specified as well. - """ - - -class LendReceiptAmounts(BaseModel): - """The lending amounts in the original receipt token amounts""" - - collateralized: str - """ - Total amount of receipt token collateralized across this user's borrowing - portfolio - """ - - extra: LendReceiptAmountsExtra - - held: str - """Total amount of receipt token held in address balance""" - - total: str - """Sum of receipt amount held and receipt amount collateralized""" +__all__ = ["UserMergedMarket", "Lend"] class Lend(BaseModel): """User contribution for asset's lending market, if one exists""" - origin_equivalent: LendOriginEquivalent + origin_equivalent: UserLendOriginAmounts """ The lending amounts converted into the equivalent for the receipt token's origin/source asset """ - receipt_amounts: LendReceiptAmounts + receipt_amounts: UserLendReceiptAmounts """The lending amounts in the original receipt token amounts""" diff --git a/tests/api_resources/analytics/market/test_history.py b/tests/api_resources/analytics/market/test_history.py index ff1446d..7c67a98 100644 --- a/tests/api_resources/analytics/market/test_history.py +++ b/tests/api_resources/analytics/market/test_history.py @@ -9,6 +9,12 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 +from neptune_api_v2.pagination import ( + SyncIntervalMultiPage, + AsyncIntervalMultiPage, + SyncIntervalSinglePage, + AsyncIntervalSinglePage, +) from neptune_api_v2.types.analytics.market import ( HistoryGetLoansOriginatedResponse, HistoryGetLoansOriginatedByAssetResponse, @@ -28,7 +34,7 @@ def test_method_get_loans_originated(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -41,7 +47,7 @@ def test_method_get_loans_originated_with_all_params(self, client: NeptuneAPIV2) limit=1, offset=0, ) - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -55,7 +61,7 @@ def test_raw_response_get_loans_originated(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -69,7 +75,7 @@ def test_streaming_response_get_loans_originated(self, client: NeptuneAPIV2) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +87,7 @@ def test_method_get_loans_originated_by_asset(self, client: NeptuneAPIV2) -> Non period="h", start=0, ) - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -95,7 +101,7 @@ def test_method_get_loans_originated_by_asset_with_all_params(self, client: Nept limit=1, offset=0, ) - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -109,7 +115,7 @@ def test_raw_response_get_loans_originated_by_asset(self, client: NeptuneAPIV2) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -123,7 +129,9 @@ def test_streaming_response_get_loans_originated_by_asset(self, client: NeptuneA assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type( + SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] + ) assert cast(Any, response.is_closed) is True @@ -141,7 +149,7 @@ async def test_method_get_loans_originated(self, async_client: AsyncNeptuneAPIV2 period="h", start=0, ) - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -154,7 +162,7 @@ async def test_method_get_loans_originated_with_all_params(self, async_client: A limit=1, offset=0, ) - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -168,7 +176,7 @@ async def test_raw_response_get_loans_originated(self, async_client: AsyncNeptun assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -182,7 +190,7 @@ async def test_streaming_response_get_loans_originated(self, async_client: Async assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(HistoryGetLoansOriginatedResponse, history, path=["response"]) + assert_matches_type(AsyncIntervalSinglePage[HistoryGetLoansOriginatedResponse], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +202,9 @@ async def test_method_get_loans_originated_by_asset(self, async_client: AsyncNep period="h", start=0, ) - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type( + AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] + ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -208,7 +218,9 @@ async def test_method_get_loans_originated_by_asset_with_all_params(self, async_ limit=1, offset=0, ) - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type( + AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] + ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -222,7 +234,9 @@ async def test_raw_response_get_loans_originated_by_asset(self, async_client: As assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type( + AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] + ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -236,6 +250,8 @@ async def test_streaming_response_get_loans_originated_by_asset(self, async_clie assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) + assert_matches_type( + AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] + ) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/markets/test_borrow.py b/tests/api_resources/markets/test_borrow.py index 7da039e..3c8a563 100644 --- a/tests/api_resources/markets/test_borrow.py +++ b/tests/api_resources/markets/test_borrow.py @@ -9,10 +9,11 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 +from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage from neptune_api_v2.types.markets import ( BorrowGetOverviewResponse, - BorrowGetRateHistoryResponse, ) +from neptune_api_v2.types.asset_rate_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -65,7 +66,7 @@ def test_method_get_rate_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -79,7 +80,7 @@ def test_method_get_rate_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -93,7 +94,7 @@ def test_raw_response_get_rate_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = response.parse() - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -107,7 +108,7 @@ def test_streaming_response_get_rate_history(self, client: NeptuneAPIV2) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = response.parse() - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) assert cast(Any, response.is_closed) is True @@ -162,7 +163,7 @@ async def test_method_get_rate_history(self, async_client: AsyncNeptuneAPIV2) -> period="h", start=0, ) - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -176,7 +177,7 @@ async def test_method_get_rate_history_with_all_params(self, async_client: Async limit=1, offset=0, ) - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -190,7 +191,7 @@ async def test_raw_response_get_rate_history(self, async_client: AsyncNeptuneAPI assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = await response.parse() - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -204,6 +205,6 @@ async def test_streaming_response_get_rate_history(self, async_client: AsyncNept assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = await response.parse() - assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/markets/test_lend.py b/tests/api_resources/markets/test_lend.py index 19aad1f..7f9bbcd 100644 --- a/tests/api_resources/markets/test_lend.py +++ b/tests/api_resources/markets/test_lend.py @@ -9,11 +9,12 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 +from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage from neptune_api_v2.types.markets import ( LendListResponse, LendGetByAssetResponse, - LendGetRateHistoryResponse, ) +from neptune_api_v2.types.asset_rate_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -110,7 +111,7 @@ def test_method_get_rate_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -124,7 +125,7 @@ def test_method_get_rate_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -138,7 +139,7 @@ def test_raw_response_get_rate_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = response.parse() - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -152,7 +153,7 @@ def test_streaming_response_get_rate_history(self, client: NeptuneAPIV2) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = response.parse() - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) assert cast(Any, response.is_closed) is True @@ -251,7 +252,7 @@ async def test_method_get_rate_history(self, async_client: AsyncNeptuneAPIV2) -> period="h", start=0, ) - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -265,7 +266,7 @@ async def test_method_get_rate_history_with_all_params(self, async_client: Async limit=1, offset=0, ) - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -279,7 +280,7 @@ async def test_raw_response_get_rate_history(self, async_client: AsyncNeptuneAPI assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = await response.parse() - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -293,6 +294,6 @@ async def test_streaming_response_get_rate_history(self, async_client: AsyncNept assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = await response.parse() - assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/swap/__init__.py b/tests/api_resources/swap/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/swap/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/swap/test_routes.py b/tests/api_resources/swap/test_routes.py new file mode 100644 index 0000000..cecfe1e --- /dev/null +++ b/tests/api_resources/swap/test_routes.py @@ -0,0 +1,169 @@ +# 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 tests.utils import assert_matches_type +from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 +from neptune_api_v2.types.swap import ( + RouteListAllResponse, + RouteListByDenomResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoutes: + 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_list_all(self, client: NeptuneAPIV2) -> None: + route = client.swap.routes.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list_all(self, client: NeptuneAPIV2) -> None: + response = client.swap.routes.with_raw_response.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list_all(self, client: NeptuneAPIV2) -> None: + with client.swap.routes.with_streaming_response.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_by_denom(self, client: NeptuneAPIV2) -> None: + route = client.swap.routes.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list_by_denom(self, client: NeptuneAPIV2) -> None: + response = client.swap.routes.with_raw_response.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list_by_denom(self, client: NeptuneAPIV2) -> None: + with client.swap.routes.with_streaming_response.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRoutes: + 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_list_all(self, async_client: AsyncNeptuneAPIV2) -> None: + route = await async_client.swap.routes.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list_all(self, async_client: AsyncNeptuneAPIV2) -> None: + response = await async_client.swap.routes.with_raw_response.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list_all(self, async_client: AsyncNeptuneAPIV2) -> None: + async with async_client.swap.routes.with_streaming_response.list_all( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteListAllResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_by_denom(self, async_client: AsyncNeptuneAPIV2) -> None: + route = await async_client.swap.routes.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list_by_denom(self, async_client: AsyncNeptuneAPIV2) -> None: + response = await async_client.swap.routes.with_raw_response.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = await response.parse() + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list_by_denom(self, async_client: AsyncNeptuneAPIV2) -> None: + async with async_client.swap.routes.with_streaming_response.list_by_denom( + contract_address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + source_denom="source_denom", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = await response.parse() + assert_matches_type(RouteListByDenomResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_assets.py b/tests/api_resources/test_assets.py index 8f862d0..1761658 100644 --- a/tests/api_resources/test_assets.py +++ b/tests/api_resources/test_assets.py @@ -12,8 +12,9 @@ from neptune_api_v2.types import ( AssetListResponse, AssetListPricesResponse, - AssetGetPriceHistoryResponse, ) +from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage +from neptune_api_v2.types.asset_price_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -57,7 +58,7 @@ def test_method_get_price_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -71,7 +72,7 @@ def test_method_get_price_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -85,7 +86,7 @@ def test_raw_response_get_price_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = response.parse() - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -99,7 +100,7 @@ def test_streaming_response_get_price_history(self, client: NeptuneAPIV2) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = response.parse() - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +182,7 @@ async def test_method_get_price_history(self, async_client: AsyncNeptuneAPIV2) - period="h", start=0, ) - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -195,7 +196,7 @@ async def test_method_get_price_history_with_all_params(self, async_client: Asyn limit=1, offset=0, ) - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -209,7 +210,7 @@ async def test_raw_response_get_price_history(self, async_client: AsyncNeptuneAP assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = await response.parse() - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -223,7 +224,7 @@ async def test_streaming_response_get_price_history(self, async_client: AsyncNep assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = await response.parse() - assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) + assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_user.py b/tests/api_resources/test_user.py index 8fca026..e5a0d69 100644 --- a/tests/api_resources/test_user.py +++ b/tests/api_resources/test_user.py @@ -10,9 +10,10 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 from neptune_api_v2.types import ( + UserTx, UserGetUserResponse, - UserGetTxHistoryResponse, ) +from neptune_api_v2.pagination import SyncTxHistoryPage, AsyncTxHistoryPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +27,7 @@ def test_method_get_tx_history(self, client: NeptuneAPIV2) -> None: user = client.user.get_tx_history( address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ) - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(SyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -40,7 +41,7 @@ def test_method_get_tx_history_with_all_params(self, client: NeptuneAPIV2) -> No with_text=True, with_value=True, ) - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(SyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -52,7 +53,7 @@ def test_raw_response_get_tx_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(SyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -64,7 +65,7 @@ def test_streaming_response_get_tx_history(self, client: NeptuneAPIV2) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(SyncTxHistoryPage[UserTx], user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,7 +142,7 @@ async def test_method_get_tx_history(self, async_client: AsyncNeptuneAPIV2) -> N user = await async_client.user.get_tx_history( address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ) - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(AsyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -155,7 +156,7 @@ async def test_method_get_tx_history_with_all_params(self, async_client: AsyncNe with_text=True, with_value=True, ) - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(AsyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -167,7 +168,7 @@ async def test_raw_response_get_tx_history(self, async_client: AsyncNeptuneAPIV2 assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(AsyncTxHistoryPage[UserTx], user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -179,7 +180,7 @@ async def test_streaming_response_get_tx_history(self, async_client: AsyncNeptun assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserGetTxHistoryResponse, user, path=["response"]) + assert_matches_type(AsyncTxHistoryPage[UserTx], user, path=["response"]) assert cast(Any, response.is_closed) is True From 9d71f0b3d797212151cb8d65c5ff72886904a6e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 18:04:56 +0000 Subject: [PATCH 05/20] feat(api): disable series pagn, update example requests --- .stats.yml | 2 +- README.md | 98 +++++++++++-------- api.md | 16 ++- .../resources/analytics/market/history.py | 29 ++---- src/neptune_api_v2/resources/assets.py | 23 ++--- .../resources/markets/borrow/borrow.py | 23 ++--- src/neptune_api_v2/resources/markets/lend.py | 23 ++--- src/neptune_api_v2/types/__init__.py | 1 + ..._get_loans_originated_by_asset_response.py | 80 ++++++++++++++- .../types/asset_get_price_history_response.py | 24 +++++ src/neptune_api_v2/types/markets/__init__.py | 2 + .../borrow_get_rate_history_response.py | 24 +++++ .../markets/lend_get_rate_history_response.py | 24 +++++ .../analytics/market/test_history.py | 33 ++----- tests/api_resources/markets/test_borrow.py | 19 ++-- tests/api_resources/markets/test_lend.py | 19 ++-- tests/api_resources/test_assets.py | 19 ++-- tests/test_client.py | 42 ++++---- 18 files changed, 316 insertions(+), 185 deletions(-) create mode 100644 src/neptune_api_v2/types/asset_get_price_history_response.py create mode 100644 src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py create mode 100644 src/neptune_api_v2/types/markets/lend_get_rate_history_response.py diff --git a/.stats.yml b/.stats.yml index 98e43d6..2ba3979 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-3e68b318eeaab1241ee6ed696300829c9eae836a937905e7389788413f9daa8a.yml openapi_spec_hash: b76569f104863b1e7b3c5271f53df840 -config_hash: a6c5cf005205fb3c675ac298b416cf14 +config_hash: c289d0e2a34fb50fdbd02ca21400d3cd diff --git a/README.md b/README.md index 1dd464e..e2511f2 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,11 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -response = client.status.check_health() -print(response.status) +response = client.markets.get_overview( + with_text=True, + with_value=True, +) +print(response.data) ``` ## Async usage @@ -48,8 +51,11 @@ client = AsyncNeptuneAPIV2() async def main() -> None: - response = await client.status.check_health() - print(response.status) + response = await client.markets.get_overview( + with_text=True, + with_value=True, + ) + print(response.data) asyncio.run(main()) @@ -80,8 +86,11 @@ async def main() -> None: async with AsyncNeptuneAPIV2( http_client=DefaultAioHttpClient(), ) as client: - response = await client.status.check_health() - print(response.status) + response = await client.markets.get_overview( + with_text=True, + with_value=True, + ) + print(response.data) asyncio.run(main()) @@ -107,16 +116,14 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -all_assets = [] +all_users = [] # Automatically fetches more pages as needed. -for asset in client.assets.get_price_history( - end=0, - period="h", - start=0, +for user in client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ): - # Do something with asset here - all_assets.append(asset) -print(all_assets) + # Do something with user here + all_users.append(user) +print(all_users) ``` Or, asynchronously: @@ -129,15 +136,13 @@ client = AsyncNeptuneAPIV2() async def main() -> None: - all_assets = [] + all_users = [] # Iterate through items across all pages, issuing requests as needed. - async for asset in client.assets.get_price_history( - end=0, - period="h", - start=0, + async for user in client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ): - all_assets.append(asset) - print(all_assets) + all_users.append(user) + print(all_users) asyncio.run(main()) @@ -146,15 +151,13 @@ asyncio.run(main()) Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: ```python -first_page = await client.assets.get_price_history( - end=0, - period="h", - start=0, +first_page = await client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ) if first_page.has_next_page(): print(f"will fetch next page using these details: {first_page.next_page_info()}") next_page = await first_page.get_next_page() - print(f"number of items we just fetched: {len(next_page.data.series)}") + print(f"number of items we just fetched: {len(next_page.data)}") # Remove `await` for non-async usage. ``` @@ -162,17 +165,13 @@ if first_page.has_next_page(): Or just work directly with the returned data: ```python -first_page = await client.assets.get_price_history( - end=0, - period="h", - start=0, +first_page = await client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ) -print( - f"the current start offset for this page: {first_page.data.pagination.next_offset}" -) # => "the current start offset for this page: 1" -for asset in first_page.data.series: - print(asset.asset) +print(f"next page cursor: {first_page.prev_event_uuid}") # => "next page cursor: ..." +for user in first_page.data: + print(user.event_uuid) # Remove `await` for non-async usage. ``` @@ -193,7 +192,10 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() try: - client.status.check_health() + client.markets.get_overview( + with_text=True, + with_value=True, + ) except neptune_api_v2.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. @@ -236,7 +238,10 @@ client = NeptuneAPIV2( ) # Or, configure per-request: -client.with_options(max_retries=5).status.check_health() +client.with_options(max_retries=5).markets.get_overview( + with_text=True, + with_value=True, +) ``` ### Timeouts @@ -259,7 +264,10 @@ client = NeptuneAPIV2( ) # Override per-request: -client.with_options(timeout=5.0).status.check_health() +client.with_options(timeout=5.0).markets.get_overview( + with_text=True, + with_value=True, +) ``` On timeout, an `APITimeoutError` is thrown. @@ -300,11 +308,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -response = client.status.with_raw_response.check_health() +response = client.markets.with_raw_response.get_overview( + with_text=True, + with_value=True, +) print(response.headers.get('X-My-Header')) -status = response.parse() # get the object that `status.check_health()` would have returned -print(status.status) +market = response.parse() # get the object that `markets.get_overview()` would have returned +print(market.data) ``` These methods return an [`APIResponse`](https://github.com/cryptechdev/neptune-api-v2-python/tree/main/src/neptune_api_v2/_response.py) object. @@ -318,7 +329,10 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.status.with_streaming_response.check_health() as response: +with client.markets.with_streaming_response.get_overview( + with_text=True, + with_value=True, +) as response: print(response.headers.get("X-My-Header")) for line in response.iter_lines(): diff --git a/api.md b/api.md index 1cd34dc..cc66777 100644 --- a/api.md +++ b/api.md @@ -43,6 +43,7 @@ from neptune_api_v2.types import ( AssetRateHistory, AssetSpec, AssetListResponse, + AssetGetPriceHistoryResponse, AssetListPricesResponse, ) ``` @@ -50,7 +51,7 @@ from neptune_api_v2.types import ( Methods: - client.assets.list() -> AssetListResponse -- client.assets.get_price_history(\*\*params) -> SyncIntervalMultiPage[Series] +- client.assets.get_price_history(\*\*params) -> AssetGetPriceHistoryResponse - client.assets.list_prices(\*\*params) -> AssetListPricesResponse # Markets @@ -87,6 +88,7 @@ from neptune_api_v2.types.markets import ( LendMarketState, LendListResponse, LendGetByAssetResponse, + LendGetRateHistoryResponse, ) ``` @@ -94,20 +96,24 @@ Methods: - client.markets.lend.list(\*\*params) -> LendListResponse - client.markets.lend.get_by_asset(\*\*params) -> LendGetByAssetResponse -- client.markets.lend.get_rate_history(\*\*params) -> SyncIntervalMultiPage[Series] +- client.markets.lend.get_rate_history(\*\*params) -> LendGetRateHistoryResponse ## Borrow Types: ```python -from neptune_api_v2.types.markets import BorrowMarketOverview, BorrowGetOverviewResponse +from neptune_api_v2.types.markets import ( + BorrowMarketOverview, + BorrowGetOverviewResponse, + BorrowGetRateHistoryResponse, +) ``` Methods: - client.markets.borrow.get_overview(\*\*params) -> BorrowGetOverviewResponse -- client.markets.borrow.get_rate_history(\*\*params) -> SyncIntervalMultiPage[Series] +- client.markets.borrow.get_rate_history(\*\*params) -> BorrowGetRateHistoryResponse ### Collaterals @@ -369,7 +375,7 @@ from neptune_api_v2.types.analytics.market import ( Methods: - client.analytics.market.history.get_loans_originated(\*\*params) -> SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse] -- client.analytics.market.history.get_loans_originated_by_asset(\*\*params) -> SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse] +- client.analytics.market.history.get_loans_originated_by_asset(\*\*params) -> HistoryGetLoansOriginatedByAssetResponse ## Nept diff --git a/src/neptune_api_v2/resources/analytics/market/history.py b/src/neptune_api_v2/resources/analytics/market/history.py index eb97087..d464fe1 100644 --- a/src/neptune_api_v2/resources/analytics/market/history.py +++ b/src/neptune_api_v2/resources/analytics/market/history.py @@ -8,7 +8,7 @@ from ....types import IntervalUnit from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -17,12 +17,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import ( - SyncIntervalMultiPage, - AsyncIntervalMultiPage, - SyncIntervalSinglePage, - AsyncIntervalSinglePage, -) +from ....pagination import SyncIntervalSinglePage, AsyncIntervalSinglePage from ...._base_client import AsyncPaginator, make_request_options from ....types.interval_unit import IntervalUnit from ....types.analytics.market import history_get_loans_originated_params, history_get_loans_originated_by_asset_params @@ -155,7 +150,7 @@ def get_loans_originated_by_asset( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse]: + ) -> HistoryGetLoansOriginatedByAssetResponse: """ Get cumulative lending value history assets @@ -205,9 +200,8 @@ def get_loans_originated_by_asset( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/api/v1/analytics/market/history/loans-originated/by-asset", - page=SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -226,7 +220,7 @@ def get_loans_originated_by_asset( history_get_loans_originated_by_asset_params.HistoryGetLoansOriginatedByAssetParams, ), ), - model=HistoryGetLoansOriginatedByAssetResponse, + cast_to=HistoryGetLoansOriginatedByAssetResponse, ) @@ -335,7 +329,7 @@ def get_loans_originated( model=HistoryGetLoansOriginatedResponse, ) - def get_loans_originated_by_asset( + async def get_loans_originated_by_asset( self, *, end: int, @@ -351,9 +345,7 @@ def get_loans_originated_by_asset( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[ - HistoryGetLoansOriginatedByAssetResponse, AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse] - ]: + ) -> HistoryGetLoansOriginatedByAssetResponse: """ Get cumulative lending value history assets @@ -403,15 +395,14 @@ def get_loans_originated_by_asset( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/api/v1/analytics/market/history/loans-originated/by-asset", - page=AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "end": end, "period": period, @@ -424,7 +415,7 @@ def get_loans_originated_by_asset( history_get_loans_originated_by_asset_params.HistoryGetLoansOriginatedByAssetParams, ), ), - model=HistoryGetLoansOriginatedByAssetResponse, + cast_to=HistoryGetLoansOriginatedByAssetResponse, ) diff --git a/src/neptune_api_v2/resources/assets.py b/src/neptune_api_v2/resources/assets.py index d64da3d..ba20705 100644 --- a/src/neptune_api_v2/resources/assets.py +++ b/src/neptune_api_v2/resources/assets.py @@ -17,12 +17,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage -from .._base_client import AsyncPaginator, make_request_options +from .._base_client import make_request_options from ..types.interval_unit import IntervalUnit from ..types.asset_list_response import AssetListResponse -from ..types.asset_price_history import Series from ..types.asset_list_prices_response import AssetListPricesResponse +from ..types.asset_get_price_history_response import AssetGetPriceHistoryResponse __all__ = ["AssetsResource", "AsyncAssetsResource"] @@ -82,7 +81,7 @@ def get_price_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncIntervalMultiPage[Series]: + ) -> AssetGetPriceHistoryResponse: """ Get historical prices for assets @@ -132,9 +131,8 @@ def get_price_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/api/v1/assets/price-history", - page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -153,7 +151,7 @@ def get_price_history( asset_get_price_history_params.AssetGetPriceHistoryParams, ), ), - model=Series, + cast_to=AssetGetPriceHistoryResponse, ) def list_prices( @@ -233,7 +231,7 @@ async def list( cast_to=AssetListResponse, ) - def get_price_history( + async def get_price_history( self, *, end: int, @@ -249,7 +247,7 @@ def get_price_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: + ) -> AssetGetPriceHistoryResponse: """ Get historical prices for assets @@ -299,15 +297,14 @@ def get_price_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/api/v1/assets/price-history", - page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "end": end, "period": period, @@ -320,7 +317,7 @@ def get_price_history( asset_get_price_history_params.AssetGetPriceHistoryParams, ), ), - model=Series, + cast_to=AssetGetPriceHistoryResponse, ) async def list_prices( diff --git a/src/neptune_api_v2/resources/markets/borrow/borrow.py b/src/neptune_api_v2/resources/markets/borrow/borrow.py index 558d0f3..de746b2 100644 --- a/src/neptune_api_v2/resources/markets/borrow/borrow.py +++ b/src/neptune_api_v2/resources/markets/borrow/borrow.py @@ -33,12 +33,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage -from ...._base_client import AsyncPaginator, make_request_options +from ...._base_client import make_request_options from ....types.markets import borrow_get_overview_params, borrow_get_rate_history_params from ....types.interval_unit import IntervalUnit -from ....types.asset_rate_history import Series from ....types.markets.borrow_get_overview_response import BorrowGetOverviewResponse +from ....types.markets.borrow_get_rate_history_response import BorrowGetRateHistoryResponse __all__ = ["BorrowResource", "AsyncBorrowResource"] @@ -133,7 +132,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncIntervalMultiPage[Series]: + ) -> BorrowGetRateHistoryResponse: """ Get historical borrowing rates for assets @@ -183,9 +182,8 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/api/v1/markets/borrow/rate-history", - page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -204,7 +202,7 @@ def get_rate_history( borrow_get_rate_history_params.BorrowGetRateHistoryParams, ), ), - model=Series, + cast_to=BorrowGetRateHistoryResponse, ) @@ -282,7 +280,7 @@ async def get_overview( cast_to=BorrowGetOverviewResponse, ) - def get_rate_history( + async def get_rate_history( self, *, end: int, @@ -298,7 +296,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: + ) -> BorrowGetRateHistoryResponse: """ Get historical borrowing rates for assets @@ -348,15 +346,14 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/api/v1/markets/borrow/rate-history", - page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "end": end, "period": period, @@ -369,7 +366,7 @@ def get_rate_history( borrow_get_rate_history_params.BorrowGetRateHistoryParams, ), ), - model=Series, + cast_to=BorrowGetRateHistoryResponse, ) diff --git a/src/neptune_api_v2/resources/markets/lend.py b/src/neptune_api_v2/resources/markets/lend.py index fd28004..67de206 100644 --- a/src/neptune_api_v2/resources/markets/lend.py +++ b/src/neptune_api_v2/resources/markets/lend.py @@ -17,13 +17,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import make_request_options from ...types.markets import lend_list_params, lend_get_by_asset_params, lend_get_rate_history_params from ...types.interval_unit import IntervalUnit -from ...types.asset_rate_history import Series from ...types.markets.lend_list_response import LendListResponse from ...types.markets.lend_get_by_asset_response import LendGetByAssetResponse +from ...types.markets.lend_get_rate_history_response import LendGetRateHistoryResponse __all__ = ["LendResource", "AsyncLendResource"] @@ -160,7 +159,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncIntervalMultiPage[Series]: + ) -> LendGetRateHistoryResponse: """ Get historical lending rates for assets @@ -210,9 +209,8 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/api/v1/markets/lend/rate-history", - page=SyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -231,7 +229,7 @@ def get_rate_history( lend_get_rate_history_params.LendGetRateHistoryParams, ), ), - model=Series, + cast_to=LendGetRateHistoryResponse, ) @@ -351,7 +349,7 @@ async def get_by_asset( cast_to=LendGetByAssetResponse, ) - def get_rate_history( + async def get_rate_history( self, *, end: int, @@ -367,7 +365,7 @@ def get_rate_history( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Series, AsyncIntervalMultiPage[Series]]: + ) -> LendGetRateHistoryResponse: """ Get historical lending rates for assets @@ -417,15 +415,14 @@ def get_rate_history( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/api/v1/markets/lend/rate-history", - page=AsyncIntervalMultiPage[Series], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "end": end, "period": period, @@ -438,7 +435,7 @@ def get_rate_history( lend_get_rate_history_params.LendGetRateHistoryParams, ), ), - model=Series, + cast_to=LendGetRateHistoryResponse, ) diff --git a/src/neptune_api_v2/types/__init__.py b/src/neptune_api_v2/types/__init__.py index 0b2619f..40c7afc 100644 --- a/src/neptune_api_v2/types/__init__.py +++ b/src/neptune_api_v2/types/__init__.py @@ -44,6 +44,7 @@ from .status_check_health_response import StatusCheckHealthResponse as StatusCheckHealthResponse from .asset_get_price_history_params import AssetGetPriceHistoryParams as AssetGetPriceHistoryParams from .nept_unlock_distribution_group import NeptUnlockDistributionGroup as NeptUnlockDistributionGroup +from .asset_get_price_history_response import AssetGetPriceHistoryResponse as AssetGetPriceHistoryResponse from .nept_get_staking_overview_params import NeptGetStakingOverviewParams as NeptGetStakingOverviewParams from .market_get_merged_by_asset_params import MarketGetMergedByAssetParams as MarketGetMergedByAssetParams from .nept_get_staking_overview_response import NeptGetStakingOverviewResponse as NeptGetStakingOverviewResponse diff --git a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py index 593264b..47c68d0 100644 --- a/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py +++ b/src/neptune_api_v2/types/analytics/market/history_get_loans_originated_by_asset_response.py @@ -1,15 +1,52 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List, Union, Optional from datetime import datetime from ...._models import BaseModel +from ...interval import Interval from ...asset_spec import AssetSpec -__all__ = ["HistoryGetLoansOriginatedByAssetResponse", "Point"] +__all__ = [ + "HistoryGetLoansOriginatedByAssetResponse", + "Data", + "DataPagination", + "DataRange", + "DataSeries", + "DataSeriesPoint", +] -class Point(BaseModel): +class DataPagination(BaseModel): + """Values used for paginating the time series data""" + + interval_count: int + """ + The total number of intervals/buckets for the provided interval parameters + (size, period, start, end) + """ + + next_offset: Optional[int] = None + """ + The offset a client should use to fetch the next page of intervals (so long as + limit remains unchanged) + """ + + +class DataRange(BaseModel): + """ + Provides values for the requested range in it's entire width, regardless of page/limit. + """ + + end: datetime + + interval: Interval + """Interval period & size""" + + start: datetime + + +class DataSeriesPoint(BaseModel): """Time + value pair representing a point in time for use with time series""" t: datetime @@ -17,7 +54,7 @@ class Point(BaseModel): v: Union[str, float, None] = None -class HistoryGetLoansOriginatedByAssetResponse(BaseModel): +class DataSeries(BaseModel): """Item and associated points""" asset: AssetSpec @@ -26,4 +63,37 @@ class HistoryGetLoansOriginatedByAssetResponse(BaseModel): IDs are unique across asset domains (contract tokens, native denoms, etc) """ - points: List[Point] + points: List[DataSeriesPoint] + + +class Data(BaseModel): + """Historical cumulative lend value for assets""" + + pagination: DataPagination + """Values used for paginating the time series data""" + + range: DataRange + """ + Provides values for the requested range in it's entire width, regardless of + page/limit. + """ + + series: List[DataSeries] + + +class HistoryGetLoansOriginatedByAssetResponse(BaseModel): + data: Data + """Historical cumulative lend value for assets""" + + error: None = None + """Error data. Guaranteed `null` for successful response.""" + + status: int + """HTTP status. + + Successful responses are guaranteed to be < `400`. Conversely, error responses + are guaranteed to be >= `400`. + """ + + status_text: str + """HTTP status text""" diff --git a/src/neptune_api_v2/types/asset_get_price_history_response.py b/src/neptune_api_v2/types/asset_get_price_history_response.py new file mode 100644 index 0000000..eec3a6d --- /dev/null +++ b/src/neptune_api_v2/types/asset_get_price_history_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel +from .asset_price_history import AssetPriceHistory + +__all__ = ["AssetGetPriceHistoryResponse"] + + +class AssetGetPriceHistoryResponse(BaseModel): + data: AssetPriceHistory + """Historical prices for assets""" + + error: None = None + """Error data. Guaranteed `null` for successful response.""" + + status: int + """HTTP status. + + Successful responses are guaranteed to be < `400`. Conversely, error responses + are guaranteed to be >= `400`. + """ + + status_text: str + """HTTP status text""" diff --git a/src/neptune_api_v2/types/markets/__init__.py b/src/neptune_api_v2/types/markets/__init__.py index fd36e56..d64c771 100644 --- a/src/neptune_api_v2/types/markets/__init__.py +++ b/src/neptune_api_v2/types/markets/__init__.py @@ -14,3 +14,5 @@ from .borrow_get_overview_response import BorrowGetOverviewResponse as BorrowGetOverviewResponse from .lend_get_rate_history_params import LendGetRateHistoryParams as LendGetRateHistoryParams from .borrow_get_rate_history_params import BorrowGetRateHistoryParams as BorrowGetRateHistoryParams +from .lend_get_rate_history_response import LendGetRateHistoryResponse as LendGetRateHistoryResponse +from .borrow_get_rate_history_response import BorrowGetRateHistoryResponse as BorrowGetRateHistoryResponse diff --git a/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py b/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py new file mode 100644 index 0000000..60dcfba --- /dev/null +++ b/src/neptune_api_v2/types/markets/borrow_get_rate_history_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from ..asset_rate_history import AssetRateHistory + +__all__ = ["BorrowGetRateHistoryResponse"] + + +class BorrowGetRateHistoryResponse(BaseModel): + data: AssetRateHistory + """Historical rates for assets""" + + error: None = None + """Error data. Guaranteed `null` for successful response.""" + + status: int + """HTTP status. + + Successful responses are guaranteed to be < `400`. Conversely, error responses + are guaranteed to be >= `400`. + """ + + status_text: str + """HTTP status text""" diff --git a/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py b/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py new file mode 100644 index 0000000..095ea67 --- /dev/null +++ b/src/neptune_api_v2/types/markets/lend_get_rate_history_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from ..asset_rate_history import AssetRateHistory + +__all__ = ["LendGetRateHistoryResponse"] + + +class LendGetRateHistoryResponse(BaseModel): + data: AssetRateHistory + """Historical rates for assets""" + + error: None = None + """Error data. Guaranteed `null` for successful response.""" + + status: int + """HTTP status. + + Successful responses are guaranteed to be < `400`. Conversely, error responses + are guaranteed to be >= `400`. + """ + + status_text: str + """HTTP status text""" diff --git a/tests/api_resources/analytics/market/test_history.py b/tests/api_resources/analytics/market/test_history.py index 7c67a98..91c2393 100644 --- a/tests/api_resources/analytics/market/test_history.py +++ b/tests/api_resources/analytics/market/test_history.py @@ -9,12 +9,7 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 -from neptune_api_v2.pagination import ( - SyncIntervalMultiPage, - AsyncIntervalMultiPage, - SyncIntervalSinglePage, - AsyncIntervalSinglePage, -) +from neptune_api_v2.pagination import SyncIntervalSinglePage, AsyncIntervalSinglePage from neptune_api_v2.types.analytics.market import ( HistoryGetLoansOriginatedResponse, HistoryGetLoansOriginatedByAssetResponse, @@ -87,7 +82,7 @@ def test_method_get_loans_originated_by_asset(self, client: NeptuneAPIV2) -> Non period="h", start=0, ) - assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -101,7 +96,7 @@ def test_method_get_loans_originated_by_asset_with_all_params(self, client: Nept limit=1, offset=0, ) - assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -115,7 +110,7 @@ def test_raw_response_get_loans_originated_by_asset(self, client: NeptuneAPIV2) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"]) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -129,9 +124,7 @@ def test_streaming_response_get_loans_originated_by_asset(self, client: NeptuneA assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type( - SyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] - ) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -202,9 +195,7 @@ async def test_method_get_loans_originated_by_asset(self, async_client: AsyncNep period="h", start=0, ) - assert_matches_type( - AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] - ) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -218,9 +209,7 @@ async def test_method_get_loans_originated_by_asset_with_all_params(self, async_ limit=1, offset=0, ) - assert_matches_type( - AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] - ) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -234,9 +223,7 @@ async def test_raw_response_get_loans_originated_by_asset(self, async_client: As assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type( - AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] - ) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -250,8 +237,6 @@ async def test_streaming_response_get_loans_originated_by_asset(self, async_clie assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type( - AsyncIntervalMultiPage[HistoryGetLoansOriginatedByAssetResponse], history, path=["response"] - ) + assert_matches_type(HistoryGetLoansOriginatedByAssetResponse, history, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/markets/test_borrow.py b/tests/api_resources/markets/test_borrow.py index 3c8a563..7da039e 100644 --- a/tests/api_resources/markets/test_borrow.py +++ b/tests/api_resources/markets/test_borrow.py @@ -9,11 +9,10 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 -from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage from neptune_api_v2.types.markets import ( BorrowGetOverviewResponse, + BorrowGetRateHistoryResponse, ) -from neptune_api_v2.types.asset_rate_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -66,7 +65,7 @@ def test_method_get_rate_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -80,7 +79,7 @@ def test_method_get_rate_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -94,7 +93,7 @@ def test_raw_response_get_rate_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -108,7 +107,7 @@ def test_streaming_response_get_rate_history(self, client: NeptuneAPIV2) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) assert cast(Any, response.is_closed) is True @@ -163,7 +162,7 @@ async def test_method_get_rate_history(self, async_client: AsyncNeptuneAPIV2) -> period="h", start=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -177,7 +176,7 @@ async def test_method_get_rate_history_with_all_params(self, async_client: Async limit=1, offset=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -191,7 +190,7 @@ async def test_raw_response_get_rate_history(self, async_client: AsyncNeptuneAPI assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -205,6 +204,6 @@ async def test_streaming_response_get_rate_history(self, async_client: AsyncNept assert response.http_request.headers.get("X-Stainless-Lang") == "python" borrow = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], borrow, path=["response"]) + assert_matches_type(BorrowGetRateHistoryResponse, borrow, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/markets/test_lend.py b/tests/api_resources/markets/test_lend.py index 7f9bbcd..19aad1f 100644 --- a/tests/api_resources/markets/test_lend.py +++ b/tests/api_resources/markets/test_lend.py @@ -9,12 +9,11 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 -from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage from neptune_api_v2.types.markets import ( LendListResponse, LendGetByAssetResponse, + LendGetRateHistoryResponse, ) -from neptune_api_v2.types.asset_rate_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -111,7 +110,7 @@ def test_method_get_rate_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -125,7 +124,7 @@ def test_method_get_rate_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -139,7 +138,7 @@ def test_raw_response_get_rate_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -153,7 +152,7 @@ def test_streaming_response_get_rate_history(self, client: NeptuneAPIV2) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) assert cast(Any, response.is_closed) is True @@ -252,7 +251,7 @@ async def test_method_get_rate_history(self, async_client: AsyncNeptuneAPIV2) -> period="h", start=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -266,7 +265,7 @@ async def test_method_get_rate_history_with_all_params(self, async_client: Async limit=1, offset=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -280,7 +279,7 @@ async def test_raw_response_get_rate_history(self, async_client: AsyncNeptuneAPI assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -294,6 +293,6 @@ async def test_streaming_response_get_rate_history(self, async_client: AsyncNept assert response.http_request.headers.get("X-Stainless-Lang") == "python" lend = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], lend, path=["response"]) + assert_matches_type(LendGetRateHistoryResponse, lend, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_assets.py b/tests/api_resources/test_assets.py index 1761658..8f862d0 100644 --- a/tests/api_resources/test_assets.py +++ b/tests/api_resources/test_assets.py @@ -12,9 +12,8 @@ from neptune_api_v2.types import ( AssetListResponse, AssetListPricesResponse, + AssetGetPriceHistoryResponse, ) -from neptune_api_v2.pagination import SyncIntervalMultiPage, AsyncIntervalMultiPage -from neptune_api_v2.types.asset_price_history import Series base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -58,7 +57,7 @@ def test_method_get_price_history(self, client: NeptuneAPIV2) -> None: period="h", start=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -72,7 +71,7 @@ def test_method_get_price_history_with_all_params(self, client: NeptuneAPIV2) -> limit=1, offset=0, ) - assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -86,7 +85,7 @@ def test_raw_response_get_price_history(self, client: NeptuneAPIV2) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -100,7 +99,7 @@ def test_streaming_response_get_price_history(self, client: NeptuneAPIV2) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = response.parse() - assert_matches_type(SyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,7 +181,7 @@ async def test_method_get_price_history(self, async_client: AsyncNeptuneAPIV2) - period="h", start=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -196,7 +195,7 @@ async def test_method_get_price_history_with_all_params(self, async_client: Asyn limit=1, offset=0, ) - assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -210,7 +209,7 @@ async def test_raw_response_get_price_history(self, async_client: AsyncNeptuneAP assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize @@ -224,7 +223,7 @@ async def test_streaming_response_get_price_history(self, async_client: AsyncNep assert response.http_request.headers.get("X-Stainless-Lang") == "python" asset = await response.parse() - assert_matches_type(AsyncIntervalMultiPage[Series], asset, path=["response"]) + assert_matches_type(AssetGetPriceHistoryResponse, asset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index afe0b6f..366c625 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -814,20 +814,20 @@ def test_parse_retry_after_header( @mock.patch("neptune_api_v2._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: NeptuneAPIV2) -> None: - respx_mock.get("/api/v1/status/health").mock(side_effect=httpx.TimeoutException("Test timeout error")) + respx_mock.get("/api/v1/markets").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - client.status.with_streaming_response.check_health().__enter__() + client.markets.with_streaming_response.get_overview().__enter__() assert _get_open_connections(client) == 0 @mock.patch("neptune_api_v2._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: NeptuneAPIV2) -> None: - respx_mock.get("/api/v1/status/health").mock(return_value=httpx.Response(500)) + respx_mock.get("/api/v1/markets").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - client.status.with_streaming_response.check_health().__enter__() + client.markets.with_streaming_response.get_overview().__enter__() assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -854,9 +854,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = client.status.with_raw_response.check_health() + response = client.markets.with_raw_response.get_overview() assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -878,9 +878,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = client.status.with_raw_response.check_health(extra_headers={"x-stainless-retry-count": Omit()}) + response = client.markets.with_raw_response.get_overview(extra_headers={"x-stainless-retry-count": Omit()}) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -901,9 +901,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = client.status.with_raw_response.check_health(extra_headers={"x-stainless-retry-count": "42"}) + response = client.markets.with_raw_response.get_overview(extra_headers={"x-stainless-retry-count": "42"}) assert response.http_request.headers.get("x-stainless-retry-count") == "42" @@ -1684,10 +1684,10 @@ async def test_parse_retry_after_header( async def test_retrying_timeout_errors_doesnt_leak( self, respx_mock: MockRouter, async_client: AsyncNeptuneAPIV2 ) -> None: - respx_mock.get("/api/v1/status/health").mock(side_effect=httpx.TimeoutException("Test timeout error")) + respx_mock.get("/api/v1/markets").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await async_client.status.with_streaming_response.check_health().__aenter__() + await async_client.markets.with_streaming_response.get_overview().__aenter__() assert _get_open_connections(async_client) == 0 @@ -1696,10 +1696,10 @@ async def test_retrying_timeout_errors_doesnt_leak( async def test_retrying_status_errors_doesnt_leak( self, respx_mock: MockRouter, async_client: AsyncNeptuneAPIV2 ) -> None: - respx_mock.get("/api/v1/status/health").mock(return_value=httpx.Response(500)) + respx_mock.get("/api/v1/markets").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await async_client.status.with_streaming_response.check_health().__aenter__() + await async_client.markets.with_streaming_response.get_overview().__aenter__() assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -1726,9 +1726,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = await client.status.with_raw_response.check_health() + response = await client.markets.with_raw_response.get_overview() assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -1750,9 +1750,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = await client.status.with_raw_response.check_health(extra_headers={"x-stainless-retry-count": Omit()}) + response = await client.markets.with_raw_response.get_overview( + extra_headers={"x-stainless-retry-count": Omit()} + ) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -1773,9 +1775,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/api/v1/status/health").mock(side_effect=retry_handler) + respx_mock.get("/api/v1/markets").mock(side_effect=retry_handler) - response = await client.status.with_raw_response.check_health(extra_headers={"x-stainless-retry-count": "42"}) + response = await client.markets.with_raw_response.get_overview(extra_headers={"x-stainless-retry-count": "42"}) assert response.http_request.headers.get("x-stainless-retry-count") == "42" From 219ae5ea1765de38421f70866d9fd622a0d878ce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 18:20:53 +0000 Subject: [PATCH 06/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2ba3979..585c4b0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-3e68b318eeaab1241ee6ed696300829c9eae836a937905e7389788413f9daa8a.yml openapi_spec_hash: b76569f104863b1e7b3c5271f53df840 -config_hash: c289d0e2a34fb50fdbd02ca21400d3cd +config_hash: 84ae3ae9153257feb1da17e9d67435dc From ebee3a79f42790d9fba6fced90848e432581817f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 18:35:31 +0000 Subject: [PATCH 07/20] feat(api): api update --- .stats.yml | 4 ++-- src/neptune_api_v2/resources/swap/routes.py | 12 ++++++++++-- .../types/swap/route_list_by_denom_params.py | 6 +++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 585c4b0..8a6698e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-3e68b318eeaab1241ee6ed696300829c9eae836a937905e7389788413f9daa8a.yml -openapi_spec_hash: b76569f104863b1e7b3c5271f53df840 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml +openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 config_hash: 84ae3ae9153257feb1da17e9d67435dc diff --git a/src/neptune_api_v2/resources/swap/routes.py b/src/neptune_api_v2/resources/swap/routes.py index ad70a0d..43f3acd 100644 --- a/src/neptune_api_v2/resources/swap/routes.py +++ b/src/neptune_api_v2/resources/swap/routes.py @@ -100,7 +100,11 @@ def list_by_denom( source_denom: Source asset denom to fetch target routes for **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. - E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + + E.g. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. extra_headers: Send extra headers @@ -209,7 +213,11 @@ async def list_by_denom( source_denom: Source asset denom to fetch target routes for **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. - E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + + E.g. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. extra_headers: Send extra headers diff --git a/src/neptune_api_v2/types/swap/route_list_by_denom_params.py b/src/neptune_api_v2/types/swap/route_list_by_denom_params.py index 3ea3190..d6291cc 100644 --- a/src/neptune_api_v2/types/swap/route_list_by_denom_params.py +++ b/src/neptune_api_v2/types/swap/route_list_by_denom_params.py @@ -15,5 +15,9 @@ class RouteListByDenomParams(TypedDict, total=False): """Source asset denom to fetch target routes for **Note**: This is a normal injective asset denom, and not an `AssetSpec` ID. - E.g. While `inj` is a valid `source_denom, `native;inj` is not valid. + + E.g. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. """ From f1f5aaef9e720cdb0933330c9836e8a666b806b4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 21:55:42 +0000 Subject: [PATCH 08/20] feat(api): manual updates --- .stats.yml | 2 +- README.md | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8a6698e..6c60b2d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 84ae3ae9153257feb1da17e9d67435dc +config_hash: 9741b1a625d599ce70727931ab1b9fbf diff --git a/README.md b/README.md index e2511f2..316e595 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,7 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -response = client.markets.get_overview( - with_text=True, - with_value=True, -) +response = client.markets.get_overview() print(response.data) ``` @@ -51,10 +48,7 @@ client = AsyncNeptuneAPIV2() async def main() -> None: - response = await client.markets.get_overview( - with_text=True, - with_value=True, - ) + response = await client.markets.get_overview() print(response.data) @@ -86,10 +80,7 @@ async def main() -> None: async with AsyncNeptuneAPIV2( http_client=DefaultAioHttpClient(), ) as client: - response = await client.markets.get_overview( - with_text=True, - with_value=True, - ) + response = await client.markets.get_overview() print(response.data) From 3424a811af4205ad9396f23f7fd56055f6e2fb35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:02:51 +0000 Subject: [PATCH 09/20] feat(api): manual updates --- .github/workflows/publish-pypi.yml | 1 + .github/workflows/release-doctor.yml | 3 ++- .stats.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 6035a80..c1407e4 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,6 +12,7 @@ jobs: publish: name: publish runs-on: ubuntu-latest + environment: production steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index b8e1556..a0a1edc 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,6 +1,6 @@ name: Release Doctor on: - pull_request: + push: branches: - main workflow_dispatch: @@ -9,6 +9,7 @@ jobs: release_doctor: name: release doctor runs-on: ubuntu-latest + environment: production if: github.repository == 'cryptechdev/neptune-api-v2-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: diff --git a/.stats.yml b/.stats.yml index 6c60b2d..b6c5659 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 9741b1a625d599ce70727931ab1b9fbf +config_hash: 01aa687bc640569e9b16db6c2286ecce From f3461b1ee959f5495da8948a4dca0f86edd0041c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:10:35 +0000 Subject: [PATCH 10/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b6c5659..ea5ca8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 01aa687bc640569e9b16db6c2286ecce +config_hash: ed2c90c2baa82a30204d0ec28a08799c From 379cf45924898e33951f6298b2a21171e165a3a1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:26:04 +0000 Subject: [PATCH 11/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index ea5ca8c..1e2770b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: ed2c90c2baa82a30204d0ec28a08799c +config_hash: 44386e9d4a51b58f5f2834717af79934 From c90715f3ad82baedeb47f32889d7aba4404d5114 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:40:35 +0000 Subject: [PATCH 12/20] feat(api): Fix readme title, fix inverted example params --- .stats.yml | 2 +- README.md | 40 +++++++++++++++++----------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1e2770b..37d788d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 44386e9d4a51b58f5f2834717af79934 +config_hash: dc344034a910e99efa08ab68979a541e diff --git a/README.md b/README.md index 316e595..b3047e0 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,10 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -response = client.markets.get_overview() +response = client.markets.get_overview( + with_text=True, + with_value=True, +) print(response.data) ``` @@ -48,7 +51,10 @@ client = AsyncNeptuneAPIV2() async def main() -> None: - response = await client.markets.get_overview() + response = await client.markets.get_overview( + with_text=True, + with_value=True, + ) print(response.data) @@ -80,7 +86,10 @@ async def main() -> None: async with AsyncNeptuneAPIV2( http_client=DefaultAioHttpClient(), ) as client: - response = await client.markets.get_overview() + response = await client.markets.get_overview( + with_text=True, + with_value=True, + ) print(response.data) @@ -183,10 +192,7 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() try: - client.markets.get_overview( - with_text=True, - with_value=True, - ) + client.markets.get_overview() except neptune_api_v2.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. @@ -229,10 +235,7 @@ client = NeptuneAPIV2( ) # Or, configure per-request: -client.with_options(max_retries=5).markets.get_overview( - with_text=True, - with_value=True, -) +client.with_options(max_retries=5).markets.get_overview() ``` ### Timeouts @@ -255,10 +258,7 @@ client = NeptuneAPIV2( ) # Override per-request: -client.with_options(timeout=5.0).markets.get_overview( - with_text=True, - with_value=True, -) +client.with_options(timeout=5.0).markets.get_overview() ``` On timeout, an `APITimeoutError` is thrown. @@ -299,10 +299,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() -response = client.markets.with_raw_response.get_overview( - with_text=True, - with_value=True, -) +response = client.markets.with_raw_response.get_overview() print(response.headers.get('X-My-Header')) market = response.parse() # get the object that `markets.get_overview()` would have returned @@ -320,10 +317,7 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.markets.with_streaming_response.get_overview( - with_text=True, - with_value=True, -) as response: +with client.markets.with_streaming_response.get_overview() as response: print(response.headers.get("X-My-Header")) for line in response.iter_lines(): From 235b0f253b2dec5cdee846c4ebdd5a2ac64e1bf5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:17:12 +0000 Subject: [PATCH 13/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 37d788d..c5c470f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: dc344034a910e99efa08ab68979a541e +config_hash: 1ee5d48e570fb1f12ad1bf9134b83102 From a1fcd6aaf2660ddc01e3c1d45a16e46258c0181d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:17:27 +0000 Subject: [PATCH 14/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c5c470f..febf90a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 1ee5d48e570fb1f12ad1bf9134b83102 +config_hash: 5661f6e4da3447ba607ef132c104f232 From 72173a429dddb88648a29991c1870d86dd8c6b0a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:57:07 +0000 Subject: [PATCH 15/20] feat(api): add python publishing config --- .github/workflows/publish-pypi.yml | 5 +++-- .github/workflows/release-doctor.yml | 2 -- .stats.yml | 2 +- README.md | 11 ++++------- bin/check-release-environment | 4 ---- bin/publish-pypi | 6 +++++- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index c1407e4..ed68a26 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,6 +13,9 @@ jobs: name: publish runs-on: ubuntu-latest environment: production + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -25,5 +28,3 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index a0a1edc..5dcdfce 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,5 +18,3 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index febf90a..77e888d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 5661f6e4da3447ba607ef132c104f232 +config_hash: 3f508a2d5edc17b7b4f18fd7112c2faa diff --git a/README.md b/README.md index b3047e0..80cecb6 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,10 @@ The full API of this library can be found in [api.md](api.md). ## Installation ```sh -# install from the production repo -pip install git+ssh://git@github.com/cryptechdev/neptune-api-v2-python.git +# install from PyPI +pip install neptune_api_v2 ``` -> [!NOTE] -> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install neptune_api_v2` - ## Usage The full API of this library can be found in [api.md](api.md). @@ -70,8 +67,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv You can enable this by installing `aiohttp`: ```sh -# install from the production repo -pip install 'neptune_api_v2[aiohttp] @ git+ssh://git@github.com/cryptechdev/neptune-api-v2-python.git' +# install from PyPI +pip install neptune_api_v2[aiohttp] ``` Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: diff --git a/bin/check-release-environment b/bin/check-release-environment index b845b0f..1e951e9 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") -fi - lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index e72ca2f..5895700 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,4 +4,8 @@ set -eux rm -rf dist mkdir -p dist uv build -uv publish --token=$PYPI_TOKEN +if [ -n "${PYPI_TOKEN:-}" ]; then + uv publish --token=$PYPI_TOKEN +else + uv publish +fi From 5759a869889951c83f68dfc8d7df247c81fe6cd1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:57:45 +0000 Subject: [PATCH 16/20] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 5 ++--- .github/workflows/release-doctor.yml | 2 ++ .stats.yml | 2 +- bin/check-release-environment | 4 ++++ bin/publish-pypi | 6 +----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index ed68a26..c1407e4 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,9 +13,6 @@ jobs: name: publish runs-on: ubuntu-latest environment: production - permissions: - contents: read - id-token: write steps: - uses: actions/checkout@v6 @@ -28,3 +25,5 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 5dcdfce..a0a1edc 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,3 +18,5 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 77e888d..0908471 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: 3f508a2d5edc17b7b4f18fd7112c2faa +config_hash: eb7459746cbb47e3a1cc8c08a96824e2 diff --git a/bin/check-release-environment b/bin/check-release-environment index 1e951e9..b845b0f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index 5895700..e72ca2f 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,8 +4,4 @@ set -eux rm -rf dist mkdir -p dist uv build -if [ -n "${PYPI_TOKEN:-}" ]; then - uv publish --token=$PYPI_TOKEN -else - uv publish -fi +uv publish --token=$PYPI_TOKEN From a41b0dd737f1ca76a0af6af4792c05dac3ea0b93 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:58:00 +0000 Subject: [PATCH 17/20] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 5 +++-- .github/workflows/release-doctor.yml | 2 -- .stats.yml | 2 +- bin/check-release-environment | 4 ---- bin/publish-pypi | 6 +++++- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index c1407e4..ed68a26 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,6 +13,9 @@ jobs: name: publish runs-on: ubuntu-latest environment: production + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -25,5 +28,3 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index a0a1edc..5dcdfce 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,5 +18,3 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 0908471..9f90917 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: eb7459746cbb47e3a1cc8c08a96824e2 +config_hash: a79df81e5bba11abab18a84163248141 diff --git a/bin/check-release-environment b/bin/check-release-environment index b845b0f..1e951e9 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") -fi - lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index e72ca2f..5895700 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,4 +4,8 @@ set -eux rm -rf dist mkdir -p dist uv build -uv publish --token=$PYPI_TOKEN +if [ -n "${PYPI_TOKEN:-}" ]; then + uv publish --token=$PYPI_TOKEN +else + uv publish +fi From 3b2c9f9b390aa03d3601dea10cb69133568726fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:58:17 +0000 Subject: [PATCH 18/20] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 5 ++--- .github/workflows/release-doctor.yml | 2 ++ .stats.yml | 2 +- bin/check-release-environment | 4 ++++ bin/publish-pypi | 6 +----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index ed68a26..c1407e4 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,9 +13,6 @@ jobs: name: publish runs-on: ubuntu-latest environment: production - permissions: - contents: read - id-token: write steps: - uses: actions/checkout@v6 @@ -28,3 +25,5 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 5dcdfce..a0a1edc 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,3 +18,5 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 9f90917..0908471 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: a79df81e5bba11abab18a84163248141 +config_hash: eb7459746cbb47e3a1cc8c08a96824e2 diff --git a/bin/check-release-environment b/bin/check-release-environment index 1e951e9..b845b0f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index 5895700..e72ca2f 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,8 +4,4 @@ set -eux rm -rf dist mkdir -p dist uv build -if [ -n "${PYPI_TOKEN:-}" ]; then - uv publish --token=$PYPI_TOKEN -else - uv publish -fi +uv publish --token=$PYPI_TOKEN From 3ea910942b953e7ee8f5ed1baa371d72df8dfaf6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:58:34 +0000 Subject: [PATCH 19/20] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 5 +++-- .github/workflows/release-doctor.yml | 2 -- .stats.yml | 2 +- bin/check-release-environment | 4 ---- bin/publish-pypi | 6 +++++- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index c1407e4..ed68a26 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,6 +13,9 @@ jobs: name: publish runs-on: ubuntu-latest environment: production + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -25,5 +28,3 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index a0a1edc..5dcdfce 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,5 +18,3 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.NEPTUNE_API_V2_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 0908471..9f90917 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-cd88dd75403e620991c3659cd7e9278f9c8c439f3857c25db8634dfc7e77a9b9.yml openapi_spec_hash: 35a0cbd0262458d633e38fc5ba442118 -config_hash: eb7459746cbb47e3a1cc8c08a96824e2 +config_hash: a79df81e5bba11abab18a84163248141 diff --git a/bin/check-release-environment b/bin/check-release-environment index b845b0f..1e951e9 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") -fi - lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index e72ca2f..5895700 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -4,4 +4,8 @@ set -eux rm -rf dist mkdir -p dist uv build -uv publish --token=$PYPI_TOKEN +if [ -n "${PYPI_TOKEN:-}" ]; then + uv publish --token=$PYPI_TOKEN +else + uv publish +fi From b8dc1716dffb9baa7e7b632e57c998778d6671b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:58:52 +0000 Subject: [PATCH 20/20] release: 0.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 25 +++++++++++++++++++++++++ pyproject.toml | 2 +- src/neptune_api_v2/_version.py | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d2ac0b..10f3091 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fb1613..57d66bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 0.2.0 (2026-04-03) + +Full Changelog: [v0.1.0...v0.2.0](https://github.com/cryptechdev/neptune-api-v2-python/compare/v0.1.0...v0.2.0) + +### Features + +* **api:** add missing models, pagination impls ([1aa9a59](https://github.com/cryptechdev/neptune-api-v2-python/commit/1aa9a590bdc800e554100b00a41b552add478bce)) +* **api:** add python publishing config ([72173a4](https://github.com/cryptechdev/neptune-api-v2-python/commit/72173a429dddb88648a29991c1870d86dd8c6b0a)) +* **api:** api update ([ebee3a7](https://github.com/cryptechdev/neptune-api-v2-python/commit/ebee3a79f42790d9fba6fced90848e432581817f)) +* **api:** api update ([a2daaa3](https://github.com/cryptechdev/neptune-api-v2-python/commit/a2daaa306f5c0ea3c17d2816d25ab9eaf90f058c)) +* **api:** api update ([64bfdf0](https://github.com/cryptechdev/neptune-api-v2-python/commit/64bfdf0f0f702d71e05b37a490f1ced871af27d0)) +* **api:** disable series pagn, update example requests ([9d71f0b](https://github.com/cryptechdev/neptune-api-v2-python/commit/9d71f0b3d797212151cb8d65c5ff72886904a6e9)) +* **api:** Fix readme title, fix inverted example params ([c90715f](https://github.com/cryptechdev/neptune-api-v2-python/commit/c90715f3ad82baedeb47f32889d7aba4404d5114)) +* **api:** manual updates ([3424a81](https://github.com/cryptechdev/neptune-api-v2-python/commit/3424a811af4205ad9396f23f7fd56055f6e2fb35)) +* **api:** manual updates ([f1f5aae](https://github.com/cryptechdev/neptune-api-v2-python/commit/f1f5aaef9e720cdb0933330c9836e8a666b806b4)) + + +### Chores + +* remove custom code ([d81def3](https://github.com/cryptechdev/neptune-api-v2-python/commit/d81def31c6a38ad5972605a6054bf701bcaad6be)) +* update SDK settings ([3ea9109](https://github.com/cryptechdev/neptune-api-v2-python/commit/3ea910942b953e7ee8f5ed1baa371d72df8dfaf6)) +* update SDK settings ([3b2c9f9](https://github.com/cryptechdev/neptune-api-v2-python/commit/3b2c9f9b390aa03d3601dea10cb69133568726fd)) +* update SDK settings ([a41b0dd](https://github.com/cryptechdev/neptune-api-v2-python/commit/a41b0dd737f1ca76a0af6af4792c05dac3ea0b93)) +* update SDK settings ([5759a86](https://github.com/cryptechdev/neptune-api-v2-python/commit/5759a869889951c83f68dfc8d7df247c81fe6cd1)) + ## 0.1.0 (2026-03-30) Full Changelog: [v0.0.1...v0.1.0](https://github.com/cryptechdev/neptune-api-v2-python/compare/v0.0.1...v0.1.0) diff --git a/pyproject.toml b/pyproject.toml index 64d3057..647d5f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "neptune_api_v2" -version = "0.1.0" +version = "0.2.0" description = "The official Python library for the neptune-api-v2 API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/neptune_api_v2/_version.py b/src/neptune_api_v2/_version.py index ec05cbf..35454df 100644 --- a/src/neptune_api_v2/_version.py +++ b/src/neptune_api_v2/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "neptune_api_v2" -__version__ = "0.1.0" # x-release-please-version +__version__ = "0.2.0" # x-release-please-version