@@ -27,10 +27,11 @@ client = Finch(
2727 access_token = " my access token" ,
2828)
2929
30- candidate = client.ats.candidates.retrieve (
31- " <candidate id>" ,
30+ page = client.hris.directory.list_individuals (
31+ candidate_id = " <candidate id>" ,
3232)
33- print (candidate.first_name)
33+ directory = page.individuals[0 ]
34+ print (directory.first_name)
3435```
3536
3637## Async Usage
@@ -46,10 +47,10 @@ client = AsyncFinch(
4647
4748
4849async def main ():
49- candidate = await client.ats.candidates.retrieve (
50- " <candidate id>" ,
50+ page = await client.hris.directory.list_individuals (
51+ candidate_id = " <candidate id>" ,
5152 )
52- print (candidate .first_name)
53+ print (page.individuals[ 0 ] .first_name)
5354
5455
5556asyncio.run(main())
@@ -74,12 +75,12 @@ import finch
7475
7576client = Finch()
7677
77- all_jobs = []
78+ all_directories = []
7879# Automatically fetches more pages as needed.
79- for job in client.ats.jobs.list ():
80- # Do something with job here
81- all_jobs .append(job )
82- print (all_jobs )
80+ for directory in client.hris.directory.list_individuals ():
81+ # Do something with directory here
82+ all_directories .append(directory )
83+ print (all_directories )
8384```
8485
8586Or, asynchronously:
@@ -92,11 +93,11 @@ client = AsyncFinch()
9293
9394
9495async def main () -> None :
95- all_jobs = []
96+ all_directories = []
9697 # Iterate through items across all pages, issuing requests as needed.
97- async for job in client.ats.jobs.list ():
98- all_jobs .append(job )
99- print (all_jobs )
98+ async for directory in client.hris.directory.list_individuals ():
99+ all_directories .append(directory )
100+ print (all_directories )
100101
101102
102103asyncio.run(main())
@@ -105,25 +106,25 @@ asyncio.run(main())
105106Alternatively, you can use the ` .has_next_page() ` , ` .next_page_info() ` , or ` .get_next_page() ` methods for more granular control working with pages:
106107
107108``` python
108- first_page = await client.ats.jobs.list ()
109+ first_page = await client.hris.directory.list_individuals ()
109110if first_page.has_next_page():
110111 print (f " will fetch next page using these details: { first_page.next_page_info()} " )
111112 next_page = await first_page.get_next_page()
112- print (f " number of items we just fetched: { len (next_page.jobs )} " )
113+ print (f " number of items we just fetched: { len (next_page.individuals )} " )
113114
114115# Remove `await` for non-async usage.
115116```
116117
117118Or just work directly with the returned data:
118119
119120``` python
120- first_page = await client.ats.jobs.list ()
121+ first_page = await client.hris.directory.list_individuals ()
121122
122123print (
123124 f " the current start offset for this page: { first_page.paging.offset} "
124125) # => "the current start offset for this page: 1"
125- for job in first_page.jobs :
126- print (job .id)
126+ for directory in first_page.individuals :
127+ print (directory .id)
127128
128129# Remove `await` for non-async usage.
129130```
0 commit comments