From 28182ef079af3dedba079745efd6f695134a5345 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Sat, 3 Aug 2024 07:24:46 +0000 Subject: [PATCH] fix(specs): body is not required in multiple batch request (#3454) (generated) [skip ci] Co-authored-by: Kai Welke --- .../Models/Search/MultipleBatchRequest.cs | 4 +- .../lib/src/model/multiple_batch_request.dart | 4 +- .../src/model/multiple_batch_request.g.dart | 23 +++++++---- .../search/model_multiple_batch_request.go | 38 ++++++++++++++----- .../model/search/MultipleBatchRequest.java | 2 +- .../model/multipleBatchRequest.ts | 2 +- .../model/search/MultipleBatchRequest.kt | 8 ++-- .../lib/Model/Search/MultipleBatchRequest.php | 7 +--- .../search/models/multiple_batch_request.py | 7 ++-- .../models/search/multiple_batch_request.rb | 2 - .../search/MultipleBatchRequest.scala | 2 +- .../Search/Models/MultipleBatchRequest.swift | 8 ++-- snippets/guides/search-snippets.json | 2 +- snippets/scala/src/main/scala/Search.scala | 2 +- specs/bundled/search.doc.yml | 3 +- specs/bundled/search.yml | 1 - .../csharp/src/generated/e2e/Insights.test.cs | 4 +- .../src/generated/requests/Insights.test.cs | 6 +-- .../dart/test/requests/insights_test.dart | 6 +-- tests/output/go/tests/e2e/insights_test.go | 4 +- .../output/go/tests/requests/insights_test.go | 6 +-- .../java/com/algolia/e2e/Insights.test.java | 4 +- .../com/algolia/requests/Insights.test.java | 8 ++-- .../javascript/src/e2e/insights.test.ts | 4 +- .../javascript/src/requests/insights.test.ts | 8 ++-- .../com/algolia/requests/InsightsTest.kt | 6 +-- tests/output/php/src/e2e/InsightsTest.php | 4 +- .../output/php/src/requests/InsightsTest.php | 6 +-- .../output/python/tests/e2e/insights_test.py | 8 ++-- .../python/tests/requests/insights_test.py | 6 +-- tests/output/ruby/test/e2e/insights_test.rb | 8 ++-- .../ruby/test/requests/insights_test.rb | 6 +-- .../algoliasearch/e2e/InsightsTest.scala | 4 +- .../algoliasearch/requests/InsightsTest.scala | 6 +-- .../algoliasearch/requests/SearchTest.scala | 2 +- .../swift/Tests/e2e/InsightsTests.swift | 4 +- .../swift/Tests/requests/InsightsTests.swift | 6 +-- 37 files changed, 125 insertions(+), 106 deletions(-) diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/MultipleBatchRequest.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/MultipleBatchRequest.cs index 6cd96453b7..1b3d802625 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/MultipleBatchRequest.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/MultipleBatchRequest.cs @@ -31,12 +31,10 @@ public MultipleBatchRequest() { } /// Initializes a new instance of the MultipleBatchRequest class. /// /// action (required). - /// Operation arguments (varies with specified `action`). (required). /// Index name (case-sensitive). (required). - public MultipleBatchRequest(Action? action, object body, string indexName) + public MultipleBatchRequest(Action? action, string indexName) { Action = action; - Body = body ?? throw new ArgumentNullException(nameof(body)); IndexName = indexName ?? throw new ArgumentNullException(nameof(indexName)); } diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.dart index ce2e610f7b..a1ba1d81f1 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.dart @@ -11,7 +11,7 @@ final class MultipleBatchRequest { /// Returns a new [MultipleBatchRequest] instance. const MultipleBatchRequest({ required this.action, - required this.body, + this.body, required this.indexName, }); @@ -20,7 +20,7 @@ final class MultipleBatchRequest { /// Operation arguments (varies with specified `action`). @JsonKey(name: r'body') - final Object body; + final Object? body; /// Index name (case-sensitive). @JsonKey(name: r'indexName') diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.g.dart index 048db2c555..bddfa54b47 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/multiple_batch_request.g.dart @@ -15,7 +15,7 @@ MultipleBatchRequest _$MultipleBatchRequestFromJson( final val = MultipleBatchRequest( action: $checkedConvert('action', (v) => $enumDecode(_$ActionEnumMap, v)), - body: $checkedConvert('body', (v) => v as Object), + body: $checkedConvert('body', (v) => v), indexName: $checkedConvert('indexName', (v) => v as String), ); return val; @@ -23,12 +23,21 @@ MultipleBatchRequest _$MultipleBatchRequestFromJson( ); Map _$MultipleBatchRequestToJson( - MultipleBatchRequest instance) => - { - 'action': instance.action.toJson(), - 'body': instance.body, - 'indexName': instance.indexName, - }; + MultipleBatchRequest instance) { + final val = { + 'action': instance.action.toJson(), + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('body', instance.body); + val['indexName'] = instance.indexName; + return val; +} const _$ActionEnumMap = { Action.addObject: 'addObject', diff --git a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go index dddf0ac905..67e54d9c4e 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go +++ b/clients/algoliasearch-client-go/algolia/search/model_multiple_batch_request.go @@ -10,20 +10,30 @@ import ( type MultipleBatchRequest struct { Action Action `json:"action"` // Operation arguments (varies with specified `action`). - Body map[string]any `json:"body"` + Body map[string]any `json:"body,omitempty"` // Index name (case-sensitive). IndexName string `json:"indexName"` } +type MultipleBatchRequestOption func(f *MultipleBatchRequest) + +func WithMultipleBatchRequestBody(val map[string]any) MultipleBatchRequestOption { + return func(f *MultipleBatchRequest) { + f.Body = val + } +} + // NewMultipleBatchRequest instantiates a new MultipleBatchRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewMultipleBatchRequest(action Action, body map[string]any, indexName string) *MultipleBatchRequest { +func NewMultipleBatchRequest(action Action, indexName string, opts ...MultipleBatchRequestOption) *MultipleBatchRequest { this := &MultipleBatchRequest{} this.Action = action - this.Body = body this.IndexName = indexName + for _, opt := range opts { + opt(this) + } return this } @@ -57,26 +67,34 @@ func (o *MultipleBatchRequest) SetAction(v Action) *MultipleBatchRequest { return o } -// GetBody returns the Body field value. +// GetBody returns the Body field value if set, zero value otherwise. func (o *MultipleBatchRequest) GetBody() map[string]any { - if o == nil { + if o == nil || o.Body == nil { var ret map[string]any return ret } - return o.Body } -// GetBodyOk returns a tuple with the Body field value +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *MultipleBatchRequest) GetBodyOk() (map[string]any, bool) { - if o == nil { + if o == nil || o.Body == nil { return nil, false } return o.Body, true } -// SetBody sets field value. +// HasBody returns a boolean if a field has been set. +func (o *MultipleBatchRequest) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given map[string]any and assigns it to the Body field. func (o *MultipleBatchRequest) SetBody(v map[string]any) *MultipleBatchRequest { o.Body = v return o @@ -112,7 +130,7 @@ func (o MultipleBatchRequest) MarshalJSON() ([]byte, error) { if true { toSerialize["action"] = o.Action } - if true { + if o.Body != nil { toSerialize["body"] = o.Body } if true { diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/MultipleBatchRequest.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/MultipleBatchRequest.java index c1801e6a49..9722ce7985 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/MultipleBatchRequest.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/MultipleBatchRequest.java @@ -36,7 +36,7 @@ public MultipleBatchRequest setBody(Object body) { } /** Operation arguments (varies with specified `action`). */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Object getBody() { return body; } diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchRequest.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchRequest.ts index ac524e30ef..cf89923815 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchRequest.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleBatchRequest.ts @@ -8,7 +8,7 @@ export type MultipleBatchRequest = { /** * Operation arguments (varies with specified `action`). */ - body: Record; + body?: Record; /** * Index name (case-sensitive). diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/MultipleBatchRequest.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/MultipleBatchRequest.kt index 188f6a298c..cb97f3f45b 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/MultipleBatchRequest.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/MultipleBatchRequest.kt @@ -8,17 +8,17 @@ import kotlinx.serialization.json.* * MultipleBatchRequest * * @param action - * @param body Operation arguments (varies with specified `action`). * @param indexName Index name (case-sensitive). + * @param body Operation arguments (varies with specified `action`). */ @Serializable public data class MultipleBatchRequest( @SerialName(value = "action") val action: Action, - /** Operation arguments (varies with specified `action`). */ - @SerialName(value = "body") val body: JsonObject, - /** Index name (case-sensitive). */ @SerialName(value = "indexName") val indexName: String, + + /** Operation arguments (varies with specified `action`). */ + @SerialName(value = "body") val body: JsonObject? = null, ) diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MultipleBatchRequest.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleBatchRequest.php index fb2e25f0f5..7885dbd3f1 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/MultipleBatchRequest.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleBatchRequest.php @@ -157,9 +157,6 @@ public function listInvalidProperties() if (!isset($this->container['action']) || null === $this->container['action']) { $invalidProperties[] = "'action' can't be null"; } - if (!isset($this->container['body']) || null === $this->container['body']) { - $invalidProperties[] = "'body' can't be null"; - } if (!isset($this->container['indexName']) || null === $this->container['indexName']) { $invalidProperties[] = "'indexName' can't be null"; } @@ -205,7 +202,7 @@ public function setAction($action) /** * Gets body. * - * @return object + * @return null|object */ public function getBody() { @@ -215,7 +212,7 @@ public function getBody() /** * Sets body. * - * @param object $body operation arguments (varies with specified `action`) + * @param null|object $body operation arguments (varies with specified `action`) * * @return self */ diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/multiple_batch_request.py b/clients/algoliasearch-client-python/algoliasearch/search/models/multiple_batch_request.py index 1826f722fd..927ea11d36 100644 --- a/clients/algoliasearch-client-python/algoliasearch/search/models/multiple_batch_request.py +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/multiple_batch_request.py @@ -7,7 +7,7 @@ from __future__ import annotations from json import loads -from typing import Any, Dict, Self +from typing import Any, Dict, Optional, Self from pydantic import BaseModel, ConfigDict, Field, StrictStr @@ -20,8 +20,9 @@ class MultipleBatchRequest(BaseModel): """ action: Action - body: Dict[str, Any] = Field( - description="Operation arguments (varies with specified `action`)." + body: Optional[Dict[str, Any]] = Field( + default=None, + description="Operation arguments (varies with specified `action`).", ) index_name: StrictStr = Field( description="Index name (case-sensitive).", alias="indexName" diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/multiple_batch_request.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/multiple_batch_request.rb index 559fd6144e..8ef83d4f96 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/search/multiple_batch_request.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/multiple_batch_request.rb @@ -97,8 +97,6 @@ def initialize(attributes = {}) if attributes.key?(:body) self.body = attributes[:body] - else - self.body = nil end if attributes.key?(:index_name) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/MultipleBatchRequest.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/MultipleBatchRequest.scala index 846f89e360..0ddb0331b7 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/MultipleBatchRequest.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/MultipleBatchRequest.scala @@ -44,6 +44,6 @@ import algoliasearch.search.Action._ */ case class MultipleBatchRequest( action: Action, - body: Any, + body: Option[Any] = scala.None, indexName: String ) diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/MultipleBatchRequest.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/MultipleBatchRequest.swift index 12affdfbfc..8b35a0bd64 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Models/MultipleBatchRequest.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/MultipleBatchRequest.swift @@ -9,11 +9,11 @@ import Foundation public struct MultipleBatchRequest: Codable, JSONEncodable { public var action: SearchAction /// Operation arguments (varies with specified `action`). - public var body: AnyCodable + public var body: AnyCodable? /// Index name (case-sensitive). public var indexName: String - public init(action: SearchAction, body: AnyCodable, indexName: String) { + public init(action: SearchAction, body: AnyCodable? = nil, indexName: String) { self.action = action self.body = body self.indexName = indexName @@ -30,7 +30,7 @@ public struct MultipleBatchRequest: Codable, JSONEncodable { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(self.action, forKey: .action) - try container.encode(self.body, forKey: .body) + try container.encodeIfPresent(self.body, forKey: .body) try container.encode(self.indexName, forKey: .indexName) } } @@ -46,7 +46,7 @@ extension MultipleBatchRequest: Equatable { extension MultipleBatchRequest: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(self.action.hashValue) - hasher.combine(self.body.hashValue) + hasher.combine(self.body?.hashValue) hasher.combine(self.indexName.hashValue) } } diff --git a/snippets/guides/search-snippets.json b/snippets/guides/search-snippets.json index c3e463ffe5..ca4e97f523 100644 --- a/snippets/guides/search-snippets.json +++ b/snippets/guides/search-snippets.json @@ -2133,7 +2133,7 @@ "default": "val response = client.listUserIds(\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" }, "multipleBatch": { - "default": "val response = client.multipleBatch(\n batchParams = BatchParams(\n requests = Seq(\n MultipleBatchRequest(\n action = Action.withName(\"addObject\"),\n body = JObject(List(JField(\"key\", JString(\"value\")))),\n indexName = \"theIndexName\"\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" + "default": "val response = client.multipleBatch(\n batchParams = BatchParams(\n requests = Seq(\n MultipleBatchRequest(\n action = Action.withName(\"addObject\"),\n body = Some(JObject(List(JField(\"key\", JString(\"value\"))))),\n indexName = \"theIndexName\"\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" }, "operationIndex": { "scopes": "val response = client.operationIndex(\n indexName = \"\",\n operationIndexParams = OperationIndexParams(\n operation = OperationType.withName(\"move\"),\n destination = \"\",\n scope = Some(Seq(ScopeType.withName(\"rules\"), ScopeType.withName(\"settings\")))\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))", diff --git a/snippets/scala/src/main/scala/Search.scala b/snippets/scala/src/main/scala/Search.scala index 2e37a7d37f..012f4bb311 100644 --- a/snippets/scala/src/main/scala/Search.scala +++ b/snippets/scala/src/main/scala/Search.scala @@ -1088,7 +1088,7 @@ class SnippetSearchClient { requests = Seq( MultipleBatchRequest( action = Action.withName("addObject"), - body = JObject(List(JField("key", JString("value")))), + body = Some(JObject(List(JField("key", JString("value"))))), indexName = "theIndexName" ) ) diff --git a/specs/bundled/search.doc.yml b/specs/bundled/search.doc.yml index 08c40ae4c6..abcb356f24 100644 --- a/specs/bundled/search.doc.yml +++ b/specs/bundled/search.doc.yml @@ -4413,7 +4413,6 @@ paths: $ref: '#/components/schemas/indexName' required: - action - - body - indexName required: - requests @@ -4691,7 +4690,7 @@ paths: requests = Seq( MultipleBatchRequest( action = Action.withName("addObject"), - body = JObject(List(JField("key", JString("value")))), + body = Some(JObject(List(JField("key", JString("value"))))), indexName = "theIndexName" ) ) diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index f1e9be8203..5626562219 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -1049,7 +1049,6 @@ paths: $ref: '#/components/schemas/indexName' required: - action - - body - indexName required: - requests diff --git a/tests/output/csharp/src/generated/e2e/Insights.test.cs b/tests/output/csharp/src/generated/e2e/Insights.test.cs index 3c9764a57f..0a4c490ac9 100644 --- a/tests/output/csharp/src/generated/e2e/Insights.test.cs +++ b/tests/output/csharp/src/generated/e2e/Insights.test.cs @@ -63,7 +63,7 @@ public async Task PushEventsTest1() Index = "products", UserToken = "user-123456", AuthenticatedUserToken = "user-123456", - Timestamp = 1722384000000L, + Timestamp = 1722643200000L, ObjectIDs = new List { "9780545139700", "9780439784542" }, QueryID = "43b15df305339e827f0ac0bdc5ebcaa7", } @@ -76,7 +76,7 @@ public async Task PushEventsTest1() Index = "products", UserToken = "user-123456", AuthenticatedUserToken = "user-123456", - Timestamp = 1722384000000L, + Timestamp = 1722643200000L, ObjectIDs = new List { "9780545139700", "9780439784542" }, } ) diff --git a/tests/output/csharp/src/generated/requests/Insights.test.cs b/tests/output/csharp/src/generated/requests/Insights.test.cs index 1622624bef..6bd9b6f476 100644 --- a/tests/output/csharp/src/generated/requests/Insights.test.cs +++ b/tests/output/csharp/src/generated/requests/Insights.test.cs @@ -580,7 +580,7 @@ await client.PushEventsAsync( Index = "products", UserToken = "user-123456", AuthenticatedUserToken = "user-123456", - Timestamp = 1722384000000L, + Timestamp = 1722643200000L, ObjectIDs = new List { "9780545139700", "9780439784542" }, QueryID = "43b15df305339e827f0ac0bdc5ebcaa7", } @@ -593,7 +593,7 @@ await client.PushEventsAsync( Index = "products", UserToken = "user-123456", AuthenticatedUserToken = "user-123456", - Timestamp = 1722384000000L, + Timestamp = 1722643200000L, ObjectIDs = new List { "9780545139700", "9780439784542" }, } ) @@ -605,7 +605,7 @@ await client.PushEventsAsync( Assert.Equal("/1/events", req.Path); Assert.Equal("POST", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}", + "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}", req.Body, new JsonDiffConfig(false) ); diff --git a/tests/output/dart/test/requests/insights_test.dart b/tests/output/dart/test/requests/insights_test.dart index 66d946b27b..c0d939e46e 100644 --- a/tests/output/dart/test/requests/insights_test.dart +++ b/tests/output/dart/test/requests/insights_test.dart @@ -633,7 +633,7 @@ void main() { index: "products", userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: [ "9780545139700", "9780439784542", @@ -646,7 +646,7 @@ void main() { index: "products", userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: [ "9780545139700", "9780439784542", @@ -659,7 +659,7 @@ void main() { expectPath(request.path, '/1/events'); expect(request.method, 'post'); expectBody(request.body, - """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}"""); + """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}"""); }, ), ); diff --git a/tests/output/go/tests/e2e/insights_test.go b/tests/output/go/tests/e2e/insights_test.go index 1ad7a44615..6af0269f83 100644 --- a/tests/output/go/tests/e2e/insights_test.go +++ b/tests/output/go/tests/e2e/insights_test.go @@ -38,9 +38,9 @@ func TestInsightsE2E_PushEvents(t *testing.T) { insights.NewEmptyInsightsEvents().SetEvents( []insights.EventsItems{*insights.ConvertedObjectIDsAfterSearchAsEventsItems( - insights.NewEmptyConvertedObjectIDsAfterSearch().SetEventType(insights.ConversionEvent("conversion")).SetEventName("Product Purchased").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722384000000).SetObjectIDs( + insights.NewEmptyConvertedObjectIDsAfterSearch().SetEventType(insights.ConversionEvent("conversion")).SetEventName("Product Purchased").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722643200000).SetObjectIDs( []string{"9780545139700", "9780439784542"}).SetQueryID("43b15df305339e827f0ac0bdc5ebcaa7")), *insights.ViewedObjectIDsAsEventsItems( - insights.NewEmptyViewedObjectIDs().SetEventType(insights.ViewEvent("view")).SetEventName("Product Detail Page Viewed").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722384000000).SetObjectIDs( + insights.NewEmptyViewedObjectIDs().SetEventType(insights.ViewEvent("view")).SetEventName("Product Detail Page Viewed").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722643200000).SetObjectIDs( []string{"9780545139700", "9780439784542"}))}), )) require.NoError(t, err) diff --git a/tests/output/go/tests/requests/insights_test.go b/tests/output/go/tests/requests/insights_test.go index 1c7dbbae38..99e93372ac 100644 --- a/tests/output/go/tests/requests/insights_test.go +++ b/tests/output/go/tests/requests/insights_test.go @@ -433,9 +433,9 @@ func TestInsights_PushEvents(t *testing.T) { insights.NewEmptyInsightsEvents().SetEvents( []insights.EventsItems{*insights.ConvertedObjectIDsAfterSearchAsEventsItems( - insights.NewEmptyConvertedObjectIDsAfterSearch().SetEventType(insights.ConversionEvent("conversion")).SetEventName("Product Purchased").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722384000000).SetObjectIDs( + insights.NewEmptyConvertedObjectIDsAfterSearch().SetEventType(insights.ConversionEvent("conversion")).SetEventName("Product Purchased").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722643200000).SetObjectIDs( []string{"9780545139700", "9780439784542"}).SetQueryID("43b15df305339e827f0ac0bdc5ebcaa7")), *insights.ViewedObjectIDsAsEventsItems( - insights.NewEmptyViewedObjectIDs().SetEventType(insights.ViewEvent("view")).SetEventName("Product Detail Page Viewed").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722384000000).SetObjectIDs( + insights.NewEmptyViewedObjectIDs().SetEventType(insights.ViewEvent("view")).SetEventName("Product Detail Page Viewed").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1722643200000).SetObjectIDs( []string{"9780545139700", "9780439784542"}))}), )) require.NoError(t, err) @@ -444,7 +444,7 @@ func TestInsights_PushEvents(t *testing.T) { require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}`) + ja.Assertf(*echo.Body, `{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}`) }) t.Run("ConvertedObjectIDsAfterSearch", func(t *testing.T) { _, err := client.PushEvents(client.NewApiPushEventsRequest( diff --git a/tests/output/java/src/test/java/com/algolia/e2e/Insights.test.java b/tests/output/java/src/test/java/com/algolia/e2e/Insights.test.java index 82008ef406..2d70423b0d 100644 --- a/tests/output/java/src/test/java/com/algolia/e2e/Insights.test.java +++ b/tests/output/java/src/test/java/com/algolia/e2e/Insights.test.java @@ -50,7 +50,7 @@ void pushEventsTest1() { .setIndex("products") .setUserToken("user-123456") .setAuthenticatedUserToken("user-123456") - .setTimestamp(1722384000000L) + .setTimestamp(1722643200000L) .setObjectIDs(List.of("9780545139700", "9780439784542")) .setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"), new ViewedObjectIDs() @@ -59,7 +59,7 @@ void pushEventsTest1() { .setIndex("products") .setUserToken("user-123456") .setAuthenticatedUserToken("user-123456") - .setTimestamp(1722384000000L) + .setTimestamp(1722643200000L) .setObjectIDs(List.of("9780545139700", "9780439784542")) ) ) diff --git a/tests/output/java/src/test/java/com/algolia/requests/Insights.test.java b/tests/output/java/src/test/java/com/algolia/requests/Insights.test.java index aa1443365c..a3461b3cb0 100644 --- a/tests/output/java/src/test/java/com/algolia/requests/Insights.test.java +++ b/tests/output/java/src/test/java/com/algolia/requests/Insights.test.java @@ -606,7 +606,7 @@ void pushEventsTest1() { .setIndex("products") .setUserToken("user-123456") .setAuthenticatedUserToken("user-123456") - .setTimestamp(1722384000000L) + .setTimestamp(1722643200000L) .setObjectIDs(List.of("9780545139700", "9780439784542")) .setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"), new ViewedObjectIDs() @@ -615,7 +615,7 @@ void pushEventsTest1() { .setIndex("products") .setUserToken("user-123456") .setAuthenticatedUserToken("user-123456") - .setTimestamp(1722384000000L) + .setTimestamp(1722643200000L) .setObjectIDs(List.of("9780545139700", "9780439784542")) ) ) @@ -627,9 +627,9 @@ void pushEventsTest1() { assertDoesNotThrow(() -> JSONAssert.assertEquals( "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product" + - " Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product" + + " Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product" + " Detail Page" + - " Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}", + " Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}", req.body, JSONCompareMode.STRICT ) diff --git a/tests/output/javascript/src/e2e/insights.test.ts b/tests/output/javascript/src/e2e/insights.test.ts index fa8bb21cc3..1779d876be 100644 --- a/tests/output/javascript/src/e2e/insights.test.ts +++ b/tests/output/javascript/src/e2e/insights.test.ts @@ -34,7 +34,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], queryID: '43b15df305339e827f0ac0bdc5ebcaa7', }, @@ -44,7 +44,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], }, ], diff --git a/tests/output/javascript/src/requests/insights.test.ts b/tests/output/javascript/src/requests/insights.test.ts index fdc761682f..3ab2ef7899 100644 --- a/tests/output/javascript/src/requests/insights.test.ts +++ b/tests/output/javascript/src/requests/insights.test.ts @@ -384,7 +384,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], queryID: '43b15df305339e827f0ac0bdc5ebcaa7', }, @@ -394,7 +394,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], }, ], @@ -410,7 +410,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], queryID: '43b15df305339e827f0ac0bdc5ebcaa7', }, @@ -420,7 +420,7 @@ describe('pushEvents', () => { index: 'products', userToken: 'user-123456', authenticatedUserToken: 'user-123456', - timestamp: 1722384000000, + timestamp: 1722643200000, objectIDs: ['9780545139700', '9780439784542'], }, ], diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/InsightsTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/InsightsTest.kt index 4b83b35cfe..bc542f8865 100644 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/InsightsTest.kt +++ b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/InsightsTest.kt @@ -529,7 +529,7 @@ class InsightsTest { index = "products", userToken = "user-123456", authenticatedUserToken = "user-123456", - timestamp = 1722384000000L, + timestamp = 1722643200000L, objectIDs = listOf("9780545139700", "9780439784542"), queryID = "43b15df305339e827f0ac0bdc5ebcaa7", ), @@ -539,7 +539,7 @@ class InsightsTest { index = "products", userToken = "user-123456", authenticatedUserToken = "user-123456", - timestamp = 1722384000000L, + timestamp = 1722643200000L, objectIDs = listOf("9780545139700", "9780439784542"), ), ), @@ -549,7 +549,7 @@ class InsightsTest { intercept = { assertEquals("/1/events".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}""", it.body) + assertJsonBody("""{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}""", it.body) }, ) } diff --git a/tests/output/php/src/e2e/InsightsTest.php b/tests/output/php/src/e2e/InsightsTest.php index fcb13889f0..a74225cd7c 100644 --- a/tests/output/php/src/e2e/InsightsTest.php +++ b/tests/output/php/src/e2e/InsightsTest.php @@ -35,7 +35,7 @@ public function testPushEvents1() 'index' => 'products', 'userToken' => 'user-123456', 'authenticatedUserToken' => 'user-123456', - 'timestamp' => 1722384000000, + 'timestamp' => 1722643200000, 'objectIDs' => [ '9780545139700', @@ -49,7 +49,7 @@ public function testPushEvents1() 'index' => 'products', 'userToken' => 'user-123456', 'authenticatedUserToken' => 'user-123456', - 'timestamp' => 1722384000000, + 'timestamp' => 1722643200000, 'objectIDs' => [ '9780545139700', diff --git a/tests/output/php/src/requests/InsightsTest.php b/tests/output/php/src/requests/InsightsTest.php index 531e14b613..81dc227cbe 100644 --- a/tests/output/php/src/requests/InsightsTest.php +++ b/tests/output/php/src/requests/InsightsTest.php @@ -527,7 +527,7 @@ public function testPushEvents1() 'index' => 'products', 'userToken' => 'user-123456', 'authenticatedUserToken' => 'user-123456', - 'timestamp' => 1722384000000, + 'timestamp' => 1722643200000, 'objectIDs' => [ '9780545139700', @@ -541,7 +541,7 @@ public function testPushEvents1() 'index' => 'products', 'userToken' => 'user-123456', 'authenticatedUserToken' => 'user-123456', - 'timestamp' => 1722384000000, + 'timestamp' => 1722643200000, 'objectIDs' => [ '9780545139700', @@ -556,7 +556,7 @@ public function testPushEvents1() [ 'path' => '/1/events', 'method' => 'POST', - 'body' => json_decode('{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}'), + 'body' => json_decode('{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}'), ], ]); } diff --git a/tests/output/python/tests/e2e/insights_test.py b/tests/output/python/tests/e2e/insights_test.py index f2c80e5b75..86937a72c1 100644 --- a/tests/output/python/tests/e2e/insights_test.py +++ b/tests/output/python/tests/e2e/insights_test.py @@ -35,7 +35,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", @@ -48,7 +48,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", @@ -70,7 +70,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", @@ -83,7 +83,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", diff --git a/tests/output/python/tests/requests/insights_test.py b/tests/output/python/tests/requests/insights_test.py index 56b51b999d..5e833e0f75 100644 --- a/tests/output/python/tests/requests/insights_test.py +++ b/tests/output/python/tests/requests/insights_test.py @@ -461,7 +461,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", @@ -474,7 +474,7 @@ async def test_push_events_1(self): "index": "products", "userToken": "user-123456", "authenticatedUserToken": "user-123456", - "timestamp": 1722384000000, + "timestamp": 1722643200000, "objectIDs": [ "9780545139700", "9780439784542", @@ -489,7 +489,7 @@ async def test_push_events_1(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}""" + """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}""" ) async def test_push_events_2(self): diff --git a/tests/output/ruby/test/e2e/insights_test.rb b/tests/output/ruby/test/e2e/insights_test.rb index 925b5eca64..c5714fb50c 100644 --- a/tests/output/ruby/test/e2e/insights_test.rb +++ b/tests/output/ruby/test/e2e/insights_test.rb @@ -28,7 +28,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"], query_id: "43b15df305339e827f0ac0bdc5ebcaa7" ), @@ -38,7 +38,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"] ) ] @@ -55,7 +55,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"], query_id: "43b15df305339e827f0ac0bdc5ebcaa7" ), @@ -65,7 +65,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"] ) ] diff --git a/tests/output/ruby/test/requests/insights_test.rb b/tests/output/ruby/test/requests/insights_test.rb index 032c1ec4fd..8b18716ef7 100644 --- a/tests/output/ruby/test/requests/insights_test.rb +++ b/tests/output/ruby/test/requests/insights_test.rb @@ -338,7 +338,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"], query_id: "43b15df305339e827f0ac0bdc5ebcaa7" ), @@ -348,7 +348,7 @@ def test_push_events1 index: "products", user_token: "user-123456", authenticated_user_token: "user-123456", - timestamp: 1722384000000, + timestamp: 1722643200000, object_ids: ["9780545139700", "9780439784542"] ) ] @@ -361,7 +361,7 @@ def test_push_events1 assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( JSON.parse( - "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}" + "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}" ), JSON.parse(req.body) ) diff --git a/tests/output/scala/src/test/scala/algoliasearch/e2e/InsightsTest.scala b/tests/output/scala/src/test/scala/algoliasearch/e2e/InsightsTest.scala index 5c9b0ca93a..af0e205769 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/e2e/InsightsTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/e2e/InsightsTest.scala @@ -49,7 +49,7 @@ class InsightsTestE2E extends AnyFunSuite { index = "products", userToken = "user-123456", authenticatedUserToken = Some("user-123456"), - timestamp = Some(1722384000000L), + timestamp = Some(1722643200000L), objectIDs = Seq("9780545139700", "9780439784542"), queryID = "43b15df305339e827f0ac0bdc5ebcaa7" ), @@ -59,7 +59,7 @@ class InsightsTestE2E extends AnyFunSuite { index = "products", userToken = "user-123456", authenticatedUserToken = Some("user-123456"), - timestamp = Some(1722384000000L), + timestamp = Some(1722643200000L), objectIDs = Seq("9780545139700", "9780439784542") ) ) diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/InsightsTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/InsightsTest.scala index 5d65f53686..6a9aacbb46 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/InsightsTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/requests/InsightsTest.scala @@ -574,7 +574,7 @@ class InsightsTest extends AnyFunSuite { index = "products", userToken = "user-123456", authenticatedUserToken = Some("user-123456"), - timestamp = Some(1722384000000L), + timestamp = Some(1722643200000L), objectIDs = Seq("9780545139700", "9780439784542"), queryID = "43b15df305339e827f0ac0bdc5ebcaa7" ), @@ -584,7 +584,7 @@ class InsightsTest extends AnyFunSuite { index = "products", userToken = "user-123456", authenticatedUserToken = Some("user-123456"), - timestamp = Some(1722384000000L), + timestamp = Some(1722643200000L), objectIDs = Seq("9780545139700", "9780439784542") ) ) @@ -597,7 +597,7 @@ class InsightsTest extends AnyFunSuite { assert(res.path == "/1/events") assert(res.method == "POST") val expectedBody = parse( - """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722384000000,"objectIDs":["9780545139700","9780439784542"]}]}""" + """{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1722643200000,"objectIDs":["9780545139700","9780439784542"]}]}""" ) val actualBody = parse(res.body.get) assert(actualBody == expectedBody) diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala index d29b293d29..42e139e34a 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala @@ -1517,7 +1517,7 @@ class SearchTest extends AnyFunSuite { requests = Seq( MultipleBatchRequest( action = Action.withName("addObject"), - body = JObject(List(JField("key", JString("value")))), + body = Some(JObject(List(JField("key", JString("value"))))), indexName = "theIndexName" ) ) diff --git a/tests/output/swift/Tests/e2e/InsightsTests.swift b/tests/output/swift/Tests/e2e/InsightsTests.swift index 3f1d917f49..02ca86f214 100644 --- a/tests/output/swift/Tests/e2e/InsightsTests.swift +++ b/tests/output/swift/Tests/e2e/InsightsTests.swift @@ -65,7 +65,7 @@ final class InsightsClientRequestsTestsE2E: XCTestCase { queryID: "43b15df305339e827f0ac0bdc5ebcaa7", userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: Int64(1_722_384_000_000) + timestamp: Int64(1_722_643_200_000) )), EventsItems.viewedObjectIDs(ViewedObjectIDs( eventName: "Product Detail Page Viewed", @@ -74,7 +74,7 @@ final class InsightsClientRequestsTestsE2E: XCTestCase { objectIDs: ["9780545139700", "9780439784542"], userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: Int64(1_722_384_000_000) + timestamp: Int64(1_722_643_200_000) )), ])) let responseBody = try XCTUnwrap(response.body) diff --git a/tests/output/swift/Tests/requests/InsightsTests.swift b/tests/output/swift/Tests/requests/InsightsTests.swift index a3f8a8dff7..5dac38abdd 100644 --- a/tests/output/swift/Tests/requests/InsightsTests.swift +++ b/tests/output/swift/Tests/requests/InsightsTests.swift @@ -785,7 +785,7 @@ final class InsightsClientRequestsTests: XCTestCase { queryID: "43b15df305339e827f0ac0bdc5ebcaa7", userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: Int64(1_722_384_000_000) + timestamp: Int64(1_722_643_200_000) )), EventsItems.viewedObjectIDs(ViewedObjectIDs( eventName: "Product Detail Page Viewed", @@ -794,7 +794,7 @@ final class InsightsClientRequestsTests: XCTestCase { objectIDs: ["9780545139700", "9780439784542"], userToken: "user-123456", authenticatedUserToken: "user-123456", - timestamp: Int64(1_722_384_000_000) + timestamp: Int64(1_722_643_200_000) )), ])) let responseBodyData = try XCTUnwrap(response.bodyData) @@ -804,7 +804,7 @@ final class InsightsClientRequestsTests: XCTestCase { let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) let expectedBodyData = - "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722384000000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}" + "{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1722643200000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}" .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString)