### Get Payment Method Example Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/paymentmethods/README.md Python example demonstrating how to fetch a single payment method using the Codat Lending SDK. It shows client initialization with security and calling the get method with required parameters. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.sales.payment_methods.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "payment_method_id": "7110701885", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### List Payment Methods Example Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/paymentmethods/README.md Python example demonstrating how to list payment methods for a company's connection using the Codat Lending SDK. Includes client setup and calling the list method with pagination and sorting parameters. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.sales.payment_methods.list(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "order_by": "-modifiedDate", "page": 1, "page_size": 100, "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Connection Example (Python) Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/docs/sdks/connectionssdk/README.md Demonstrates how to retrieve a specific connection for a company using the Codat client SDK. It shows the initialization of the client and the call to the get method with company and connection IDs. ```python from codat_common import CodatCommon s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.connections.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if res is not None: # handle response pass ``` -------------------------------- ### Get Specific Connection Example Source: https://github.com/codatio/client-sdk-python/blob/main/platform/docs/sdks/connections/README.md Demonstrates how to retrieve a specific connection for a company using the Codat Platform SDK. It shows the initialization of the client and the call to the get method. ```python from codat_platform import CodatPlatform from codat_platform.models import shared with CodatPlatform( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as cp_client: res = cp_client.connections.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Create Accounting Account - Python SDK Example Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/sync-for-commerce-version-1/docs/sdks/accountingaccounts/README.md Example demonstrating how to create a new accounting account using the Codat Sync Commerce Python SDK. It shows the setup of the client, the request object with account details, and how to call the create method. ```python import codatsynccommerce from codatsynccommerce.models import operations, shared from decimal import Decimal s = codatsynccommerce.CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) req = operations.CreateAccountingAccountRequest( account_prototype=shared.AccountPrototype( currency='GBP', current_balance=Decimal('0'), description='Invoices the business has issued but has not yet collected payment on.', fully_qualified_category='Asset.Current', fully_qualified_name='Cash On Hand', name='Accounts Receivable', nominal_code='610', status=shared.AccountStatus.ACTIVE, supplemental_data=shared.SupplementalData( content={ 'key': { 'key': 'string', }, }, ), type=shared.AccountType.ASSET, valid_datatype_links=[ shared.ValidDataTypeLinks( links=[ 'string', ], ), ], ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171', ) res = s.accounting_accounts.create_accounting_account(req) if res.accounting_create_account_response is not None: # handle response pass ``` -------------------------------- ### Python SDK Example: Get Create Direct Cost Model Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/directcosts/README.md Example usage of the CodatLending SDK to call the get_create_model method for direct costs. Demonstrates client initialization with security and making the API call. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.loan_writeback.direct_costs.get_create_model(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Company Example Usage Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/sync-for-expenses-version-1/docs/sdks/companies/README.md Demonstrates how to use the CodatSyncExpenses client to fetch company details. It shows client initialization, request object creation, and handling the response. ```python import codatsyncexpenses from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) req = operations.GetCompanyRequest( company_id='8a210b68-6988-11ed-a1eb-0242ac120002', ) res = s.companies.get_company(req) if res.company is not None: # handle response pass ``` -------------------------------- ### Get Data Status Example Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/managedata/README.md Demonstrates how to retrieve the data status for a company using the Codat Lending SDK. Includes setup, method call, and response handling. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.manage_data.get_status(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Create API Key with Codat Platform Python SDK (Synchronous and Asynchronous) Source: https://github.com/codatio/client-sdk-python/blob/main/platform/USAGE.md These examples demonstrate how to initialize the Codat Platform Python SDK and create a new API key. The first example shows a synchronous approach, while the second illustrates an asynchronous implementation using `asyncio`. Both examples cover client initialization with API key security and making a call to the settings service to create an API key. ```python # Synchronous Example from codat_platform import CodatPlatform from codat_platform.models import shared with CodatPlatform( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as cp_client: res = cp_client.settings.create_api_key(request={ "name": "azure-invoice-finance-processor", }) assert res is not None # Handle response print(res) ``` ```python # Asynchronous Example import asyncio from codat_platform import CodatPlatform from codat_platform.models import shared async def main(): async with CodatPlatform( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as cp_client: res = await cp_client.settings.create_api_key_async(request={ "name": "azure-invoice-finance-processor", }) assert res is not None # Handle response print(res) asyncio.run(main()) ``` -------------------------------- ### List Integrations Example (Python) Source: https://github.com/codatio/client-sdk-python/blob/main/platform/docs/sdks/integrations/README.md Demonstrates how to list available integrations using the Codat Platform SDK. It shows client initialization with authentication and making the list request. ```python from codat_platform import CodatPlatform from codat_platform.models import shared with CodatPlatform( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as cp_client: res = cp_client.integrations.list(request={ "order_by": "-modifiedDate", "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Python SDK Example: Get Journal Entry Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/accounting/docs/sdks/journalentries/README.md Example demonstrating how to initialize the Codat Accounting SDK and call the get method for journal entries. ```python from codat_accounting import CodatAccounting from codat_accounting.models import shared s = CodatAccounting( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.journal_entries.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "journal_entry_id": "", }) if res is not None: # handle response pass ``` -------------------------------- ### Initialize CodatBanking SDK with Server Index Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/banking/README.md Demonstrates the basic initialization of the CodatBanking SDK using a server index and security credentials. It includes an example of calling the `account_balances.list` method with request parameters. ```python import codat_banking from codat_banking import CodatBanking s = CodatBanking( server_idx=0, security=codat_banking.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.account_balances.list(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "order_by": "-modifiedDate", "page": 1, "page_size": 100, "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) if res is not None: # handle response pass ``` -------------------------------- ### Codat Python SDK Usage Examples Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/README.md Demonstrates how to use the Codat Python SDK for both synchronous and asynchronous operations. It shows initializing the client with an authentication header and making API calls. ```python # Synchronous Example from codat_common import CodatCommon s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.settings.create_api_key(request={ "name": "azure-invoice-finance-processor", }) if res is not None: # handle response pass ``` ```python # Asynchronous Example import asyncio from codat_common import CodatCommon async def main(): s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = await s.settings.create_api_key_async(request={ "name": "azure-invoice-finance-processor", }) if res is not None: # handle response pass asyncio.run(main()) ``` -------------------------------- ### Get Data Integrity Summary Example Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/dataintegrity/README.md Example usage of the Get data integrity summary endpoint using the Codat Lending Python SDK. Demonstrates setting up the client with authentication, making the request with specific parameters, and printing the response. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.data_integrity.summaries(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "data_type": shared.DataIntegrityDataType.BANKING_ACCOUNTS, "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Company Configuration using Python SDK Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-commerce/docs/sdks/advancedcontrols/README.md Provides an example of retrieving a company's commerce sync configuration using the Python SDK. It illustrates the client setup and the call to the `get_configuration` method, specifying the company ID and handling the returned configuration object. ```python from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_commerce: res = codat_sync_commerce.advanced_controls.get_configuration(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### SDK Initialization with Authentication Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/README.md Shows how to initialize the CodatCommon SDK with an API key for authentication. It includes an example of making an API call to create an API key. ```python from codat_common import CodatCommon s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.settings.create_api_key(request={ "name": "azure-invoice-finance-processor", }) if res is not None: # handle response pass ``` -------------------------------- ### List Connections Example (Python) Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/docs/sdks/connectionssdk/README.md Shows how to list all connections for a company using the Codat client SDK. This example includes optional parameters for ordering, pagination, and querying. ```python from codat_common import CodatCommon s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.connections.list(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "order_by": "-modifiedDate", "page": 1, "page_size": 100, "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) if res is not None: # handle response pass ``` -------------------------------- ### Python Example: Get Customer Attachment Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/accounting/docs/sdks/customers/README.md Example Python code demonstrating how to initialize the CodatAccounting client and call the get_attachment method for a customer. ```python from codat_accounting import CodatAccounting from codat_accounting.models import shared s = CodatAccounting( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.customers.get_attachment(request={ "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "customer_id": "", }) if res is not None: # handle response pass ``` -------------------------------- ### Synchronous SDK Usage with CodatSyncCommerce Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-commerce/USAGE.md Demonstrates initializing the CodatSyncCommerce client for synchronous API calls. It includes setting up authentication with an API key and making a request to get sync flow settings. ```python # Synchronous Example from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_commerce: res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={ "locale": shared.Locale.EN_US, }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Example: Get Create Bank Account Model Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-expenses/docs/sdks/bankaccounts/README.md Example usage of the `get_create_model` method for bank accounts in the Codat Python SDK. ```python from codat_sync_for_expenses import CodatSyncExpenses from codat_sync_for_expenses.models import shared with CodatSyncExpenses( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_expenses: res = codat_sync_expenses.bank_accounts.get_create_model(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if res is not None: # handle response pass ``` -------------------------------- ### Get Supplier (Python Example) Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-expenses/docs/sdks/suppliers/README.md Python code demonstrating how to use the Codat Sync for Expenses SDK to get a specific supplier. It shows setting up the client and making the get call with company and supplier IDs. ```python from codat_sync_for_expenses import CodatSyncExpenses from codat_sync_for_expenses.models import shared with CodatSyncExpenses( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_expenses: res = codat_sync_expenses.suppliers.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "supplier_id": "7110701885", }) if res is not None: # handle response pass ``` -------------------------------- ### Create Account Example Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-payroll/docs/sdks/accounts/README.md Demonstrates how to create a new account for a company's connection using the Codat Sync for Payroll Python SDK. It includes setting up the client with authentication and defining the request parameters. ```python import codatsyncpayroll from codatsyncpayroll.models import operations, shared s = codatsyncpayroll.CodatSyncPayroll( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) req = operations.CreateAccountRequest( company_id='8a210b68-6988-11ed-a1eb-0242ac120002', connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171', ) res = s.accounts.create(req) if res.create_account_response is not None: # handle response pass ``` -------------------------------- ### Python SDK Example: Get Company Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/companies/README.md Demonstrates how to use the Codat Lending Python SDK to fetch company details. It shows client initialization with authentication and making the 'get' request. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.companies.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Python SDK Example - Initialization Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-commerce/docs/sdks/codatsynccommerce/README.md This snippet demonstrates how to initialize the Codat Sync for Commerce Python SDK. It typically involves setting up the client with necessary authentication credentials and configuration, though specific initialization code is not provided in the source text. ```Python # Example initialization (actual code not provided in source text) # from codat_sync_commerce.client import SyncCommerceClient # client = SyncCommerceClient(api_key='YOUR_API_KEY', company_id='YOUR_COMPANY_ID') ``` -------------------------------- ### Python Get Create Model Example Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/sync-for-payables-version-1/docs/sdks/journals/README.md Example demonstrating how to use the CodatSyncPayables client to fetch the create journal model. It shows client initialization with authentication and making the API call. ```python from codat_sync_for_payables_version_1 import CodatSyncPayables from codat_sync_for_payables_version_1.models import shared s = CodatSyncPayables( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.journals.get_create_model(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if res is not None: # handle response pass ``` -------------------------------- ### Create Supplier (Python Example) Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-expenses/docs/sdks/suppliers/README.md Python code demonstrating how to use the Codat Sync for Expenses SDK to create a supplier. It shows setting up the client and making the create call with necessary parameters. ```python from codat_sync_for_expenses import CodatSyncExpenses from codat_sync_for_expenses.models import shared with CodatSyncExpenses( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_expenses: res = codat_sync_expenses.suppliers.create(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "supplier": { "status": shared.SupplierStatus.ACTIVE, "contact_name": "Joe Bloggs", "id": "73593", "supplier_name": "test 20230420 1004", }, }) if res is not None: # handle response pass ``` -------------------------------- ### Create Account Python Example Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-expenses/docs/sdks/accounts/README.md Example Python code demonstrating how to use the Codat Sync for Expenses SDK to create an account. It shows setting up the client with authentication and making the create call with necessary parameters. ```python from codat_sync_for_expenses import CodatSyncExpenses from codat_sync_for_expenses.models import shared from decimal import Decimal with CodatSyncExpenses( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_expenses: res = codat_sync_expenses.accounts.create(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "account_prototype": { "currency": "USD", "current_balance": Decimal("0"), "description": "Invoices the business has issued but has not yet collected payment on.", "fully_qualified_category": "Asset.Current", "fully_qualified_name": "Fixed Asset", "name": "Accounts Receivable", "nominal_code": "610", "status": shared.AccountStatus.ACTIVE, "type": shared.AccountType.ASSET, }, }) if res is not None: # handle response pass ``` -------------------------------- ### SDK Installation Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/sync-for-expenses-version-1/README.md Installs the Codat Sync for Expenses Python SDK using pip. ```bash pip install codat-sync-for-expenses-version-1 ``` -------------------------------- ### Synchronous SDK Example Source: https://github.com/codatio/client-sdk-python/blob/main/platform/README.md Demonstrates a synchronous usage pattern for the Codat Platform SDK. It shows how to initialize the client and make a call to the client_rate_limit_reached method with a sample request payload. ```python # Synchronous Example from codat_platform import CodatPlatform with CodatPlatform() as cp_client: cp_client.client_rate_limit_reached(request={ "event_type": "client.rateLimit.reached", "generated_date": "2024-09-01T00:00:00Z", "id": "743ec94a-8aa4-44bb-8bd4-e1855ee0e74b", "payload": { "daily_quota": 12000, "expiry_date": "2024-09-01T12:14:14Z", "quota_remaining": 0, }, }) # Use the SDK ... ``` -------------------------------- ### Get Bank Account Mapping Example Source: https://github.com/codatio/client-sdk-python/blob/main/bank-feeds/docs/sdks/accountmapping/README.md Demonstrates how to use the `get` method from the Codat Bank Feeds SDK to retrieve bank account mapping information. ```python from codat_bankfeeds import CodatBankFeeds from codat_bankfeeds.models import shared with CodatBankFeeds( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_bank_feeds: res = codat_bank_feeds.account_mapping.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Commerce Customer Retention Metrics Python Example Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/assess/docs/sdks/reports/README.md Example demonstrating how to use the CodatAssess client to fetch customer retention metrics for a company connection. ```python from codat_assess import CodatAssess from codat_assess.models import shared s = CodatAssess( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.reports.get_commerce_customer_retention_metrics(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "number_of_periods": 10128, "period_length": 474636, "period_unit": shared.PeriodUnit.MONTH, "report_date": "29-09-2020", }) if res is not None: # handle response pass ``` -------------------------------- ### Install SDK using pip Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-expenses/README.md Installs the Codat Sync for Expenses SDK using pip, the default Python package installer, from PyPI. ```bash pip install codat-sync-for-expenses ``` -------------------------------- ### Get Create Item Model Example Usage Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/accounting/docs/sdks/items/README.md Example of how to use the get_create_model method from the Codat Accounting client to fetch the data structure for creating an item. ```python from codat_accounting import CodatAccounting from codat_accounting.models import shared s = CodatAccounting( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.items.get_create_model(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) if res is not None: # handle response pass ``` -------------------------------- ### Get Direct Income Example Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/accounting/docs/sdks/directincomes/README.md Demonstrates how to retrieve a specific direct income for a given company and connection ID using the Codat Accounting SDK. It shows the initialization of the client and the call to the get method. ```python from codat_accounting import CodatAccounting from codat_accounting.models import shared s = CodatAccounting( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) res = s.direct_incomes.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "direct_income_id": "", }) if res is not None: # handle response pass ``` -------------------------------- ### Asynchronous SDK Usage with CodatSyncCommerce Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-commerce/USAGE.md Demonstrates initializing the CodatSyncCommerce client for asynchronous API calls using asyncio. It shows setting up authentication and making an async request to get sync flow settings. ```python # Asynchronous Example import asyncio from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared async def main(): async with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_sync_commerce: res = await codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow_async(request={ "locale": shared.Locale.EN_US, }) assert res is not None # Handle response print(res) asyncio.run(main()) ``` -------------------------------- ### Initialize Codat SDK with API Key Authentication Source: https://github.com/codatio/client-sdk-python/blob/main/lending/README.md Demonstrates how to initialize the Codat SDK client with API key authentication using the `security` parameter and making an initial API call. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.companies.create(request={ "name": "Technicalium", "description": "Requested early access to the new financing scheme.", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Generate Credentials Example Source: https://github.com/codatio/client-sdk-python/blob/main/bank-feeds/docs/sdks/sourceaccounts/README.md Python example demonstrating how to generate bank account credentials using the CodatBankFeeds SDK. It shows the setup with security and the call to the generate_credentials method. ```python from codat_bankfeeds import CodatBankFeeds from codat_bankfeeds.models import shared with CodatBankFeeds( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_bank_feeds: res = codat_bank_feeds.source_accounts.generate_credentials(request={ "request_body": open("example.file", "rb"), "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Install Codat Python SDK Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/README.md Instructions for installing the Codat Python SDK using package managers pip and poetry. Pip is the default installer for Python packages from PyPI, while poetry offers advanced dependency management. ```bash pip install codat-common ``` ```bash poetry add codat-common ``` -------------------------------- ### Get Company Example Source: https://github.com/codatio/client-sdk-python/blob/main/bank-feeds/docs/sdks/companies/README.md Demonstrates how to retrieve a single company using the Codat Bank Feeds Python SDK. It shows the initialization of the client and the call to the get method for company data. ```python from codat_bankfeeds import CodatBankFeeds from codat_bankfeeds.models import shared with CodatBankFeeds( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_bank_feeds: res = codat_bank_feeds.companies.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Direct Cost Example Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/codatlendingdirectcosts/README.md Example of how to retrieve a single direct cost using the Codat Lending Python SDK. It shows client initialization, request parameters, and response handling. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.transactions.direct_costs.get(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "direct_cost_id": "7110701885", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Python SDK: Synchronous API Key Creation Source: https://github.com/codatio/client-sdk-python/blob/main/previous-versions/common/USAGE.md Demonstrates synchronous SDK usage for creating an API key. Initializes CodatCommon with an auth header and calls the `create_api_key` method. Handles potential responses. ```python # Synchronous Example from codat_common import CodatCommon s = CodatCommon( auth_header="Basic BASE_64_ENCODED(API_KEY)", ) res = s.settings.create_api_key(request={ "name": "azure-invoice-finance-processor", }) if res is not None: # handle response pass ``` -------------------------------- ### Install SDK with Poetry Source: https://github.com/codatio/client-sdk-python/blob/main/platform/README.md Installs the Codat Platform SDK using Poetry, a modern tool for dependency management and package publishing. It uses a single pyproject.toml file for project metadata and dependencies. ```bash poetry add codat-platform ``` -------------------------------- ### Get Journal (Python) Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-payroll/docs/sdks/journals/README.md Example usage for retrieving a single journal by its ID using the Codat Sync for Payroll Python SDK. It shows how to initialize the client and make the get journal request. ```python import codatsyncpayroll from codatsyncpayroll.models import operations, shared s = codatsyncpayroll.CodatSyncPayroll( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) req = operations.GetJournalRequest( company_id='8a210b68-6988-11ed-a1eb-0242ac120002', journal_id='', ) res = s.journals.get(req) if res.journal is not None: # handle response pass ``` -------------------------------- ### List Customers Example Usage Source: https://github.com/codatio/client-sdk-python/blob/main/lending/docs/sdks/customers/README.md Demonstrates how to initialize the CodatLending client and call the list method for customers, including setting authentication and request parameters. ```python from codat_lending import CodatLending from codat_lending.models import shared with CodatLending( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) as codat_lending: res = codat_lending.accounts_receivable.customers.list(request={ "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", "order_by": "-modifiedDate", "page": 1, "page_size": 100, "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", }) assert res is not None # Handle response print(res) ``` -------------------------------- ### Get Journal Entry Example Source: https://github.com/codatio/client-sdk-python/blob/main/sync-for-payroll/docs/sdks/journalentries/README.md Illustrates fetching a single journal entry by its ID using the CodatSyncPayroll client. Includes client initialization and making the get request with company and journal entry IDs. ```python import codatsyncpayroll from codatsyncpayroll.models import operations, shared s = codatsyncpayroll.CodatSyncPayroll( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), ) req = operations.GetJournalEntryRequest( company_id='8a210b68-6988-11ed-a1eb-0242ac120002', journal_entry_id='', ) res = s.journal_entries.get(req) if res.journal_entry is not None: # handle response pass ```