diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5ed336e..df11df7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,9 +18,25 @@ jobs:
run: poetry install
- name: Compile
run: poetry run mypy .
+ test:
+ runs-on: ubuntu-latest
+ 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
+ - 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
steps:
diff --git a/pyproject.toml b/pyproject.toml
index 07d79c9..3e7ae7c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flagright"
-version = "0.0.4"
+version = "0.1.1"
description = ""
readme = "README.md"
authors = []
@@ -10,11 +10,12 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
-httpx = "0.23.3"
pydantic = "^1.9.2"
+httpx = "0.23.3"
[tool.poetry.dev-dependencies]
mypy = "0.971"
+pytest = "^7.4.0"
[build-system]
requires = ["poetry-core"]
diff --git a/src/flagright/__init__.py b/src/flagright/__init__.py
index 1fa599b..62c3b0a 100644
--- a/src/flagright/__init__.py
+++ b/src/flagright/__init__.py
@@ -1,7 +1,5 @@
# This file was auto-generated by Fern from our API Definition.
-from .environment import FlagrightEnvironment
-from .errors import BadRequestError, TooManyRequestsError, UnauthorizedError
from .types import (
AchDetails,
AchPaymentMethod,
@@ -9,11 +7,14 @@
Address,
AlertClosedDetails,
Amount,
+ BooleanString,
Business,
BusinessBase,
BusinessEntityLink,
BusinessOptional,
BusinessOptionalSavedPaymentDetailsItem,
+ BusinessResponse,
+ BusinessUsersCreateResponse,
BusinessUsersResponse,
BusinessWithRulesResult,
CardDetails,
@@ -35,6 +36,8 @@
CompanyGeneralDetailsUserSegment,
CompanyRegistrationDetails,
ConsumerName,
+ ConsumerUserSegment,
+ ConsumerUsersCreateResponse,
ConsumerUsersResponse,
ContactDetails,
CountryCode,
@@ -68,11 +71,8 @@
PaymentMethod,
PepStatus,
Person,
- PostBusinessUserResponse,
- PostConsumerTransactionResponse,
- PostConsumerUserResponse,
RiskLevel,
- RiskScoringResult,
+ RiskScoreDetails,
RuleAction,
RuleFailureException,
RuleHitDirection,
@@ -90,17 +90,20 @@
TransactionAmountLimit,
TransactionBase,
TransactionCountLimit,
+ TransactionEvent,
TransactionEventMonitoringResult,
TransactionLimit,
TransactionLimits,
TransactionLimitsPaymentMethodLimits,
TransactionMonitoringResult,
TransactionState,
+ TransactionStatusDetails,
TransactionType,
TransactionUpdatable,
TransactionUpdatableDestinationPaymentDetails,
TransactionUpdatableOriginPaymentDetails,
TransactionWithRulesResult,
+ TransactionsVerifyResponse,
UpiDetails,
UpiPaymentMethod,
User,
@@ -109,16 +112,27 @@
UserDetailsGender,
UserMonitoringResult,
UserOptional,
- UserOptionalUserSegment,
UserRegistrationStatus,
+ UserResponse,
UserState,
UserStateDetails,
UserWithRulesResult,
WalletDetails,
WalletPaymentMethod,
WebhookEvent,
+ WebhookEventData,
WebhookEventType,
)
+from .errors import BadRequestError, TooManyRequestsError, UnauthorizedError
+from .resources import (
+ business_user_events,
+ business_users,
+ consumer_user_events,
+ consumer_users,
+ transaction_events,
+ transactions,
+)
+from .environment import FlagrightEnvironment
__all__ = [
"AchDetails",
@@ -128,11 +142,14 @@
"AlertClosedDetails",
"Amount",
"BadRequestError",
+ "BooleanString",
"Business",
"BusinessBase",
"BusinessEntityLink",
"BusinessOptional",
"BusinessOptionalSavedPaymentDetailsItem",
+ "BusinessResponse",
+ "BusinessUsersCreateResponse",
"BusinessUsersResponse",
"BusinessWithRulesResult",
"CardDetails",
@@ -154,6 +171,8 @@
"CompanyGeneralDetailsUserSegment",
"CompanyRegistrationDetails",
"ConsumerName",
+ "ConsumerUserSegment",
+ "ConsumerUsersCreateResponse",
"ConsumerUsersResponse",
"ContactDetails",
"CountryCode",
@@ -188,11 +207,8 @@
"PaymentMethod",
"PepStatus",
"Person",
- "PostBusinessUserResponse",
- "PostConsumerTransactionResponse",
- "PostConsumerUserResponse",
"RiskLevel",
- "RiskScoringResult",
+ "RiskScoreDetails",
"RuleAction",
"RuleFailureException",
"RuleHitDirection",
@@ -211,17 +227,20 @@
"TransactionAmountLimit",
"TransactionBase",
"TransactionCountLimit",
+ "TransactionEvent",
"TransactionEventMonitoringResult",
"TransactionLimit",
"TransactionLimits",
"TransactionLimitsPaymentMethodLimits",
"TransactionMonitoringResult",
"TransactionState",
+ "TransactionStatusDetails",
"TransactionType",
"TransactionUpdatable",
"TransactionUpdatableDestinationPaymentDetails",
"TransactionUpdatableOriginPaymentDetails",
"TransactionWithRulesResult",
+ "TransactionsVerifyResponse",
"UnauthorizedError",
"UpiDetails",
"UpiPaymentMethod",
@@ -231,13 +250,20 @@
"UserDetailsGender",
"UserMonitoringResult",
"UserOptional",
- "UserOptionalUserSegment",
"UserRegistrationStatus",
+ "UserResponse",
"UserState",
"UserStateDetails",
"UserWithRulesResult",
"WalletDetails",
"WalletPaymentMethod",
"WebhookEvent",
+ "WebhookEventData",
"WebhookEventType",
+ "business_user_events",
+ "business_users",
+ "consumer_user_events",
+ "consumer_users",
+ "transaction_events",
+ "transactions",
]
diff --git a/src/flagright/client.py b/src/flagright/client.py
index d189cf7..d3cdb5f 100644
--- a/src/flagright/client.py
+++ b/src/flagright/client.py
@@ -1,577 +1,60 @@
# This file was auto-generated by Fern from our API Definition.
import typing
-import urllib.parse
-from json.decoder import JSONDecodeError
import httpx
-import pydantic
-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 .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import FlagrightEnvironment
-from .errors.bad_request_error import BadRequestError
-from .errors.too_many_requests_error import TooManyRequestsError
-from .errors.unauthorized_error import UnauthorizedError
-from .types.business import Business
-from .types.business_optional import BusinessOptional
-from .types.business_with_rules_result import BusinessWithRulesResult
-from .types.device_data import DeviceData
-from .types.post_business_user_response import PostBusinessUserResponse
-from .types.post_consumer_transaction_response import PostConsumerTransactionResponse
-from .types.post_consumer_user_response import PostConsumerUserResponse
-from .types.transaction import Transaction
-from .types.transaction_event_monitoring_result import TransactionEventMonitoringResult
-from .types.transaction_state import TransactionState
-from .types.transaction_updatable import TransactionUpdatable
-from .types.transaction_with_rules_result import TransactionWithRulesResult
-from .types.user import User
-from .types.user_optional import UserOptional
-from .types.user_with_rules_result import UserWithRulesResult
-
-# this is used as the default value for optional parameters
-OMIT = typing.cast(typing.Any, ...)
+from .resources.business_user_events.client import AsyncBusinessUserEventsClient, BusinessUserEventsClient
+from .resources.business_users.client import AsyncBusinessUsersClient, BusinessUsersClient
+from .resources.consumer_user_events.client import AsyncConsumerUserEventsClient, ConsumerUserEventsClient
+from .resources.consumer_users.client import AsyncConsumerUsersClient, ConsumerUsersClient
+from .resources.transaction_events.client import AsyncTransactionEventsClient, TransactionEventsClient
+from .resources.transactions.client import AsyncTransactionsClient, TransactionsClient
class Flagright:
- def __init__(self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, api_key: str):
- self._environment = environment
- self.api_key = api_key
-
- def post_consumer_transaction(
+ def __init__(
self,
*,
- validate_origin_user_id: typing.Optional[str] = None,
- validate_destination_user_id: typing.Optional[str] = None,
- request: Transaction,
- ) -> PostConsumerTransactionResponse:
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "transactions"),
- params={
- "validateOriginUserId": validate_origin_user_id,
- "validateDestinationUserId": validate_destination_user_id,
- },
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostConsumerTransactionResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def get_consumer_transaction(self, transaction_id: str) -> TransactionWithRulesResult:
- _response = httpx.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"transactions/{transaction_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(TransactionWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def post_transaction_event(
- self,
- *,
- transaction_state: TransactionState,
- timestamp: float,
- transaction_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_transaction_attributes: typing.Optional[TransactionUpdatable] = OMIT,
- meta_data: typing.Optional[DeviceData] = OMIT,
- ) -> TransactionEventMonitoringResult:
- _request: typing.Dict[str, typing.Any] = {
- "transactionState": transaction_state,
- "timestamp": timestamp,
- "transactionId": transaction_id,
- }
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_transaction_attributes is not OMIT:
- _request["updatedTransactionAttributes"] = updated_transaction_attributes
- if meta_data is not OMIT:
- _request["metaData"] = meta_data
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/transaction"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(TransactionEventMonitoringResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def post_consumer_user(self, *, request: User) -> PostConsumerUserResponse:
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "consumer/users"),
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostConsumerUserResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def get_consumer_user(self, user_id: str) -> User:
- _response = httpx.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"consumer/users/{user_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
+ environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT,
+ api_key: str,
+ timeout: typing.Optional[float] = 60
+ ):
+ self._environment = environment
+ self._client_wrapper = SyncClientWrapper(api_key=api_key, httpx_client=httpx.Client(timeout=timeout))
+ self.transactions = TransactionsClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.transaction_events = TransactionEventsClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.consumer_users = ConsumerUsersClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.business_users = BusinessUsersClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.consumer_user_events = ConsumerUserEventsClient(
+ environment=environment, client_wrapper=self._client_wrapper
)
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(User, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def post_business_user(self, *, request: Business) -> PostBusinessUserResponse:
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "business/users"),
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
+ self.business_user_events = BusinessUserEventsClient(
+ environment=environment, client_wrapper=self._client_wrapper
)
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostBusinessUserResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
- def get_business_user_user_id(self, user_id: str) -> Business:
- _response = httpx.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"business/users/{user_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(Business, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
- def post_user_event(
+class AsyncFlagright:
+ def __init__(
self,
*,
- timestamp: float,
- user_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_consumer_user_attributes: typing.Optional[UserOptional] = OMIT,
- ) -> UserWithRulesResult:
- _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_consumer_user_attributes is not OMIT:
- _request["updatedConsumerUserAttributes"] = updated_consumer_user_attributes
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/consumer/user"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
+ environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT,
+ api_key: str,
+ timeout: typing.Optional[float] = 60
+ ):
+ self._environment = environment
+ self._client_wrapper = AsyncClientWrapper(api_key=api_key, httpx_client=httpx.AsyncClient(timeout=timeout))
+ self.transactions = AsyncTransactionsClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.transaction_events = AsyncTransactionEventsClient(
+ environment=environment, client_wrapper=self._client_wrapper
)
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(UserWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- def post_business_user_event(
- self,
- *,
- timestamp: float,
- user_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_business_user_attributes: typing.Optional[BusinessOptional] = OMIT,
- ) -> BusinessWithRulesResult:
- _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_business_user_attributes is not OMIT:
- _request["updatedBusinessUserAttributes"] = updated_business_user_attributes
- _response = httpx.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/business/user"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
+ self.consumer_users = AsyncConsumerUsersClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.business_users = AsyncBusinessUsersClient(environment=environment, client_wrapper=self._client_wrapper)
+ self.consumer_user_events = AsyncConsumerUserEventsClient(
+ environment=environment, client_wrapper=self._client_wrapper
+ )
+ self.business_user_events = AsyncBusinessUserEventsClient(
+ environment=environment, client_wrapper=self._client_wrapper
)
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(BusinessWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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 AsyncFlagright:
- def __init__(self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, api_key: str):
- self._environment = environment
- self.api_key = api_key
-
- async def post_consumer_transaction(
- self,
- *,
- validate_origin_user_id: typing.Optional[str] = None,
- validate_destination_user_id: typing.Optional[str] = None,
- request: Transaction,
- ) -> PostConsumerTransactionResponse:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "transactions"),
- params={
- "validateOriginUserId": validate_origin_user_id,
- "validateDestinationUserId": validate_destination_user_id,
- },
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostConsumerTransactionResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def get_consumer_transaction(self, transaction_id: str) -> TransactionWithRulesResult:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"transactions/{transaction_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(TransactionWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def post_transaction_event(
- self,
- *,
- transaction_state: TransactionState,
- timestamp: float,
- transaction_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_transaction_attributes: typing.Optional[TransactionUpdatable] = OMIT,
- meta_data: typing.Optional[DeviceData] = OMIT,
- ) -> TransactionEventMonitoringResult:
- _request: typing.Dict[str, typing.Any] = {
- "transactionState": transaction_state,
- "timestamp": timestamp,
- "transactionId": transaction_id,
- }
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_transaction_attributes is not OMIT:
- _request["updatedTransactionAttributes"] = updated_transaction_attributes
- if meta_data is not OMIT:
- _request["metaData"] = meta_data
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/transaction"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(TransactionEventMonitoringResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def post_consumer_user(self, *, request: User) -> PostConsumerUserResponse:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "consumer/users"),
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostConsumerUserResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def get_consumer_user(self, user_id: str) -> User:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"consumer/users/{user_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(User, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def post_business_user(self, *, request: Business) -> PostBusinessUserResponse:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "business/users"),
- json=jsonable_encoder(request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(PostBusinessUserResponse, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def get_business_user_user_id(self, user_id: str) -> Business:
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "GET",
- urllib.parse.urljoin(f"{self._environment.value}/", f"business/users/{user_id}"),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(Business, _response.json()) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def post_user_event(
- self,
- *,
- timestamp: float,
- user_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_consumer_user_attributes: typing.Optional[UserOptional] = OMIT,
- ) -> UserWithRulesResult:
- _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_consumer_user_attributes is not OMIT:
- _request["updatedConsumerUserAttributes"] = updated_consumer_user_attributes
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/consumer/user"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(UserWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
-
- async def post_business_user_event(
- self,
- *,
- timestamp: float,
- user_id: str,
- event_id: typing.Optional[str] = OMIT,
- reason: typing.Optional[str] = OMIT,
- event_description: typing.Optional[str] = OMIT,
- updated_business_user_attributes: typing.Optional[BusinessOptional] = OMIT,
- ) -> BusinessWithRulesResult:
- _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
- if event_id is not OMIT:
- _request["eventId"] = event_id
- if reason is not OMIT:
- _request["reason"] = reason
- if event_description is not OMIT:
- _request["eventDescription"] = event_description
- if updated_business_user_attributes is not OMIT:
- _request["updatedBusinessUserAttributes"] = updated_business_user_attributes
- async with httpx.AsyncClient() as _client:
- _response = await _client.request(
- "POST",
- urllib.parse.urljoin(f"{self._environment.value}/", "events/business/user"),
- json=jsonable_encoder(_request),
- headers=remove_none_from_headers({"x-api-key": self.api_key}),
- timeout=60,
- )
- if 200 <= _response.status_code < 300:
- return pydantic.parse_obj_as(BusinessWithRulesResult, _response.json()) # type: ignore
- if _response.status_code == 400:
- raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 401:
- raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- if _response.status_code == 429:
- raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
- 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)
diff --git a/src/flagright/core/__init__.py b/src/flagright/core/__init__.py
index b213a1a..2414955 100644
--- a/src/flagright/core/__init__.py
+++ b/src/flagright/core/__init__.py
@@ -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",
+]
diff --git a/src/flagright/core/client_wrapper.py b/src/flagright/core/client_wrapper.py
new file mode 100644
index 0000000..16e1dac
--- /dev/null
+++ b/src/flagright/core/client_wrapper.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import httpx
+
+
+class BaseClientWrapper:
+ def __init__(self, *, api_key: str):
+ self.api_key = api_key
+
+ def get_headers(self) -> typing.Dict[str, str]:
+ headers: typing.Dict[str, str] = {
+ "X-Fern-Language": "Python",
+ "X-Fern-SDK-Name": "flagright",
+ "X-Fern-SDK-Version": "0.1.1",
+ }
+ headers["x-api-key"] = self.api_key
+ return headers
+
+
+class SyncClientWrapper(BaseClientWrapper):
+ def __init__(self, *, api_key: str, httpx_client: httpx.Client):
+ super().__init__(api_key=api_key)
+ self.httpx_client = httpx_client
+
+
+class AsyncClientWrapper(BaseClientWrapper):
+ def __init__(self, *, api_key: str, httpx_client: httpx.AsyncClient):
+ super().__init__(api_key=api_key)
+ self.httpx_client = httpx_client
diff --git a/src/flagright/core/remove_none_from_dict.py b/src/flagright/core/remove_none_from_dict.py
new file mode 100644
index 0000000..2da30f7
--- /dev/null
+++ b/src/flagright/core/remove_none_from_dict.py
@@ -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
diff --git a/src/flagright/core/remove_none_from_headers.py b/src/flagright/core/remove_none_from_headers.py
deleted file mode 100644
index 21a44ca..0000000
--- a/src/flagright/core/remove_none_from_headers.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-from typing import Dict, Optional
-
-
-def remove_none_from_headers(headers: Dict[str, Optional[str]]) -> Dict[str, str]:
- new_headers: Dict[str, str] = {}
- for header_key, header_value in headers.items():
- if header_value is not None:
- new_headers[header_key] = header_value
- return new_headers
diff --git a/src/flagright/resources/__init__.py b/src/flagright/resources/__init__.py
new file mode 100644
index 0000000..f5f0e2b
--- /dev/null
+++ b/src/flagright/resources/__init__.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from . import (
+ business_user_events,
+ business_users,
+ consumer_user_events,
+ consumer_users,
+ transaction_events,
+ transactions,
+)
+
+__all__ = [
+ "business_user_events",
+ "business_users",
+ "consumer_user_events",
+ "consumer_users",
+ "transaction_events",
+ "transactions",
+]
diff --git a/src/flagright/resources/business_user_events/__init__.py b/src/flagright/resources/business_user_events/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/business_user_events/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/business_user_events/client.py b/src/flagright/resources/business_user_events/client.py
new file mode 100644
index 0000000..a049afd
--- /dev/null
+++ b/src/flagright/resources/business_user_events/client.py
@@ -0,0 +1,194 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.remove_none_from_dict import remove_none_from_dict
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.boolean_string import BooleanString
+from ...types.business_optional import BusinessOptional
+from ...types.business_with_rules_result import BusinessWithRulesResult
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class BusinessUserEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ allow_user_type_conversion: typing.Optional[BooleanString] = None,
+ timestamp: float,
+ user_id: str,
+ event_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ event_description: typing.Optional[str] = OMIT,
+ updated_business_user_attributes: typing.Optional[BusinessOptional] = OMIT,
+ ) -> BusinessWithRulesResult:
+ """
+ ## POST Business User Events
+
+ `/events/business/user` endpoint allows you to operate on the Business User Events entity.
+
+ User events are created after the initial `POST /business/users` call (which creates a user) and are used to:
+
+ * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
+ * Update the user details, using the `updatedBusinessUserAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use user events.
+
+ ### Payload
+
+ Each user event needs three mandatory fields:
+
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `userId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - allow_user_type_conversion: typing.Optional[BooleanString]. Boolean string whether Flagright should allow a Business user event to be applied to a Consumer user with the same user ID. This will converts a Consumer user to a Business user.
+
+ - timestamp: float. Timestamp of the event
+
+ - user_id: str. Transaction ID the event pertains to `non-empty`
+
+ - event_id: typing.Optional[str]. Unique event ID
+
+ - reason: typing.Optional[str]. Reason for the event or a state change
+
+ - event_description: typing.Optional[str]. Event description
+
+ - updated_business_user_attributes: typing.Optional[BusinessOptional].
+ """
+ _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
+ if event_id is not OMIT:
+ _request["eventId"] = event_id
+ if reason is not OMIT:
+ _request["reason"] = reason
+ if event_description is not OMIT:
+ _request["eventDescription"] = event_description
+ if updated_business_user_attributes is not OMIT:
+ _request["updatedBusinessUserAttributes"] = updated_business_user_attributes
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/business/user"),
+ params=remove_none_from_dict({"allowUserTypeConversion": allow_user_type_conversion}),
+ json=jsonable_encoder(_request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncBusinessUserEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ allow_user_type_conversion: typing.Optional[BooleanString] = None,
+ timestamp: float,
+ user_id: str,
+ event_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ event_description: typing.Optional[str] = OMIT,
+ updated_business_user_attributes: typing.Optional[BusinessOptional] = OMIT,
+ ) -> BusinessWithRulesResult:
+ """
+ ## POST Business User Events
+
+ `/events/business/user` endpoint allows you to operate on the Business User Events entity.
+
+ User events are created after the initial `POST /business/users` call (which creates a user) and are used to:
+
+ * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
+ * Update the user details, using the `updatedBusinessUserAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use user events.
+
+ ### Payload
+
+ Each user event needs three mandatory fields:
+
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `userId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - allow_user_type_conversion: typing.Optional[BooleanString]. Boolean string whether Flagright should allow a Business user event to be applied to a Consumer user with the same user ID. This will converts a Consumer user to a Business user.
+
+ - timestamp: float. Timestamp of the event
+
+ - user_id: str. Transaction ID the event pertains to `non-empty`
+
+ - event_id: typing.Optional[str]. Unique event ID
+
+ - reason: typing.Optional[str]. Reason for the event or a state change
+
+ - event_description: typing.Optional[str]. Event description
+
+ - updated_business_user_attributes: typing.Optional[BusinessOptional].
+ """
+ _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
+ if event_id is not OMIT:
+ _request["eventId"] = event_id
+ if reason is not OMIT:
+ _request["reason"] = reason
+ if event_description is not OMIT:
+ _request["eventDescription"] = event_description
+ if updated_business_user_attributes is not OMIT:
+ _request["updatedBusinessUserAttributes"] = updated_business_user_attributes
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/business/user"),
+ params=remove_none_from_dict({"allowUserTypeConversion": allow_user_type_conversion}),
+ json=jsonable_encoder(_request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/resources/business_users/__init__.py b/src/flagright/resources/business_users/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/business_users/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/business_users/client.py b/src/flagright/resources/business_users/client.py
new file mode 100644
index 0000000..0b5bb54
--- /dev/null
+++ b/src/flagright/resources/business_users/client.py
@@ -0,0 +1,177 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.business import Business
+from ...types.business_response import BusinessResponse
+from ...types.business_users_create_response import BusinessUsersCreateResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class BusinessUsersClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def create(self, *, request: Business) -> BusinessUsersCreateResponse:
+ """
+ ## POST Business User
+
+ `/business/user` endpoint allows you to operate on the [Business user entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user)
+
+ In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+ ### Payload
+
+
+ Each consumer Business entity needs three mandatory fields:
+
+ * `userId` - Unique identifier for the user
+ * `legalEntity` - Details of the business legal entity (CompanyGeneralDetails, FinancialDetails etc) - only `legalName`in `CompanyGeneralDetails` is mandatory
+ * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
+
+ Parameters:
+ - request: Business.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "business/users"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessUsersCreateResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ def get(self, user_id: str) -> BusinessResponse:
+ """
+ ### GET Business User
+
+ `/business/user` endpoint allows you to operate on the [Business User entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user).
+
+ Calling `GET /business/user/{userId}` will return the entire User payload and rule execution results for the User with the corresponding `userId`
+
+ Parameters:
+ - user_id: str.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"business/users/{user_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessResponse, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncBusinessUsersClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def create(self, *, request: Business) -> BusinessUsersCreateResponse:
+ """
+ ## POST Business User
+
+ `/business/user` endpoint allows you to operate on the [Business user entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user)
+
+ In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+ ### Payload
+
+
+ Each consumer Business entity needs three mandatory fields:
+
+ * `userId` - Unique identifier for the user
+ * `legalEntity` - Details of the business legal entity (CompanyGeneralDetails, FinancialDetails etc) - only `legalName`in `CompanyGeneralDetails` is mandatory
+ * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
+
+ Parameters:
+ - request: Business.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "business/users"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessUsersCreateResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ async def get(self, user_id: str) -> BusinessResponse:
+ """
+ ### GET Business User
+
+ `/business/user` endpoint allows you to operate on the [Business User entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user).
+
+ Calling `GET /business/user/{userId}` will return the entire User payload and rule execution results for the User with the corresponding `userId`
+
+ Parameters:
+ - user_id: str.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"business/users/{user_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(BusinessResponse, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/resources/consumer_user_events/__init__.py b/src/flagright/resources/consumer_user_events/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/consumer_user_events/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/consumer_user_events/client.py b/src/flagright/resources/consumer_user_events/client.py
new file mode 100644
index 0000000..acfa724
--- /dev/null
+++ b/src/flagright/resources/consumer_user_events/client.py
@@ -0,0 +1,194 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.remove_none_from_dict import remove_none_from_dict
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.boolean_string import BooleanString
+from ...types.user_optional import UserOptional
+from ...types.user_with_rules_result import UserWithRulesResult
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ConsumerUserEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ allow_user_type_conversion: typing.Optional[BooleanString] = None,
+ timestamp: float,
+ user_id: str,
+ event_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ event_description: typing.Optional[str] = OMIT,
+ updated_consumer_user_attributes: typing.Optional[UserOptional] = OMIT,
+ ) -> UserWithRulesResult:
+ """
+ ## POST Consumer User Events
+
+ `/events/consumer/user` endpoint allows you to operate on the Consumer User Events entity.
+
+ User events are created after the initial `POST /consumer/users` call (which creates a user) and are used to:
+
+ * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
+ * Update the user details, using the `updatedConsumerUserAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use user events.
+
+ ### Payload
+
+ Each user event needs three mandatory fields:
+
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `userId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - allow_user_type_conversion: typing.Optional[BooleanString]. Boolean string whether Flagright should allow a Consumer user event to be applied to a Business user with the same user ID. This will converts a Business user to a Consumer user.
+
+ - timestamp: float. Timestamp of the event
+
+ - user_id: str. Transaction ID the event pertains to `non-empty`
+
+ - event_id: typing.Optional[str]. Unique event ID
+
+ - reason: typing.Optional[str]. Reason for the event or a state change
+
+ - event_description: typing.Optional[str]. Event description
+
+ - updated_consumer_user_attributes: typing.Optional[UserOptional].
+ """
+ _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
+ if event_id is not OMIT:
+ _request["eventId"] = event_id
+ if reason is not OMIT:
+ _request["reason"] = reason
+ if event_description is not OMIT:
+ _request["eventDescription"] = event_description
+ if updated_consumer_user_attributes is not OMIT:
+ _request["updatedConsumerUserAttributes"] = updated_consumer_user_attributes
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/consumer/user"),
+ params=remove_none_from_dict({"allowUserTypeConversion": allow_user_type_conversion}),
+ json=jsonable_encoder(_request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(UserWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncConsumerUserEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ allow_user_type_conversion: typing.Optional[BooleanString] = None,
+ timestamp: float,
+ user_id: str,
+ event_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ event_description: typing.Optional[str] = OMIT,
+ updated_consumer_user_attributes: typing.Optional[UserOptional] = OMIT,
+ ) -> UserWithRulesResult:
+ """
+ ## POST Consumer User Events
+
+ `/events/consumer/user` endpoint allows you to operate on the Consumer User Events entity.
+
+ User events are created after the initial `POST /consumer/users` call (which creates a user) and are used to:
+
+ * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
+ * Update the user details, using the `updatedConsumerUserAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use user events.
+
+ ### Payload
+
+ Each user event needs three mandatory fields:
+
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `userId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - allow_user_type_conversion: typing.Optional[BooleanString]. Boolean string whether Flagright should allow a Consumer user event to be applied to a Business user with the same user ID. This will converts a Business user to a Consumer user.
+
+ - timestamp: float. Timestamp of the event
+
+ - user_id: str. Transaction ID the event pertains to `non-empty`
+
+ - event_id: typing.Optional[str]. Unique event ID
+
+ - reason: typing.Optional[str]. Reason for the event or a state change
+
+ - event_description: typing.Optional[str]. Event description
+
+ - updated_consumer_user_attributes: typing.Optional[UserOptional].
+ """
+ _request: typing.Dict[str, typing.Any] = {"timestamp": timestamp, "userId": user_id}
+ if event_id is not OMIT:
+ _request["eventId"] = event_id
+ if reason is not OMIT:
+ _request["reason"] = reason
+ if event_description is not OMIT:
+ _request["eventDescription"] = event_description
+ if updated_consumer_user_attributes is not OMIT:
+ _request["updatedConsumerUserAttributes"] = updated_consumer_user_attributes
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/consumer/user"),
+ params=remove_none_from_dict({"allowUserTypeConversion": allow_user_type_conversion}),
+ json=jsonable_encoder(_request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(UserWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/resources/consumer_users/__init__.py b/src/flagright/resources/consumer_users/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/consumer_users/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/consumer_users/client.py b/src/flagright/resources/consumer_users/client.py
new file mode 100644
index 0000000..628ed4b
--- /dev/null
+++ b/src/flagright/resources/consumer_users/client.py
@@ -0,0 +1,173 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.consumer_users_create_response import ConsumerUsersCreateResponse
+from ...types.user import User
+from ...types.user_response import UserResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ConsumerUsersClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def create(self, *, request: User) -> ConsumerUsersCreateResponse:
+ """
+ ## POST Consumer User
+
+ `/consumer/user` endpoint allows you to operate on the [Consumer user entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user)
+
+ In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+ ### Payload
+
+ Each consumer User entity needs three mandatory fields:
+
+ * `userId` - Unique identifier for the user
+ * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
+
+ Parameters:
+ - request: User.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "consumer/users"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(ConsumerUsersCreateResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ def get(self, user_id: str) -> UserResponse:
+ """
+ ### GET Consumer User
+
+ `/consumer/user` endpoint allows you to operate on the [Consumer User entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user).
+
+ Calling `GET /consumer/user/{userId}` will return the entire user payload and rule execution results for the user with the corresponding `userId`
+
+ Parameters:
+ - user_id: str.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"consumer/users/{user_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(UserResponse, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncConsumerUsersClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def create(self, *, request: User) -> ConsumerUsersCreateResponse:
+ """
+ ## POST Consumer User
+
+ `/consumer/user` endpoint allows you to operate on the [Consumer user entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user)
+
+ In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+ ### Payload
+
+ Each consumer User entity needs three mandatory fields:
+
+ * `userId` - Unique identifier for the user
+ * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
+
+ Parameters:
+ - request: User.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "consumer/users"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(ConsumerUsersCreateResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ async def get(self, user_id: str) -> UserResponse:
+ """
+ ### GET Consumer User
+
+ `/consumer/user` endpoint allows you to operate on the [Consumer User entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#user).
+
+ Calling `GET /consumer/user/{userId}` will return the entire user payload and rule execution results for the user with the corresponding `userId`
+
+ Parameters:
+ - user_id: str.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"consumer/users/{user_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(UserResponse, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/resources/transaction_events/__init__.py b/src/flagright/resources/transaction_events/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/transaction_events/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/transaction_events/client.py b/src/flagright/resources/transaction_events/client.py
new file mode 100644
index 0000000..8ddde40
--- /dev/null
+++ b/src/flagright/resources/transaction_events/client.py
@@ -0,0 +1,188 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.transaction_event import TransactionEvent
+from ...types.transaction_event_monitoring_result import TransactionEventMonitoringResult
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class TransactionEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def create(self, *, request: TransactionEvent) -> TransactionEventMonitoringResult:
+ """
+ ## POST Transaction Events
+
+ `/events/transaction` endpoint allows you to operate on the [Transaction Events entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-event)
+
+ Transaction events are created after the initial `POST /transactions` call (which creates a transaction) and are used to:
+
+ * Update the STATE of the transaction, using the `transactionState` field and manage the [Transaction Lifecycle](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-lifecycle-through-transaction-events)
+ * Update the transaction details, using the `updatedTransactionAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use transaction events.
+
+ ### Payload
+
+ Each transaction event needs three mandatory fields:
+
+ * `transactionState` - STATE of the transaction -> value is set to `CREATED` after `POST /transactions` call
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `transactionId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - request: TransactionEvent.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/transaction"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionEventMonitoringResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ def get(self, event_id: str) -> TransactionEvent:
+ """
+ ### GET Transaction Events
+
+ `/events/transaction` endpoint allows you to operate on the [Transaction Events entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-event).
+
+ You can retrieve any transaction event you create using the [POST Transaction Events](https://docs.flagright.com/docs/flagright-api/d7c4dc4d02850-create-a-transaction-event) call.
+
+ Parameters:
+ - event_id: str. Unique Transaction Identifier
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"events/transaction/{event_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionEvent, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncTransactionEventsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def create(self, *, request: TransactionEvent) -> TransactionEventMonitoringResult:
+ """
+ ## POST Transaction Events
+
+ `/events/transaction` endpoint allows you to operate on the [Transaction Events entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-event)
+
+ Transaction events are created after the initial `POST /transactions` call (which creates a transaction) and are used to:
+
+ * Update the STATE of the transaction, using the `transactionState` field and manage the [Transaction Lifecycle](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-lifecycle-through-transaction-events)
+ * Update the transaction details, using the `updatedTransactionAttributes` field.
+
+ > If you have neither of the above two use cases, you do not need to use transaction events.
+
+ ### Payload
+
+ Each transaction event needs three mandatory fields:
+
+ * `transactionState` - STATE of the transaction -> value is set to `CREATED` after `POST /transactions` call
+ * `timestamp`- the timestamp of when the event was created or occured in your system
+ * `transactionId` - The ID of the transaction for which this event is generated.
+
+ In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
+
+ Parameters:
+ - request: TransactionEvent.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "events/transaction"),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionEventMonitoringResult, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ async def get(self, event_id: str) -> TransactionEvent:
+ """
+ ### GET Transaction Events
+
+ `/events/transaction` endpoint allows you to operate on the [Transaction Events entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction-event).
+
+ You can retrieve any transaction event you create using the [POST Transaction Events](https://docs.flagright.com/docs/flagright-api/d7c4dc4d02850-create-a-transaction-event) call.
+
+ Parameters:
+ - event_id: str. Unique Transaction Identifier
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"events/transaction/{event_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionEvent, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/resources/transactions/__init__.py b/src/flagright/resources/transactions/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/src/flagright/resources/transactions/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/src/flagright/resources/transactions/client.py b/src/flagright/resources/transactions/client.py
new file mode 100644
index 0000000..40e892c
--- /dev/null
+++ b/src/flagright/resources/transactions/client.py
@@ -0,0 +1,225 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+import urllib.parse
+from json.decoder import JSONDecodeError
+
+import pydantic
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.remove_none_from_dict import remove_none_from_dict
+from ...environment import FlagrightEnvironment
+from ...errors.bad_request_error import BadRequestError
+from ...errors.too_many_requests_error import TooManyRequestsError
+from ...errors.unauthorized_error import UnauthorizedError
+from ...types.boolean_string import BooleanString
+from ...types.transaction import Transaction
+from ...types.transaction_with_rules_result import TransactionWithRulesResult
+from ...types.transactions_verify_response import TransactionsVerifyResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class TransactionsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: SyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ def verify(
+ self,
+ *,
+ validate_origin_user_id: typing.Optional[BooleanString] = None,
+ validate_destination_user_id: typing.Optional[BooleanString] = None,
+ request: Transaction,
+ ) -> TransactionsVerifyResponse:
+ """
+ ## POST Transactions
+
+ `/transactions` endpoint allows you to operate on the [Transaction entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction)
+
+ In order to pass the payload of a transaction to Flagright and verify the transaciton, you will need to call this endpoint with the transaction payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+
+ ### Payload
+
+ Here are some of the most used payload fields explained (you can find the full payload [schema below](https://docs.flagright.com/docs/flagright-api/87742ed31b30e-verify-a-transaction#request-body) with 1 line descriptions):
+
+ * `type`: Type of transaction (Ex: `WITHDRAWAL`, `DEPOSIT`, `TRANSFER` etc).
+ * `transactionId` - Unique Identifier for the transaction. Flagright API will generate a `transactionId` if this field is left empty
+ * `timestamp` - UNIX timestamp in *milliseconds* of when the transaction took place
+ * `transactionState` - The state of the transaction, set to `CREATED` by default. [More details here](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships-in-the-api#transaction-lifecycle-through-transaction-events)
+ * `originUserId` - Unique identifier (if any) of the user who is sending the money. This user must be created within the Flagright system before using the [create a consumer user](https://docs.flagright.com/docs/flagright-api/18132cd454603-create-a-consumer-user) or [create a business user](https://docs.flagright.com/docs/flagright-api/f651463db29d8-create-a-business-user) endpoint
+ * `destinationUserId` - Unique identifier (if any) of the user who is receiving the money. This user must be created within the Flagright system before using the [create a consumer user](https://docs.flagright.com/docs/flagright-api/18132cd454603-create-a-consumer-user) or [create a business user](https://docs.flagright.com/docs/flagright-api/f651463db29d8-create-a-business-user) endpoint
+ * `originAmountDetails` - Details of the amount being sent from the origin
+ * `destinationAmountDetails` - Details of the amount being received at the destination
+ * `originPaymentDetails` - Payment details (if any) used at the origin (ex: `CARD`, `IBAN`, `WALLET` etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.
+ * `destinationPaymentDetails` - Payment details (if any) used at the destination (ex: `CARD`, `IBAN`, `WALLET` etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.
+
+ Parameters:
+ - validate_origin_user_id: typing.Optional[BooleanString]. Boolean string whether Flagright should validate if provided originUserId exist. True by default
+
+ - validate_destination_user_id: typing.Optional[BooleanString]. Boolean string whether Flagright should validate if provided destinationUserId exist. True by default
+
+ - request: Transaction.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "transactions"),
+ params=remove_none_from_dict(
+ {
+ "validateOriginUserId": validate_origin_user_id,
+ "validateDestinationUserId": validate_destination_user_id,
+ }
+ ),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionsVerifyResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ def get(self, transaction_id: str) -> TransactionWithRulesResult:
+ """
+ ### GET Transactions
+
+ `/transactions` endpoint allows you to operate on the [Transaction entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction).
+
+ Calling `GET /transactions/{transactionId}` will return the entire transaction payload and rule execution results for the transaction with the corresponding `transactionId`
+
+ Parameters:
+ - transaction_id: str. Unique Transaction Identifier
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"transactions/{transaction_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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 AsyncTransactionsClient:
+ def __init__(
+ self, *, environment: FlagrightEnvironment = FlagrightEnvironment.DEFAULT, client_wrapper: AsyncClientWrapper
+ ):
+ self._environment = environment
+ self._client_wrapper = client_wrapper
+
+ async def verify(
+ self,
+ *,
+ validate_origin_user_id: typing.Optional[BooleanString] = None,
+ validate_destination_user_id: typing.Optional[BooleanString] = None,
+ request: Transaction,
+ ) -> TransactionsVerifyResponse:
+ """
+ ## POST Transactions
+
+ `/transactions` endpoint allows you to operate on the [Transaction entity.](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction)
+
+ In order to pass the payload of a transaction to Flagright and verify the transaciton, you will need to call this endpoint with the transaction payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.
+
+
+ ### Payload
+
+ Here are some of the most used payload fields explained (you can find the full payload [schema below](https://docs.flagright.com/docs/flagright-api/87742ed31b30e-verify-a-transaction#request-body) with 1 line descriptions):
+
+ * `type`: Type of transaction (Ex: `WITHDRAWAL`, `DEPOSIT`, `TRANSFER` etc).
+ * `transactionId` - Unique Identifier for the transaction. Flagright API will generate a `transactionId` if this field is left empty
+ * `timestamp` - UNIX timestamp in *milliseconds* of when the transaction took place
+ * `transactionState` - The state of the transaction, set to `CREATED` by default. [More details here](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships-in-the-api#transaction-lifecycle-through-transaction-events)
+ * `originUserId` - Unique identifier (if any) of the user who is sending the money. This user must be created within the Flagright system before using the [create a consumer user](https://docs.flagright.com/docs/flagright-api/18132cd454603-create-a-consumer-user) or [create a business user](https://docs.flagright.com/docs/flagright-api/f651463db29d8-create-a-business-user) endpoint
+ * `destinationUserId` - Unique identifier (if any) of the user who is receiving the money. This user must be created within the Flagright system before using the [create a consumer user](https://docs.flagright.com/docs/flagright-api/18132cd454603-create-a-consumer-user) or [create a business user](https://docs.flagright.com/docs/flagright-api/f651463db29d8-create-a-business-user) endpoint
+ * `originAmountDetails` - Details of the amount being sent from the origin
+ * `destinationAmountDetails` - Details of the amount being received at the destination
+ * `originPaymentDetails` - Payment details (if any) used at the origin (ex: `CARD`, `IBAN`, `WALLET` etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.
+ * `destinationPaymentDetails` - Payment details (if any) used at the destination (ex: `CARD`, `IBAN`, `WALLET` etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.
+
+ Parameters:
+ - validate_origin_user_id: typing.Optional[BooleanString]. Boolean string whether Flagright should validate if provided originUserId exist. True by default
+
+ - validate_destination_user_id: typing.Optional[BooleanString]. Boolean string whether Flagright should validate if provided destinationUserId exist. True by default
+
+ - request: Transaction.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "POST",
+ urllib.parse.urljoin(f"{self._environment.value}/", "transactions"),
+ params=remove_none_from_dict(
+ {
+ "validateOriginUserId": validate_origin_user_id,
+ "validateDestinationUserId": validate_destination_user_id,
+ }
+ ),
+ json=jsonable_encoder(request),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionsVerifyResponse, _response.json()) # type: ignore
+ if _response.status_code == 400:
+ raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
+
+ async def get(self, transaction_id: str) -> TransactionWithRulesResult:
+ """
+ ### GET Transactions
+
+ `/transactions` endpoint allows you to operate on the [Transaction entity](https://docs.flagright.com/docs/flagright-api/8c06ae6a3231a-entities-and-relationships#transaction).
+
+ Calling `GET /transactions/{transactionId}` will return the entire transaction payload and rule execution results for the transaction with the corresponding `transactionId`
+
+ Parameters:
+ - transaction_id: str. Unique Transaction Identifier
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "GET",
+ urllib.parse.urljoin(f"{self._environment.value}/", f"transactions/{transaction_id}"),
+ headers=self._client_wrapper.get_headers(),
+ timeout=60,
+ )
+ if 200 <= _response.status_code < 300:
+ return pydantic.parse_obj_as(TransactionWithRulesResult, _response.json()) # type: ignore
+ if _response.status_code == 401:
+ raise UnauthorizedError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ if _response.status_code == 429:
+ raise TooManyRequestsError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
+ 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)
diff --git a/src/flagright/types/__init__.py b/src/flagright/types/__init__.py
index 77674c1..5960cd2 100644
--- a/src/flagright/types/__init__.py
+++ b/src/flagright/types/__init__.py
@@ -6,11 +6,14 @@
from .address import Address
from .alert_closed_details import AlertClosedDetails
from .amount import Amount
+from .boolean_string import BooleanString
from .business import Business
from .business_base import BusinessBase
from .business_entity_link import BusinessEntityLink
from .business_optional import BusinessOptional
from .business_optional_saved_payment_details_item import BusinessOptionalSavedPaymentDetailsItem
+from .business_response import BusinessResponse
+from .business_users_create_response import BusinessUsersCreateResponse
from .business_users_response import BusinessUsersResponse
from .business_with_rules_result import BusinessWithRulesResult
from .card_details import CardDetails
@@ -32,6 +35,8 @@
from .company_general_details_user_segment import CompanyGeneralDetailsUserSegment
from .company_registration_details import CompanyRegistrationDetails
from .consumer_name import ConsumerName
+from .consumer_user_segment import ConsumerUserSegment
+from .consumer_users_create_response import ConsumerUsersCreateResponse
from .consumer_users_response import ConsumerUsersResponse
from .contact_details import ContactDetails
from .country_code import CountryCode
@@ -65,11 +70,8 @@
from .payment_method import PaymentMethod
from .pep_status import PepStatus
from .person import Person
-from .post_business_user_response import PostBusinessUserResponse
-from .post_consumer_transaction_response import PostConsumerTransactionResponse
-from .post_consumer_user_response import PostConsumerUserResponse
from .risk_level import RiskLevel
-from .risk_scoring_result import RiskScoringResult
+from .risk_score_details import RiskScoreDetails
from .rule_action import RuleAction
from .rule_failure_exception import RuleFailureException
from .rule_hit_direction import RuleHitDirection
@@ -87,17 +89,20 @@
from .transaction_amount_limit import TransactionAmountLimit
from .transaction_base import TransactionBase
from .transaction_count_limit import TransactionCountLimit
+from .transaction_event import TransactionEvent
from .transaction_event_monitoring_result import TransactionEventMonitoringResult
from .transaction_limit import TransactionLimit
from .transaction_limits import TransactionLimits
from .transaction_limits_payment_method_limits import TransactionLimitsPaymentMethodLimits
from .transaction_monitoring_result import TransactionMonitoringResult
from .transaction_state import TransactionState
+from .transaction_status_details import TransactionStatusDetails
from .transaction_type import TransactionType
from .transaction_updatable import TransactionUpdatable
from .transaction_updatable_destination_payment_details import TransactionUpdatableDestinationPaymentDetails
from .transaction_updatable_origin_payment_details import TransactionUpdatableOriginPaymentDetails
from .transaction_with_rules_result import TransactionWithRulesResult
+from .transactions_verify_response import TransactionsVerifyResponse
from .upi_details import UpiDetails
from .upi_payment_method import UpiPaymentMethod
from .user import User
@@ -106,14 +111,15 @@
from .user_details_gender import UserDetailsGender
from .user_monitoring_result import UserMonitoringResult
from .user_optional import UserOptional
-from .user_optional_user_segment import UserOptionalUserSegment
from .user_registration_status import UserRegistrationStatus
+from .user_response import UserResponse
from .user_state import UserState
from .user_state_details import UserStateDetails
from .user_with_rules_result import UserWithRulesResult
from .wallet_details import WalletDetails
from .wallet_payment_method import WalletPaymentMethod
from .webhook_event import WebhookEvent
+from .webhook_event_data import WebhookEventData
from .webhook_event_type import WebhookEventType
__all__ = [
@@ -123,11 +129,14 @@
"Address",
"AlertClosedDetails",
"Amount",
+ "BooleanString",
"Business",
"BusinessBase",
"BusinessEntityLink",
"BusinessOptional",
"BusinessOptionalSavedPaymentDetailsItem",
+ "BusinessResponse",
+ "BusinessUsersCreateResponse",
"BusinessUsersResponse",
"BusinessWithRulesResult",
"CardDetails",
@@ -149,6 +158,8 @@
"CompanyGeneralDetailsUserSegment",
"CompanyRegistrationDetails",
"ConsumerName",
+ "ConsumerUserSegment",
+ "ConsumerUsersCreateResponse",
"ConsumerUsersResponse",
"ContactDetails",
"CountryCode",
@@ -182,11 +193,8 @@
"PaymentMethod",
"PepStatus",
"Person",
- "PostBusinessUserResponse",
- "PostConsumerTransactionResponse",
- "PostConsumerUserResponse",
"RiskLevel",
- "RiskScoringResult",
+ "RiskScoreDetails",
"RuleAction",
"RuleFailureException",
"RuleHitDirection",
@@ -204,17 +212,20 @@
"TransactionAmountLimit",
"TransactionBase",
"TransactionCountLimit",
+ "TransactionEvent",
"TransactionEventMonitoringResult",
"TransactionLimit",
"TransactionLimits",
"TransactionLimitsPaymentMethodLimits",
"TransactionMonitoringResult",
"TransactionState",
+ "TransactionStatusDetails",
"TransactionType",
"TransactionUpdatable",
"TransactionUpdatableDestinationPaymentDetails",
"TransactionUpdatableOriginPaymentDetails",
"TransactionWithRulesResult",
+ "TransactionsVerifyResponse",
"UpiDetails",
"UpiPaymentMethod",
"User",
@@ -223,13 +234,14 @@
"UserDetailsGender",
"UserMonitoringResult",
"UserOptional",
- "UserOptionalUserSegment",
"UserRegistrationStatus",
+ "UserResponse",
"UserState",
"UserStateDetails",
"UserWithRulesResult",
"WalletDetails",
"WalletPaymentMethod",
"WebhookEvent",
+ "WebhookEventData",
"WebhookEventType",
]
diff --git a/src/flagright/types/ach_details.py b/src/flagright/types/ach_details.py
index 61cab90..ad58172 100644
--- a/src/flagright/types/ach_details.py
+++ b/src/flagright/types/ach_details.py
@@ -18,19 +18,19 @@ class AchDetails(pydantic.BaseModel):
method: AchPaymentMethod
routing_number: typing.Optional[str] = pydantic.Field(
alias="routingNumber",
- description=('Routing number of the bank `non-empty` \n'),
+ description='Routing number of the bank `non-empty` ',
)
account_number: typing.Optional[str] = pydantic.Field(
alias="accountNumber",
- description=('Bank account number of the individual `non-empty` \n'),
+ description='Bank account number of the individual `non-empty` ',
)
bank_name: typing.Optional[str] = pydantic.Field(
- alias="bankName", description=('Name of the bank `non-empty` \n')
+ alias="bankName", description='Name of the bank `non-empty` '
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the account holder\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the account holder")
bank_address: typing.Optional[Address] = pydantic.Field(alias="bankAddress")
beneficiary_name: typing.Optional[str] = pydantic.Field(
- alias="beneficiaryName", description=("Beneficiary name of the account\n")
+ alias="beneficiaryName", description="Beneficiary name of the account"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/address.py b/src/flagright/types/address.py
index 61e37dc..62ae9fc 100644
--- a/src/flagright/types/address.py
+++ b/src/flagright/types/address.py
@@ -15,24 +15,22 @@ class Address(pydantic.BaseModel):
"""
address_lines: typing.List[typing.Any] = pydantic.Field(
- alias="addressLines", description=("Address lines of the user's residence address\n")
+ alias="addressLines", description="Address lines of the user's residence address"
)
postcode: str = pydantic.Field(
- description=(
- 'Post code of the user\'s residence address `non-empty` \n'
- )
+ description='Post code of the user\'s residence address `non-empty` '
)
city: str = pydantic.Field(
- description=('City of the user\'s residence address `non-empty` \n')
+ description='City of the user\'s residence address `non-empty` '
)
state: typing.Optional[str] = pydantic.Field(
- description=('State of the user\'s residence address `non-empty` \n')
+ description='State of the user\'s residence address `non-empty` '
)
country: str = pydantic.Field(
- description=('User\'s country of residence `non-empty` \n')
+ description='User\'s country of residence `non-empty` '
)
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/alert_closed_details.py b/src/flagright/types/alert_closed_details.py
index 8d083bf..3431b3b 100644
--- a/src/flagright/types/alert_closed_details.py
+++ b/src/flagright/types/alert_closed_details.py
@@ -12,7 +12,7 @@ class AlertClosedDetails(pydantic.BaseModel):
alert_id: typing.Optional[str] = pydantic.Field(alias="alertId")
status: typing.Optional[str]
reasons: typing.Optional[typing.List[str]]
- reason_description_for_other: typing.Optional[typing.List[str]] = pydantic.Field(alias="reasonDescriptionForOther")
+ reason_description_for_other: typing.Optional[str] = pydantic.Field(alias="reasonDescriptionForOther")
comment: typing.Optional[str]
user_id: typing.Optional[str] = pydantic.Field(alias="userId")
transaction_ids: typing.Optional[typing.List[str]] = pydantic.Field(alias="transactionIds")
diff --git a/src/flagright/types/amount.py b/src/flagright/types/amount.py
index 54083d9..7beb150 100644
--- a/src/flagright/types/amount.py
+++ b/src/flagright/types/amount.py
@@ -14,7 +14,7 @@ class Amount(pydantic.BaseModel):
Model for amount
"""
- amount_value: float = pydantic.Field(alias="amountValue", description=("Numerical value of the transaction\n"))
+ amount_value: float = pydantic.Field(alias="amountValue", description="Numerical value of the transaction")
amount_currency: CurrencyCode = pydantic.Field(alias="amountCurrency")
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/boolean_string.py b/src/flagright/types/boolean_string.py
new file mode 100644
index 0000000..3e0f221
--- /dev/null
+++ b/src/flagright/types/boolean_string.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import enum
+import typing
+
+T_Result = typing.TypeVar("T_Result")
+
+
+class BooleanString(str, enum.Enum):
+ TRUE = "true"
+ FALSE = "false"
+
+ def visit(self, true: typing.Callable[[], T_Result], false: typing.Callable[[], T_Result]) -> T_Result:
+ if self is BooleanString.TRUE:
+ return true()
+ if self is BooleanString.FALSE:
+ return false()
diff --git a/src/flagright/types/business.py b/src/flagright/types/business.py
index 370b6c9..a25ba94 100644
--- a/src/flagright/types/business.py
+++ b/src/flagright/types/business.py
@@ -3,12 +3,53 @@
import datetime as dt
import typing
+import pydantic
+
from ..core.datetime_utils import serialize_datetime
-from .business_base import BusinessBase
-from .business_optional import BusinessOptional
+from .acquisition_channel import AcquisitionChannel
+from .business_entity_link import BusinessEntityLink
+from .business_optional_saved_payment_details_item import BusinessOptionalSavedPaymentDetailsItem
+from .kyc_status_details import KycStatusDetails
+from .legal_entity import LegalEntity
+from .mcc_details import MccDetails
+from .payment_method import PaymentMethod
+from .person import Person
+from .risk_level import RiskLevel
+from .tag import Tag
+from .transaction_limits import TransactionLimits
+from .user_state_details import UserStateDetails
+
+class Business(pydantic.BaseModel):
+ user_id: str = pydantic.Field(
+ alias="userId", description='Unique user ID for the user `non-empty` '
+ )
+ created_timestamp: float = pydantic.Field(
+ alias="createdTimestamp", description="Timestamp when the user was created"
+ )
+ legal_entity: LegalEntity = pydantic.Field(alias="legalEntity")
+ user_state_details: typing.Optional[UserStateDetails] = pydantic.Field(alias="userStateDetails")
+ kyc_status_details: typing.Optional[KycStatusDetails] = pydantic.Field(alias="kycStatusDetails")
+ share_holders: typing.Optional[typing.List[Person]] = pydantic.Field(
+ alias="shareHolders",
+ description="Shareholders (beneficiaries) of the company that hold at least 25% ownership. Can be another company or an individual",
+ )
+ directors: typing.Optional[typing.List[Person]] = pydantic.Field(
+ description="Director(s) of the company. Must be at least one"
+ )
+ transaction_limits: typing.Optional[TransactionLimits] = pydantic.Field(alias="transactionLimits")
+ risk_level: typing.Optional[RiskLevel] = pydantic.Field(alias="riskLevel")
+ allowed_payment_methods: typing.Optional[typing.List[PaymentMethod]] = pydantic.Field(alias="allowedPaymentMethods")
+ linked_entities: typing.Optional[BusinessEntityLink] = pydantic.Field(alias="linkedEntities")
+ acquisition_channel: typing.Optional[AcquisitionChannel] = pydantic.Field(alias="acquisitionChannel")
+ saved_payment_details: typing.Optional[typing.List[BusinessOptionalSavedPaymentDetailsItem]] = pydantic.Field(
+ alias="savedPaymentDetails"
+ )
+ mcc_details: typing.Optional[MccDetails] = pydantic.Field(alias="mccDetails")
+ tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
+ description="Additional information that can be added via tags"
+ )
-class Business(BusinessBase, BusinessOptional):
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)
diff --git a/src/flagright/types/business_base.py b/src/flagright/types/business_base.py
index 1b1254e..8d3d60e 100644
--- a/src/flagright/types/business_base.py
+++ b/src/flagright/types/business_base.py
@@ -6,6 +6,7 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .legal_entity import LegalEntity
class BusinessBase(pydantic.BaseModel):
@@ -14,12 +15,12 @@ class BusinessBase(pydantic.BaseModel):
"""
user_id: str = pydantic.Field(
- alias="userId",
- description=('Unique user ID for the user `non-empty` \n'),
+ alias="userId", description='Unique user ID for the user `non-empty` '
)
created_timestamp: float = pydantic.Field(
- alias="createdTimestamp", description=("Timestamp when the user was created\n")
+ alias="createdTimestamp", description="Timestamp when the user was created"
)
+ legal_entity: LegalEntity = pydantic.Field(alias="legalEntity")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/business_optional.py b/src/flagright/types/business_optional.py
index 8bbab5f..0b2a349 100644
--- a/src/flagright/types/business_optional.py
+++ b/src/flagright/types/business_optional.py
@@ -30,12 +30,10 @@ class BusinessOptional(pydantic.BaseModel):
legal_entity: typing.Optional[LegalEntity] = pydantic.Field(alias="legalEntity")
share_holders: typing.Optional[typing.List[Person]] = pydantic.Field(
alias="shareHolders",
- description=(
- "Shareholders (beneficiaries) of the company that hold at least 25% ownership. Can be another company or an individual\n"
- ),
+ description="Shareholders (beneficiaries) of the company that hold at least 25% ownership. Can be another company or an individual",
)
directors: typing.Optional[typing.List[Person]] = pydantic.Field(
- description=("Director(s) of the company. Must be at least one\n")
+ description="Director(s) of the company. Must be at least one"
)
transaction_limits: typing.Optional[TransactionLimits] = pydantic.Field(alias="transactionLimits")
risk_level: typing.Optional[RiskLevel] = pydantic.Field(alias="riskLevel")
@@ -47,7 +45,7 @@ class BusinessOptional(pydantic.BaseModel):
)
mcc_details: typing.Optional[MccDetails] = pydantic.Field(alias="mccDetails")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/risk_scoring_result.py b/src/flagright/types/business_response.py
similarity index 58%
rename from src/flagright/types/risk_scoring_result.py
rename to src/flagright/types/business_response.py
index 3a77e1c..de69856 100644
--- a/src/flagright/types/risk_scoring_result.py
+++ b/src/flagright/types/business_response.py
@@ -6,20 +6,12 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .business_with_rules_result import BusinessWithRulesResult
+from .risk_score_details import RiskScoreDetails
-class RiskScoringResult(pydantic.BaseModel):
- """
- Model for results from Risk Scoring
- """
-
- kyc_risk_score: float = pydantic.Field(alias="kycRiskScore", description=("Quantified KYC risk score\n"))
- transaction_risk_score: float = pydantic.Field(
- alias="transactionRiskScore", description=("Quantified action risk score\n")
- )
- customer_risk_assessment: typing.Optional[float] = pydantic.Field(
- alias="customerRiskAssessment", description=("Quantified dynamic risk score\n")
- )
+class BusinessResponse(BusinessWithRulesResult):
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/post_business_user_response.py b/src/flagright/types/business_users_create_response.py
similarity index 73%
rename from src/flagright/types/post_business_user_response.py
rename to src/flagright/types/business_users_create_response.py
index 3ef4876..b4c47e9 100644
--- a/src/flagright/types/post_business_user_response.py
+++ b/src/flagright/types/business_users_create_response.py
@@ -6,15 +6,17 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .risk_score_details import RiskScoreDetails
from .rules_results import RulesResults
-class PostBusinessUserResponse(RulesResults):
+class BusinessUsersCreateResponse(RulesResults):
message: typing.Optional[str]
user_id: str = pydantic.Field(
alias="userId",
- description=('user ID the risk score pertains to `non-empty` \n'),
+ description='user ID the risk score pertains to `non-empty` ',
)
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/business_users_response.py b/src/flagright/types/business_users_response.py
index d1862bf..36a4b3d 100644
--- a/src/flagright/types/business_users_response.py
+++ b/src/flagright/types/business_users_response.py
@@ -6,6 +6,7 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .risk_score_details import RiskScoreDetails
class BusinessUsersResponse(pydantic.BaseModel):
@@ -15,8 +16,9 @@ class BusinessUsersResponse(pydantic.BaseModel):
user_id: str = pydantic.Field(
alias="userId",
- description=('user ID the risk score pertains to `non-empty` \n'),
+ description='user ID the risk score pertains to `non-empty` ',
)
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/card_details.py b/src/flagright/types/card_details.py
index 38f58af..282f4b7 100644
--- a/src/flagright/types/card_details.py
+++ b/src/flagright/types/card_details.py
@@ -24,29 +24,28 @@ class CardDetails(pydantic.BaseModel):
method: CardPaymentMethod
card_fingerprint: typing.Optional[str] = pydantic.Field(
alias="cardFingerprint",
- description=(
- 'Unique card fingerprint that helps identify a specific card without having to use explicit card number. This is likely available at your card payment scheme provider `non-empty` \n'
- ),
+ description='Unique card fingerprint that helps identify a specific card without having to use explicit card number. This is likely available at your card payment scheme provider `non-empty` ',
)
card_issued_country: typing.Optional[CountryCode] = pydantic.Field(alias="cardIssuedCountry")
transaction_reference_field: typing.Optional[str] = pydantic.Field(
alias="transactionReferenceField",
- description=('Reference for the transaction `non-empty` \n'),
+ description='Reference for the transaction `non-empty` ',
+ )
+ _3_ds_done: typing.Optional[bool] = pydantic.Field(
+ alias="3dsDone", description="Whether 3ds was successfully enforced for the transaction"
)
name_on_card: typing.Optional[ConsumerName] = pydantic.Field(alias="nameOnCard")
card_expiry: typing.Optional[CardExpiry] = pydantic.Field(alias="cardExpiry")
card_last_4_digits: typing.Optional[str] = pydantic.Field(
alias="cardLast4Digits",
- description=('Last 4 digits of Card `<= 4 characters` \n'),
- )
- card_brand: typing.Optional[CardDetailsCardBrand] = pydantic.Field(
- alias="cardBrand", description=("Brand of Card\n")
+ description='Last 4 digits of Card `<= 4 characters` ',
)
+ card_brand: typing.Optional[CardDetailsCardBrand] = pydantic.Field(alias="cardBrand", description="Brand of Card")
card_funding: typing.Optional[CardDetailsCardFunding] = pydantic.Field(
- alias="cardFunding", description=("Funding of Card\n")
+ alias="cardFunding", description="Funding of Card"
)
card_authenticated: typing.Optional[bool] = pydantic.Field(
- alias="cardAuthenticated", description=("Authentication of Card\n")
+ alias="cardAuthenticated", description="Authentication of Card"
)
payment_channel: typing.Optional[str] = pydantic.Field(alias="paymentChannel")
card_type: typing.Optional[CardDetailsCardType] = pydantic.Field(alias="cardType")
diff --git a/src/flagright/types/card_merchant_details.py b/src/flagright/types/card_merchant_details.py
index 43ae31c..c4274c0 100644
--- a/src/flagright/types/card_merchant_details.py
+++ b/src/flagright/types/card_merchant_details.py
@@ -14,7 +14,7 @@ class CardMerchantDetails(pydantic.BaseModel):
mcc: typing.Optional[str] = pydantic.Field(alias="MCC")
city: typing.Optional[str]
country: typing.Optional[str] = pydantic.Field(
- description=('`<= 2 characters`\n')
+ description='`<= 2 characters`'
)
state: typing.Optional[str]
post_code: typing.Optional[str] = pydantic.Field(alias="postCode")
diff --git a/src/flagright/types/case_closed_details.py b/src/flagright/types/case_closed_details.py
index 5094352..7d5da56 100644
--- a/src/flagright/types/case_closed_details.py
+++ b/src/flagright/types/case_closed_details.py
@@ -12,7 +12,7 @@ class CaseClosedDetails(pydantic.BaseModel):
case_id: typing.Optional[str] = pydantic.Field(alias="caseId")
status: typing.Optional[str]
reasons: typing.Optional[typing.List[str]]
- reason_description_for_other: typing.Optional[typing.List[str]] = pydantic.Field(alias="reasonDescriptionForOther")
+ reason_description_for_other: typing.Optional[str] = pydantic.Field(alias="reasonDescriptionForOther")
comment: typing.Optional[str]
user_id: typing.Optional[str] = pydantic.Field(alias="userId")
transaction_ids: typing.Optional[typing.List[str]] = pydantic.Field(alias="transactionIds")
diff --git a/src/flagright/types/case_management_event.py b/src/flagright/types/case_management_event.py
index c60158e..9a6d14f 100644
--- a/src/flagright/types/case_management_event.py
+++ b/src/flagright/types/case_management_event.py
@@ -16,21 +16,21 @@ class CaseManagementEvent(pydantic.BaseModel):
"""
case_status: CaseManagementEventCaseStatus = pydantic.Field(
- alias="caseStatus", description=("Status of a case. E.g. Open, Closed etc.\n")
+ alias="caseStatus", description="Status of a case. E.g. Open, Closed etc."
)
- timestamp: float = pydantic.Field(description=("Timestamp of the event\n"))
+ timestamp: float = pydantic.Field(description="Timestamp of the event")
case_status_reason: CaseManagementEventCaseStatusReason = pydantic.Field(
alias="caseStatusReason",
- description=("Case status reason. E.g. Closed & False Positive, Closed & Investigation Completed etc.\n"),
+ description="Case status reason. E.g. Closed & False Positive, Closed & Investigation Completed etc.",
)
transaction_id: typing.Optional[str] = pydantic.Field(
alias="transactionId",
- description=('Transaction ID the case pertains to `non-empty` \n'),
+ description='Transaction ID the case pertains to `non-empty` ',
)
- user_id: typing.Optional[str] = pydantic.Field(alias="userId", description=("User ID the case pertains to\n"))
- event_id: typing.Optional[str] = pydantic.Field(alias="eventId", description=("Event ID the case pertains to\n"))
+ user_id: typing.Optional[str] = pydantic.Field(alias="userId", description="User ID the case pertains to")
+ event_id: typing.Optional[str] = pydantic.Field(alias="eventId", description="Event ID the case pertains to")
case_status_reason_description: typing.Optional[str] = pydantic.Field(
- alias="caseStatusReasonDescription", description=("Case status reason description\n")
+ alias="caseStatusReasonDescription", description="Case status reason description"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/company_financial_details.py b/src/flagright/types/company_financial_details.py
index 76117c9..b691079 100644
--- a/src/flagright/types/company_financial_details.py
+++ b/src/flagright/types/company_financial_details.py
@@ -20,7 +20,7 @@ class CompanyFinancialDetails(pydantic.BaseModel):
)
expected_turnover_per_month: typing.Optional[Amount] = pydantic.Field(alias="expectedTurnoverPerMonth")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/company_general_details.py b/src/flagright/types/company_general_details.py
index 0a449b8..02bf9ed 100644
--- a/src/flagright/types/company_general_details.py
+++ b/src/flagright/types/company_general_details.py
@@ -17,21 +17,20 @@ class CompanyGeneralDetails(pydantic.BaseModel):
"""
legal_name: str = pydantic.Field(
- alias="legalName",
- description=('Legal name of the company `non-empty` \n'),
+ alias="legalName", description='Legal name of the company `non-empty` '
)
business_industry: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="businessIndustry", description=("The industry the business operates in for a business customer\n")
+ alias="businessIndustry", description="The industry the business operates in for a business customer"
)
main_products_services_sold: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="mainProductsServicesSold", description=("The key products and services provided by the company\n")
+ alias="mainProductsServicesSold", description="The key products and services provided by the company"
)
user_segment: typing.Optional[CompanyGeneralDetailsUserSegment] = pydantic.Field(
- alias="userSegment", description=("Segmentation of the business user\n")
+ alias="userSegment", description="Segmentation of the business user"
)
user_registration_status: typing.Optional[UserRegistrationStatus] = pydantic.Field(alias="userRegistrationStatus")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/company_general_details_user_segment.py b/src/flagright/types/company_general_details_user_segment.py
index 12dda55..68fbd59 100644
--- a/src/flagright/types/company_general_details_user_segment.py
+++ b/src/flagright/types/company_general_details_user_segment.py
@@ -12,6 +12,7 @@ class CompanyGeneralDetailsUserSegment(str, enum.Enum):
"""
SOLE_PROPRIETORSHIP = "SOLE_PROPRIETORSHIP"
+ LIMITED = "LIMITED"
SMB = "SMB"
SMALL = "SMALL"
MEDIUM = "MEDIUM"
@@ -21,6 +22,7 @@ class CompanyGeneralDetailsUserSegment(str, enum.Enum):
def visit(
self,
sole_proprietorship: typing.Callable[[], T_Result],
+ limited: typing.Callable[[], T_Result],
smb: typing.Callable[[], T_Result],
small: typing.Callable[[], T_Result],
medium: typing.Callable[[], T_Result],
@@ -29,6 +31,8 @@ def visit(
) -> T_Result:
if self is CompanyGeneralDetailsUserSegment.SOLE_PROPRIETORSHIP:
return sole_proprietorship()
+ if self is CompanyGeneralDetailsUserSegment.LIMITED:
+ return limited()
if self is CompanyGeneralDetailsUserSegment.SMB:
return smb()
if self is CompanyGeneralDetailsUserSegment.SMALL:
diff --git a/src/flagright/types/company_registration_details.py b/src/flagright/types/company_registration_details.py
index a41c01d..bacfc6c 100644
--- a/src/flagright/types/company_registration_details.py
+++ b/src/flagright/types/company_registration_details.py
@@ -17,20 +17,18 @@ class CompanyRegistrationDetails(pydantic.BaseModel):
registration_identifier: str = pydantic.Field(
alias="registrationIdentifier",
- description=(
- 'Commercial registry registration number for the company in its registration country `non-empty` \n'
- ),
+ description='Commercial registry registration number for the company in its registration country `non-empty` ',
)
registration_country: CountryCode = pydantic.Field(alias="registrationCountry")
tax_identifier: typing.Optional[str] = pydantic.Field(
- alias="taxIdentifier", description=("Tax ID number of the registered entity\n")
+ alias="taxIdentifier", description="Tax ID number of the registered entity"
)
legal_entity_type: typing.Optional[str] = pydantic.Field(
- alias="legalEntityType", description=("Type of legal entity. Ex: Limited Liability\n")
+ alias="legalEntityType", description="Type of legal entity. Ex: Limited Liability"
)
date_of_registration: typing.Optional[str] = pydantic.Field(alias="dateOfRegistration")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/consumer_name.py b/src/flagright/types/consumer_name.py
index a048412..99d8fd2 100644
--- a/src/flagright/types/consumer_name.py
+++ b/src/flagright/types/consumer_name.py
@@ -14,15 +14,13 @@ class ConsumerName(pydantic.BaseModel):
"""
first_name: str = pydantic.Field(
- alias="firstName",
- description=('First name of the user `non-empty` \n'),
+ alias="firstName", description='First name of the user `non-empty` '
)
middle_name: typing.Optional[str] = pydantic.Field(
- alias="middleName",
- description=('Middle name of the user `non-empty` \n'),
+ alias="middleName", description='Middle name of the user `non-empty` '
)
last_name: typing.Optional[str] = pydantic.Field(
- alias="lastName", description=('Last name of the user `non-empty` \n')
+ alias="lastName", description='Last name of the user `non-empty` '
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/user_optional_user_segment.py b/src/flagright/types/consumer_user_segment.py
similarity index 70%
rename from src/flagright/types/user_optional_user_segment.py
rename to src/flagright/types/consumer_user_segment.py
index 766fe68..77db7df 100644
--- a/src/flagright/types/user_optional_user_segment.py
+++ b/src/flagright/types/consumer_user_segment.py
@@ -6,12 +6,12 @@
T_Result = typing.TypeVar("T_Result")
-class UserOptionalUserSegment(str, enum.Enum):
+class ConsumerUserSegment(str, enum.Enum):
RETAIL = "RETAIL"
PROFESSIONAL = "PROFESSIONAL"
def visit(self, retail: typing.Callable[[], T_Result], professional: typing.Callable[[], T_Result]) -> T_Result:
- if self is UserOptionalUserSegment.RETAIL:
+ if self is ConsumerUserSegment.RETAIL:
return retail()
- if self is UserOptionalUserSegment.PROFESSIONAL:
+ if self is ConsumerUserSegment.PROFESSIONAL:
return professional()
diff --git a/src/flagright/types/post_consumer_user_response.py b/src/flagright/types/consumer_users_create_response.py
similarity index 73%
rename from src/flagright/types/post_consumer_user_response.py
rename to src/flagright/types/consumer_users_create_response.py
index b6bec32..6cdc567 100644
--- a/src/flagright/types/post_consumer_user_response.py
+++ b/src/flagright/types/consumer_users_create_response.py
@@ -6,15 +6,17 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .risk_score_details import RiskScoreDetails
from .rules_results import RulesResults
-class PostConsumerUserResponse(RulesResults):
+class ConsumerUsersCreateResponse(RulesResults):
message: typing.Optional[str]
user_id: str = pydantic.Field(
alias="userId",
- description=('user ID the risk score pertains to `non-empty` \n'),
+ description='user ID the risk score pertains to `non-empty` ',
)
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/consumer_users_response.py b/src/flagright/types/consumer_users_response.py
index a0cb276..b9e695f 100644
--- a/src/flagright/types/consumer_users_response.py
+++ b/src/flagright/types/consumer_users_response.py
@@ -6,6 +6,7 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .risk_score_details import RiskScoreDetails
class ConsumerUsersResponse(pydantic.BaseModel):
@@ -15,8 +16,9 @@ class ConsumerUsersResponse(pydantic.BaseModel):
user_id: str = pydantic.Field(
alias="userId",
- description=('user ID the risk score pertains to `non-empty` \n'),
+ description='user ID the risk score pertains to `non-empty` ',
)
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/contact_details.py b/src/flagright/types/contact_details.py
index 83850cf..29612bc 100644
--- a/src/flagright/types/contact_details.py
+++ b/src/flagright/types/contact_details.py
@@ -15,16 +15,16 @@ class ContactDetails(pydantic.BaseModel):
"""
email_ids: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="emailIds", description=("Email addresses of the contacts for a given business customer\n")
+ alias="emailIds", description="Email addresses of the contacts for a given business customer"
)
contact_numbers: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="contactNumbers", description=("Phone numbers to contact a given business customer\n")
+ alias="contactNumbers", description="Phone numbers to contact a given business customer"
)
fax_numbers: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="faxNumbers", description=("Fax numbers to contact a business customer\n")
+ alias="faxNumbers", description="Fax numbers to contact a business customer"
)
- websites: typing.Optional[typing.List[str]] = pydantic.Field(description=("Website of the company\n"))
- addresses: typing.Optional[typing.List[Address]] = pydantic.Field(description=("Address(es) of the company\n"))
+ websites: typing.Optional[typing.List[str]] = pydantic.Field(description="Website of the company")
+ addresses: typing.Optional[typing.List[Address]] = pydantic.Field(description="Address(es) of the company")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/currency_code.py b/src/flagright/types/currency_code.py
index 7eaf538..f8e02d9 100644
--- a/src/flagright/types/currency_code.py
+++ b/src/flagright/types/currency_code.py
@@ -7,7 +7,7 @@
class CurrencyCode(str, enum.Enum):
- ONE = "1INCH"
+ ONE_INCH = "1INCH"
AAVE = "AAVE"
ADA = "ADA"
AED = "AED"
@@ -280,7 +280,7 @@ class CurrencyCode(str, enum.Enum):
def visit(
self,
- one: typing.Callable[[], T_Result],
+ one_inch: typing.Callable[[], T_Result],
aave: typing.Callable[[], T_Result],
ada: typing.Callable[[], T_Result],
aed: typing.Callable[[], T_Result],
@@ -551,8 +551,8 @@ def visit(
zmw: typing.Callable[[], T_Result],
zwl: typing.Callable[[], T_Result],
) -> T_Result:
- if self is CurrencyCode.ONE:
- return one()
+ if self is CurrencyCode.ONE_INCH:
+ return one_inch()
if self is CurrencyCode.AAVE:
return aave()
if self is CurrencyCode.ADA:
diff --git a/src/flagright/types/date.py b/src/flagright/types/date.py
index 7b36dc5..fdd74af 100644
--- a/src/flagright/types/date.py
+++ b/src/flagright/types/date.py
@@ -13,9 +13,9 @@ class Date(pydantic.BaseModel):
Model for date
"""
- day: float = pydantic.Field(description=("Day of date\n"))
- month: float = pydantic.Field(description=("Month of date\n"))
- year: float = pydantic.Field(description=("Year of date\n"))
+ day: float = pydantic.Field(description="Day of date")
+ month: float = pydantic.Field(description="Month of date")
+ year: float = pydantic.Field(description="Year of date")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/device_data.py b/src/flagright/types/device_data.py
index cf526f4..524d593 100644
--- a/src/flagright/types/device_data.py
+++ b/src/flagright/types/device_data.py
@@ -15,56 +15,44 @@ class DeviceData(pydantic.BaseModel):
battery_level: typing.Optional[float] = pydantic.Field(
alias="batteryLevel",
- description=("Battery level of the device used for a transaction or event at a given timestamp\n"),
+ description="Battery level of the device used for a transaction or event at a given timestamp",
)
device_latitude: typing.Optional[float] = pydantic.Field(
- alias="deviceLatitude", description=("Device latitude at a give timestamp for an event or transaction\n")
+ alias="deviceLatitude", description="Device latitude at a give timestamp for an event or transaction"
)
device_longitude: typing.Optional[float] = pydantic.Field(
- alias="deviceLongitude", description=("Device longitude at a give timestamp for an event or transaction\n")
+ alias="deviceLongitude", description="Device longitude at a give timestamp for an event or transaction"
)
ip_address: typing.Optional[str] = pydantic.Field(
alias="ipAddress",
- description=(
- 'IP address of the device at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='IP address of the device at a given timestamp for an event or transaction `non-empty` ',
)
device_identifier: typing.Optional[str] = pydantic.Field(
alias="deviceIdentifier",
- description=('Device identifier number `non-empty` \n'),
+ description='Device identifier number `non-empty` ',
)
vpn_used: typing.Optional[bool] = pydantic.Field(
- alias="vpnUsed", description=("Whether VPN was used at a given timestamp for an event or transaction\n")
+ alias="vpnUsed", description="Whether VPN was used at a given timestamp for an event or transaction"
)
operating_system: typing.Optional[str] = pydantic.Field(
alias="operatingSystem",
- description=(
- 'Operating system of the device at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='Operating system of the device at a given timestamp for an event or transaction `non-empty` ',
)
device_maker: typing.Optional[str] = pydantic.Field(
alias="deviceMaker",
- description=(
- 'The maker of the device at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='The maker of the device at a given timestamp for an event or transaction `non-empty` ',
)
device_model: typing.Optional[str] = pydantic.Field(
alias="deviceModel",
- description=(
- 'The model of the device at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='The model of the device at a given timestamp for an event or transaction `non-empty` ',
)
device_year: typing.Optional[str] = pydantic.Field(
alias="deviceYear",
- description=(
- 'The year the device was manufactured at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='The year the device was manufactured at a given timestamp for an event or transaction `non-empty` ',
)
app_version: typing.Optional[str] = pydantic.Field(
alias="appVersion",
- description=(
- 'The version of the app your user is using on their device at a given timestamp for an event or transaction `non-empty` \n'
- ),
+ description='The version of the app your user is using on their device at a given timestamp for an event or transaction `non-empty` ',
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/executed_rules_result.py b/src/flagright/types/executed_rules_result.py
index 353ae32..180c9a0 100644
--- a/src/flagright/types/executed_rules_result.py
+++ b/src/flagright/types/executed_rules_result.py
@@ -18,15 +18,15 @@ class ExecutedRulesResult(pydantic.BaseModel):
"""
rule_id: str = pydantic.Field(
- alias="ruleId", description=('Unique rule identifier `non-empty` \n')
+ alias="ruleId", description='Unique rule identifier `non-empty` '
)
rule_instance_id: str = pydantic.Field(alias="ruleInstanceId")
rule_name: str = pydantic.Field(
- alias="ruleName", description=('Name of the rule `non-empty` \n')
+ alias="ruleName", description='Name of the rule `non-empty` '
)
rule_description: str = pydantic.Field(
alias="ruleDescription",
- description=('Description of the rule `non-empty` \n'),
+ description='Description of the rule `non-empty` ',
)
rule_action: RuleAction = pydantic.Field(alias="ruleAction")
rule_hit: bool = pydantic.Field(alias="ruleHit")
diff --git a/src/flagright/types/failed_rules_result.py b/src/flagright/types/failed_rules_result.py
index 5c03e7c..3d434e1 100644
--- a/src/flagright/types/failed_rules_result.py
+++ b/src/flagright/types/failed_rules_result.py
@@ -15,14 +15,14 @@ class FailedRulesResult(pydantic.BaseModel):
"""
rule_id: str = pydantic.Field(
- alias="ruleId", description=('Unique rule identifier `non-empty` \n')
+ alias="ruleId", description='Unique rule identifier `non-empty` '
)
rule_name: str = pydantic.Field(
- alias="ruleName", description=('Name of the rule `non-empty` \n')
+ alias="ruleName", description='Name of the rule `non-empty` '
)
rule_description: str = pydantic.Field(
alias="ruleDescription",
- description=('Description of the rule `non-empty` \n'),
+ description='Description of the rule `non-empty` ',
)
failure_exception: RuleFailureException = pydantic.Field(alias="failureException")
diff --git a/src/flagright/types/generic_bank_account_details.py b/src/flagright/types/generic_bank_account_details.py
index d0b0d21..8cf4067 100644
--- a/src/flagright/types/generic_bank_account_details.py
+++ b/src/flagright/types/generic_bank_account_details.py
@@ -17,25 +17,22 @@ class GenericBankAccountDetails(pydantic.BaseModel):
method: GeneralBankAccountPaymentMethod
account_number: typing.Optional[str] = pydantic.Field(
- alias="accountNumber",
- description=('Bank account number `non-empty` \n'),
+ alias="accountNumber", description='Bank account number `non-empty` '
)
account_type: typing.Optional[str] = pydantic.Field(
- alias="accountType", description=("Bank account type. E.g. Checking, Savings etc.\n")
+ alias="accountType", description="Bank account type. E.g. Checking, Savings etc."
)
bank_name: typing.Optional[str] = pydantic.Field(
- alias="bankName", description=('Name of the bank `non-empty` \n')
+ alias="bankName", description='Name of the bank `non-empty` '
)
bank_code: typing.Optional[str] = pydantic.Field(
alias="bankCode",
- description=(
- "Unique identifier of the bank. In some countries, this can be the same as the bank's SWIFT code\n"
- ),
+ description="Unique identifier of the bank. In some countries, this can be the same as the bank's SWIFT code",
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the account holder\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the account holder")
bank_address: typing.Optional[Address] = pydantic.Field(alias="bankAddress")
special_instructions: typing.Optional[str] = pydantic.Field(
- alias="specialInstructions", description=("Special instructions to be specified if any\n")
+ alias="specialInstructions", description="Special instructions to be specified if any"
)
payment_channel: typing.Optional[str] = pydantic.Field(alias="paymentChannel")
diff --git a/src/flagright/types/hit_rules_details.py b/src/flagright/types/hit_rules_details.py
index 1b7f0ad..9d6733a 100644
--- a/src/flagright/types/hit_rules_details.py
+++ b/src/flagright/types/hit_rules_details.py
@@ -18,15 +18,15 @@ class HitRulesDetails(pydantic.BaseModel):
"""
rule_id: str = pydantic.Field(
- alias="ruleId", description=('Unique rule identifier `non-empty` \n')
+ alias="ruleId", description='Unique rule identifier `non-empty` '
)
rule_instance_id: str = pydantic.Field(alias="ruleInstanceId")
rule_name: str = pydantic.Field(
- alias="ruleName", description=('Name of the rule `non-empty` \n')
+ alias="ruleName", description='Name of the rule `non-empty` '
)
rule_description: str = pydantic.Field(
alias="ruleDescription",
- description=('Description of the rule `non-empty` \n'),
+ description='Description of the rule `non-empty` ',
)
rule_action: RuleAction = pydantic.Field(alias="ruleAction")
rule_hit_meta: typing.Optional[RuleHitMeta] = pydantic.Field(alias="ruleHitMeta")
diff --git a/src/flagright/types/iban_details.py b/src/flagright/types/iban_details.py
index 822b443..4b15bfd 100644
--- a/src/flagright/types/iban_details.py
+++ b/src/flagright/types/iban_details.py
@@ -20,23 +20,21 @@ class IbanDetails(pydantic.BaseModel):
method: IbanPaymentMethod
bic: typing.Optional[str] = pydantic.Field(
alias="BIC",
- description=(
- 'Identifier for the bank. Can be routing number, BIK number, SWIFT code, BIC number etc. `non-empty` \n'
- ),
+ description='Identifier for the bank. Can be routing number, BIK number, SWIFT code, BIC number etc. `non-empty` ',
)
bank_name: typing.Optional[str] = pydantic.Field(
- alias="bankName", description=('Name of the bank `non-empty` \n')
+ alias="bankName", description='Name of the bank `non-empty` '
)
bank_address: typing.Optional[Address] = pydantic.Field(alias="bankAddress")
country: typing.Optional[CountryCode]
iban: typing.Optional[str] = pydantic.Field(
- alias="IBAN", description=("Account number of the user. Can be account number, IBAN number etc.\n")
+ alias="IBAN", description="Account number of the user. Can be account number, IBAN number etc."
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the bank account holder\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the bank account holder")
tags: typing.Optional[Tag]
bank_branch_code: typing.Optional[str] = pydantic.Field(
alias="bankBranchCode",
- description=("Branch code of the bank. In some countries, this can be the same as the bank's SWIFT code\n"),
+ description="Branch code of the bank. In some countries, this can be the same as the bank's SWIFT code",
)
payment_channel: typing.Optional[str] = pydantic.Field(alias="paymentChannel")
diff --git a/src/flagright/types/legal_document.py b/src/flagright/types/legal_document.py
index ceb403d..a42d2ab 100644
--- a/src/flagright/types/legal_document.py
+++ b/src/flagright/types/legal_document.py
@@ -18,27 +18,23 @@ class LegalDocument(pydantic.BaseModel):
document_type: str = pydantic.Field(
alias="documentType",
- description=(
- 'User\'s identity document type such as passport, national ID etc. `non-empty` \n'
- ),
+ description='User\'s identity document type such as passport, national ID etc. `non-empty` ',
)
document_number: str = pydantic.Field(
alias="documentNumber",
- description=(
- 'User\'s unique identity document number such as passport number `non-empty` \n'
- ),
+ description='User\'s unique identity document number such as passport number `non-empty` ',
)
document_issued_date: typing.Optional[float] = pydantic.Field(
alias="documentIssuedDate",
- description=("User's identity document issuance date (UNIX timestamp in milliseconds)\n"),
+ description="User's identity document issuance date (UNIX timestamp in milliseconds)",
)
document_expiration_date: typing.Optional[float] = pydantic.Field(
alias="documentExpirationDate",
- description=("User's identity document expiration date (UNIX timestamp in milliseconds)\n"),
+ description="User's identity document expiration date (UNIX timestamp in milliseconds)",
)
document_issued_country: CountryCode = pydantic.Field(alias="documentIssuedCountry")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
name_on_document: typing.Optional[ConsumerName] = pydantic.Field(alias="nameOnDocument")
diff --git a/src/flagright/types/legal_entity.py b/src/flagright/types/legal_entity.py
index 7043be2..9b97aa5 100644
--- a/src/flagright/types/legal_entity.py
+++ b/src/flagright/types/legal_entity.py
@@ -25,7 +25,7 @@ class LegalEntity(pydantic.BaseModel):
alias="companyRegistrationDetails"
)
reason_for_account_opening: typing.Optional[typing.List[str]] = pydantic.Field(
- alias="reasonForAccountOpening", description=("Reason for opening the account at financial institution\n")
+ alias="reasonForAccountOpening", description="Reason for opening the account at financial institution"
)
contact_details: typing.Optional[ContactDetails] = pydantic.Field(alias="contactDetails")
diff --git a/src/flagright/types/list_data.py b/src/flagright/types/list_data.py
index dac3139..94cc7ac 100644
--- a/src/flagright/types/list_data.py
+++ b/src/flagright/types/list_data.py
@@ -16,7 +16,7 @@ class ListData(pydantic.BaseModel):
"""
metadata: typing.Optional[ListMetadata]
- items: typing.Optional[typing.List[ListItem]] = pydantic.Field(description=("List items\n"))
+ items: typing.Optional[typing.List[ListItem]] = pydantic.Field(description="List items")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/list_existed.py b/src/flagright/types/list_existed.py
index 8b1ed91..8c27d11 100644
--- a/src/flagright/types/list_existed.py
+++ b/src/flagright/types/list_existed.py
@@ -17,7 +17,7 @@ class ListExisted(pydantic.BaseModel):
list_id: str = pydantic.Field(alias="listId")
header: ListHeader
- items: typing.List[ListItem] = pydantic.Field(description=("List items\n"))
+ items: typing.List[ListItem] = pydantic.Field(description="List items")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/list_metadata.py b/src/flagright/types/list_metadata.py
index d91559d..125ee2b 100644
--- a/src/flagright/types/list_metadata.py
+++ b/src/flagright/types/list_metadata.py
@@ -9,8 +9,8 @@
class ListMetadata(pydantic.BaseModel):
- name: typing.Optional[str] = pydantic.Field(description=("List name\n"))
- description: typing.Optional[str] = pydantic.Field(description=("List description\n"))
+ name: typing.Optional[str] = pydantic.Field(description="List name")
+ description: typing.Optional[str] = pydantic.Field(description="List description")
status: typing.Optional[bool]
checksum: typing.Optional[str]
diff --git a/src/flagright/types/mcc_details.py b/src/flagright/types/mcc_details.py
index 4441eaf..fa1feae 100644
--- a/src/flagright/types/mcc_details.py
+++ b/src/flagright/types/mcc_details.py
@@ -9,8 +9,8 @@
class MccDetails(pydantic.BaseModel):
- code: float = pydantic.Field(description=("Merchant code\n"))
- description: typing.Optional[str] = pydantic.Field(description=("Merchant Description\n"))
+ code: float = pydantic.Field(description="Merchant code")
+ description: typing.Optional[str] = pydantic.Field(description="Merchant Description")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/mpesa_details.py b/src/flagright/types/mpesa_details.py
index 88f21e6..8a8fbeb 100644
--- a/src/flagright/types/mpesa_details.py
+++ b/src/flagright/types/mpesa_details.py
@@ -17,12 +17,12 @@ class MpesaDetails(pydantic.BaseModel):
method: MpesaPaymentMethod
business_short_code: str = pydantic.Field(
- alias="businessShortCode", description=('Business code `non-empty` \n')
+ alias="businessShortCode", description='Business code `non-empty` '
)
transaction_type: MpesaDetailsTransactionType = pydantic.Field(
- alias="transactionType", description=("Type of transaction\n")
+ alias="transactionType", description="Type of transaction"
)
- phone_number: str = pydantic.Field(alias="phoneNumber", description=("Contact Number of the account holder\n"))
+ phone_number: str = pydantic.Field(alias="phoneNumber", description="Contact Number of the account holder")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/pep_status.py b/src/flagright/types/pep_status.py
index 97320ae..78c89e1 100644
--- a/src/flagright/types/pep_status.py
+++ b/src/flagright/types/pep_status.py
@@ -11,7 +11,7 @@
class PepStatus(pydantic.BaseModel):
is_pep_hit: bool = pydantic.Field(alias="isPepHit")
pep_country: typing.Optional[str] = pydantic.Field(
- alias="pepCountry", description=('`<= 2 characters`\n')
+ alias="pepCountry", description='`<= 2 characters`'
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/person.py b/src/flagright/types/person.py
index baeb00b..b74bf51 100644
--- a/src/flagright/types/person.py
+++ b/src/flagright/types/person.py
@@ -20,12 +20,12 @@ class Person(pydantic.BaseModel):
general_details: UserDetails = pydantic.Field(alias="generalDetails")
legal_documents: typing.Optional[typing.List[LegalDocument]] = pydantic.Field(
- alias="legalDocuments", description=("User's legal identity documents - See Document Model for details\n")
+ alias="legalDocuments", description="User's legal identity documents - See Document Model for details"
)
contact_details: typing.Optional[ContactDetails] = pydantic.Field(alias="contactDetails")
pep_status: typing.Optional[typing.List[PepStatus]] = pydantic.Field(alias="pepStatus")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/risk_score_details.py b/src/flagright/types/risk_score_details.py
new file mode 100644
index 0000000..f5c2f71
--- /dev/null
+++ b/src/flagright/types/risk_score_details.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+import pydantic
+
+from ..core.datetime_utils import serialize_datetime
+from .risk_level import RiskLevel
+
+
+class RiskScoreDetails(pydantic.BaseModel):
+ kyc_risk_score: typing.Optional[float] = pydantic.Field(alias="kycRiskScore")
+ cra_risk_score: typing.Optional[float] = pydantic.Field(alias="craRiskScore")
+ kyc_risk_level: typing.Optional[RiskLevel] = pydantic.Field(alias="kycRiskLevel")
+ cra_risk_level: typing.Optional[RiskLevel] = pydantic.Field(alias="craRiskLevel")
+
+ def json(self, **kwargs: typing.Any) -> str:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().json(**kwargs_with_defaults)
+
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().dict(**kwargs_with_defaults)
+
+ class Config:
+ frozen = True
+ allow_population_by_field_name = True
+ json_encoders = {dt.datetime: serialize_datetime}
diff --git a/src/flagright/types/rule_failure_exception.py b/src/flagright/types/rule_failure_exception.py
index 6abcd87..e4185c0 100644
--- a/src/flagright/types/rule_failure_exception.py
+++ b/src/flagright/types/rule_failure_exception.py
@@ -11,11 +11,11 @@
class RuleFailureException(pydantic.BaseModel):
exception_name: str = pydantic.Field(
alias="exceptionName",
- description=('Unique rule identifier `non-empty` \n'),
+ description='Unique rule identifier `non-empty` ',
)
exception_description: str = pydantic.Field(
alias="exceptionDescription",
- description=('Name of the rule `non-empty` \n'),
+ description='Name of the rule `non-empty` ',
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/rules_results.py b/src/flagright/types/rules_results.py
index 44750f2..b8b463b 100644
--- a/src/flagright/types/rules_results.py
+++ b/src/flagright/types/rules_results.py
@@ -12,10 +12,10 @@
class RulesResults(pydantic.BaseModel):
executed_rules: typing.List[ExecutedRulesResult] = pydantic.Field(
- alias="executedRules", description=("Unique transaction identifier\n")
+ alias="executedRules", description="Unique transaction identifier"
)
hit_rules: typing.List[HitRulesDetails] = pydantic.Field(
- alias="hitRules", description=("Unique transaction identifier\n")
+ alias="hitRules", description="Unique transaction identifier"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/sanctions_details.py b/src/flagright/types/sanctions_details.py
index ec4e43c..8c02eb2 100644
--- a/src/flagright/types/sanctions_details.py
+++ b/src/flagright/types/sanctions_details.py
@@ -12,6 +12,7 @@
class SanctionsDetails(pydantic.BaseModel):
name: str
search_id: str = pydantic.Field(alias="searchId")
+ iban: typing.Optional[str]
entity_type: typing.Optional[SanctionsDetailsEntityType] = pydantic.Field(alias="entityType")
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/swift_details.py b/src/flagright/types/swift_details.py
index a237a38..b427e92 100644
--- a/src/flagright/types/swift_details.py
+++ b/src/flagright/types/swift_details.py
@@ -18,21 +18,21 @@ class SwiftDetails(pydantic.BaseModel):
method: SwiftPaymentMethod
swift_code: typing.Optional[str] = pydantic.Field(
alias="swiftCode",
- description=('SWIFT code of the financial institution `non-empty` \n'),
+ description='SWIFT code of the financial institution `non-empty` ',
)
account_number: typing.Optional[str] = pydantic.Field(
- alias="accountNumber", description=('Account number `non-empty` \n')
+ alias="accountNumber", description='Account number `non-empty` '
)
account_type: typing.Optional[str] = pydantic.Field(
- alias="accountType", description=("Account type. E.g. Checking, Savings etc.\n")
+ alias="accountType", description="Account type. E.g. Checking, Savings etc."
)
bank_name: typing.Optional[str] = pydantic.Field(
- alias="bankName", description=('Name of the bank `non-empty` \n')
+ alias="bankName", description='Name of the bank `non-empty` '
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the account holder\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the account holder")
bank_address: typing.Optional[Address] = pydantic.Field(alias="bankAddress")
special_instructions: typing.Optional[str] = pydantic.Field(
- alias="specialInstructions", description=("Special instructions if any\n")
+ alias="specialInstructions", description="Special instructions if any"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/tag.py b/src/flagright/types/tag.py
index c846628..4f1137e 100644
--- a/src/flagright/types/tag.py
+++ b/src/flagright/types/tag.py
@@ -14,14 +14,10 @@ class Tag(pydantic.BaseModel):
"""
key: str = pydantic.Field(
- description=(
- 'Key value when you are creating a custom variable `non-empty` \n'
- )
+ description='Key value when you are creating a custom variable `non-empty` '
)
value: str = pydantic.Field(
- description=(
- 'Value for a given key when you are creating a custom variable `non-empty` \n'
- )
+ description='Value for a given key when you are creating a custom variable `non-empty` '
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/transaction_amount_details.py b/src/flagright/types/transaction_amount_details.py
index 50c4368..f4ed5ee 100644
--- a/src/flagright/types/transaction_amount_details.py
+++ b/src/flagright/types/transaction_amount_details.py
@@ -15,7 +15,7 @@ class TransactionAmountDetails(pydantic.BaseModel):
Model for transaction amount details
"""
- transaction_amount: float = pydantic.Field(alias="transactionAmount", description=("Amount of the transaction\n"))
+ transaction_amount: float = pydantic.Field(alias="transactionAmount", description="Amount of the transaction")
transaction_currency: CurrencyCode = pydantic.Field(alias="transactionCurrency")
country: typing.Optional[CountryCode]
diff --git a/src/flagright/types/transaction_base.py b/src/flagright/types/transaction_base.py
index 72f839a..e0239c6 100644
--- a/src/flagright/types/transaction_base.py
+++ b/src/flagright/types/transaction_base.py
@@ -17,17 +17,15 @@ class TransactionBase(pydantic.BaseModel):
type: typing.Optional[TransactionType]
transaction_id: str = pydantic.Field(
alias="transactionId",
- description=('Unique transaction identifier `non-empty` \n'),
+ description='Unique transaction identifier `non-empty` ',
)
- timestamp: float = pydantic.Field(description=("Timestamp of when transaction took place\n"))
+ timestamp: float = pydantic.Field(description="Timestamp of when transaction took place")
origin_user_id: typing.Optional[str] = pydantic.Field(
- alias="originUserId", description=("UserId for where the transaction originates from\n")
+ alias="originUserId", description="UserId for where the transaction originates from"
)
destination_user_id: typing.Optional[str] = pydantic.Field(
alias="destinationUserId",
- description=(
- "UserId for transaction's destination. In other words, where the value is being transferred to.\n"
- ),
+ description="UserId for transaction's destination. In other words, where the value is being transferred to.",
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/transaction_event.py b/src/flagright/types/transaction_event.py
new file mode 100644
index 0000000..21d3ebf
--- /dev/null
+++ b/src/flagright/types/transaction_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+import pydantic
+
+from ..core.datetime_utils import serialize_datetime
+from .device_data import DeviceData
+from .transaction_state import TransactionState
+from .transaction_updatable import TransactionUpdatable
+
+
+class TransactionEvent(pydantic.BaseModel):
+ """
+ Model for transaction-related events
+ """
+
+ transaction_state: TransactionState = pydantic.Field(alias="transactionState")
+ timestamp: float = pydantic.Field(description="Timestamp of the event")
+ transaction_id: str = pydantic.Field(
+ alias="transactionId",
+ description='Transaction ID the event pertains to `non-empty` ',
+ )
+ event_id: typing.Optional[str] = pydantic.Field(alias="eventId", description="Unique event ID")
+ reason: typing.Optional[str] = pydantic.Field(description="Reason for the event or a state change")
+ event_description: typing.Optional[str] = pydantic.Field(alias="eventDescription", description="Event description")
+ updated_transaction_attributes: typing.Optional[TransactionUpdatable] = pydantic.Field(
+ alias="updatedTransactionAttributes"
+ )
+ meta_data: typing.Optional[DeviceData] = pydantic.Field(alias="metaData")
+
+ def json(self, **kwargs: typing.Any) -> str:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().json(**kwargs_with_defaults)
+
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().dict(**kwargs_with_defaults)
+
+ class Config:
+ frozen = True
+ allow_population_by_field_name = True
+ json_encoders = {dt.datetime: serialize_datetime}
diff --git a/src/flagright/types/transaction_monitoring_result.py b/src/flagright/types/transaction_monitoring_result.py
index 82ce8b5..a8e11a1 100644
--- a/src/flagright/types/transaction_monitoring_result.py
+++ b/src/flagright/types/transaction_monitoring_result.py
@@ -6,13 +6,15 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
+from .rule_action import RuleAction
from .rules_results import RulesResults
class TransactionMonitoringResult(RulesResults):
transaction_id: str = pydantic.Field(
- alias="transactionId", description=("Transaction ID that the results pertain to\n")
+ alias="transactionId", description="Transaction ID that the results pertain to"
)
+ status: RuleAction
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/transaction_status_details.py b/src/flagright/types/transaction_status_details.py
new file mode 100644
index 0000000..2a617b3
--- /dev/null
+++ b/src/flagright/types/transaction_status_details.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+import pydantic
+
+from ..core.datetime_utils import serialize_datetime
+from .rule_action import RuleAction
+
+
+class TransactionStatusDetails(pydantic.BaseModel):
+ transaction_id: str = pydantic.Field(alias="transactionId")
+ reasons: typing.List[str]
+ status: RuleAction
+
+ def json(self, **kwargs: typing.Any) -> str:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().json(**kwargs_with_defaults)
+
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().dict(**kwargs_with_defaults)
+
+ class Config:
+ frozen = True
+ allow_population_by_field_name = True
+ json_encoders = {dt.datetime: serialize_datetime}
diff --git a/src/flagright/types/transaction_updatable.py b/src/flagright/types/transaction_updatable.py
index b555f62..933e4a2 100644
--- a/src/flagright/types/transaction_updatable.py
+++ b/src/flagright/types/transaction_updatable.py
@@ -26,34 +26,28 @@ class TransactionUpdatable(pydantic.BaseModel):
)
origin_payment_details: typing.Optional[TransactionUpdatableOriginPaymentDetails] = pydantic.Field(
alias="originPaymentDetails",
- description=(
- "Payment details of the origin. It can be a bank account number, wallet ID, card fingerprint etc.\n"
- ),
+ description="Payment details of the origin. It can be a bank account number, wallet ID, card fingerprint etc.",
)
destination_payment_details: typing.Optional[TransactionUpdatableDestinationPaymentDetails] = pydantic.Field(
alias="destinationPaymentDetails",
- description=(
- "Payment details of the destination. It can be a bank account number, wallet ID, card fingerprint etc.\n"
- ),
+ description="Payment details of the destination. It can be a bank account number, wallet ID, card fingerprint etc.",
)
related_transaction_ids: typing.Optional[typing.List[str]] = pydantic.Field(
alias="relatedTransactionIds",
- description=("IDs of transactions related to this transaction. Ex: refund, split bills\n"),
+ description="IDs of transactions related to this transaction. Ex: refund, split bills",
)
product_type: typing.Optional[str] = pydantic.Field(
- alias="productType", description=("Type of produce being used by the consumer (ex wallets, payments etc)\n")
+ alias="productType", description="Type of produce being used by the consumer (ex wallets, payments etc)"
)
promotion_code_used: typing.Optional[bool] = pydantic.Field(
- alias="promotionCodeUsed", description=("Whether a promotion code was used or not the transaction\n")
+ alias="promotionCodeUsed", description="Whether a promotion code was used or not the transaction"
)
reference: typing.Optional[str] = pydantic.Field(
- description=(
- 'Reference field for the transaction indicating the purpose of the transaction etc. `non-empty` \n'
- )
+ description='Reference field for the transaction indicating the purpose of the transaction etc. `non-empty` '
)
device_data: typing.Optional[DeviceData] = pydantic.Field(alias="deviceData")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/transaction_with_rules_result.py b/src/flagright/types/transaction_with_rules_result.py
index fcbc3e2..4a463fb 100644
--- a/src/flagright/types/transaction_with_rules_result.py
+++ b/src/flagright/types/transaction_with_rules_result.py
@@ -8,6 +8,7 @@
from ..core.datetime_utils import serialize_datetime
from .executed_rules_result import ExecutedRulesResult
from .hit_rules_details import HitRulesDetails
+from .rule_action import RuleAction
from .transaction import Transaction
@@ -18,6 +19,7 @@ class TransactionWithRulesResult(Transaction):
executed_rules: typing.List[ExecutedRulesResult] = pydantic.Field(alias="executedRules")
hit_rules: typing.List[HitRulesDetails] = pydantic.Field(alias="hitRules")
+ status: RuleAction
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/post_consumer_transaction_response.py b/src/flagright/types/transactions_verify_response.py
similarity index 92%
rename from src/flagright/types/post_consumer_transaction_response.py
rename to src/flagright/types/transactions_verify_response.py
index d693ae6..d6d604b 100644
--- a/src/flagright/types/post_consumer_transaction_response.py
+++ b/src/flagright/types/transactions_verify_response.py
@@ -7,7 +7,7 @@
from .transaction_monitoring_result import TransactionMonitoringResult
-class PostConsumerTransactionResponse(TransactionMonitoringResult):
+class TransactionsVerifyResponse(TransactionMonitoringResult):
message: typing.Optional[str]
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/upi_details.py b/src/flagright/types/upi_details.py
index 9a1b316..c652a08 100644
--- a/src/flagright/types/upi_details.py
+++ b/src/flagright/types/upi_details.py
@@ -16,16 +16,16 @@ class UpiDetails(pydantic.BaseModel):
method: UpiPaymentMethod
upi_id: str = pydantic.Field(
- alias="upiID", description=('UPI Id number `non-empty` \n')
+ alias="upiID", description='UPI Id number `non-empty` '
)
bank_provider: typing.Optional[str] = pydantic.Field(
- alias="bankProvider", description=('Bank provider name `non-empty` \n')
+ alias="bankProvider", description='Bank provider name `non-empty` '
)
interface_provider: typing.Optional[str] = pydantic.Field(
alias="interfaceProvider",
- description=('Interface provider name `non-empty` \n'),
+ description='Interface provider name `non-empty` ',
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the account holder\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the account holder")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/user_base.py b/src/flagright/types/user_base.py
index e3c1702..ea2f6ae 100644
--- a/src/flagright/types/user_base.py
+++ b/src/flagright/types/user_base.py
@@ -6,7 +6,6 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
-from .user_details import UserDetails
class UserBase(pydantic.BaseModel):
@@ -15,12 +14,9 @@ class UserBase(pydantic.BaseModel):
"""
user_id: str = pydantic.Field(
- alias="userId", description=('Unique user ID `non-empty` \n')
- )
- user_details: typing.Optional[UserDetails] = pydantic.Field(alias="userDetails")
- created_timestamp: float = pydantic.Field(
- alias="createdTimestamp", description=("Timestamp when userId is created\n")
+ alias="userId", description='Unique user ID `non-empty` '
)
+ created_timestamp: float = pydantic.Field(alias="createdTimestamp", description="Timestamp when userId is created")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/user_details.py b/src/flagright/types/user_details.py
index 6b6034e..a0705e2 100644
--- a/src/flagright/types/user_details.py
+++ b/src/flagright/types/user_details.py
@@ -18,12 +18,12 @@ class UserDetails(pydantic.BaseModel):
name: ConsumerName
date_of_birth: typing.Optional[str] = pydantic.Field(
- alias="dateOfBirth", description=("Date of birth of the user (YYYY-MM-DD)\n")
+ alias="dateOfBirth", description="Date of birth of the user (YYYY-MM-DD)"
)
country_of_residence: typing.Optional[CountryCode] = pydantic.Field(alias="countryOfResidence")
country_of_nationality: typing.Optional[CountryCode] = pydantic.Field(alias="countryOfNationality")
gender: typing.Optional[UserDetailsGender] = pydantic.Field(
- description=("Gender of the individual - Male, Female or Non-Binary\n")
+ description="Gender of the individual - Male, Female or Non-Binary"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/user_monitoring_result.py b/src/flagright/types/user_monitoring_result.py
index 5e4690c..44e331c 100644
--- a/src/flagright/types/user_monitoring_result.py
+++ b/src/flagright/types/user_monitoring_result.py
@@ -10,7 +10,7 @@
class UserMonitoringResult(RulesResults):
- user_id: str = pydantic.Field(alias="userId", description=("User ID that the results pertain to\n"))
+ user_id: str = pydantic.Field(alias="userId", description="User ID that the results pertain to")
def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
diff --git a/src/flagright/types/user_optional.py b/src/flagright/types/user_optional.py
index 842b273..f3d82ab 100644
--- a/src/flagright/types/user_optional.py
+++ b/src/flagright/types/user_optional.py
@@ -7,6 +7,7 @@
from ..core.datetime_utils import serialize_datetime
from .acquisition_channel import AcquisitionChannel
+from .consumer_user_segment import ConsumerUserSegment
from .contact_details import ContactDetails
from .kyc_status_details import KycStatusDetails
from .legal_document import LegalDocument
@@ -14,7 +15,7 @@
from .risk_level import RiskLevel
from .tag import Tag
from .transaction_limits import TransactionLimits
-from .user_optional_user_segment import UserOptionalUserSegment
+from .user_details import UserDetails
from .user_state_details import UserStateDetails
@@ -23,20 +24,21 @@ class UserOptional(pydantic.BaseModel):
Model for User details
"""
+ user_details: typing.Optional[UserDetails] = pydantic.Field(alias="userDetails")
user_state_details: typing.Optional[UserStateDetails] = pydantic.Field(alias="userStateDetails")
kyc_status_details: typing.Optional[KycStatusDetails] = pydantic.Field(alias="kycStatusDetails")
legal_documents: typing.Optional[typing.List[LegalDocument]] = pydantic.Field(
- alias="legalDocuments", description=("User's legal identity documents - See Document Model for details\n")
+ alias="legalDocuments", description="User's legal identity documents - See Document Model for details"
)
contact_details: typing.Optional[ContactDetails] = pydantic.Field(alias="contactDetails")
transaction_limits: typing.Optional[TransactionLimits] = pydantic.Field(alias="transactionLimits")
risk_level: typing.Optional[RiskLevel] = pydantic.Field(alias="riskLevel")
acquisition_channel: typing.Optional[AcquisitionChannel] = pydantic.Field(alias="acquisitionChannel")
reason_for_account_opening: typing.Optional[typing.List[str]] = pydantic.Field(alias="reasonForAccountOpening")
- user_segment: typing.Optional[UserOptionalUserSegment] = pydantic.Field(alias="userSegment")
+ user_segment: typing.Optional[ConsumerUserSegment] = pydantic.Field(alias="userSegment")
pep_status: typing.Optional[typing.List[PepStatus]] = pydantic.Field(alias="pepStatus")
tags: typing.Optional[typing.List[Tag]] = pydantic.Field(
- description=("Additional information that can be added via tags\n")
+ description="Additional information that can be added via tags"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/user_response.py b/src/flagright/types/user_response.py
new file mode 100644
index 0000000..2490969
--- /dev/null
+++ b/src/flagright/types/user_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+import pydantic
+
+from ..core.datetime_utils import serialize_datetime
+from .risk_score_details import RiskScoreDetails
+from .user_with_rules_result import UserWithRulesResult
+
+
+class UserResponse(UserWithRulesResult):
+ risk_score_details: typing.Optional[RiskScoreDetails] = pydantic.Field(alias="riskScoreDetails")
+
+ def json(self, **kwargs: typing.Any) -> str:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().json(**kwargs_with_defaults)
+
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
+ return super().dict(**kwargs_with_defaults)
+
+ class Config:
+ frozen = True
+ allow_population_by_field_name = True
+ json_encoders = {dt.datetime: serialize_datetime}
diff --git a/src/flagright/types/user_state.py b/src/flagright/types/user_state.py
index 9527463..cb692e6 100644
--- a/src/flagright/types/user_state.py
+++ b/src/flagright/types/user_state.py
@@ -8,45 +8,33 @@
class UserState(str, enum.Enum):
UNACCEPTABLE = "UNACCEPTABLE"
- UNDECIDED = "UNDECIDED"
TERMINATED = "TERMINATED"
ACTIVE = "ACTIVE"
- INACTIVE = "INACTIVE"
DORMANT = "DORMANT"
CREATED = "CREATED"
- DELETED = "DELETED"
SUSPENDED = "SUSPENDED"
BLOCKED = "BLOCKED"
def visit(
self,
unacceptable: typing.Callable[[], T_Result],
- undecided: typing.Callable[[], T_Result],
terminated: typing.Callable[[], T_Result],
active: typing.Callable[[], T_Result],
- inactive: typing.Callable[[], T_Result],
dormant: typing.Callable[[], T_Result],
created: typing.Callable[[], T_Result],
- deleted: typing.Callable[[], T_Result],
suspended: typing.Callable[[], T_Result],
blocked: typing.Callable[[], T_Result],
) -> T_Result:
if self is UserState.UNACCEPTABLE:
return unacceptable()
- if self is UserState.UNDECIDED:
- return undecided()
if self is UserState.TERMINATED:
return terminated()
if self is UserState.ACTIVE:
return active()
- if self is UserState.INACTIVE:
- return inactive()
if self is UserState.DORMANT:
return dormant()
if self is UserState.CREATED:
return created()
- if self is UserState.DELETED:
- return deleted()
if self is UserState.SUSPENDED:
return suspended()
if self is UserState.BLOCKED:
diff --git a/src/flagright/types/wallet_details.py b/src/flagright/types/wallet_details.py
index 700ee6b..8a03f47 100644
--- a/src/flagright/types/wallet_details.py
+++ b/src/flagright/types/wallet_details.py
@@ -18,21 +18,18 @@ class WalletDetails(pydantic.BaseModel):
method: WalletPaymentMethod
wallet_type: str = pydantic.Field(
alias="walletType",
- description=(
- "Wallet type if there are various types of wallets belonging to the same user. E.g. Checking, savings, vault, different currency wallets etc.\n"
- ),
+ description="Wallet type if there are various types of wallets belonging to the same user. E.g. Checking, savings, vault, different currency wallets etc.",
)
wallet_id: typing.Optional[str] = pydantic.Field(
- alias="walletId",
- description=('Unique ID of the wallet `non-empty` \n'),
+ alias="walletId", description='Unique ID of the wallet `non-empty` '
)
payment_channel: typing.Optional[str] = pydantic.Field(
- alias="paymentChannel", description=("Payment Channel used through wallet\n")
+ alias="paymentChannel", description="Payment Channel used through wallet"
)
- name: typing.Optional[str] = pydantic.Field(description=("Name of the account holder for a specific wallet\n"))
+ name: typing.Optional[str] = pydantic.Field(description="Name of the account holder for a specific wallet")
tags: typing.Optional[Tag]
wallet_phone_number: typing.Optional[str] = pydantic.Field(
- alias="walletPhoneNumber", description=("Phone number associated with the wallet, if any\n")
+ alias="walletPhoneNumber", description="Phone number associated with the wallet, if any"
)
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/webhook_event.py b/src/flagright/types/webhook_event.py
index 42599af..0f70a4d 100644
--- a/src/flagright/types/webhook_event.py
+++ b/src/flagright/types/webhook_event.py
@@ -6,14 +6,14 @@
import pydantic
from ..core.datetime_utils import serialize_datetime
-from .user_state_details import UserStateDetails
+from .webhook_event_data import WebhookEventData
from .webhook_event_type import WebhookEventType
class WebhookEvent(pydantic.BaseModel):
id: str
type: WebhookEventType
- data: UserStateDetails
+ data: WebhookEventData
created_timestamp: float = pydantic.Field(alias="createdTimestamp")
def json(self, **kwargs: typing.Any) -> str:
diff --git a/src/flagright/types/webhook_event_data.py b/src/flagright/types/webhook_event_data.py
new file mode 100644
index 0000000..1490024
--- /dev/null
+++ b/src/flagright/types/webhook_event_data.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .alert_closed_details import AlertClosedDetails
+from .case_closed_details import CaseClosedDetails
+from .transaction_status_details import TransactionStatusDetails
+from .user_state_details import UserStateDetails
+
+WebhookEventData = typing.Union[UserStateDetails, CaseClosedDetails, AlertClosedDetails, TransactionStatusDetails]
diff --git a/src/flagright/types/webhook_event_type.py b/src/flagright/types/webhook_event_type.py
index 58619e6..75c7754 100644
--- a/src/flagright/types/webhook_event_type.py
+++ b/src/flagright/types/webhook_event_type.py
@@ -10,12 +10,14 @@ class WebhookEventType(str, enum.Enum):
CASE_CLOSED = "CASE_CLOSED"
USER_STATE_UPDATED = "USER_STATE_UPDATED"
ALERT_CLOSED = "ALERT_CLOSED"
+ TRANSACTION_STATUS_UPDATED = "TRANSACTION_STATUS_UPDATED"
def visit(
self,
case_closed: typing.Callable[[], T_Result],
user_state_updated: typing.Callable[[], T_Result],
alert_closed: typing.Callable[[], T_Result],
+ transaction_status_updated: typing.Callable[[], T_Result],
) -> T_Result:
if self is WebhookEventType.CASE_CLOSED:
return case_closed()
@@ -23,3 +25,5 @@ def visit(
return user_state_updated()
if self is WebhookEventType.ALERT_CLOSED:
return alert_closed()
+ if self is WebhookEventType.TRANSACTION_STATUS_UPDATED:
+ return transaction_status_updated()
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_client.py b/tests/test_client.py
new file mode 100644
index 0000000..60a58e6
--- /dev/null
+++ b/tests/test_client.py
@@ -0,0 +1,6 @@
+import pytest
+
+# Get started with writing tests with pytest at https://docs.pytest.org
+@pytest.mark.skip(reason="Unimplemented")
+def test_client() -> None:
+ assert True == True