From 38157b9db5046e1d2585c1e59c84fa1d2e4ebb7e Mon Sep 17 00:00:00 2001 From: Matthieu Bonnefoy Date: Thu, 4 Jul 2019 14:40:22 +1200 Subject: [PATCH] Add entity.id as a search param for events --- predicthq/endpoints/schemas.py | 8 ++++++++ predicthq/endpoints/v1/events/schemas.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/predicthq/endpoints/schemas.py b/predicthq/endpoints/schemas.py index 4e05a8a..6d27c3c 100644 --- a/predicthq/endpoints/schemas.py +++ b/predicthq/endpoints/schemas.py @@ -211,6 +211,14 @@ class Options: exclude = BooleanType() +class Entity(Model): + + class Options: + serialize_when_none = False + + id = StringType() + + class LimitMixin(Model): limit = IntType(min_value=1) diff --git a/predicthq/endpoints/v1/events/schemas.py b/predicthq/endpoints/v1/events/schemas.py index ad315aa..5cc1ad1 100644 --- a/predicthq/endpoints/v1/events/schemas.py +++ b/predicthq/endpoints/v1/events/schemas.py @@ -5,7 +5,7 @@ PaginatedMixin, SortableMixin, Model, ResultSet, ListType, StringType, GeoJSONPointType, StringListType, StringModelType, Area, ModelType, IntRange, IntType, DateTimeRange, DateTimeType, FloatType, ResultType, DictType, DateType, Place, Signal, DateAround, - LocationAround, BooleanType, BrandUnsafe + LocationAround, BooleanType, BrandUnsafe, Entity ) @@ -36,6 +36,7 @@ class Options: signal = ModelType(Signal) relevance = ListType(StringType) brand_unsafe = ModelType(BrandUnsafe) + entity = ModelType(Entity) class Entities(Model):