Skip to content

Commit 9e2c02a

Browse files
fix: correct benfits to benefits (#125)
1 parent 623f5bc commit 9e2c02a

File tree

11 files changed

+179
-46
lines changed

11 files changed

+179
-46
lines changed

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and offers both synchronous and asynchronous clients powered by [httpx](https://
88

99
## Documentation
1010

11-
The API documentation can be found at [https://developer.tryfinch.com/](https://developer.tryfinch.com/).
11+
The API documentation can be found [in the Finch Documentation Center](https://developer.tryfinch.com/).
1212

1313
## Installation
1414

@@ -27,7 +27,7 @@ client = Finch(
2727
access_token="my access token",
2828
)
2929

30-
page = client.hris.directory.list_individuals(
30+
page = client.hris.directory.list(
3131
candidate_id="<candidate id>",
3232
)
3333
directory = page.individuals[0]
@@ -47,7 +47,7 @@ client = AsyncFinch(
4747

4848

4949
async def main():
50-
page = await client.hris.directory.list_individuals(
50+
page = await client.hris.directory.list(
5151
candidate_id="<candidate id>",
5252
)
5353
print(page.individuals[0].first_name)
@@ -77,7 +77,7 @@ client = Finch()
7777

7878
all_directories = []
7979
# Automatically fetches more pages as needed.
80-
for directory in client.hris.directory.list_individuals():
80+
for directory in client.hris.directory.list():
8181
# Do something with directory here
8282
all_directories.append(directory)
8383
print(all_directories)
@@ -95,7 +95,7 @@ client = AsyncFinch()
9595
async def main() -> None:
9696
all_directories = []
9797
# Iterate through items across all pages, issuing requests as needed.
98-
async for directory in client.hris.directory.list_individuals():
98+
async for directory in client.hris.directory.list():
9999
all_directories.append(directory)
100100
print(all_directories)
101101

@@ -106,7 +106,7 @@ asyncio.run(main())
106106
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
107107

108108
```python
109-
first_page = await client.hris.directory.list_individuals()
109+
first_page = await client.hris.directory.list()
110110
if first_page.has_next_page():
111111
print(f"will fetch next page using these details: {first_page.next_page_info()}")
112112
next_page = await first_page.get_next_page()
@@ -118,7 +118,7 @@ if first_page.has_next_page():
118118
Or just work directly with the returned data:
119119

120120
```python
121-
first_page = await client.hris.directory.list_individuals()
121+
first_page = await client.hris.directory.list()
122122

123123
print(
124124
f"the current start offset for this page: {first_page.paging.offset}"
@@ -138,7 +138,7 @@ from finch import Finch
138138

139139
client = Finch()
140140

141-
client.hris.directory.list_individuals(
141+
client.hris.directory.list(
142142
path_params=[],
143143
params={},
144144
)
@@ -183,7 +183,7 @@ from finch import Finch
183183
client = Finch()
184184

185185
try:
186-
client.hris.directory.list_individuals()
186+
client.hris.directory.list()
187187
except finch.APIConnectionError as e:
188188
print("The server could not be reached")
189189
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -226,7 +226,7 @@ client = Finch(
226226
)
227227

228228
# Or, configure per-request:
229-
client.with_options(max_retries=5).hris.directory.list_individuals()
229+
client.with_options(max_retries=5).hris.directory.list()
230230
```
231231

232232
### Timeouts
@@ -249,7 +249,7 @@ client = Finch(
249249
)
250250

251251
# Override per-request:
252-
client.with_options(timeout=5 * 1000).hris.directory.list_individuals()
252+
client.with_options(timeout=5 * 1000).hris.directory.list()
253253
```
254254

255255
On timeout, an `APITimeoutError` is thrown.
@@ -313,7 +313,7 @@ By default the library closes underlying HTTP connections whenever the client is
313313

314314
## Versioning
315315

316-
This package generally attempts to follow [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
316+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
317317

318318
1. Changes that only affect static types, without breaking runtime behavior.
319319
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.

api.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ from finch.types.hris import IndividualInDirectory
3535

3636
Methods:
3737

38-
- <code title="get /employer/directory">client.hris.directory.<a href="./src/finch/resources/hris/directory.py">list_individuals</a>(\*\*<a href="src/finch/types/hris/directory_list_individuals_params.py">params</a>) -> <a href="./src/finch/types/hris/individual_in_directory.py">SyncIndividualsPage[IndividualInDirectory]</a></code>
38+
- <code title="get /employer/directory">client.hris.directory.<a href="./src/finch/resources/hris/directory.py">list</a>(\*\*<a href="src/finch/types/hris/directory_list_params.py">params</a>) -> <a href="./src/finch/types/hris/individual_in_directory.py">SyncIndividualsPage[IndividualInDirectory]</a></code>
3939

4040
## Individuals
4141

@@ -95,6 +95,7 @@ Types:
9595

9696
```python
9797
from finch.types.hris import (
98+
BenefitContribution,
9899
BenefitFrequency,
99100
BenefitType,
100101
BenfitContribution,

src/finch/resources/hris/directory.py

+83-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
from __future__ import annotations
44

5+
import typing_extensions
6+
57
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
68
from ..._utils import maybe_transform
79
from ..._resource import SyncAPIResource, AsyncAPIResource
810
from ...pagination import SyncIndividualsPage, AsyncIndividualsPage
9-
from ...types.hris import IndividualInDirectory, directory_list_individuals_params
11+
from ...types.hris import IndividualInDirectory, directory_list_params
1012
from ..._base_client import AsyncPaginator, make_request_options
1113

1214
__all__ = ["Directory", "AsyncDirectory"]
1315

1416

1517
class Directory(SyncAPIResource):
16-
def list_individuals(
18+
def list(
1719
self,
1820
*,
1921
limit: int | NotGiven = NOT_GIVEN,
@@ -54,15 +56,53 @@ def list_individuals(
5456
"limit": limit,
5557
"offset": offset,
5658
},
57-
directory_list_individuals_params.DirectoryListIndividualsParams,
59+
directory_list_params.DirectoryListParams,
5860
),
5961
),
6062
model=IndividualInDirectory,
6163
)
6264

65+
@typing_extensions.deprecated("use `list` instead")
66+
def list_individuals(
67+
self,
68+
*,
69+
limit: int | NotGiven = NOT_GIVEN,
70+
offset: int | NotGiven = NOT_GIVEN,
71+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
72+
# The extra values given here take precedence over values defined on the client or passed to this method.
73+
extra_headers: Headers | None = None,
74+
extra_query: Query | None = None,
75+
extra_body: Body | None = None,
76+
timeout: float | None | NotGiven = NOT_GIVEN,
77+
) -> SyncIndividualsPage[IndividualInDirectory]:
78+
"""
79+
Read company directory and organization structure
80+
81+
Args:
82+
limit: Number of employees to return (defaults to all)
83+
84+
offset: Index to start from (defaults to 0)
85+
86+
extra_headers: Send extra headers
87+
88+
extra_query: Add additional query parameters to the request
89+
90+
extra_body: Add additional JSON properties to the request
91+
92+
timeout: Override the client-level default timeout for this request, in seconds
93+
"""
94+
return self.list(
95+
limit=limit,
96+
offset=offset,
97+
extra_headers=extra_headers,
98+
extra_query=extra_query,
99+
extra_body=extra_body,
100+
timeout=timeout,
101+
)
102+
63103

64104
class AsyncDirectory(AsyncAPIResource):
65-
def list_individuals(
105+
def list(
66106
self,
67107
*,
68108
limit: int | NotGiven = NOT_GIVEN,
@@ -103,8 +143,46 @@ def list_individuals(
103143
"limit": limit,
104144
"offset": offset,
105145
},
106-
directory_list_individuals_params.DirectoryListIndividualsParams,
146+
directory_list_params.DirectoryListParams,
107147
),
108148
),
109149
model=IndividualInDirectory,
110150
)
151+
152+
@typing_extensions.deprecated("use `list` instead")
153+
def list_individuals(
154+
self,
155+
*,
156+
limit: int | NotGiven = NOT_GIVEN,
157+
offset: int | NotGiven = NOT_GIVEN,
158+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
159+
# The extra values given here take precedence over values defined on the client or passed to this method.
160+
extra_headers: Headers | None = None,
161+
extra_query: Query | None = None,
162+
extra_body: Body | None = None,
163+
timeout: float | None | NotGiven = NOT_GIVEN,
164+
) -> AsyncPaginator[IndividualInDirectory, AsyncIndividualsPage[IndividualInDirectory]]:
165+
"""
166+
Read company directory and organization structure
167+
168+
Args:
169+
limit: Number of employees to return (defaults to all)
170+
171+
offset: Index to start from (defaults to 0)
172+
173+
extra_headers: Send extra headers
174+
175+
extra_query: Add additional query parameters to the request
176+
177+
extra_body: Add additional JSON properties to the request
178+
179+
timeout: Override the client-level default timeout for this request, in seconds
180+
"""
181+
return self.list(
182+
limit=limit,
183+
offset=offset,
184+
extra_headers=extra_headers,
185+
extra_query=extra_query,
186+
extra_body=extra_body,
187+
timeout=timeout,
188+
)

src/finch/types/hris/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
from .benfit_contribution import BenfitContribution as BenfitContribution
1515
from .individual_response import IndividualResponse as IndividualResponse
1616
from .payment_list_params import PaymentListParams as PaymentListParams
17+
from .benefit_contribution import BenefitContribution as BenefitContribution
1718
from .benefit_create_params import BenefitCreateParams as BenefitCreateParams
1819
from .benefit_update_params import BenefitUpdateParams as BenefitUpdateParams
20+
from .directory_list_params import DirectoryListParams as DirectoryListParams
1921
from .pay_statement_response import PayStatementResponse as PayStatementResponse
2022
from .individual_in_directory import IndividualInDirectory as IndividualInDirectory
2123
from .employment_data_response import EmploymentDataResponse as EmploymentDataResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# File generated from our OpenAPI spec by Stainless.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["BenefitContribution"]
9+
10+
11+
class BenefitContribution(BaseModel):
12+
amount: Optional[int] = None
13+
"""Contribution amount in cents (if `fixed`) or basis points (if `percent`)."""
14+
15+
type: Optional[Literal["fixed", "percent"]] = None
16+
"""Contribution type."""

src/finch/types/hris/benefits/individual_benefit.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing_extensions import Literal
55

66
from ...._models import BaseModel
7-
from ..benfit_contribution import BenfitContribution
7+
from ..benefit_contribution import BenefitContribution
88

99
__all__ = ["IndividualBenefit", "Body"]
1010

@@ -21,9 +21,9 @@ class Body(BaseModel):
2121
for this individual.
2222
"""
2323

24-
company_contribution: Optional[BenfitContribution] = None
24+
company_contribution: Optional[BenefitContribution] = None
2525

26-
employee_deduction: Optional[BenfitContribution] = None
26+
employee_deduction: Optional[BenefitContribution] = None
2727

2828
hsa_contribution_limit: Optional[Literal["individual", "family"]] = None
2929
"""Type for HSA contribution limit if the benefit is a HSA."""
+3-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless.
22

3-
from typing import Optional
4-
from typing_extensions import Literal
53

6-
from ..._models import BaseModel
4+
from .benefit_contribution import BenefitContribution
75

8-
__all__ = ["BenfitContribution"]
9-
10-
11-
class BenfitContribution(BaseModel):
12-
amount: Optional[int] = None
13-
"""Contribution amount in cents (if `fixed`) or basis points (if `percent`)."""
14-
15-
type: Optional[Literal["fixed", "percent"]] = None
16-
"""Contribution type."""
6+
BenfitContribution = BenefitContribution
7+
"""use `BenefitContribution` instead"""

src/finch/types/hris/company_benefit.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
from ..._models import BaseModel
66
from .benefit_type import BenefitType
77
from .benefit_frequency import BenefitFrequency
8-
from .benfit_contribution import BenfitContribution
8+
from .benefit_contribution import BenefitContribution
99

1010
__all__ = ["CompanyBenefit"]
1111

1212

1313
class CompanyBenefit(BaseModel):
1414
benefit_id: str
1515

16-
company_contribution: Optional[BenfitContribution]
16+
company_contribution: Optional[BenefitContribution]
1717

1818
description: Optional[str]
1919

20-
employee_deduction: Optional[BenfitContribution]
20+
employee_deduction: Optional[BenefitContribution]
2121

2222
frequency: Optional[BenefitFrequency]
2323

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["DirectoryListParams"]
8+
9+
10+
class DirectoryListParams(TypedDict, total=False):
11+
limit: int
12+
"""Number of employees to return (defaults to all)"""
13+
14+
offset: int
15+
"""Index to start from (defaults to 0)"""

0 commit comments

Comments
 (0)