class TffConfiguration(TO): """ Args: rogerthat(RogerthatConfiguration) ledger(LedgerConfiguration) odoo(OdooConfiguration) support_emails(list[string]) orchestator(OrchestatorConfiguration) investor(InvestorConfiguration) apple(AppleConfiguration) backup_disabled(bool) intercom_admin_id(unicode) cloudstorage_encryption_key(unicode) onfido(OnfidoConfiguration) influxdb(InfluxDBConfig) """ rogerthat = typed_property('1', RogerthatConfiguration, False) ledger = typed_property('3', LedgerConfiguration, False) odoo = typed_property('4', OdooConfiguration, False) orchestator = typed_property('5', OrchestatorConfiguration, False) support_emails = unicode_list_property('support_emails') backup_disabled = bool_property('backup_disabled') intercom_admin_id = long_property('intercom_admin_id') cloudstorage_encryption_key = unicode_property( 'cloudstorage_encryption_key') exchangerate_key = unicode_property('exchangerate_key') onfido = typed_property('onfido', OnfidoConfiguration) influxdb = typed_property('influxdb', InfluxDBConfig)
class MenuCategory(object): name = unicode_property('1') items = typed_property('2', MenuItem, True) index = long_property('3') predescription = unicode_property('4') postdescription = unicode_property('5') id = unicode_property('6')
class Address(object): street = unicode_property('1') house_number = long_property('2') bus = unicode_property('3') zipcode = unicode_property('4') city = unicode_property('5') country = unicode_property('6')
class InfluxDBConfig(TO): host = unicode_property('host') ssl = bool_property('ssl') port = long_property('port') database = unicode_property('database') username = unicode_property('username') password = unicode_property('password')
class IYOSeeDocumentView(IYOSeeDocumenVersion): username = unicode_property('51') globalid = unicode_property('52') uniqueid = unicode_property('53') def __init__(self, username=None, globalid=None, uniqueid=None, version=1, category=None, link=None, content_type=None, markdown_short_description=None, markdown_full_description=None, creation_date=None, start_date=None, end_date=None, keystore_label=None, signature=None, **kwargs): super(IYOSeeDocumentView, self).__init__(version, category, link, content_type, markdown_short_description, markdown_full_description, creation_date, start_date, end_date, keystore_label, signature, **kwargs) self.username = convert_to_unicode(username) self.globalid = convert_to_unicode(globalid) self.uniqueid = convert_to_unicode(uniqueid)
class RegioManagerBaseTO(object): email = unicode_property('1') name = unicode_property('2') app_ids = unicode_list_property('3') show_in_stats = bool_property('4') internal_support = bool_property('5') phone = unicode_property('6') team_id = long_property('7') admin = bool_property('8') @classmethod def from_model(cls, model): to = cls() to.email = model.email to.name = model.name to.app_ids = sorted([ app_id for app_id in model.app_ids if app_id not in model.read_only_app_ids ]) to.show_in_stats = model.show_in_stats to.internal_support = model.internal_support to.phone = model.phone to.team_id = model.team_id to.admin = model.admin return to
class OrderItemTO(SerializableTO): id = long_property('0') number = long_property('1') product = unicode_property('2') comment = unicode_property('3') count = long_property('4') price = long_property('5') app_id = unicode_property('6') service_visible_in = unicode_property('7') @classmethod def create(cls, model, subscription_order_date=None): item = OrderItemTO() item.id = model.key().id() item.number = model.number item.product = model.product.code item.comment = model.comment item.count = model.count item.price = model.price item.app_id = getattr(model, 'app_id', None) # dynamic property if item.app_id: item.service_visible_in = subscription_order_date else: item.service_visible_in = None return item
class TffConfiguration(TO): """ Args: rogerthat(RogerthatConfiguration) ledger(LedgerConfiguration) odoo(OdooConfiguration) orchestator(OrchestatorConfiguration) investor(InvestorConfiguration) apple(AppleConfiguration) backup_disabled(bool) intercom_admin_id(unicode) cloudstorage_encryption_key(unicode) onfido(OnfidoConfiguration) """ rogerthat = typed_property('1', RogerthatConfiguration, False) ledger = typed_property('3', LedgerConfiguration, False) odoo = typed_property('4', OdooConfiguration, False) orchestator = typed_property('5', OrchestatorConfiguration, False) investor = typed_property('6', InvestorConfiguration, False) apple = typed_property('apple', AppleConfiguration) backup_disabled = bool_property('backup_disabled') intercom_admin_id = long_property('intercom_admin_id') cloudstorage_encryption_key = unicode_property( 'cloudstorage_encryption_key') exchangerate_key = unicode_property('exchangerate_key') onfido = typed_property('onfido', OnfidoConfiguration)
class TickerEntryTO(TO): date = unicode_property('date') data = typed_property('data', dict) id = unicode_property('id') type = unicode_property('type') # one of ['flow', 'installation'] def to_dict(self, include=None, exclude=None): return super(TickerEntryTO, self).to_dict(exclude=exclude or ['id'])
class TffProfileTO(TO): username = unicode_property('username') app_user = unicode_property('app_user') referrer_user = unicode_property('referrer_user') referrer_username = unicode_property('referrer_username') nodes = typed_property('nodes', dict, True) referral_code = unicode_property('referral_code') kyc = typed_property('kyc', dict)
class CreateInvestmentAgreementTO(TO): app_user = unicode_property('app_user') amount = float_property('amount') currency = unicode_property('currency') document = unicode_property('document') token = unicode_property('token') status = long_property('status') sign_time = long_property('sign_time') paid_time = long_property('paid_time')
class IYOKeyStoreKeyData(TO): timestamp = unicode_property('1') comment = unicode_property('2') algorithm = unicode_property('3') def __init__(self, timestamp=None, comment=None, algorithm=None, **kwargs): self.timestamp = convert_to_unicode(timestamp) self.comment = convert_to_unicode(comment) self.algorithm = convert_to_unicode(algorithm)
class EventTO(TO): id = long_property('id') type = long_property('type') title = unicode_property('title') description = unicode_property('description') location = unicode_property('location') start_timestamp = unicode_property('start_timestamp') end_timestamp = unicode_property('end_timestamp') past = bool_property('past')
class GlobalStatsTO(TO): id = unicode_property('id') name = unicode_property('name') token_count = long_property('token_count') unlocked_count = long_property('unlocked_count') value = float_property('value') currencies = typed_property('currencies', CurrencyValueTO, True) # type: list[CurrencyValueTO] market_cap = float_property('market_cap')
class OdooConfiguration(TO): url = unicode_property('1') database = unicode_property('2') username = unicode_property('3') password = unicode_property('4') incoterm = long_property('5') payment_term = long_property('6') product_ids = typed_property( 'product_ids', dict) # key: the node's socket type, value: product id
class BaseTransactionTO(TO): timestamp = long_property('timestamp') unlock_timestamps = long_list_property('unlock_timestamps') unlock_amounts = long_list_property('unlock_amounts') token = unicode_property('token') token_type = unicode_property('token_type') amount = long_property('amount') memo = unicode_property('memo') app_users = unicode_list_property('app_users') from_user = unicode_property('from_user') to_user = unicode_property('to_user')
class SimpleAppTO(object): id = unicode_property('0') name = unicode_property('1') orderable_app_ids = unicode_list_property('2') @staticmethod def create(model): app = SimpleAppTO() app.id = model.app_id app.name = model.name app.orderable_app_ids = model.orderable_app_ids return app
class ShopProductTO(object): app_id = unicode_property('0') code = unicode_property('1') count = long_property('2') @classmethod def create(cls, app_id, code, count): to = cls() to.app_id = app_id to.code = code to.count = count return to
class CreateNodeOrderTO(TO): app_user = unicode_property('app_user') billing_info = typed_property('billing_info', ContactInfoTO) # type: ContactInfoTO shipping_info = typed_property('shipping_info', ContactInfoTO) # type: ContactInfoTO status = long_property('status') order_time = long_property('order_time') sign_time = long_property('sign_time') send_time = long_property('send_time') odoo_sale_order_id = long_property('odoo_sale_order_id') document = unicode_property('document')
class PaymentProviderAssetTO(TO): provider_id = unicode_property('1') id = unicode_property('2') type = unicode_property('3') name = unicode_property('4') currency = unicode_property('5') available_balance = typed_property('6', PaymentAssetBalanceTO) total_balance = typed_property('7', PaymentAssetBalanceTO) verified = bool_property('8') enabled = bool_property('9') has_balance = bool_property('10') has_transactions = bool_property('11') required_action = typed_property('12', PaymentAssetRequiredActionTO)
class MenuItem(object): VISIBLE_IN_MENU = 1 VISIBLE_IN_ORDER = 2 name = unicode_property('1') price = long_property('2') description = unicode_property('3') visible_in = long_property('4') unit = long_property('5') step = long_property('6') image_id = long_property('7') qr_url = unicode_property('8') has_price = bool_property('9') id = unicode_property('10')
class IYOKeyStoreKey(TO): key = unicode_property('1') globalid = unicode_property('2') username = unicode_property('3') label = unicode_property('4') keydata = typed_property('5', IYOKeyStoreKeyData, False) def __init__(self, key=None, globalid=None, username=None, label=None, keydata=None, **kwargs): self.key = convert_to_unicode(key) self.globalid = convert_to_unicode(globalid) self.username = convert_to_unicode(username) self.label = convert_to_unicode(label) self.keydata = IYOKeyStoreKeyData(**keydata) if keydata else None
class Shift(object): name = unicode_property('1', 'Name of the shift. Eg Lunch, Dinner') start = long_property( '2', 'Start of the shift expressed in a number of seconds since midnight.') end = long_property( '3', 'End of the shift expressed in a number of seconds since midnight.') leap_time = long_property( '4', 'The time preceding the shift in which the customer cannot automatically make a reservation anymore expressed in minutes.' ) capacity = long_property( '5', 'Max number of people attending the restaurant for this shift.') threshold = long_property( '6', 'Percentage of the capacity that allows auto-booking of reservations.') max_group_size = long_property('7', 'Max number of people in one reservation.') days = long_list_property( '8', 'Days on which this shift applies. 1=Monday, 7=Sunday') def __eq__(self, other): if not isinstance(other, Shift): return False return self.start == other.start and self.end == other.end and self.days == other.days
class TaskListTO(object): assignee = unicode_property('0') assignee_name = unicode_property('1') tasks = typed_property('2', TaskTO, True) @classmethod def create(cls, email, regio_manager, tasks, prospects): to = cls() to.assignee = email.decode('utf-8') to.assignee_name = (regio_manager.name if regio_manager else email).decode('utf-8') to.tasks = list() for task in tasks: prospect = prospects[task.parent_key().name()] to.tasks.append(TaskTO.from_model(task, prospect)) return to
class SolutionUser(object): name = unicode_property('1') email = unicode_property('2') avatar_url = unicode_property('3') language = unicode_property('4') app_id = unicode_property('5') @staticmethod def fromTO(to): u = SolutionUser() u.name = to.name u.email = to.email u.avatar_url = to.avatar_url u.language = to.language u.app_id = to.app_id return u
class ContactTO(object): id = long_property('0') first_name = unicode_property('1') last_name = unicode_property('2') email = unicode_property('3') phone_number = unicode_property('4') @staticmethod def fromContactModel(contact): c = ContactTO() c.id = contact.id c.first_name = contact.first_name c.last_name = contact.last_name c.email = contact.email c.phone_number = contact.phone_number return c
class Dummy(object): f1 = unicode_property('1') f2 = bool_property('2') f3 = float_property('3') f4 = long_property('4') f5 = unicode_list_property('5') f6 = typed_property('6', InnerDummy) f7 = typed_property('7', InnerDummy, True)
class ValidateVatReturnStatusTO(ReturnStatusTO): vat = unicode_property('vat') @classmethod def create(cls, success, errormsg, vat=None): to = super(ValidateVatReturnStatusTO, cls).create(success, errormsg) to.vat = vat return to
class CustomerChargesTO(object): customer_charges = typed_property('1', CustomerChargeTO, True) # related to manager/user is_admin = bool_property('2') is_reseller = bool_property('3') is_payment_admin = bool_property('4') cursor = unicode_property('5')
class MyLittleTO(object): name = unicode_property('name') age = long_property('age') def __str__(self): return u"%s is %s years old" % (self.name, self.age) def __eq__(self, other): return self.name == other.name and self.age == other.age