From c61347dbebba13a46ca02ef65e49a4c8afbe8c76 Mon Sep 17 00:00:00 2001 From: Enes Aldemir Date: Sun, 7 Jul 2019 14:16:27 +0300 Subject: [PATCH] Add function for creating empty event (closes #81) --- .../Event.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/scala/com.snowplowanalytics.snowplow.analytics.scalasdk/Event.scala b/src/main/scala/com.snowplowanalytics.snowplow.analytics.scalasdk/Event.scala index b43b567..5f95178 100644 --- a/src/main/scala/com.snowplowanalytics.snowplow.analytics.scalasdk/Event.scala +++ b/src/main/scala/com.snowplowanalytics.snowplow.analytics.scalasdk/Event.scala @@ -256,4 +256,18 @@ object Event { */ def parse(line: String): DecodeResult[Event] = parser.parse(line) + + /** + * Creates empty event which optional fields of it are None + * Only necessary fields are given as arguments + */ + def emptyEvent(id: UUID, collectorTstamp: Instant, vCollector: String, vTstamp: String): Event = + Event(None, None, None, collectorTstamp, None, None, id, None, None, None, vCollector, vTstamp, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + Contexts(Nil), None, None, None, None, None, UnstructEvent(None), None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + Contexts(Nil), None, None, None, None, None, None, None, None) }