Skip to content

Commit

Permalink
feat(api): manual updates (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 7, 2025
1 parent c180f02 commit edc4b54
Show file tree
Hide file tree
Showing 13 changed files with 726 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
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
19 changes: 19 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ Methods:

- <code title="post /employer/pay-statement">client.hris.pay_statements.<a href="./src/finch/resources/hris/pay_statements.py">retrieve_many</a>(\*\*<a href="src/finch/types/hris/pay_statement_retrieve_many_params.py">params</a>) -> <a href="./src/finch/types/hris/pay_statement_response.py">SyncResponsesPage[PayStatementResponse]</a></code>

## Documents

Types:

```python
from finch.types.hris import (
DocumentResponse,
W42005,
W42020,
DocumentListResponse,
DocumentRetreiveResponse,
)
```

Methods:

- <code title="get /employer/documents">client.hris.documents.<a href="./src/finch/resources/hris/documents.py">list</a>(\*\*<a href="src/finch/types/hris/document_list_params.py">params</a>) -> <a href="./src/finch/types/hris/document_list_response.py">DocumentListResponse</a></code>
- <code title="get /employer/documents/{document_id}">client.hris.documents.<a href="./src/finch/resources/hris/documents.py">retreive</a>(document_id) -> <a href="./src/finch/types/hris/document_retreive_response.py">DocumentRetreiveResponse</a></code>

## Benefits

Types:
Expand Down
14 changes: 14 additions & 0 deletions src/finch/resources/hris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
DirectoryWithStreamingResponse,
AsyncDirectoryWithStreamingResponse,
)
from .documents import (
Documents,
AsyncDocuments,
DocumentsWithRawResponse,
AsyncDocumentsWithRawResponse,
DocumentsWithStreamingResponse,
AsyncDocumentsWithStreamingResponse,
)
from .employments import (
Employments,
AsyncEmployments,
Expand Down Expand Up @@ -102,6 +110,12 @@
"AsyncPayStatementsWithRawResponse",
"PayStatementsWithStreamingResponse",
"AsyncPayStatementsWithStreamingResponse",
"Documents",
"AsyncDocuments",
"DocumentsWithRawResponse",
"AsyncDocumentsWithRawResponse",
"DocumentsWithStreamingResponse",
"AsyncDocumentsWithStreamingResponse",
"Benefits",
"AsyncBenefits",
"BenefitsWithRawResponse",
Expand Down
310 changes: 310 additions & 0 deletions src/finch/resources/hris/documents.py
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,
)
Loading

0 comments on commit edc4b54

Please sign in to comment.