Skip to content

Commit

Permalink
chore(api): remove deprecated & unused ATS API (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and rattrayalex committed Sep 21, 2023
1 parent 66aa272 commit 0eca3cb
Show file tree
Hide file tree
Showing 29 changed files with 23 additions and 1,700 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 27
configured_endpoints: 18
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ client = Finch(
access_token="my access token",
)

candidate = client.ats.candidates.retrieve(
"<candidate id>",
page = client.hris.directory.list_individuals(
candidate_id="<candidate id>",
)
print(candidate.first_name)
directory = page.individuals[0]
print(directory.first_name)
```

## Async Usage
Expand All @@ -46,10 +47,10 @@ client = AsyncFinch(


async def main():
candidate = await client.ats.candidates.retrieve(
"<candidate id>",
page = await client.hris.directory.list_individuals(
candidate_id="<candidate id>",
)
print(candidate.first_name)
print(page.individuals[0].first_name)


asyncio.run(main())
Expand All @@ -74,12 +75,12 @@ import finch

client = Finch()

all_jobs = []
all_directories = []
# Automatically fetches more pages as needed.
for job in client.ats.jobs.list():
# Do something with job here
all_jobs.append(job)
print(all_jobs)
for directory in client.hris.directory.list_individuals():
# Do something with directory here
all_directories.append(directory)
print(all_directories)
```

Or, asynchronously:
Expand All @@ -92,11 +93,11 @@ client = AsyncFinch()


async def main() -> None:
all_jobs = []
all_directories = []
# Iterate through items across all pages, issuing requests as needed.
async for job in client.ats.jobs.list():
all_jobs.append(job)
print(all_jobs)
async for directory in client.hris.directory.list_individuals():
all_directories.append(directory)
print(all_directories)


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

```python
first_page = await client.ats.jobs.list()
first_page = await client.hris.directory.list_individuals()
if first_page.has_next_page():
print(f"will fetch next page using these details: {first_page.next_page_info()}")
next_page = await first_page.get_next_page()
print(f"number of items we just fetched: {len(next_page.jobs)}")
print(f"number of items we just fetched: {len(next_page.individuals)}")

# Remove `await` for non-async usage.
```

Or just work directly with the returned data:

```python
first_page = await client.ats.jobs.list()
first_page = await client.hris.directory.list_individuals()

print(
f"the current start offset for this page: {first_page.paging.offset}"
) # => "the current start offset for this page: 1"
for job in first_page.jobs:
print(job.id)
for directory in first_page.individuals:
print(directory.id)

# Remove `await` for non-async usage.
```
Expand Down
66 changes: 0 additions & 66 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,72 +133,6 @@ Methods:
- <code title="get /employer/benefits/{benefit_id}/individuals">client.hris.benefits.individuals.<a href="./src/finch/resources/hris/benefits/individuals.py">retrieve_many_benefits</a>(benefit_id, \*\*<a href="src/finch/types/hris/benefits/individual_retrieve_many_benefits_params.py">params</a>) -> <a href="./src/finch/types/hris/benefits/individual_benefit.py">SyncSinglePage[IndividualBenefit]</a></code>
- <code title="delete /employer/benefits/{benefit_id}/individuals">client.hris.benefits.individuals.<a href="./src/finch/resources/hris/benefits/individuals.py">unenroll_many</a>(benefit_id, \*\*<a href="src/finch/types/hris/benefits/individual_unenroll_many_params.py">params</a>) -> <a href="./src/finch/types/hris/benefits/unenrolled_individual.py">SyncSinglePage[UnenrolledIndividual]</a></code>

# ATS

## Candidates

Types:

```python
from finch.types.ats import Candidate
```

Methods:

- <code title="get /ats/candidates/{candidate_id}">client.ats.candidates.<a href="./src/finch/resources/ats/candidates.py">retrieve</a>(candidate_id) -> <a href="./src/finch/types/ats/candidate.py">Candidate</a></code>
- <code title="get /ats/candidates">client.ats.candidates.<a href="./src/finch/resources/ats/candidates.py">list</a>(\*\*<a href="src/finch/types/ats/candidate_list_params.py">params</a>) -> <a href="./src/finch/types/ats/candidate.py">SyncCandidatesPage[Candidate]</a></code>

## Applications

Types:

```python
from finch.types.ats import Application
```

Methods:

- <code title="get /ats/applications/{application_id}">client.ats.applications.<a href="./src/finch/resources/ats/applications.py">retrieve</a>(application_id) -> <a href="./src/finch/types/ats/application.py">Application</a></code>
- <code title="get /ats/applications">client.ats.applications.<a href="./src/finch/resources/ats/applications.py">list</a>(\*\*<a href="src/finch/types/ats/application_list_params.py">params</a>) -> <a href="./src/finch/types/ats/application.py">SyncApplicationsPage[Application]</a></code>

## Stages

Types:

```python
from finch.types.ats import Stage
```

Methods:

- <code title="get /ats/stages">client.ats.stages.<a href="./src/finch/resources/ats/stages.py">list</a>() -> <a href="./src/finch/types/ats/stage.py">SyncSinglePage[Stage]</a></code>

## Jobs

Types:

```python
from finch.types.ats import Job
```

Methods:

- <code title="get /ats/jobs/{job_id}">client.ats.jobs.<a href="./src/finch/resources/ats/jobs.py">retrieve</a>(job_id) -> <a href="./src/finch/types/ats/job.py">Job</a></code>
- <code title="get /ats/jobs">client.ats.jobs.<a href="./src/finch/resources/ats/jobs.py">list</a>(\*\*<a href="src/finch/types/ats/job_list_params.py">params</a>) -> <a href="./src/finch/types/ats/job.py">SyncJobsPage[Job]</a></code>

## Offers

Types:

```python
from finch.types.ats import Offer
```

Methods:

- <code title="get /ats/offers/{offer_id}">client.ats.offers.<a href="./src/finch/resources/ats/offers.py">retrieve</a>(offer_id) -> <a href="./src/finch/types/ats/offer.py">Offer</a></code>
- <code title="get /ats/offers">client.ats.offers.<a href="./src/finch/resources/ats/offers.py">list</a>(\*\*<a href="src/finch/types/ats/offer_list_params.py">params</a>) -> <a href="./src/finch/types/ats/offer.py">SyncOffersPage[Offer]</a></code>

# Providers

Types:
Expand Down
4 changes: 0 additions & 4 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

class Finch(SyncAPIClient):
hris: resources.HRIS
ats: resources.ATS
providers: resources.Providers
account: resources.Account
webhooks: resources.Webhooks
Expand Down Expand Up @@ -120,7 +119,6 @@ def __init__(
)

self.hris = resources.HRIS(self)
self.ats = resources.ATS(self)
self.providers = resources.Providers(self)
self.account = resources.Account(self)
self.webhooks = resources.Webhooks(self)
Expand Down Expand Up @@ -279,7 +277,6 @@ def get_auth_url(

class AsyncFinch(AsyncAPIClient):
hris: resources.AsyncHRIS
ats: resources.AsyncATS
providers: resources.AsyncProviders
account: resources.AsyncAccount
webhooks: resources.AsyncWebhooks
Expand Down Expand Up @@ -353,7 +350,6 @@ def __init__(
)

self.hris = resources.AsyncHRIS(self)
self.ats = resources.AsyncATS(self)
self.providers = resources.AsyncProviders(self)
self.account = resources.AsyncAccount(self)
self.webhooks = resources.AsyncWebhooks(self)
Expand Down
Loading

0 comments on commit 0eca3cb

Please sign in to comment.