예제 #1
0
파일: schemas.py 프로젝트: ron-t/sdk-py
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)
예제 #2
0
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)
예제 #3
0
파일: schemas.py 프로젝트: sgpohlj87/sdk-py
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)
예제 #4
0
파일: schemas.py 프로젝트: yjst2012/sdk-py
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)
예제 #5
0
파일: schemas.py 프로젝트: yjst2012/sdk-py
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)
예제 #6
0
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")