Skip to content

Commit

Permalink
Release 0.2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Sep 1, 2023
1 parent c8b9c76 commit 902e9cd
Show file tree
Hide file tree
Showing 150 changed files with 3,240 additions and 1,657 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: ci
on: [push]
jobs:
compile:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -13,16 +13,32 @@ jobs:
python-version: 3.7
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Compile
run: poetry run mypy .
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Test
run: poetry run pytest .

publish:
needs: [ compile ]
needs: [compile, test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -32,7 +48,7 @@ jobs:
python-version: 3.7
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Publish to pypi
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mercoa"
version = "v0.2.12"
version = "v0.2.13"
description = ""
readme = "README.md"
authors = []
Expand All @@ -10,11 +10,12 @@ packages = [

[tool.poetry.dependencies]
python = "^3.7"
httpx = "0.23.3"
httpx = ">=0.21.2"
pydantic = "^1.9.2"

[tool.poetry.dev-dependencies]
mypy = "0.971"
pytest = "^7.4.0"

[build-system]
requires = ["poetry-core"]
Expand Down
14 changes: 11 additions & 3 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from .environment import MercoaEnvironment
from .resources import (
AccountType,
Address,
Expand Down Expand Up @@ -57,6 +56,7 @@
EntityArchivePayeesRequest,
EntityForeignIdAlreadyExists,
EntityId,
EntityMetadataResponse,
EntityOnboardingLinkType,
EntityRequest,
EntityResponse,
Expand Down Expand Up @@ -92,6 +92,9 @@
InvoiceResponse,
InvoiceStatus,
Itin,
MetadataConditional,
MetadataSchema,
MetadataType,
NotificationConfigurationRequest,
NotificationConfigurationRequest_Invoice,
NotificationConfigurationResponse,
Expand Down Expand Up @@ -127,14 +130,14 @@
PaymentMethodSchemaId,
PaymentMethodSchemaRequest,
PaymentMethodSchemaResponse,
PaymentMethodsRequest,
PaymentMethodsResponse,
PaymentMethodType,
PaymentMethodUpdateRequest,
PaymentMethodUpdateRequest_BankAccount,
PaymentMethodUpdateRequest_Card,
PaymentMethodUpdateRequest_Check,
PaymentMethodUpdateRequest_Custom,
PaymentMethodsRequest,
PaymentMethodsResponse,
PaymentRailMarkup,
PaymentRailMarkupType,
PaymentRailRequest,
Expand Down Expand Up @@ -179,6 +182,7 @@
payment_method_types,
transaction,
)
from .environment import MercoaEnvironment

__all__ = [
"AccountType",
Expand Down Expand Up @@ -236,6 +240,7 @@
"EntityArchivePayeesRequest",
"EntityForeignIdAlreadyExists",
"EntityId",
"EntityMetadataResponse",
"EntityOnboardingLinkType",
"EntityRequest",
"EntityResponse",
Expand Down Expand Up @@ -272,6 +277,9 @@
"InvoiceStatus",
"Itin",
"MercoaEnvironment",
"MetadataConditional",
"MetadataSchema",
"MetadataType",
"NotificationConfigurationRequest",
"NotificationConfigurationRequest_Invoice",
"NotificationConfigurationResponse",
Expand Down
74 changes: 54 additions & 20 deletions src/mercoa/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import httpx

from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import MercoaEnvironment
from .resources.bank_lookup.client import AsyncBankLookupClient, BankLookupClient
from .resources.entity.client import AsyncEntityClient, EntityClient
Expand All @@ -11,26 +16,55 @@


class Mercoa:
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, token: str):
self._environment = environment
self._token = token
self.entity = EntityClient(environment=self._environment, token=self._token)
self.invoice = InvoiceClient(environment=self._environment, token=self._token)
self.organization = OrganizationClient(environment=self._environment, token=self._token)
self.bank_lookup = BankLookupClient(environment=self._environment, token=self._token)
self.ocr = OcrClient(environment=self._environment, token=self._token)
self.payment_method_schema = PaymentMethodSchemaClient(environment=self._environment, token=self._token)
self.transaction = TransactionClient(environment=self._environment, token=self._token)
def __init__(
self,
*,
base_url: typing.Optional[str] = None,
environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION,
token: typing.Union[str, typing.Callable[[], str]],
timeout: typing.Optional[float] = 60
):
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
httpx_client=httpx.Client(timeout=timeout),
)
self.entity = EntityClient(client_wrapper=self._client_wrapper)
self.invoice = InvoiceClient(client_wrapper=self._client_wrapper)
self.organization = OrganizationClient(client_wrapper=self._client_wrapper)
self.bank_lookup = BankLookupClient(client_wrapper=self._client_wrapper)
self.ocr = OcrClient(client_wrapper=self._client_wrapper)
self.payment_method_schema = PaymentMethodSchemaClient(client_wrapper=self._client_wrapper)
self.transaction = TransactionClient(client_wrapper=self._client_wrapper)


class AsyncMercoa:
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, token: str):
self._environment = environment
self._token = token
self.entity = AsyncEntityClient(environment=self._environment, token=self._token)
self.invoice = AsyncInvoiceClient(environment=self._environment, token=self._token)
self.organization = AsyncOrganizationClient(environment=self._environment, token=self._token)
self.bank_lookup = AsyncBankLookupClient(environment=self._environment, token=self._token)
self.ocr = AsyncOcrClient(environment=self._environment, token=self._token)
self.payment_method_schema = AsyncPaymentMethodSchemaClient(environment=self._environment, token=self._token)
self.transaction = AsyncTransactionClient(environment=self._environment, token=self._token)
def __init__(
self,
*,
base_url: typing.Optional[str] = None,
environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION,
token: typing.Union[str, typing.Callable[[], str]],
timeout: typing.Optional[float] = 60
):
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
httpx_client=httpx.AsyncClient(timeout=timeout),
)
self.entity = AsyncEntityClient(client_wrapper=self._client_wrapper)
self.invoice = AsyncInvoiceClient(client_wrapper=self._client_wrapper)
self.organization = AsyncOrganizationClient(client_wrapper=self._client_wrapper)
self.bank_lookup = AsyncBankLookupClient(client_wrapper=self._client_wrapper)
self.ocr = AsyncOcrClient(client_wrapper=self._client_wrapper)
self.payment_method_schema = AsyncPaymentMethodSchemaClient(client_wrapper=self._client_wrapper)
self.transaction = AsyncTransactionClient(client_wrapper=self._client_wrapper)


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: MercoaEnvironment) -> str:
if base_url is not None:
return base_url
elif environment is not None:
return environment.value
else:
raise Exception("Please pass in either base_url or environment to construct the client")
13 changes: 11 additions & 2 deletions src/mercoa/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# This file was auto-generated by Fern from our API Definition.

from .api_error import ApiError
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
from .datetime_utils import serialize_datetime
from .jsonable_encoder import jsonable_encoder
from .remove_none_from_headers import remove_none_from_headers
from .remove_none_from_dict import remove_none_from_dict

__all__ = ["ApiError", "jsonable_encoder", "remove_none_from_headers", "serialize_datetime"]
__all__ = [
"ApiError",
"AsyncClientWrapper",
"BaseClientWrapper",
"SyncClientWrapper",
"jsonable_encoder",
"remove_none_from_dict",
"serialize_datetime",
]
45 changes: 45 additions & 0 deletions src/mercoa/core/client_wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import httpx


class BaseClientWrapper:
def __init__(self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str):
self._token = token
self._base_url = base_url

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "mercoa",
"X-Fern-SDK-Version": "v0.2.13",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers

def _get_token(self) -> str:
if isinstance(self._token, str):
return self._token
else:
return self._token()

def get_base_url(self) -> str:
return self._base_url


class SyncClientWrapper(BaseClientWrapper):
def __init__(
self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.Client
):
super().__init__(token=token, base_url=base_url)
self.httpx_client = httpx_client


class AsyncClientWrapper(BaseClientWrapper):
def __init__(
self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.AsyncClient
):
super().__init__(token=token, base_url=base_url)
self.httpx_client = httpx_client
11 changes: 11 additions & 0 deletions src/mercoa/core/remove_none_from_dict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was auto-generated by Fern from our API Definition.

from typing import Any, Dict, Optional


def remove_none_from_dict(original: Dict[str, Optional[Any]]) -> Dict[str, Any]:
new: Dict[str, Any] = {}
for key, value in original.items():
if value is not None:
new[key] = value
return new
11 changes: 0 additions & 11 deletions src/mercoa/core/remove_none_from_headers.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
EntityArchivePayeesRequest,
EntityForeignIdAlreadyExists,
EntityId,
EntityMetadataResponse,
EntityOnboardingLinkType,
EntityRequest,
EntityResponse,
Expand Down Expand Up @@ -125,6 +126,9 @@
IndividualOnboardingOptions,
InvoiceNotificationConfigurationRequest,
InvoiceNotificationConfigurationResponse,
MetadataConditional,
MetadataSchema,
MetadataType,
NotificationConfigurationRequest,
NotificationConfigurationRequest_Invoice,
NotificationConfigurationResponse,
Expand Down Expand Up @@ -241,6 +245,7 @@
"EntityArchivePayeesRequest",
"EntityForeignIdAlreadyExists",
"EntityId",
"EntityMetadataResponse",
"EntityOnboardingLinkType",
"EntityRequest",
"EntityResponse",
Expand Down Expand Up @@ -276,6 +281,9 @@
"InvoiceResponse",
"InvoiceStatus",
"Itin",
"MetadataConditional",
"MetadataSchema",
"MetadataType",
"NotificationConfigurationRequest",
"NotificationConfigurationRequest_Invoice",
"NotificationConfigurationResponse",
Expand Down
Loading

0 comments on commit 902e9cd

Please sign in to comment.