Source code for q2_sdk.hq.db.transaction_type

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 TransactionTypeRow(TableRow): TransactionTypeID: int ShortName: str Description: str BitFlags: int UiTextElementID: int
TransactionTypeRowBase = TransactionTypeRow # Backwards compatibility. Remove in 3.0
[docs] class TransactionType(DbObject): GET_BY_NAME_KEY = "ShortName" NAME = "TransactionType" REPRESENTATION_ROW_CLASS = TransactionTypeRow
[docs] def add_arguments(self, parser: _SubParsersAction): subparser = parser.add_parser("get_transaction_types") subparser.set_defaults(parser="get") subparser.set_defaults(func=partial(self.get, serialize_for_cli=True))
[docs] async def get(self, serialize_for_cli=False) -> List[TransactionTypeRow]: response = await self.call_hq("sdk_GetTransactionTypes") if serialize_for_cli: columns = [ "TransactionTypeID", "ShortName", "Description", "BitFlags", "UiTextElementID", ] response = self.serialize_for_cli(response, columns) return response