@@ -31,7 +31,9 @@ client = Finch(
3131 access_token = " My Access Token" ,
3232)
3333
34- page = client.hris.directory.list()
34+ page = client.hris.directory.list(
35+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
36+ )
3537print (page.individuals)
3638```
3739
@@ -49,7 +51,9 @@ client = AsyncFinch(
4951
5052
5153async def main () -> None :
52- page = await client.hris.directory.list()
54+ page = await client.hris.directory.list(
55+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
56+ )
5357 print (page.individuals)
5458
5559
@@ -82,7 +86,9 @@ async def main() -> None:
8286 access_token = " My Access Token" ,
8387 http_client = DefaultAioHttpClient(),
8488 ) as client:
85- page = await client.hris.directory.list()
89+ page = await client.hris.directory.list(
90+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
91+ )
8692 print (page.individuals)
8793
8894
@@ -111,7 +117,9 @@ client = Finch()
111117
112118all_directories = []
113119# Automatically fetches more pages as needed.
114- for directory in client.hris.directory.list():
120+ for directory in client.hris.directory.list(
121+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
122+ ):
115123 # Do something with directory here
116124 all_directories.append(directory)
117125print (all_directories)
@@ -129,7 +137,9 @@ client = AsyncFinch()
129137async def main () -> None :
130138 all_directories = []
131139 # Iterate through items across all pages, issuing requests as needed.
132- async for directory in client.hris.directory.list():
140+ async for directory in client.hris.directory.list(
141+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
142+ ):
133143 all_directories.append(directory)
134144 print (all_directories)
135145
@@ -140,7 +150,9 @@ asyncio.run(main())
140150Alternatively, you can use the ` .has_next_page() ` , ` .next_page_info() ` , or ` .get_next_page() ` methods for more granular control working with pages:
141151
142152``` python
143- first_page = await client.hris.directory.list()
153+ first_page = await client.hris.directory.list(
154+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
155+ )
144156if first_page.has_next_page():
145157 print (f " will fetch next page using these details: { first_page.next_page_info()} " )
146158 next_page = await first_page.get_next_page()
@@ -152,7 +164,9 @@ if first_page.has_next_page():
152164Or just work directly with the returned data:
153165
154166``` python
155- first_page = await client.hris.directory.list()
167+ first_page = await client.hris.directory.list(
168+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
169+ )
156170
157171print (
158172 f " the current start offset for this page: { first_page.paging.offset} "
@@ -202,7 +216,9 @@ from finch import Finch
202216client = Finch()
203217
204218try :
205- client.hris.company.retrieve()
219+ client.hris.company.retrieve(
220+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
221+ )
206222except finch.APIConnectionError as e:
207223 print (" The server could not be reached" )
208224 print (e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -245,7 +261,9 @@ client = Finch(
245261)
246262
247263# Or, configure per-request:
248- client.with_options(max_retries = 5 ).hris.directory.list()
264+ client.with_options(max_retries = 5 ).hris.directory.list(
265+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
266+ )
249267```
250268
251269### Timeouts
@@ -268,7 +286,9 @@ client = Finch(
268286)
269287
270288# Override per-request:
271- client.with_options(timeout = 5.0 ).hris.directory.list()
289+ client.with_options(timeout = 5.0 ).hris.directory.list(
290+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
291+ )
272292```
273293
274294On timeout, an ` APITimeoutError ` is thrown.
@@ -325,7 +345,9 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
325345from finch import Finch
326346
327347client = Finch()
328- response = client.hris.directory.with_raw_response.list()
348+ response = client.hris.directory.with_raw_response.list(
349+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
350+ )
329351print (response.headers.get(' X-My-Header' ))
330352
331353directory = response.parse() # get the object that `hris.directory.list()` would have returned
@@ -350,7 +372,9 @@ To stream the response body, use `.with_streaming_response` instead, which requi
350372As such, ` .with_streaming_response ` methods return a different [ ` APIResponse ` ] ( https://github.com/Finch-API/finch-api-python/tree/main/src/finch/_response.py ) object, and the async client returns an [ ` AsyncAPIResponse ` ] ( https://github.com/Finch-API/finch-api-python/tree/main/src/finch/_response.py ) object.
351373
352374``` python
353- with client.hris.directory.with_streaming_response.list() as response:
375+ with client.hris.directory.with_streaming_response.list(
376+ entity_ids = [" 550e8400-e29b-41d4-a716-446655440000" ],
377+ ) as response:
354378 print (response.headers.get(" X-My-Header" ))
355379
356380 for line in response.iter_lines():
0 commit comments