chore: sync submodule state (parent ref update)
Made-with: Cursor
This commit is contained in:
10
sdk/python/dbis_iru/__init__.py
Normal file
10
sdk/python/dbis_iru/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
DBIS IRU Python SDK
|
||||
Client library for IRU integration
|
||||
"""
|
||||
|
||||
from .client import IRUClient
|
||||
from .types import IRUOffering, IRUInquiry, IRUSubscription
|
||||
|
||||
__version__ = "1.0.0"
|
||||
__all__ = ["IRUClient", "IRUOffering", "IRUInquiry", "IRUSubscription"]
|
||||
219
sdk/python/dbis_iru/client.py
Normal file
219
sdk/python/dbis_iru/client.py
Normal file
@@ -0,0 +1,219 @@
|
||||
"""
|
||||
DBIS IRU Python Client
|
||||
"""
|
||||
|
||||
import requests
|
||||
from typing import Optional, Dict, Any, List
|
||||
from .types import IRUOffering, IRUInquiry, IRUSubscription
|
||||
|
||||
|
||||
class IRUClient:
|
||||
"""Client for DBIS IRU API"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
api_base_url: str,
|
||||
api_key: Optional[str] = None,
|
||||
timeout: int = 30
|
||||
):
|
||||
"""
|
||||
Initialize IRU Client
|
||||
|
||||
Args:
|
||||
api_base_url: Base URL for DBIS API
|
||||
api_key: API key for authentication (optional)
|
||||
timeout: Request timeout in seconds
|
||||
"""
|
||||
self.api_base_url = api_base_url.rstrip('/')
|
||||
self.api_key = api_key
|
||||
self.timeout = timeout
|
||||
self.session = requests.Session()
|
||||
|
||||
if api_key:
|
||||
self.session.headers.update({
|
||||
'Authorization': f'Bearer {api_key}'
|
||||
})
|
||||
|
||||
self.session.headers.update({
|
||||
'Content-Type': 'application/json'
|
||||
})
|
||||
|
||||
def get_offerings(
|
||||
self,
|
||||
capacity_tier: Optional[int] = None,
|
||||
institutional_type: Optional[str] = None
|
||||
) -> List[IRUOffering]:
|
||||
"""
|
||||
Get all IRU offerings
|
||||
|
||||
Args:
|
||||
capacity_tier: Filter by capacity tier (1-5)
|
||||
institutional_type: Filter by institutional type
|
||||
|
||||
Returns:
|
||||
List of IRU offerings
|
||||
"""
|
||||
params = {}
|
||||
if capacity_tier:
|
||||
params['capacityTier'] = capacity_tier
|
||||
if institutional_type:
|
||||
params['institutionalType'] = institutional_type
|
||||
|
||||
response = self._request(
|
||||
'GET',
|
||||
'/api/v1/iru/marketplace/offerings',
|
||||
params=params
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def get_offering(self, offering_id: str) -> IRUOffering:
|
||||
"""
|
||||
Get offering by ID
|
||||
|
||||
Args:
|
||||
offering_id: Offering ID
|
||||
|
||||
Returns:
|
||||
IRU offering details
|
||||
"""
|
||||
response = self._request(
|
||||
'GET',
|
||||
f'/api/v1/iru/marketplace/offerings/{offering_id}'
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def submit_inquiry(self, inquiry: IRUInquiry) -> Dict[str, Any]:
|
||||
"""
|
||||
Submit initial inquiry
|
||||
|
||||
Args:
|
||||
inquiry: Inquiry details
|
||||
|
||||
Returns:
|
||||
Inquiry result with inquiry ID and status
|
||||
"""
|
||||
response = self._request(
|
||||
'POST',
|
||||
'/api/v1/iru/marketplace/inquiries',
|
||||
json=inquiry.dict()
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def get_inquiry_status(self, inquiry_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Get inquiry status
|
||||
|
||||
Args:
|
||||
inquiry_id: Inquiry ID
|
||||
|
||||
Returns:
|
||||
Inquiry status details
|
||||
"""
|
||||
response = self._request(
|
||||
'GET',
|
||||
f'/api/v1/iru/marketplace/inquiries/{inquiry_id}'
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def calculate_pricing(
|
||||
self,
|
||||
offering_id: str,
|
||||
usage_profile: Optional[Dict[str, Any]] = None
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Calculate pricing for an offering
|
||||
|
||||
Args:
|
||||
offering_id: Offering ID
|
||||
usage_profile: Optional usage profile
|
||||
|
||||
Returns:
|
||||
Pricing breakdown
|
||||
"""
|
||||
params = {}
|
||||
if usage_profile:
|
||||
import json
|
||||
params['usageProfile'] = json.dumps(usage_profile)
|
||||
|
||||
response = self._request(
|
||||
'GET',
|
||||
f'/api/v1/iru/marketplace/offerings/{offering_id}/pricing',
|
||||
params=params
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def get_dashboard(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Get participant dashboard
|
||||
|
||||
Returns:
|
||||
Dashboard data
|
||||
"""
|
||||
response = self._request(
|
||||
'GET',
|
||||
'/api/v1/iru/portal/dashboard'
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def get_service_health(self, subscription_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Get service health
|
||||
|
||||
Args:
|
||||
subscription_id: Subscription ID
|
||||
|
||||
Returns:
|
||||
Service health data
|
||||
"""
|
||||
response = self._request(
|
||||
'GET',
|
||||
f'/api/v1/iru/portal/monitoring/{subscription_id}/health'
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def get_deployment_status(self, subscription_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Get deployment status
|
||||
|
||||
Args:
|
||||
subscription_id: Subscription ID
|
||||
|
||||
Returns:
|
||||
Deployment status
|
||||
"""
|
||||
response = self._request(
|
||||
'GET',
|
||||
f'/api/v1/iru/portal/deployment/{subscription_id}'
|
||||
)
|
||||
|
||||
return response['data']
|
||||
|
||||
def _request(
|
||||
self,
|
||||
method: str,
|
||||
path: str,
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
json: Optional[Dict[str, Any]] = None
|
||||
) -> Dict[str, Any]:
|
||||
"""Make HTTP request"""
|
||||
url = f"{self.api_base_url}{path}"
|
||||
|
||||
try:
|
||||
response = self.session.request(
|
||||
method=method,
|
||||
url=url,
|
||||
params=params,
|
||||
json=json,
|
||||
timeout=self.timeout
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise Exception(f"API request failed: {str(e)}")
|
||||
89
sdk/python/dbis_iru/types.py
Normal file
89
sdk/python/dbis_iru/types.py
Normal file
@@ -0,0 +1,89 @@
|
||||
"""
|
||||
DBIS IRU Types
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class IRUOffering:
|
||||
"""IRU Offering"""
|
||||
id: str
|
||||
offering_id: str
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
capacity_tier: int = 3
|
||||
institutional_type: str = "CommercialBank"
|
||||
base_price: Optional[float] = None
|
||||
currency: str = "USD"
|
||||
|
||||
def dict(self):
|
||||
"""Convert to dictionary"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'offeringId': self.offering_id,
|
||||
'name': self.name,
|
||||
'description': self.description,
|
||||
'capacityTier': self.capacity_tier,
|
||||
'institutionalType': self.institutional_type,
|
||||
'basePrice': self.base_price,
|
||||
'currency': self.currency,
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class IRUInquiry:
|
||||
"""IRU Inquiry"""
|
||||
offering_id: str
|
||||
organization_name: str
|
||||
institutional_type: str
|
||||
jurisdiction: str
|
||||
contact_email: str
|
||||
contact_phone: Optional[str] = None
|
||||
contact_name: str = ""
|
||||
estimated_volume: Optional[str] = None
|
||||
expected_go_live: Optional[datetime] = None
|
||||
|
||||
def dict(self):
|
||||
"""Convert to dictionary"""
|
||||
data = {
|
||||
'offeringId': self.offering_id,
|
||||
'organizationName': self.organization_name,
|
||||
'institutionalType': self.institutional_type,
|
||||
'jurisdiction': self.jurisdiction,
|
||||
'contactEmail': self.contact_email,
|
||||
'contactName': self.contact_name,
|
||||
}
|
||||
|
||||
if self.contact_phone:
|
||||
data['contactPhone'] = self.contact_phone
|
||||
if self.estimated_volume:
|
||||
data['estimatedVolume'] = self.estimated_volume
|
||||
if self.expected_go_live:
|
||||
data['expectedGoLive'] = self.expected_go_live.isoformat()
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@dataclass
|
||||
class IRUSubscription:
|
||||
"""IRU Subscription"""
|
||||
subscription_id: str
|
||||
offering_id: str
|
||||
subscription_status: str
|
||||
activation_date: Optional[datetime] = None
|
||||
|
||||
def dict(self):
|
||||
"""Convert to dictionary"""
|
||||
data = {
|
||||
'subscriptionId': self.subscription_id,
|
||||
'offeringId': self.offering_id,
|
||||
'subscriptionStatus': self.subscription_status,
|
||||
}
|
||||
|
||||
if self.activation_date:
|
||||
data['activationDate'] = self.activation_date.isoformat()
|
||||
|
||||
return data
|
||||
41
sdk/python/setup.py
Normal file
41
sdk/python/setup.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
DBIS IRU Python SDK Setup
|
||||
"""
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name="dbis-iru-sdk",
|
||||
version="1.0.0",
|
||||
author="DBIS",
|
||||
description="DBIS IRU Python SDK",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/dbis/iru-sdk-python",
|
||||
packages=find_packages(),
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Financial and Insurance Industry",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
],
|
||||
python_requires=">=3.8",
|
||||
install_requires=[
|
||||
"requests>=2.28.0",
|
||||
],
|
||||
extras_require={
|
||||
"dev": [
|
||||
"pytest>=7.0.0",
|
||||
"pytest-cov>=4.0.0",
|
||||
"black>=22.0.0",
|
||||
"mypy>=1.0.0",
|
||||
],
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user