class AccessToken(Model): access_token = StringType() token_type = StringType() scope = StringListType(StringType, separator=" ") refresh_token = StringType(serialize_when_none=False) expires_in = IntType(serialize_when_none=False)
class SearchParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = ListType(StringType) q = StringType() label = ListType(StringType) category = ListType(StringType) start = ModelType(DateTimeRange) start_around = ModelType(DateAround) end = ModelType(DateTimeRange) end_around = ModelType(DateAround) active = ModelType(DateTimeRange) updated = ModelType(DateTimeRange) state = StringType(choices=('active', 'deleted')) local_rank_level = ListType(IntType(min_value=1, max_value=5)) local_rank = ModelType(IntRange) rank_level = ListType(IntType(min_value=1, max_value=5)) rank = ModelType(IntRange) country = ListType(StringType) location_around = ModelType(LocationAround) within = StringListType(StringModelType(Area), separator="+") place = ModelType(Place) signal = ModelType(Signal) relevance = ListType(StringType)
class SearchParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = ListType(StringType) q = StringType() label = ListType(StringType) category = ListType(StringType) start = ModelType(DateTimeRange) start_around = ModelType(DateAround) end = ModelType(DateTimeRange) end_around = ModelType(DateAround) active = ModelType(DateTimeRange) updated = ModelType(DateTimeRange) state = StringType(choices=('active', 'deleted')) rank = ModelType(IntRange) rank_level = ListType(IntType(min_value=1, max_value=5)) # `local_rank` and `aviation_rank` are paid features. # If you haven't subscribed to a paid feature, using it as a # search param will have no effect on your search results. local_rank = ModelType(IntRange) local_rank_level = ListType(IntType(min_value=1, max_value=5)) aviation_rank = ModelType(IntRange) aviation_rank_level = ListType(IntType(min_value=1, max_value=5)) country = ListType(StringType) location_around = ModelType(LocationAround) within = StringListType(StringModelType(Area), separator="+") place = ModelType(Place) signal = ModelType(Signal) relevance = ListType(StringType) brand_unsafe = ModelType(BrandUnsafe) entity = ModelType(Entity)
class GetTokenParams(Model): class Options: serialize_when_none = False client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True) client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True) scope = StringListType(StringType, default=lambda: config.OAUTH2_SCOPE, separator=" ") grant_type = StringType(choices=('client_credentials',), default='client_credentials', required=True)
class AnalysisParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = StringType(required=True) date = ModelType(DateTimeRange) initiated = ModelType(DateTimeRange) completed = ModelType(DateTimeRange) within = StringListType(StringModelType(Area), separator="+") significance = FloatType(min_value=0, max_value=100) place = ModelType(Place)
class SearchParams(LimitMixin, Model): class Options: serialize_when_none = False q = StringType() id = ListType(StringType) location = StringListType(StringModelType(Location), separator="+") country = ListType(StringType) type = ListType( StringType(choices=('planet', 'continent', 'country', 'region', 'county', 'local', 'major', 'metro', 'all'))) def validate(self, *args, **kwargs): super(SearchParams, self).validate(*args, **kwargs) if not any((self.q, self.id, self.location, self.country)): raise SchematicsValidationError( "Places search requires one of q, id, location or country")