-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c180f02
commit edc4b54
Showing
13 changed files
with
726 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 39 | ||
configured_endpoints: 41 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-cf610d4dbb7e3d84161b5783a0861b2e551422eb5cf727dde86a839325d7ef76.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,310 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, List, cast | ||
from typing_extensions import Literal | ||
|
||
import httpx | ||
|
||
from ... import _legacy_response | ||
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven | ||
from ..._utils import ( | ||
maybe_transform, | ||
async_maybe_transform, | ||
) | ||
from ..._compat import cached_property | ||
from ..._resource import SyncAPIResource, AsyncAPIResource | ||
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper | ||
from ...types.hris import document_list_params | ||
from ..._base_client import make_request_options | ||
from ...types.hris.document_list_response import DocumentListResponse | ||
from ...types.hris.document_retreive_response import DocumentRetreiveResponse | ||
|
||
__all__ = ["Documents", "AsyncDocuments"] | ||
|
||
|
||
class Documents(SyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> DocumentsWithRawResponse: | ||
""" | ||
This property can be used as a prefix for any HTTP method call to return the | ||
the raw response object instead of the parsed content. | ||
For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers | ||
""" | ||
return DocumentsWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> DocumentsWithStreamingResponse: | ||
""" | ||
An alternative to `.with_raw_response` that doesn't eagerly read the response body. | ||
For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response | ||
""" | ||
return DocumentsWithStreamingResponse(self) | ||
|
||
def list( | ||
self, | ||
*, | ||
individual_ids: List[str] | NotGiven = NOT_GIVEN, | ||
limit: int | NotGiven = NOT_GIVEN, | ||
offset: int | NotGiven = NOT_GIVEN, | ||
types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN, | ||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | ||
# The extra values given here take precedence over values defined on the client or passed to this method. | ||
extra_headers: Headers | None = None, | ||
extra_query: Query | None = None, | ||
extra_body: Body | None = None, | ||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | ||
) -> DocumentListResponse: | ||
"""**Beta:** This endpoint is in beta and may change. | ||
Retrieve a list of company-wide documents. | ||
Args: | ||
individual_ids: Comma-delimited list of stable Finch uuids for each individual. If empty, | ||
defaults to all individuals | ||
limit: Number of documents to return (defaults to all) | ||
offset: Index to start from (defaults to 0) | ||
types: Comma-delimited list of document types to filter on. If empty, defaults to all | ||
types | ||
extra_headers: Send extra headers | ||
extra_query: Add additional query parameters to the request | ||
extra_body: Add additional JSON properties to the request | ||
timeout: Override the client-level default timeout for this request, in seconds | ||
""" | ||
return self._get( | ||
"/employer/documents", | ||
options=make_request_options( | ||
extra_headers=extra_headers, | ||
extra_query=extra_query, | ||
extra_body=extra_body, | ||
timeout=timeout, | ||
query=maybe_transform( | ||
{ | ||
"individual_ids": individual_ids, | ||
"limit": limit, | ||
"offset": offset, | ||
"types": types, | ||
}, | ||
document_list_params.DocumentListParams, | ||
), | ||
), | ||
cast_to=DocumentListResponse, | ||
) | ||
|
||
def retreive( | ||
self, | ||
document_id: str, | ||
*, | ||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | ||
# The extra values given here take precedence over values defined on the client or passed to this method. | ||
extra_headers: Headers | None = None, | ||
extra_query: Query | None = None, | ||
extra_body: Body | None = None, | ||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | ||
) -> DocumentRetreiveResponse: | ||
"""**Beta:** This endpoint is in beta and may change. | ||
Retrieve details of a specific document by its ID. | ||
Args: | ||
extra_headers: Send extra headers | ||
extra_query: Add additional query parameters to the request | ||
extra_body: Add additional JSON properties to the request | ||
timeout: Override the client-level default timeout for this request, in seconds | ||
""" | ||
if not document_id: | ||
raise ValueError(f"Expected a non-empty value for `document_id` but received {document_id!r}") | ||
return cast( | ||
DocumentRetreiveResponse, | ||
self._get( | ||
f"/employer/documents/{document_id}", | ||
options=make_request_options( | ||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout | ||
), | ||
cast_to=cast( | ||
Any, DocumentRetreiveResponse | ||
), # Union types cannot be passed in as arguments in the type system | ||
), | ||
) | ||
|
||
|
||
class AsyncDocuments(AsyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> AsyncDocumentsWithRawResponse: | ||
""" | ||
This property can be used as a prefix for any HTTP method call to return the | ||
the raw response object instead of the parsed content. | ||
For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers | ||
""" | ||
return AsyncDocumentsWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> AsyncDocumentsWithStreamingResponse: | ||
""" | ||
An alternative to `.with_raw_response` that doesn't eagerly read the response body. | ||
For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response | ||
""" | ||
return AsyncDocumentsWithStreamingResponse(self) | ||
|
||
async def list( | ||
self, | ||
*, | ||
individual_ids: List[str] | NotGiven = NOT_GIVEN, | ||
limit: int | NotGiven = NOT_GIVEN, | ||
offset: int | NotGiven = NOT_GIVEN, | ||
types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN, | ||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | ||
# The extra values given here take precedence over values defined on the client or passed to this method. | ||
extra_headers: Headers | None = None, | ||
extra_query: Query | None = None, | ||
extra_body: Body | None = None, | ||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | ||
) -> DocumentListResponse: | ||
"""**Beta:** This endpoint is in beta and may change. | ||
Retrieve a list of company-wide documents. | ||
Args: | ||
individual_ids: Comma-delimited list of stable Finch uuids for each individual. If empty, | ||
defaults to all individuals | ||
limit: Number of documents to return (defaults to all) | ||
offset: Index to start from (defaults to 0) | ||
types: Comma-delimited list of document types to filter on. If empty, defaults to all | ||
types | ||
extra_headers: Send extra headers | ||
extra_query: Add additional query parameters to the request | ||
extra_body: Add additional JSON properties to the request | ||
timeout: Override the client-level default timeout for this request, in seconds | ||
""" | ||
return await self._get( | ||
"/employer/documents", | ||
options=make_request_options( | ||
extra_headers=extra_headers, | ||
extra_query=extra_query, | ||
extra_body=extra_body, | ||
timeout=timeout, | ||
query=await async_maybe_transform( | ||
{ | ||
"individual_ids": individual_ids, | ||
"limit": limit, | ||
"offset": offset, | ||
"types": types, | ||
}, | ||
document_list_params.DocumentListParams, | ||
), | ||
), | ||
cast_to=DocumentListResponse, | ||
) | ||
|
||
async def retreive( | ||
self, | ||
document_id: str, | ||
*, | ||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | ||
# The extra values given here take precedence over values defined on the client or passed to this method. | ||
extra_headers: Headers | None = None, | ||
extra_query: Query | None = None, | ||
extra_body: Body | None = None, | ||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | ||
) -> DocumentRetreiveResponse: | ||
"""**Beta:** This endpoint is in beta and may change. | ||
Retrieve details of a specific document by its ID. | ||
Args: | ||
extra_headers: Send extra headers | ||
extra_query: Add additional query parameters to the request | ||
extra_body: Add additional JSON properties to the request | ||
timeout: Override the client-level default timeout for this request, in seconds | ||
""" | ||
if not document_id: | ||
raise ValueError(f"Expected a non-empty value for `document_id` but received {document_id!r}") | ||
return cast( | ||
DocumentRetreiveResponse, | ||
await self._get( | ||
f"/employer/documents/{document_id}", | ||
options=make_request_options( | ||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout | ||
), | ||
cast_to=cast( | ||
Any, DocumentRetreiveResponse | ||
), # Union types cannot be passed in as arguments in the type system | ||
), | ||
) | ||
|
||
|
||
class DocumentsWithRawResponse: | ||
def __init__(self, documents: Documents) -> None: | ||
self._documents = documents | ||
|
||
self.list = _legacy_response.to_raw_response_wrapper( | ||
documents.list, | ||
) | ||
self.retreive = _legacy_response.to_raw_response_wrapper( | ||
documents.retreive, | ||
) | ||
|
||
|
||
class AsyncDocumentsWithRawResponse: | ||
def __init__(self, documents: AsyncDocuments) -> None: | ||
self._documents = documents | ||
|
||
self.list = _legacy_response.async_to_raw_response_wrapper( | ||
documents.list, | ||
) | ||
self.retreive = _legacy_response.async_to_raw_response_wrapper( | ||
documents.retreive, | ||
) | ||
|
||
|
||
class DocumentsWithStreamingResponse: | ||
def __init__(self, documents: Documents) -> None: | ||
self._documents = documents | ||
|
||
self.list = to_streamed_response_wrapper( | ||
documents.list, | ||
) | ||
self.retreive = to_streamed_response_wrapper( | ||
documents.retreive, | ||
) | ||
|
||
|
||
class AsyncDocumentsWithStreamingResponse: | ||
def __init__(self, documents: AsyncDocuments) -> None: | ||
self._documents = documents | ||
|
||
self.list = async_to_streamed_response_wrapper( | ||
documents.list, | ||
) | ||
self.retreive = async_to_streamed_response_wrapper( | ||
documents.retreive, | ||
) |
Oops, something went wrong.