class ExactlyOneNonemptyModel(apilib.Model): foo = apilib.Field( apilib.String(), validators=[apilib.ExactlyOneNonempty('foo', 'bar')]) bar = apilib.Field( apilib.String(), validators=[apilib.ExactlyOneNonempty('foo', 'bar')])
class ModelWithValidators(apilib.Model): fstring = apilib.Field(apilib.String(), required=True, description='This is a custom description') fint = apilib.Field(apilib.Integer(), required='mutate', custom_attr='This is a custom attr') ffloat = apilib.Field(apilib.Float(), required=['get', 'mutate']) fbool = apilib.Field(apilib.Boolean(), required=['mutate/UPDATE', 'mutate/DELETE']) freadonly = apilib.Field(apilib.String(), readonly=True)
class DateRangeModel(apilib.Model): fdatetime = apilib.Field( apilib.DateTime(), validators=[ apilib.Range(min_=dateparse('2016-01-01 12:30:00-07:00'), max_=dateparse('2016-03-05 14:30:00-07:00')) ]) fdate = apilib.Field(apilib.Date(), validators=[ apilib.Range( min_=dateparse('2016-02-02').date(), max_=dateparse('2016-03-03').date()) ])
class AllBasicTypesModel(apilib.Model): fstring = apilib.Field(apilib.String()) fint = apilib.Field(apilib.Integer()) ffloat = apilib.Field(apilib.Float()) fbool = apilib.Field(apilib.Boolean()) fdate = apilib.Field(apilib.Date()) fdatetime = apilib.Field(apilib.DateTime()) fdecimal = apilib.Field(apilib.Decimal()) fenum = apilib.Field(apilib.Enum(['Jerry', 'George'])) fid = apilib.Field(apilib.EncryptedId())
class ModelWithEnum(apilib.Model): class SomeValues(apilib.EnumValues): FOO = 'foo' BAR = u'bar' NOT_A_STRING_VALUE = 1 _internal_value = 'internal' fenum = apilib.Field(apilib.Enum(list(SomeValues.values())))
class NGrandchild(apilib.Model): fint = apilib.Field(apilib.Integer()) lfloat = apilib.Field(apilib.ListType(apilib.Float()))
class ModelWithExtendedFields(apilib.Model): fdecimal = apilib.Field(apilib.Decimal()) fenum = apilib.Field(apilib.Enum(['Jerry', 'George'])) fid = apilib.Field(apilib.EncryptedId())
class ModelWithDateList(apilib.Model): ldate = apilib.Field(apilib.ListType(apilib.Date())) ldatetime = apilib.Field(apilib.ListType(apilib.DateTime()))
class ModelWithDates(apilib.Model): fdate = apilib.Field(apilib.Date()) fdatetime = apilib.Field(apilib.DateTime())
class Widget(apilib.Model): id = apilib.Field( apilib.String(), required=['delete', 'mutate/UPDATE', 'NonwidgetService.get'])
class GeneratePhoneVerificationCodeRequest(apilib.Request): eth_address = apilib.Field(apilib.String(), required=True) phone = apilib.Field(apilib.String(), required=True)
class WidgetRequest(apilib.Request): operations = apilib.Field(apilib.ListType(WidgetOperation))
class ModelWithBytes(apilib.Model): fbytes = apilib.Field(apilib.Bytes())
class DeeplyNested(apilib.Model): fdeep = apilib.Field( apilib.DictType(apilib.ListType(apilib.ModelType(BasicScalarModel))))
class ArbitraryPrimitivesModel(apilib.Model): fany = apilib.Field(apilib.AnyPrimitive()) lany = apilib.Field(apilib.ListType(apilib.AnyPrimitive())) dany = apilib.Field(apilib.DictType(apilib.AnyPrimitive()))
class Subclass(Base): subclass = apilib.Field(apilib.String())
class Base(apilib.Model): base = apilib.Field(apilib.String())
class FooResponse(apilib.Response): response_str = apilib.Field(apilib.String())
class NChild(apilib.Model): fgrandchild = apilib.Field(apilib.ModelType(NGrandchild)) lgrandchild = apilib.Field(apilib.ListType(NGrandchild)) fstring = apilib.Field(apilib.String())
class UniqueFieldsModel(apilib.Model): id = apilib.Field(apilib.Integer()) foo = apilib.Field(apilib.String())
class NParent(apilib.Model): fchild = apilib.Field(apilib.ModelType(NChild)) lchild = apilib.Field(apilib.ListType(NChild))
class WidgetOperation(apilib.Operation): operand = apilib.Field(apilib.ModelType(Widget), required=True)
class ScalarListModel(apilib.Model): lstring = apilib.Field(apilib.ListType(apilib.String())) lint = apilib.Field(apilib.ListType(apilib.Integer())) lfloat = apilib.Field(apilib.ListType(apilib.Float())) lbool = apilib.Field(apilib.ListType(apilib.Boolean()))
class BasicScalarModel(apilib.Model): fstring = apilib.Field(apilib.String()) fint = apilib.Field(apilib.Integer()) ffloat = apilib.Field(apilib.Float()) fbool = apilib.Field(apilib.Boolean())
class ToStringModel(apilib.Model): fstring = apilib.Field(apilib.String()) fint = apilib.Field(apilib.Integer()) ffloat = apilib.Field(apilib.Float()) fbool = apilib.Field(apilib.Boolean()) fdate = apilib.Field(apilib.Date()) fdatetime = apilib.Field(apilib.DateTime()) fdecimal = apilib.Field(apilib.Decimal()) fenum = apilib.Field(apilib.Enum(['JERRY', 'GEORGE'])) fbytes = apilib.Field(apilib.Bytes()) fchild = apilib.Field(apilib.ModelType(BasicScalarModel)) lchild = apilib.Field(apilib.ListType(BasicScalarModel)) dchild = apilib.Field(apilib.DictType(BasicScalarModel))
class ScalarDictModel(apilib.Model): dstring = apilib.Field(apilib.DictType(apilib.String())) dint = apilib.Field(apilib.DictType(apilib.Integer())) dfloat = apilib.Field(apilib.DictType(apilib.Float())) dbool = apilib.Field(apilib.DictType(apilib.Boolean()))
class VerifyPhoneResponse(apilib.Response): # A successful response will have response_code SUCCESS. # Any invalid code with have response_code REQUEST_ERROR # and the 'errors' list will be populated. attestation = apilib.Field(apilib.String())
class BasicChildModel(apilib.Model): fstring = apilib.Field(apilib.String())
class VerifyPhoneRequest(apilib.Request): eth_address = apilib.Field(apilib.String(), required=True) phone = apilib.Field(apilib.String(), required=True) code = apilib.Field(apilib.String(), required=True)
class BasicParentModel(apilib.Model): fchild = apilib.Field(apilib.ModelType(BasicChildModel)) lchild = apilib.Field(apilib.ListType(BasicChildModel))