diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 6035a80..ed68a26 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,6 +12,10 @@ jobs: publish: name: publish runs-on: ubuntu-latest + environment: production + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -24,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 b8e1556..5dcdfce 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: @@ -17,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/.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/.stats.yml b/.stats.yml index 6e0347a..9f90917 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 -config_hash: fa0efc29593602eac57523d55bc83fa6 +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 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/README.md b/README.md index 89bf3ae..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). @@ -32,8 +29,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 +48,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()) @@ -64,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()`: @@ -80,8 +83,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()) @@ -96,6 +102,77 @@ 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_users = [] +# Automatically fetches more pages as needed. +for user in client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", +): + # Do something with user here + all_users.append(user) +print(all_users) +``` + +Or, asynchronously: + +```python +import asyncio +from neptune_api_v2 import AsyncNeptuneAPIV2 + +client = AsyncNeptuneAPIV2() + + +async def main() -> None: + all_users = [] + # Iterate through items across all pages, issuing requests as needed. + async for user in client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", + ): + all_users.append(user) + print(all_users) + + +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.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)}") + +# Remove `await` for non-async usage. +``` + +Or just work directly with the returned data: + +```python +first_page = await client.user.get_tx_history( + address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", +) + +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. +``` + ## 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. @@ -112,7 +189,7 @@ from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() try: - client.status.check_health() + 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. @@ -155,7 +232,7 @@ client = NeptuneAPIV2( ) # Or, configure per-request: -client.with_options(max_retries=5).status.check_health() +client.with_options(max_retries=5).markets.get_overview() ``` ### Timeouts @@ -178,7 +255,7 @@ client = NeptuneAPIV2( ) # Override per-request: -client.with_options(timeout=5.0).status.check_health() +client.with_options(timeout=5.0).markets.get_overview() ``` On timeout, an `APITimeoutError` is thrown. @@ -219,11 +296,11 @@ 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() 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. @@ -237,7 +314,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.status.with_streaming_response.check_health() 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(): diff --git a/api.md b/api.md index 7fbed9f..cc66777 100644 --- a/api.md +++ b/api.md @@ -7,13 +7,11 @@ from neptune_api_v2.types import ( ErrorData, ErrorDataVariants, ErrorKind, - ErrorResponseVariants, + ErrorResponse, ErrorScope, FieldValidationError, Interval, IntervalUnit, - ListErrorResponse, - ObjErrorResponse, ValidationErrorData, ValidationFieldSource, ) @@ -186,18 +184,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 @@ -226,7 +218,10 @@ Types: ```python from neptune_api_v2.types.user.market import ( + UserLendAssetPool, UserLendMarket, + UserLendOriginAmounts, + UserLendReceiptAmounts, LendListResponse, LendGetByAssetResponse, ) @@ -379,7 +374,7 @@ 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(\*\*params) -> SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse] - client.analytics.market.history.get_loans_originated_by_asset(\*\*params) -> HistoryGetLoansOriginatedByAssetResponse ## Nept @@ -407,3 +402,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/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 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/_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/_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 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..d464fe1 100644 --- a/src/neptune_api_v2/resources/analytics/market/history.py +++ b/src/neptune_api_v2/resources/analytics/market/history.py @@ -17,7 +17,8 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +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 from ....types.analytics.market.history_get_loans_originated_response import HistoryGetLoansOriginatedResponse @@ -63,7 +64,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 +111,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 +131,7 @@ def get_loans_originated( history_get_loans_originated_params.HistoryGetLoansOriginatedParams, ), ), - cast_to=HistoryGetLoansOriginatedResponse, + model=HistoryGetLoansOriginatedResponse, ) def get_loans_originated_by_asset( @@ -242,7 +244,7 @@ def with_streaming_response(self) -> AsyncHistoryResourceWithStreamingResponse: """ return AsyncHistoryResourceWithStreamingResponse(self) - async def get_loans_originated( + def get_loans_originated( self, *, end: int, @@ -257,7 +259,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 +306,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,7 +326,7 @@ async def get_loans_originated( history_get_loans_originated_params.HistoryGetLoansOriginatedParams, ), ), - cast_to=HistoryGetLoansOriginatedResponse, + model=HistoryGetLoansOriginatedResponse, ) async def get_loans_originated_by_asset( 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..43f3acd --- /dev/null +++ b/src/neptune_api_v2/resources/swap/routes.py @@ -0,0 +1,294 @@ +# 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. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. + + 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. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. + + 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..40c7afc 100644 --- a/src/neptune_api_v2/types/__init__.py +++ b/src/neptune_api_v2/types/__init__.py @@ -42,7 +42,6 @@ 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 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..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,76 +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): - """Object data success response""" - - 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/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.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/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_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_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_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 4adf326..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 @@ -12,13 +10,15 @@ class BorrowDebtMarket(BaseModel): + """Borrowing market, debt info""" + asset_info: AssetInfo """Asset identifiers with associated metadata""" 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/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..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 @@ -11,10 +9,12 @@ class LendMarket(BaseModel): + """Lending market overview""" + 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_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..a1db93d 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__ = [ @@ -35,6 +36,9 @@ class ExtraValueExtraText(BaseModel): emission_rate: str + price: str + """Text representation of price""" + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -48,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 @@ -66,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. """ @@ -89,7 +110,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 +125,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..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. """ @@ -107,7 +127,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/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_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/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/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 71% 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 74154dc..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,19 +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): - """List data success response""" - +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..d6291cc --- /dev/null +++ b/src/neptune_api_v2/types/swap/route_list_by_denom_params.py @@ -0,0 +1,23 @@ +# 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. + + - `inj` is a **valid** value for `source_denom`. + - `native;inj` is **not a valid value** for `source_denom`. + """ diff --git a/src/neptune_api_v2/types/swap/route_list_by_denom_response.py b/src/neptune_api_v2/types/swap/route_list_by_denom_response.py new file mode 100644 index 0000000..fc92cad --- /dev/null +++ b/src/neptune_api_v2/types/swap/route_list_by_denom_response.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .swap_route_target_set import SwapRouteTargetSet + +__all__ = ["RouteListByDenomResponse"] + + +class RouteListByDenomResponse(BaseModel): + data: SwapRouteTargetSet + + 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/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/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..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 @@ -11,12 +12,17 @@ class UserBorrowMarketAccount(BaseModel): + """User borrowing subaccount""" + collaterals: List[UserCollateralAssetPool] """Account collateral allocations""" 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 67f11af..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,10 +67,25 @@ 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 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_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 74931f5..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,20 +73,31 @@ 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 UserDebtAccountPool(BaseModel): - debt: str - """Sum open debt amount (this is simply the principal + interest)""" + """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. + """ 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_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..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,10 +17,11 @@ class Data(BaseModel): asset_info: AssetInfo """Asset identifiers with associated metadata""" + market_rate: MarketRate + """Current market borrowing rate""" -class BorrowGetDebtAccountsByAssetResponse(BaseModel): - """Object data success response""" +class BorrowGetDebtAccountsByAssetResponse(BaseModel): 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..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,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from ...._models import BaseModel -from .borrow.user_debt_asset_pool import UserDebtAssetPool +from .user_lend_asset_pool import UserLendAssetPool __all__ = ["LendGetByAssetResponse"] class LendGetByAssetResponse(BaseModel): - """Object data success response""" - - data: UserDebtAssetPool + data: UserLendAssetPool 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_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_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 0263e20..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 @@ -3,11 +3,15 @@ from typing import List from ...._models import BaseModel -from .borrow.user_debt_asset_pool import UserDebtAssetPool +from ...market_rate import MarketRate +from .user_lend_asset_pool import UserLendAssetPool __all__ = ["UserLendMarket"] class UserLendMarket(BaseModel): - asset_pools: List[UserDebtAssetPool] + asset_pools: List[UserLendAssetPool] """User lending allocations""" + + net_rate: MarketRate + """Account debt net rate""" 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/market_get_merged_by_asset_response.py b/src/neptune_api_v2/types/user/market_get_merged_by_asset_response.py index 061fd50..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 @@ -7,9 +7,12 @@ class MarketGetMergedByAssetResponse(BaseModel): - """Object data success response""" - 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/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.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 73728fc..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. """ @@ -69,7 +89,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/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/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..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,257 +4,42 @@ 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", - "BorrowCollateral", - "BorrowCollateralExtra", - "BorrowCollateralExtraText", - "BorrowCollateralExtraValue", - "BorrowCollateralExtraValueExtra", - "BorrowCollateralExtraValueExtraText", - "BorrowDebt", - "BorrowDebtExtra", - "BorrowDebtExtraText", - "BorrowDebtExtraValue", - "BorrowDebtExtraValueExtra", - "BorrowDebtExtraValueExtraText", - "Lend", - "LendExtra", - "LendExtraText", - "LendExtraValue", - "LendExtraValueExtra", - "LendExtraValueExtraText", -] +__all__ = ["UserMergedMarket", "Lend"] -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 LendExtraText(BaseModel): - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - debt: str - - interest: str - - principal: str - - -class LendExtraValueExtraText(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 LendExtraValueExtra(BaseModel): - text: Optional[LendExtraValueExtraText] = None - """Human-readable variants of USD values. +class Lend(BaseModel): + """User contribution for asset's lending market, if one exists""" - Will not be null when query params `with_text` and `with_value` are `true`. + origin_equivalent: UserLendOriginAmounts """ - - -class LendExtraValue(BaseModel): - """USD values for the corresponding amounts above. - - Will not be null when query param `with_value` is `true`. + The lending amounts converted into the equivalent for the receipt token's + origin/source asset """ - debt: str - - extra: LendExtraValueExtra - - interest: str - - principal: str + receipt_amounts: UserLendReceiptAmounts + """The lending amounts in the original receipt token amounts""" -class LendExtra(BaseModel): - text: Optional[LendExtraText] = None - """Human-readable field variants. - - Will not be null when query param `with_text` is `true`. - """ - - value: Optional[LendExtraValue] = None - """USD values for the corresponding amounts above. +class UserMergedMarket(BaseModel): + """User market allocations grouped by asset. - Will not be null when query param `with_value` is `true`. + **Note**: because of the inverted structure of merged market accounts, account + health cannot be represented and is excluded in the merged structures. """ - -class Lend(BaseModel): - """User contirbution for asset's lending market, if one exists""" - - debt: str - """Sum open debt amount (this is simply the principal + interest)""" - - extra: LendExtra - - interest: str - """Sum of accrued interest for open debt position""" - - principal: str - """Initial amount borrowed (of debts which have not yet been repaid)""" - - -class UserMergedMarket(BaseModel): 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/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_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 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""" diff --git a/tests/api_resources/analytics/market/test_history.py b/tests/api_resources/analytics/market/test_history.py index ff1446d..91c2393 100644 --- a/tests/api_resources/analytics/market/test_history.py +++ b/tests/api_resources/analytics/market/test_history.py @@ -9,6 +9,7 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 +from neptune_api_v2.pagination import SyncIntervalSinglePage, AsyncIntervalSinglePage from neptune_api_v2.types.analytics.market import ( HistoryGetLoansOriginatedResponse, HistoryGetLoansOriginatedByAssetResponse, @@ -28,7 +29,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 +42,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 +56,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 +70,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 @@ -141,7 +142,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 +155,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 +169,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 +183,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 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_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 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" 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" },