11"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
22
33import requests as requests_http
4- from . import utils
54from .account_balances import AccountBalances
65from .accounts import Accounts
6+ from .sdkconfiguration import SDKConfiguration
77from .transaction_categories import TransactionCategories
88from .transactions import Transactions
9+ from codatbanking import utils
910from codatbanking .models import shared
1011
11- SERVERS = [
12- "https://api.codat.io" ,
13- r"""Production"""
14- ]
15- """Contains the list of servers available to the SDK"""
16-
1712class CodatBanking :
1813 r"""Codat's standardized API for accessing banking data.
1914 Codat's Banking API allows you to access standardised data from over bank accounts via third party providers.
@@ -33,15 +28,11 @@ class CodatBanking:
3328 transactions : Transactions
3429 r"""An immutable source of up-to-date information on income and expenditure."""
3530
36- _client : requests_http .Session
37- _security_client : requests_http .Session
38- _server_url : str = SERVERS [0 ]
39- _language : str = "python"
40- _sdk_version : str = "0.16.1"
41- _gen_version : str = "2.34.7"
31+ sdk_configuration : SDKConfiguration
4232
4333 def __init__ (self ,
4434 security : shared .Security = None ,
35+ server_idx : int = None ,
4536 server_url : str = None ,
4637 url_params : dict [str , str ] = None ,
4738 client : requests_http .Session = None
@@ -50,65 +41,31 @@ def __init__(self,
5041
5142 :param security: The security details required for authentication
5243 :type security: shared.Security
44+ :param server_idx: The index of the server to use for all operations
45+ :type server_idx: int
5346 :param server_url: The server URL to use for all operations
5447 :type server_url: str
5548 :param url_params: Parameters to optionally template the server URL with
5649 :type url_params: dict[str, str]
5750 :param client: The requests.Session HTTP client to use for all operations
5851 :type client: requests_http.Session
5952 """
60- self ._client = requests_http .Session ()
53+ if client is None :
54+ client = requests_http .Session ()
6155
56+ security_client = utils .configure_security_client (client , security )
6257
6358 if server_url is not None :
6459 if url_params is not None :
65- self ._server_url = utils .template_url (server_url , url_params )
66- else :
67- self ._server_url = server_url
68-
69- if client is not None :
70- self ._client = client
71-
72- self ._security_client = utils .configure_security_client (self ._client , security )
73-
60+ server_url = utils .template_url (server_url , url_params )
7461
62+ self .sdk_configuration = SDKConfiguration (client , security_client , server_url , server_idx )
63+
7564 self ._init_sdks ()
7665
7766 def _init_sdks (self ):
78- self .account_balances = AccountBalances (
79- self ._client ,
80- self ._security_client ,
81- self ._server_url ,
82- self ._language ,
83- self ._sdk_version ,
84- self ._gen_version
85- )
86-
87- self .accounts = Accounts (
88- self ._client ,
89- self ._security_client ,
90- self ._server_url ,
91- self ._language ,
92- self ._sdk_version ,
93- self ._gen_version
94- )
95-
96- self .transaction_categories = TransactionCategories (
97- self ._client ,
98- self ._security_client ,
99- self ._server_url ,
100- self ._language ,
101- self ._sdk_version ,
102- self ._gen_version
103- )
104-
105- self .transactions = Transactions (
106- self ._client ,
107- self ._security_client ,
108- self ._server_url ,
109- self ._language ,
110- self ._sdk_version ,
111- self ._gen_version
112- )
113-
67+ self .account_balances = AccountBalances (self .sdk_configuration )
68+ self .accounts = Accounts (self .sdk_configuration )
69+ self .transaction_categories = TransactionCategories (self .sdk_configuration )
70+ self .transactions = Transactions (self .sdk_configuration )
11471
0 commit comments