class Overlord(Larva): ''' Overlord -------- Overlords provide control for your minions. As your forces grow in number, you must hatch more overlords to control them. ''' queen = types.URLType(default=False) cerebrate = types.URLType(default=True)
class TropicalNode(Node): ''' Node basic data structure ''' # minion centurion cebus = types.URLType(default=False) # minion overlord hawks = types.URLType(default=True) # minion units capuchins = compound.ModelType(Unit) # minion squirrel servants squirrels = compound.ModelType(Unit)
class WeatherReport(Model): """Some sample class for Weather report""" city = types.StringType(max_length=50, metadata={'readOnly': True}) temperature = types.DecimalType(required=True) taken_at = types.DateTimeType(default=datetime.datetime.now) author = types.EmailType() some_url = types.URLType()
class Treant(Node): ''' Treants are sentient tree forts with monkey characteristics. They are typically portrayed as protectors of the forests and antagonists to industrialization and despoiling of nature. The tree itself is a species of willow, most likely a weeping willow. It appears to be completely hollow. The entire interior of the tree trunk is covered in boards. ''' cebus = types.URLType(default=False) hawk = types.URLType(default=True)
class BaseAccount(models.Model): ''' Base account ''' uuid = types.UUIDType(default=uuid.uuid4) passwords = compound.ListType(compound.ModelType(Password)) # api samples, remove after finish work on passwords or otherwise secret keys. api_key = types.StringType(required=False) # api_keys = compound.ListType(compound.ModelType(Mon)) # system admin account is_admin = types.BooleanType(default=False) active = types.BooleanType(default=True) account = types.StringType(required=True) name = types.StringType(required=False) email = types.EmailType(required=True) phone_number = types.StringType() country_code = types.StringType() timezone = types.StringType() location = types.StringType() resources = compound.ModelType(Resource) routes = compound.ListType(compound.ModelType(Route)) uri = types.StringType(required=False) url = types.URLType() # move this to howler and spider? max_channels = types.IntType()
class CameraValidator(Model): T = types.DateTimeType(required=True) name = types.StringType(required=True) link = types.URLType(required=True) price = types.NumberType(required=True, min_value=1) spider = types.StringType(required=True, min_length=1) uid = types.StringType() ean = types.StringType() mfr = types.StringType()
class Asset(models.Model): """ Wrapper for asset objects (embedded in Media objects) for results from the Wistia API """ url = types.URLType( required=True, metadata=dict(description="A direct-access URL to the content of the asset"), ) width = types.IntType( required=True, metadata=dict( description="(optional) The width of this specific asset, if applicable" ), ) height = types.IntType( required=True, metadata=dict( description="(optional) The height of this specific asset, if applicable" ), ) file_size = types.IntType( serialized_name="fileSize", required=True, metadata=dict( description="The size of the asset file that's referenced by url, measured in bytes" ), ) content_type = types.StringType( serialized_name="contentType", required=True, metadata=dict(description="The asset's content type"), ) type = types.StringType( required=True, metadata=dict( description="The internal type of the asset, describing how the asset should be used" ), choices=[ "OriginalFile", "FlashVideoFile", "MdFlashVideoFile", "HdFlashVideoFile", "Mp4VideoFile", "MdMp4VideoFile", "HdMp4VideoFile", "HlsVideoFile", "IphoneVideoFile", "StoryboardFile", "StillImageFile", "SwfFile", "Mp3AudioFile", "LargeImageFile", ], )
class Payment(models.Model): id = types.StringType() payee_payment_reference = types.StringType(serialized_name='payeePaymentReference') payment_reference = types.StringType(serialized_name='paymentReference') callback_url = types.URLType(serialized_name='callbackUrl') payer_alias = types.StringType(serialized_name='payerAlias') payee_alias = types.StringType(serialized_name='payeeAlias') amount = types.FloatType() currency = types.StringType() message = types.StringType() status = types.StringType() date_created = types.DateTimeType(serialized_name='dateCreated') date_paid = types.DateTimeType(serialized_name='datePaid') location = types.URLType() request_token = types.StringType() error_code = types.StringType(serialized_name='errorCode') error_message = types.StringType(serialized_name='errorMessage') class Options: serialize_when_none = False
class Refund(models.Model): id = types.StringType() original_payment_reference = types.StringType(serialized_name='originalPaymentReference') amount = types.FloatType() currency = types.StringType() message = types.StringType() payer_alias = types.StringType(serialized_name='payerAlias') payee_alias = types.StringType(serialized_name='payeeAlias') callback_url = types.URLType(serialized_name='callbackUrl') payer_payment_reference = types.StringType(serialized_name='payerPaymentReference') payment_reference = types.StringType(serialized_name='paymentReference') status = types.StringType() date_created = types.DateTimeType(serialized_name='dateCreated') date_paid = types.DateTimeType(serialized_name='datePaid') location = types.URLType() error_code = types.StringType(serialized_name='errorCode') error_message = types.StringType(serialized_name='errorMessage') additional_information = types.StringType(serialized_name='additionalInformation') class Options: serialize_when_none = False
class BaseApp(models.Model): ''' Cebus base application Apps basic data structure ''' id = mongo.ObjectIdType(required=False) uuid = types.UUIDType(default=uuid.uuid4) active = types.BooleanType(default=True) name = types.StringType(required=False) url = types.URLType()
class Refund(models.Model): original_payment_reference = types.StringType( serialized_name='originalPaymentReference') amount = types.FloatType() currency = types.StringType() message = types.StringType() payer_alias = types.StringType(serialized_name='payerAlias') payee_alias = types.StringType(serialized_name='payeeAlias') callback_url = types.URLType(serialized_name='callbackUrl') payer_payment_reference = types.StringType( serialized_name='payerPaymentReference') payment_reference = types.StringType(serialized_name='paymentReference') class Options: serialize_when_none = False
class Unit(models.Model): ''' Cebus base unit model ''' name = types.StringType(required=False) uuid = types.UUIDType(default=uuid.uuid4) contacts = compound.ModelType(ContactsContainer) url = types.URLType() urls = compound.ListType(types.StringType()) resources = compound.ModelType(Resource) cores = types.IntType(default=1) total = types.IntType()
class SchematicsFieldsModel(BaseModel): # base fields type_string = types.StringType() type_int = types.IntType() type_uuid = types.UUIDType() type_IPv4 = types.IPv4Type() type_url = types.URLType() type_email = types.EmailType() type_number = types.NumberType(int, "integer") type_int = types.IntType() type_long = types.LongType() type_float = types.FloatType() type_decimal = types.DecimalType() type_md5 = types.MD5Type() type_sha1 = types.SHA1Type() type_boolean = types.BooleanType() type_date = types.DateType() type_datetime = types.DateTimeType() type_geopoint = types.GeoPointType() # type_multilingualstring = types.MultilingualStringType(default_locale='localized_value') # compound fields type_list = compound.ListType(types.StringType) type_dict = compound.DictType( types.IntType) # dict values can be only integers type_list_of_dict = compound.ListType(compound.DictType, compound_field=types.StringType) type_dict_of_list = compound.DictType(compound.ListType, compound_field=types.IntType) type_model = compound.ModelType(NestedModel) type_list_model = compound.ListType(compound.ModelType(NestedModel)) # reference fields type_ref_simplemodel = ModelReferenceType(SimpleModel) type_ref_usermodel = ModelReferenceType(User) class Options: # namespace = 'st' collection = 'st' serialize_when_none = False
from schematics import models from schematics import types from schematics.types import compound from cebus.messages import Node class Conturbernium(Node): ''' Soldiers of a contubernium shared a tent, and could be rewarded or punished together as a unit. ''' centurion = types.URLType(default=False) decanus = types.URLType(default=True) class Treant(Node): ''' Treants are sentient tree forts with monkey characteristics. They are typically portrayed as protectors of the forests and antagonists to industrialization and despoiling of nature. The tree itself is a species of willow, most likely a weeping willow. It appears to be completely hollow. The entire interior of the tree trunk is covered in boards.
class Thumbnail(models.Model): url = types.URLType(required=True, metadata=dict(description="")) width = types.IntType(required=True, metadata=dict(description="")) height = types.IntType(required=True, metadata=dict(description=""))
class Conturbernium(Node): ''' Soldiers of a contubernium shared a tent, and could be rewarded or punished together as a unit. ''' centurion = types.URLType(default=False)
class Candidate(models.Model): name = types.StringType() image = types.URLType() gender = extended_types.EnumType(data.candidates.Genders)