Skip to content

Commit d4d67bb

Browse files
feat(api): api update (#515)
1 parent cf1ecee commit d4d67bb

9 files changed

+59
-32
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 39
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-612b573cabcee39c562dc91f5b185e2a0bfdce3a262618f0098602af2199af67.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-b67c6cc5bff73851c98deeabb3ef7548eb89abfa88aca36886084416fdc347f4.yml

requirements-dev.lock

+10-13
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ anyio==4.4.0
1616
# via httpx
1717
argcomplete==3.1.2
1818
# via nox
19-
attrs==23.1.0
20-
# via pytest
2119
certifi==2023.7.22
2220
# via httpcore
2321
# via httpx
@@ -28,8 +26,9 @@ distlib==0.3.7
2826
# via virtualenv
2927
distro==1.8.0
3028
# via finch-api
31-
exceptiongroup==1.1.3
29+
exceptiongroup==1.2.2
3230
# via anyio
31+
# via pytest
3332
filelock==3.12.4
3433
# via virtualenv
3534
h11==0.14.0
@@ -49,7 +48,7 @@ markdown-it-py==3.0.0
4948
# via rich
5049
mdurl==0.1.2
5150
# via markdown-it-py
52-
mypy==1.11.2
51+
mypy==1.13.0
5352
mypy-extensions==1.0.0
5453
# via mypy
5554
nodeenv==1.8.0
@@ -60,20 +59,18 @@ packaging==23.2
6059
# via pytest
6160
platformdirs==3.11.0
6261
# via virtualenv
63-
pluggy==1.3.0
64-
# via pytest
65-
py==1.11.0
62+
pluggy==1.5.0
6663
# via pytest
67-
pydantic==2.7.1
64+
pydantic==2.9.2
6865
# via finch-api
69-
pydantic-core==2.18.2
66+
pydantic-core==2.23.4
7067
# via pydantic
7168
pygments==2.18.0
7269
# via rich
7370
pyright==1.1.380
74-
pytest==7.1.1
71+
pytest==8.3.3
7572
# via pytest-asyncio
76-
pytest-asyncio==0.21.1
73+
pytest-asyncio==0.24.0
7774
python-dateutil==2.8.2
7875
# via time-machine
7976
pytz==2023.3.post1
@@ -90,10 +87,10 @@ sniffio==1.3.0
9087
# via finch-api
9188
# via httpx
9289
time-machine==2.9.0
93-
tomli==2.0.1
90+
tomli==2.0.2
9491
# via mypy
9592
# via pytest
96-
typing-extensions==4.8.0
93+
typing-extensions==4.12.2
9794
# via anyio
9895
# via finch-api
9996
# via mypy

requirements.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ certifi==2023.7.22
1919
# via httpx
2020
distro==1.8.0
2121
# via finch-api
22-
exceptiongroup==1.1.3
22+
exceptiongroup==1.2.2
2323
# via anyio
2424
h11==0.14.0
2525
# via httpcore
@@ -30,15 +30,15 @@ httpx==0.25.2
3030
idna==3.4
3131
# via anyio
3232
# via httpx
33-
pydantic==2.7.1
33+
pydantic==2.9.2
3434
# via finch-api
35-
pydantic-core==2.18.2
35+
pydantic-core==2.23.4
3636
# via pydantic
3737
sniffio==1.3.0
3838
# via anyio
3939
# via finch-api
4040
# via httpx
41-
typing-extensions==4.8.0
41+
typing-extensions==4.12.2
4242
# via anyio
4343
# via finch-api
4444
# via pydantic

src/finch/_compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
133133
def model_dump(
134134
model: pydantic.BaseModel,
135135
*,
136-
exclude: IncEx = None,
136+
exclude: IncEx | None = None,
137137
exclude_unset: bool = False,
138138
exclude_defaults: bool = False,
139139
warnings: bool = True,

src/finch/_models.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __str__(self) -> str:
176176
# Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836.
177177
@classmethod
178178
@override
179-
def construct(
179+
def construct( # pyright: ignore[reportIncompatibleMethodOverride]
180180
cls: Type[ModelT],
181181
_fields_set: set[str] | None = None,
182182
**values: object,
@@ -248,8 +248,8 @@ def model_dump(
248248
self,
249249
*,
250250
mode: Literal["json", "python"] | str = "python",
251-
include: IncEx = None,
252-
exclude: IncEx = None,
251+
include: IncEx | None = None,
252+
exclude: IncEx | None = None,
253253
by_alias: bool = False,
254254
exclude_unset: bool = False,
255255
exclude_defaults: bool = False,
@@ -303,8 +303,8 @@ def model_dump_json(
303303
self,
304304
*,
305305
indent: int | None = None,
306-
include: IncEx = None,
307-
exclude: IncEx = None,
306+
include: IncEx | None = None,
307+
exclude: IncEx | None = None,
308308
by_alias: bool = False,
309309
exclude_unset: bool = False,
310310
exclude_defaults: bool = False,

src/finch/_types.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Optional,
1717
Sequence,
1818
)
19-
from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
19+
from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
2020

2121
import httpx
2222
import pydantic
@@ -195,7 +195,9 @@ def get(self, __key: str) -> str | None: ...
195195

196196
# Note: copied from Pydantic
197197
# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49
198-
IncEx: TypeAlias = "set[int] | set[str] | dict[int, Any] | dict[str, Any] | None"
198+
IncEx: TypeAlias = Union[
199+
Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
200+
]
199201

200202
PostParser = Callable[[Any], Any]
201203

src/finch/types/account_update_event.py

+13
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsIndividualEmails",
3434
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsIndividualPhoneNumbers",
3535
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsIndividualResidence",
36+
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayGroup",
3637
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatement",
3738
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPaging",
3839
"AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPayStatements",
@@ -263,6 +264,16 @@ class AccountUpdateEventDataAuthenticationMethodSupportedFieldsIndividual(BaseMo
263264
ssn: Optional[bool] = None
264265

265266

267+
class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayGroup(BaseModel):
268+
id: Optional[bool] = None
269+
270+
individual_ids: Optional[bool] = None
271+
272+
name: Optional[bool] = None
273+
274+
pay_frequencies: Optional[bool] = None
275+
276+
266277
class AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPaging(BaseModel):
267278
count: bool
268279

@@ -388,6 +399,8 @@ class AccountUpdateEventDataAuthenticationMethodSupportedFields(BaseModel):
388399

389400
individual: Optional[AccountUpdateEventDataAuthenticationMethodSupportedFieldsIndividual] = None
390401

402+
pay_group: Optional[AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayGroup] = None
403+
391404
pay_statement: Optional[AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatement] = None
392405

393406
payment: Optional[AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayment] = None

src/finch/types/provider.py

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"AuthenticationMethodSupportedFieldsIndividualEmails",
3131
"AuthenticationMethodSupportedFieldsIndividualPhoneNumbers",
3232
"AuthenticationMethodSupportedFieldsIndividualResidence",
33+
"AuthenticationMethodSupportedFieldsPayGroup",
3334
"AuthenticationMethodSupportedFieldsPayStatement",
3435
"AuthenticationMethodSupportedFieldsPayStatementPaging",
3536
"AuthenticationMethodSupportedFieldsPayStatementPayStatements",
@@ -260,6 +261,16 @@ class AuthenticationMethodSupportedFieldsIndividual(BaseModel):
260261
ssn: Optional[bool] = None
261262

262263

264+
class AuthenticationMethodSupportedFieldsPayGroup(BaseModel):
265+
id: Optional[bool] = None
266+
267+
individual_ids: Optional[bool] = None
268+
269+
name: Optional[bool] = None
270+
271+
pay_frequencies: Optional[bool] = None
272+
273+
263274
class AuthenticationMethodSupportedFieldsPayStatementPaging(BaseModel):
264275
count: bool
265276

@@ -379,6 +390,8 @@ class AuthenticationMethodSupportedFields(BaseModel):
379390

380391
individual: Optional[AuthenticationMethodSupportedFieldsIndividual] = None
381392

393+
pay_group: Optional[AuthenticationMethodSupportedFieldsPayGroup] = None
394+
382395
pay_statement: Optional[AuthenticationMethodSupportedFieldsPayStatement] = None
383396

384397
payment: Optional[AuthenticationMethodSupportedFieldsPayment] = None

tests/conftest.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import annotations
22

33
import os
4-
import asyncio
54
import logging
65
from typing import TYPE_CHECKING, Iterator, AsyncIterator
76

87
import pytest
8+
from pytest_asyncio import is_async_test
99

1010
from finch import Finch, AsyncFinch
1111

@@ -17,11 +17,13 @@
1717
logging.getLogger("finch").setLevel(logging.DEBUG)
1818

1919

20-
@pytest.fixture(scope="session")
21-
def event_loop() -> Iterator[asyncio.AbstractEventLoop]:
22-
loop = asyncio.new_event_loop()
23-
yield loop
24-
loop.close()
20+
# automatically add `pytest.mark.asyncio()` to all of our async tests
21+
# so we don't have to add that boilerplate everywhere
22+
def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
23+
pytest_asyncio_tests = (item for item in items if is_async_test(item))
24+
session_scope_marker = pytest.mark.asyncio(loop_scope="session")
25+
for async_test in pytest_asyncio_tests:
26+
async_test.add_marker(session_scope_marker, append=False)
2527

2628

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

0 commit comments

Comments
 (0)