Source code for q2_sdk.hq.db.currency_code

from argparse import _SubParsersAction
from functools import partial
from typing import List

from q2_sdk.hq.table_row import TableRow

from .db_object import DbObject


[docs] class CurrencyCodeRow(TableRow): CurrencyCodeID: int CurrencyCode: str CurrencyName: str CurrencySymbol: str IsValidForIntWires: bool CurrencyGroupSizes: int CurrencyGroupSeparator: str CurrencyDecimalSeparator: str CurrencyDecimalDigits: int CultureInfo: str
[docs] class CurrencyCode(DbObject): GET_BY_NAME_KEY = "CurrencyCode" NAME = "CurrencyCode" REPRESENTATION_ROW_CLASS = CurrencyCodeRow
[docs] def add_arguments(self, parser: _SubParsersAction): subparser = parser.add_parser("get_currency_codes") subparser.set_defaults(parser="get_currency_codes") subparser.set_defaults(func=partial(self.get, serialize_for_cli=True)) subparser.add_argument( "-i", "--valid_for_international_wires", action="store_true", help="Q2_CurrencyCode.IsValidForIntWires", )
[docs] async def get( self, valid_for_international_wires: bool = False, serialize_for_cli=False ) -> List[CurrencyCodeRow]: response = await self.call_hq("sdk_GetCurrencyCode") if valid_for_international_wires: response = [x for x in response if x.IsValidForIntWires.pyval] if serialize_for_cli: columns = [ "CurrencyCodeID", "CurrencyCode", "CurrencyName", "CurrencySymbol", "IsValidForIntWires", "CurrencyDecimalDigits", "CultureInfo", ] response = self.serialize_for_cli(response, columns) return response