@@ -27,30 +27,26 @@ client = Finch(
2727 access_token = " My Access Token" ,
2828)
2929
30- page = client.hris.directory.list(
31- candidate_id = " <candidate id>" ,
32- )
33- directory = page.individuals[0 ]
34- print (directory.first_name)
30+ page = client.hris.directory.list()
31+ print (page.page)
3532```
3633
3734## Async usage
3835
3936Simply import ` AsyncFinch ` instead of ` Finch ` and use ` await ` with each API call:
4037
4138``` python
39+ import asyncio
4240from finch import AsyncFinch
4341
4442client = AsyncFinch(
4543 access_token = " My Access Token" ,
4644)
4745
4846
49- async def main ():
50- page = await client.hris.directory.list(
51- candidate_id = " <candidate id>" ,
52- )
53- print (page.individuals[0 ].first_name)
47+ async def main () -> None :
48+ page = await client.hris.directory.list()
49+ print (page.page)
5450
5551
5652asyncio.run(main())
@@ -138,10 +134,8 @@ from finch import Finch
138134
139135client = Finch()
140136
141- client.hris.directory.list(
142- path_params = [],
143- params = {},
144- )
137+ page = client.hris.directory.list()
138+ print (page.page)
145139```
146140
147141## Webhook Verification
@@ -183,7 +177,7 @@ from finch import Finch
183177client = Finch()
184178
185179try :
186- client.hris.directory.list ()
180+ client.hris.company.retrieve ()
187181except finch.APIConnectionError as e:
188182 print (" The server could not be reached" )
189183 print (e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -304,13 +298,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
304298from finch import Finch
305299
306300client = Finch()
307- page = client.hris.directory.with_raw_response.list()
308- response = page.individuals[0 ]
309-
301+ response = client.hris.directory.with_raw_response.list()
310302print (response.headers.get(' X-My-Header' ))
311303
312304directory = response.parse() # get the object that `hris.directory.list()` would have returned
313- print (directory.first_name )
305+ print (directory.id )
314306```
315307
316308These methods return an [ ` APIResponse ` ] ( https://github.com/Finch-API/finch-api-python/src/finch/_response.py ) object.
0 commit comments