Skip to content

Commit 150965a

Browse files
fix: reuse model in pagination items type (#679)
1 parent 1fd8a18 commit 150965a

File tree

5 files changed

+18
-138
lines changed

5 files changed

+18
-138
lines changed

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,12 @@ Methods:
378378
Types:
379379

380380
```python
381-
from lithic.types.financial_accounts.statements import StatementLineItems, LineItemListResponse
381+
from lithic.types.financial_accounts.statements import StatementLineItems
382382
```
383383

384384
Methods:
385385

386-
- <code title="get /v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items">client.financial_accounts.statements.line_items.<a href="./src/lithic/resources/financial_accounts/statements/line_items.py">list</a>(statement_token, \*, financial_account_token, \*\*<a href="src/lithic/types/financial_accounts/statements/line_item_list_params.py">params</a>) -> <a href="./src/lithic/types/financial_accounts/statements/line_item_list_response.py">SyncCursorPage[LineItemListResponse]</a></code>
386+
- <code title="get /v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items">client.financial_accounts.statements.line_items.<a href="./src/lithic/resources/financial_accounts/statements/line_items.py">list</a>(statement_token, \*, financial_account_token, \*\*<a href="src/lithic/types/financial_accounts/statements/line_item_list_params.py">params</a>) -> SyncCursorPage[Data]</code>
387387

388388
## LoanTapes
389389

src/lithic/resources/financial_accounts/statements/line_items.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ....pagination import SyncCursorPage, AsyncCursorPage
1414
from ...._base_client import AsyncPaginator, make_request_options
1515
from ....types.financial_accounts.statements import line_item_list_params
16-
from ....types.financial_accounts.statements.line_item_list_response import LineItemListResponse
16+
from ....types.financial_accounts.statements.statement_line_items import Data
1717

1818
__all__ = ["LineItems", "AsyncLineItems"]
1919

@@ -52,7 +52,7 @@ def list(
5252
extra_query: Query | None = None,
5353
extra_body: Body | None = None,
5454
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
55-
) -> SyncCursorPage[LineItemListResponse]:
55+
) -> SyncCursorPage[Data]:
5656
"""
5757
List the line items for a given statement within a given financial account.
5858
@@ -85,7 +85,7 @@ def list(
8585
raise ValueError(f"Expected a non-empty value for `statement_token` but received {statement_token!r}")
8686
return self._get_api_list(
8787
f"/v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items",
88-
page=SyncCursorPage[LineItemListResponse],
88+
page=SyncCursorPage[Data],
8989
options=make_request_options(
9090
extra_headers=extra_headers,
9191
extra_query=extra_query,
@@ -100,7 +100,7 @@ def list(
100100
line_item_list_params.LineItemListParams,
101101
),
102102
),
103-
model=LineItemListResponse,
103+
model=Data,
104104
)
105105

106106

@@ -138,7 +138,7 @@ def list(
138138
extra_query: Query | None = None,
139139
extra_body: Body | None = None,
140140
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
141-
) -> AsyncPaginator[LineItemListResponse, AsyncCursorPage[LineItemListResponse]]:
141+
) -> AsyncPaginator[Data, AsyncCursorPage[Data]]:
142142
"""
143143
List the line items for a given statement within a given financial account.
144144
@@ -171,7 +171,7 @@ def list(
171171
raise ValueError(f"Expected a non-empty value for `statement_token` but received {statement_token!r}")
172172
return self._get_api_list(
173173
f"/v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items",
174-
page=AsyncCursorPage[LineItemListResponse],
174+
page=AsyncCursorPage[Data],
175175
options=make_request_options(
176176
extra_headers=extra_headers,
177177
extra_query=extra_query,
@@ -186,7 +186,7 @@ def list(
186186
line_item_list_params.LineItemListParams,
187187
),
188188
),
189-
model=LineItemListResponse,
189+
model=Data,
190190
)
191191

192192

src/lithic/types/financial_accounts/statements/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
from .statements import Statements as Statements
66
from .statement_line_items import StatementLineItems as StatementLineItems
77
from .line_item_list_params import LineItemListParams as LineItemListParams
8-
from .line_item_list_response import LineItemListResponse as LineItemListResponse

src/lithic/types/financial_accounts/statements/line_item_list_response.py

Lines changed: 0 additions & 119 deletions
This file was deleted.

tests/api_resources/financial_accounts/statements/test_line_items.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from lithic import Lithic, AsyncLithic
1111
from tests.utils import assert_matches_type
1212
from lithic.pagination import SyncCursorPage, AsyncCursorPage
13-
from lithic.types.financial_accounts.statements import LineItemListResponse
13+
from lithic.types.financial_accounts.statements.statement_line_items import Data
1414

1515
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1616

@@ -24,7 +24,7 @@ def test_method_list(self, client: Lithic) -> None:
2424
statement_token="statement_token",
2525
financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
2626
)
27-
assert_matches_type(SyncCursorPage[LineItemListResponse], line_item, path=["response"])
27+
assert_matches_type(SyncCursorPage[Data], line_item, path=["response"])
2828

2929
@parametrize
3030
def test_method_list_with_all_params(self, client: Lithic) -> None:
@@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Lithic) -> None:
3535
page_size=1,
3636
starting_after="starting_after",
3737
)
38-
assert_matches_type(SyncCursorPage[LineItemListResponse], line_item, path=["response"])
38+
assert_matches_type(SyncCursorPage[Data], line_item, path=["response"])
3939

4040
@parametrize
4141
def test_raw_response_list(self, client: Lithic) -> None:
@@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Lithic) -> None:
4747
assert response.is_closed is True
4848
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4949
line_item = response.parse()
50-
assert_matches_type(SyncCursorPage[LineItemListResponse], line_item, path=["response"])
50+
assert_matches_type(SyncCursorPage[Data], line_item, path=["response"])
5151

5252
@parametrize
5353
def test_streaming_response_list(self, client: Lithic) -> None:
@@ -59,7 +59,7 @@ def test_streaming_response_list(self, client: Lithic) -> None:
5959
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6060

6161
line_item = response.parse()
62-
assert_matches_type(SyncCursorPage[LineItemListResponse], line_item, path=["response"])
62+
assert_matches_type(SyncCursorPage[Data], line_item, path=["response"])
6363

6464
assert cast(Any, response.is_closed) is True
6565

@@ -89,7 +89,7 @@ async def test_method_list(self, async_client: AsyncLithic) -> None:
8989
statement_token="statement_token",
9090
financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
9191
)
92-
assert_matches_type(AsyncCursorPage[LineItemListResponse], line_item, path=["response"])
92+
assert_matches_type(AsyncCursorPage[Data], line_item, path=["response"])
9393

9494
@parametrize
9595
async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None:
@@ -100,7 +100,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N
100100
page_size=1,
101101
starting_after="starting_after",
102102
)
103-
assert_matches_type(AsyncCursorPage[LineItemListResponse], line_item, path=["response"])
103+
assert_matches_type(AsyncCursorPage[Data], line_item, path=["response"])
104104

105105
@parametrize
106106
async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
@@ -112,7 +112,7 @@ async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
112112
assert response.is_closed is True
113113
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
114114
line_item = response.parse()
115-
assert_matches_type(AsyncCursorPage[LineItemListResponse], line_item, path=["response"])
115+
assert_matches_type(AsyncCursorPage[Data], line_item, path=["response"])
116116

117117
@parametrize
118118
async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
@@ -124,7 +124,7 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
124124
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
125125

126126
line_item = await response.parse()
127-
assert_matches_type(AsyncCursorPage[LineItemListResponse], line_item, path=["response"])
127+
assert_matches_type(AsyncCursorPage[Data], line_item, path=["response"])
128128

129129
assert cast(Any, response.is_closed) is True
130130

0 commit comments

Comments
 (0)