-
Notifications
You must be signed in to change notification settings - Fork 1
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
29ac931
commit 1225aa3
Showing
19 changed files
with
219 additions
and
15 deletions.
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
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
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
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
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,5 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .types import ProcessInvoiceRequest | ||
|
||
__all__ = ["ProcessInvoiceRequest"] |
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,64 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import typing | ||
import urllib.parse | ||
from json.decoder import JSONDecodeError | ||
|
||
import httpx | ||
|
||
from ...core.api_error import ApiError | ||
from ...core.jsonable_encoder import jsonable_encoder | ||
from ...core.remove_none_from_headers import remove_none_from_headers | ||
from ...environment import MercoaEnvironment | ||
from .types.process_invoice_request import ProcessInvoiceRequest | ||
|
||
|
||
class ProcessInvoiceClient: | ||
def __init__( | ||
self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, token: typing.Optional[str] = None | ||
): | ||
self._environment = environment | ||
self._token = token | ||
|
||
def process_invoices(self, *, request: ProcessInvoiceRequest) -> None: | ||
_response = httpx.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._environment.value}/", "process-invoices"), | ||
json=jsonable_encoder(request), | ||
headers=remove_none_from_headers( | ||
{"Authorization": f"Bearer {self._token}" if self._token is not None else None} | ||
), | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
|
||
class AsyncProcessInvoiceClient: | ||
def __init__( | ||
self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, token: typing.Optional[str] = None | ||
): | ||
self._environment = environment | ||
self._token = token | ||
|
||
async def process_invoices(self, *, request: ProcessInvoiceRequest) -> None: | ||
async with httpx.AsyncClient() as _client: | ||
_response = await _client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._environment.value}/", "process-invoices"), | ||
json=jsonable_encoder(request), | ||
headers=remove_none_from_headers( | ||
{"Authorization": f"Bearer {self._token}" if self._token is not None else None} | ||
), | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) |
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,5 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .process_invoice_request import ProcessInvoiceRequest | ||
|
||
__all__ = ["ProcessInvoiceRequest"] |
Oops, something went wrong.