From dfb2aa7f250a1f0bcf4465a56893f766c9120d0e Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Tue, 30 Jul 2024 13:43:45 +0000 Subject: [PATCH] fix(specs): required prop for dictionaryEntry (#3449) (generated) [skip ci] Co-authored-by: Kai Welke Co-authored-by: Pierre Millot --- .../Models/Search/DictionaryEntry.cs | 4 +- .../lib/src/model/dictionary_entry.dart | 4 +- .../lib/src/model/dictionary_entry.g.dart | 6 +-- .../algolia/search/model_dictionary_entry.go | 41 ++++++++++++------- .../algolia/model/search/DictionaryEntry.java | 2 +- .../client-search/model/dictionaryEntry.ts | 2 +- .../client/model/search/DictionaryEntry.kt | 8 ++-- .../lib/Model/Search/DictionaryEntry.php | 7 +--- .../search/models/dictionary_entry.py | 2 +- .../algolia/models/search/dictionary_entry.rb | 2 - .../search/DictionaryEntry.scala | 2 +- .../Search/Models/DictionaryEntry.swift | 16 ++++---- snippets/csharp/src/Search.cs | 10 +---- snippets/dart/lib/search.dart | 11 ----- snippets/go/src/search.go | 4 +- snippets/guides/search-snippets.json | 26 ++++++------ .../src/test/java/com/algolia/Search.java | 12 +----- snippets/javascript/src/search.ts | 14 +------ .../kotlin/com/algolia/snippets/Search.kt | 5 --- snippets/php/src/Search.php | 13 ------ snippets/python/search.py | 11 ----- snippets/ruby/search.rb | 14 +------ snippets/scala/src/main/scala/Search.scala | 11 ++--- snippets/swift/Sources/Search.swift | 9 +--- specs/bundled/search.doc.yml | 3 +- specs/bundled/search.yml | 1 - .../src/generated/requests/Search.test.cs | 12 +----- .../dart/test/requests/search_test.dart | 13 +----- tests/output/go/tests/requests/search_test.go | 6 +-- .../com/algolia/requests/Search.test.java | 14 +------ .../javascript/src/requests/search.test.ts | 28 +------------ .../kotlin/com/algolia/requests/SearchTest.kt | 7 +--- tests/output/php/src/requests/SearchTest.php | 15 +------ .../python/tests/requests/search_test.py | 13 +----- .../output/ruby/test/requests/search_test.rb | 16 +------- .../algoliasearch/requests/SearchTest.scala | 16 +++----- .../swift/Tests/requests/SearchTests.swift | 11 +---- 37 files changed, 94 insertions(+), 297 deletions(-) diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/DictionaryEntry.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/DictionaryEntry.cs index a9acc9c5e7..6800f24588 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/DictionaryEntry.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/DictionaryEntry.cs @@ -40,11 +40,9 @@ public DictionaryEntry() /// Initializes a new instance of the DictionaryEntry class. /// /// Unique identifier for the dictionary entry. (required). - /// language (required). - public DictionaryEntry(string objectID, SupportedLanguage? language) + public DictionaryEntry(string objectID) { ObjectID = objectID ?? throw new ArgumentNullException(nameof(objectID)); - Language = language; AdditionalProperties = new Dictionary(); } diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.dart index eecabbb962..29ed81827c 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.dart @@ -13,7 +13,7 @@ final class DictionaryEntry extends DelegatingMap { /// Returns a new [DictionaryEntry] instance. const DictionaryEntry({ required this.objectID, - required this.language, + this.language, this.word, this.words, this.decomposition, @@ -26,7 +26,7 @@ final class DictionaryEntry extends DelegatingMap { final String objectID; @JsonKey(name: r'language') - final SupportedLanguage language; + final SupportedLanguage? language; /// Matching dictionary word for `stopwords` and `compounds` dictionaries. @JsonKey(name: r'word') diff --git a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.g.dart b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.g.dart index 9dfc7509f5..d924d5486b 100644 --- a/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.g.dart +++ b/clients/algoliasearch-client-dart/packages/client_search/lib/src/model/dictionary_entry.g.dart @@ -13,8 +13,8 @@ DictionaryEntry _$DictionaryEntryFromJson(Map json) => ($checkedConvert) { final val = DictionaryEntry( objectID: $checkedConvert('objectID', (v) => v as String), - language: $checkedConvert( - 'language', (v) => $enumDecode(_$SupportedLanguageEnumMap, v)), + language: $checkedConvert('language', + (v) => $enumDecodeNullable(_$SupportedLanguageEnumMap, v)), word: $checkedConvert('word', (v) => v as String?), words: $checkedConvert('words', (v) => (v as List?)?.map((e) => e as String).toList()), @@ -39,7 +39,6 @@ const _$DictionaryEntryFieldMap = { Map _$DictionaryEntryToJson(DictionaryEntry instance) { final val = { 'objectID': instance.objectID, - 'language': instance.language.toJson(), }; void writeNotNull(String key, dynamic value) { @@ -48,6 +47,7 @@ Map _$DictionaryEntryToJson(DictionaryEntry instance) { } } + writeNotNull('language', instance.language?.toJson()); writeNotNull('word', instance.word); writeNotNull('words', instance.words); writeNotNull('decomposition', instance.decomposition); diff --git a/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go b/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go index 20d0e26128..bd27f1e0dd 100644 --- a/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go +++ b/clients/algoliasearch-client-go/algolia/search/model_dictionary_entry.go @@ -9,8 +9,8 @@ import ( // DictionaryEntry Dictionary entry. type DictionaryEntry struct { // Unique identifier for the dictionary entry. - ObjectID string `json:"objectID"` - Language SupportedLanguage `json:"language"` + ObjectID string `json:"objectID"` + Language *SupportedLanguage `json:"language,omitempty"` // Matching dictionary word for `stopwords` and `compounds` dictionaries. Word *string `json:"word,omitempty"` // Matching words in the `plurals` dictionary including declensions. @@ -25,6 +25,12 @@ type _DictionaryEntry DictionaryEntry type DictionaryEntryOption func(f *DictionaryEntry) +func WithDictionaryEntryLanguage(val SupportedLanguage) DictionaryEntryOption { + return func(f *DictionaryEntry) { + f.Language = &val + } +} + func WithDictionaryEntryWord(val string) DictionaryEntryOption { return func(f *DictionaryEntry) { f.Word = &val @@ -53,10 +59,9 @@ func WithDictionaryEntryState(val DictionaryEntryState) DictionaryEntryOption { // 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 NewDictionaryEntry(objectID string, language SupportedLanguage, opts ...DictionaryEntryOption) *DictionaryEntry { +func NewDictionaryEntry(objectID string, opts ...DictionaryEntryOption) *DictionaryEntry { this := &DictionaryEntry{} this.ObjectID = objectID - this.Language = language for _, opt := range opts { opt(this) } @@ -93,28 +98,36 @@ func (o *DictionaryEntry) SetObjectID(v string) *DictionaryEntry { return o } -// GetLanguage returns the Language field value. +// GetLanguage returns the Language field value if set, zero value otherwise. func (o *DictionaryEntry) GetLanguage() SupportedLanguage { - if o == nil { + if o == nil || o.Language == nil { var ret SupportedLanguage return ret } - - return o.Language + return *o.Language } -// GetLanguageOk returns a tuple with the Language field value +// GetLanguageOk returns a tuple with the Language field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DictionaryEntry) GetLanguageOk() (*SupportedLanguage, bool) { - if o == nil { + if o == nil || o.Language == nil { return nil, false } - return &o.Language, true + return o.Language, true } -// SetLanguage sets field value. +// HasLanguage returns a boolean if a field has been set. +func (o *DictionaryEntry) HasLanguage() bool { + if o != nil && o.Language != nil { + return true + } + + return false +} + +// SetLanguage gets a reference to the given SupportedLanguage and assigns it to the Language field. func (o *DictionaryEntry) SetLanguage(v SupportedLanguage) *DictionaryEntry { - o.Language = v + o.Language = &v return o } @@ -265,7 +278,7 @@ func (o DictionaryEntry) MarshalJSON() ([]byte, error) { if true { toSerialize["objectID"] = o.ObjectID } - if true { + if o.Language != nil { toSerialize["language"] = o.Language } if o.Word != nil { diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/DictionaryEntry.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/DictionaryEntry.java index aae8876735..8181a08c42 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/DictionaryEntry.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/search/DictionaryEntry.java @@ -62,7 +62,7 @@ public DictionaryEntry setLanguage(SupportedLanguage language) { } /** Get language */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public SupportedLanguage getLanguage() { return language; } diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts index 8c86cbb387..16fce7026b 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/dictionaryEntry.ts @@ -12,7 +12,7 @@ export type DictionaryEntry = Record & { */ objectID: string; - language: SupportedLanguage; + language?: SupportedLanguage; /** * Matching dictionary word for `stopwords` and `compounds` dictionaries. diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/DictionaryEntry.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/DictionaryEntry.kt index 086c243ace..fbf4bfbce6 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/DictionaryEntry.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/search/DictionaryEntry.kt @@ -23,7 +23,7 @@ public data class DictionaryEntry( /** Unique identifier for the dictionary entry. */ val objectID: String, - val language: SupportedLanguage, + val language: SupportedLanguage? = null, /** Matching dictionary word for `stopwords` and `compounds` dictionaries. */ val word: String? = null, @@ -43,7 +43,7 @@ internal object DictionaryEntrySerializer : KSerializer { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("DictionaryEntry") { element("objectID") - element("language") + element("language", isOptional = true) element("word", isOptional = true) element>("words", isOptional = true) element>("decomposition", isOptional = true) @@ -55,7 +55,7 @@ internal object DictionaryEntrySerializer : KSerializer { val tree = input.decodeJsonObject() return DictionaryEntry( objectID = tree.getValue("objectID").let { input.json.decodeFromJsonElement(it) }, - language = tree.getValue("language").let { input.json.decodeFromJsonElement(it) }, + language = tree["language"]?.let { input.json.decodeFromJsonElement(it) }, word = tree["word"]?.let { input.json.decodeFromJsonElement(it) }, words = tree["words"]?.let { input.json.decodeFromJsonElement(it) }, decomposition = tree["decomposition"]?.let { input.json.decodeFromJsonElement(it) }, @@ -68,7 +68,7 @@ internal object DictionaryEntrySerializer : KSerializer { val output = encoder.asJsonEncoder() val json = buildJsonObject { put("objectID", output.json.encodeToJsonElement(value.objectID)) - put("language", output.json.encodeToJsonElement(value.language)) + value.language?.let { put("language", output.json.encodeToJsonElement(it)) } value.word?.let { put("word", output.json.encodeToJsonElement(it)) } value.words?.let { put("words", output.json.encodeToJsonElement(it)) } value.decomposition?.let { put("decomposition", output.json.encodeToJsonElement(it)) } diff --git a/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntry.php b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntry.php index 4829c22720..5e8ff7ffb6 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntry.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntry.php @@ -183,9 +183,6 @@ public function listInvalidProperties() if (!isset($this->container['objectID']) || null === $this->container['objectID']) { $invalidProperties[] = "'objectID' can't be null"; } - if (!isset($this->container['language']) || null === $this->container['language']) { - $invalidProperties[] = "'language' can't be null"; - } return $invalidProperties; } @@ -228,7 +225,7 @@ public function setObjectID($objectID) /** * Gets language. * - * @return SupportedLanguage + * @return null|SupportedLanguage */ public function getLanguage() { @@ -238,7 +235,7 @@ public function getLanguage() /** * Sets language. * - * @param SupportedLanguage $language language + * @param null|SupportedLanguage $language language * * @return self */ diff --git a/clients/algoliasearch-client-python/algoliasearch/search/models/dictionary_entry.py b/clients/algoliasearch-client-python/algoliasearch/search/models/dictionary_entry.py index e8dc7c7a4b..b4f1de9d6e 100644 --- a/clients/algoliasearch-client-python/algoliasearch/search/models/dictionary_entry.py +++ b/clients/algoliasearch-client-python/algoliasearch/search/models/dictionary_entry.py @@ -23,7 +23,7 @@ class DictionaryEntry(BaseModel): object_id: StrictStr = Field( description="Unique identifier for the dictionary entry.", alias="objectID" ) - language: SupportedLanguage + language: Optional[SupportedLanguage] = None word: Optional[StrictStr] = Field( default=None, description="Matching dictionary word for `stopwords` and `compounds` dictionaries.", diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/search/dictionary_entry.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/search/dictionary_entry.rb index c1b27e5bda..d45c24c868 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/models/search/dictionary_entry.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/models/search/dictionary_entry.rb @@ -101,8 +101,6 @@ def initialize(attributes = {}) if attributes.key?(:language) self.language = attributes[:language] - else - self.language = nil end if attributes.key?(:word) diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/DictionaryEntry.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/DictionaryEntry.scala index 9965c0461e..25ad9dd1ee 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/DictionaryEntry.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/search/DictionaryEntry.scala @@ -52,7 +52,7 @@ import org.json4s.{Extraction, Formats, JField, JObject, JValue, Serializer, Typ */ case class DictionaryEntry( objectID: String, - language: SupportedLanguage, + language: Option[SupportedLanguage] = scala.None, word: Option[String] = scala.None, words: Option[Seq[String]] = scala.None, decomposition: Option[Seq[String]] = scala.None, diff --git a/clients/algoliasearch-client-swift/Sources/Search/Models/DictionaryEntry.swift b/clients/algoliasearch-client-swift/Sources/Search/Models/DictionaryEntry.swift index a1c475b171..027b4e3104 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Models/DictionaryEntry.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Models/DictionaryEntry.swift @@ -10,7 +10,7 @@ import Foundation public struct DictionaryEntry: Codable, JSONEncodable { /// Unique identifier for the dictionary entry. public var objectID: String - public var language: SearchSupportedLanguage + public var language: SearchSupportedLanguage? /// Matching dictionary word for `stopwords` and `compounds` dictionaries. public var word: String? /// Matching words in the `plurals` dictionary including declensions. @@ -21,7 +21,7 @@ public struct DictionaryEntry: Codable, JSONEncodable { public init( objectID: String, - language: SearchSupportedLanguage, + language: SearchSupportedLanguage? = nil, word: String? = nil, words: [String]? = nil, decomposition: [String]? = nil, @@ -64,10 +64,8 @@ public struct DictionaryEntry: Codable, JSONEncodable { throw GenericError(description: "Failed to cast") } self.objectID = objectID - guard let language = dictionary["language"]?.value as? SearchSupportedLanguage else { - throw GenericError(description: "Failed to cast") - } - self.language = language + self.language = dictionary["language"]?.value as? SearchSupportedLanguage + self.word = dictionary["word"]?.value as? String self.words = dictionary["words"]?.value as? [String] @@ -91,7 +89,7 @@ public struct DictionaryEntry: Codable, JSONEncodable { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(self.objectID, forKey: .objectID) - try container.encode(self.language, forKey: .language) + try container.encodeIfPresent(self.language, forKey: .language) try container.encodeIfPresent(self.word, forKey: .word) try container.encodeIfPresent(self.words, forKey: .words) try container.encodeIfPresent(self.decomposition, forKey: .decomposition) @@ -106,7 +104,7 @@ public struct DictionaryEntry: Codable, JSONEncodable { let container = try decoder.container(keyedBy: CodingKeys.self) self.objectID = try container.decode(String.self, forKey: .objectID) - self.language = try container.decode(SearchSupportedLanguage.self, forKey: .language) + self.language = try container.decodeIfPresent(SearchSupportedLanguage.self, forKey: .language) self.word = try container.decodeIfPresent(String.self, forKey: .word) self.words = try container.decodeIfPresent([String].self, forKey: .words) self.decomposition = try container.decodeIfPresent([String].self, forKey: .decomposition) @@ -141,7 +139,7 @@ extension DictionaryEntry: Equatable { extension DictionaryEntry: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(self.objectID.hashValue) - hasher.combine(self.language.hashValue) + hasher.combine(self.language?.hashValue) hasher.combine(self.word?.hashValue) hasher.combine(self.words?.hashValue) hasher.combine(self.decomposition?.hashValue) diff --git a/snippets/csharp/src/Search.cs b/snippets/csharp/src/Search.cs index f65f42df09..13a98ec9bf 100644 --- a/snippets/csharp/src/Search.cs +++ b/snippets/csharp/src/Search.cs @@ -381,15 +381,7 @@ public async Task SnippetForSearchClientBatchDictionaryEntries1() new BatchDictionaryEntriesRequest { Action = Enum.Parse("DeleteEntry"), - Body = new DictionaryEntry - { - ObjectID = "1", - Language = Enum.Parse("En"), - Word = "fancy", - Words = new List { "believe", "algolia" }, - Decomposition = new List { "trust", "algolia" }, - State = Enum.Parse("Enabled"), - }, + Body = new DictionaryEntry { ObjectID = "1", }, } }, } diff --git a/snippets/dart/lib/search.dart b/snippets/dart/lib/search.dart index b76617f541..9bfb419569 100644 --- a/snippets/dart/lib/search.dart +++ b/snippets/dart/lib/search.dart @@ -342,17 +342,6 @@ void snippetForbatchDictionaryEntries1() async { action: DictionaryAction.fromJson("deleteEntry"), body: DictionaryEntry( objectID: "1", - language: SupportedLanguage.fromJson("en"), - word: "fancy", - words: [ - "believe", - "algolia", - ], - decomposition: [ - "trust", - "algolia", - ], - state: DictionaryEntryState.fromJson("enabled"), ), ), ], diff --git a/snippets/go/src/search.go b/snippets/go/src/search.go index 24289e21d5..0ade98206b 100644 --- a/snippets/go/src/search.go +++ b/snippets/go/src/search.go @@ -415,9 +415,7 @@ func SnippetForBatchDictionaryEntriesOfSearch1() { search.DictionaryType("plurals"), search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests( []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction("deleteEntry")).SetBody( - search.NewEmptyDictionaryEntry().SetObjectID("1").SetLanguage(search.SupportedLanguage("en")).SetWord("fancy").SetWords( - []string{"believe", "algolia"}).SetDecomposition( - []string{"trust", "algolia"}).SetState(search.DictionaryEntryState("enabled")))}), + search.NewEmptyDictionaryEntry().SetObjectID("1"))}), )) if err != nil { // handle the eventual error diff --git a/snippets/guides/search-snippets.json b/snippets/guides/search-snippets.json index 31303b0fd1..91fe325c11 100644 --- a/snippets/guides/search-snippets.json +++ b/snippets/guides/search-snippets.json @@ -29,7 +29,7 @@ }, "batchDictionaryEntries": { "replace": "var response = await client.BatchDictionaryEntriesAsync(\n Enum.Parse(\"Plurals\"),\n new BatchDictionaryEntriesParams\n {\n ClearExistingDictionaryEntries = true,\n Requests = new List\n {\n new BatchDictionaryEntriesRequest\n {\n Action = Enum.Parse(\"AddEntry\"),\n Body = new DictionaryEntry\n {\n ObjectID = \"1\",\n Language = Enum.Parse(\"En\"),\n Word = \"fancy\",\n Words = new List { \"believe\", \"algolia\" },\n Decomposition = new List { \"trust\", \"algolia\" },\n State = Enum.Parse(\"Enabled\"),\n },\n }\n },\n }\n);", - "delete": "var response = await client.BatchDictionaryEntriesAsync(\n Enum.Parse(\"Plurals\"),\n new BatchDictionaryEntriesParams\n {\n ClearExistingDictionaryEntries = true,\n Requests = new List\n {\n new BatchDictionaryEntriesRequest\n {\n Action = Enum.Parse(\"DeleteEntry\"),\n Body = new DictionaryEntry\n {\n ObjectID = \"1\",\n Language = Enum.Parse(\"En\"),\n Word = \"fancy\",\n Words = new List { \"believe\", \"algolia\" },\n Decomposition = new List { \"trust\", \"algolia\" },\n State = Enum.Parse(\"Enabled\"),\n },\n }\n },\n }\n);", + "delete": "var response = await client.BatchDictionaryEntriesAsync(\n Enum.Parse(\"Plurals\"),\n new BatchDictionaryEntriesParams\n {\n ClearExistingDictionaryEntries = true,\n Requests = new List\n {\n new BatchDictionaryEntriesRequest\n {\n Action = Enum.Parse(\"DeleteEntry\"),\n Body = new DictionaryEntry { ObjectID = \"1\", },\n }\n },\n }\n);", "append": "var response = await client.BatchDictionaryEntriesAsync(\n Enum.Parse(\"Stopwords\"),\n new BatchDictionaryEntriesParams\n {\n Requests = new List\n {\n new BatchDictionaryEntriesRequest\n {\n Action = Enum.Parse(\"AddEntry\"),\n Body = new DictionaryEntry\n {\n ObjectID = \"1\",\n Language = Enum.Parse(\"En\"),\n AdditionalProperties = new Dictionary { { \"additional\", \"try me\" } }\n },\n }\n },\n }\n);" }, "browse": { @@ -251,7 +251,7 @@ }, "batchDictionaryEntries": { "replace": "final response = await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.fromJson(\"plurals\"),\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [\n BatchDictionaryEntriesRequest(\n action: DictionaryAction.fromJson(\"addEntry\"),\n body: DictionaryEntry(\n objectID: \"1\",\n language: SupportedLanguage.fromJson(\"en\"),\n word: \"fancy\",\n words: [\n \"believe\",\n \"algolia\",\n ],\n decomposition: [\n \"trust\",\n \"algolia\",\n ],\n state: DictionaryEntryState.fromJson(\"enabled\"),\n ),\n ),\n ],\n ),\n);", - "delete": "final response = await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.fromJson(\"plurals\"),\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [\n BatchDictionaryEntriesRequest(\n action: DictionaryAction.fromJson(\"deleteEntry\"),\n body: DictionaryEntry(\n objectID: \"1\",\n language: SupportedLanguage.fromJson(\"en\"),\n word: \"fancy\",\n words: [\n \"believe\",\n \"algolia\",\n ],\n decomposition: [\n \"trust\",\n \"algolia\",\n ],\n state: DictionaryEntryState.fromJson(\"enabled\"),\n ),\n ),\n ],\n ),\n);", + "delete": "final response = await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.fromJson(\"plurals\"),\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [\n BatchDictionaryEntriesRequest(\n action: DictionaryAction.fromJson(\"deleteEntry\"),\n body: DictionaryEntry(\n objectID: \"1\",\n ),\n ),\n ],\n ),\n);", "append": "final response = await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.fromJson(\"stopwords\"),\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n requests: [\n BatchDictionaryEntriesRequest(\n action: DictionaryAction.fromJson(\"addEntry\"),\n body: DictionaryEntry(\n objectID: \"1\",\n language: SupportedLanguage.fromJson(\"en\"),\n additionalProperties: {'additional': 'try me'},\n ),\n ),\n ],\n ),\n);" }, "browse": { @@ -473,7 +473,7 @@ }, "batchDictionaryEntries": { "replace": "response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(\n search.DictionaryType(\"plurals\"),\n search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(\n []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction(\"addEntry\")).SetBody(\n search.NewEmptyDictionaryEntry().SetObjectID(\"1\").SetLanguage(search.SupportedLanguage(\"en\")).SetWord(\"fancy\").SetWords(\n []string{\"believe\", \"algolia\"}).SetDecomposition(\n []string{\"trust\", \"algolia\"}).SetState(search.DictionaryEntryState(\"enabled\")))}),\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n// use the model directly\nprint(response)", - "delete": "response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(\n search.DictionaryType(\"plurals\"),\n search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(\n []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction(\"deleteEntry\")).SetBody(\n search.NewEmptyDictionaryEntry().SetObjectID(\"1\").SetLanguage(search.SupportedLanguage(\"en\")).SetWord(\"fancy\").SetWords(\n []string{\"believe\", \"algolia\"}).SetDecomposition(\n []string{\"trust\", \"algolia\"}).SetState(search.DictionaryEntryState(\"enabled\")))}),\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n// use the model directly\nprint(response)", + "delete": "response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(\n search.DictionaryType(\"plurals\"),\n search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(\n []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction(\"deleteEntry\")).SetBody(\n search.NewEmptyDictionaryEntry().SetObjectID(\"1\"))}),\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n// use the model directly\nprint(response)", "append": "response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(\n search.DictionaryType(\"stopwords\"),\n search.NewEmptyBatchDictionaryEntriesParams().SetRequests(\n []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction(\"addEntry\")).SetBody(\n search.NewEmptyDictionaryEntry().SetObjectID(\"1\").SetLanguage(search.SupportedLanguage(\"en\")).SetAdditionalProperty(\"additional\", \"try me\"))}),\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n// use the model directly\nprint(response)" }, "browse": { @@ -695,7 +695,7 @@ }, "batchDictionaryEntries": { "replace": "client.batchDictionaryEntries(\n DictionaryType.PLURALS,\n new BatchDictionaryEntriesParams()\n .setClearExistingDictionaryEntries(true)\n .setRequests(\n List.of(\n new BatchDictionaryEntriesRequest()\n .setAction(DictionaryAction.ADD_ENTRY)\n .setBody(\n new DictionaryEntry()\n .setObjectID(\"1\")\n .setLanguage(SupportedLanguage.EN)\n .setWord(\"fancy\")\n .setWords(List.of(\"believe\", \"algolia\"))\n .setDecomposition(List.of(\"trust\", \"algolia\"))\n .setState(DictionaryEntryState.ENABLED)\n )\n )\n )\n);", - "delete": "client.batchDictionaryEntries(\n DictionaryType.PLURALS,\n new BatchDictionaryEntriesParams()\n .setClearExistingDictionaryEntries(true)\n .setRequests(\n List.of(\n new BatchDictionaryEntriesRequest()\n .setAction(DictionaryAction.DELETE_ENTRY)\n .setBody(\n new DictionaryEntry()\n .setObjectID(\"1\")\n .setLanguage(SupportedLanguage.EN)\n .setWord(\"fancy\")\n .setWords(List.of(\"believe\", \"algolia\"))\n .setDecomposition(List.of(\"trust\", \"algolia\"))\n .setState(DictionaryEntryState.ENABLED)\n )\n )\n )\n);", + "delete": "client.batchDictionaryEntries(\n DictionaryType.PLURALS,\n new BatchDictionaryEntriesParams()\n .setClearExistingDictionaryEntries(true)\n .setRequests(\n List.of(\n new BatchDictionaryEntriesRequest().setAction(DictionaryAction.DELETE_ENTRY).setBody(new DictionaryEntry().setObjectID(\"1\"))\n )\n )\n);", "append": "client.batchDictionaryEntries(\n DictionaryType.STOPWORDS,\n new BatchDictionaryEntriesParams()\n .setRequests(\n List.of(\n new BatchDictionaryEntriesRequest()\n .setAction(DictionaryAction.ADD_ENTRY)\n .setBody(\n new DictionaryEntry().setObjectID(\"1\").setLanguage(SupportedLanguage.EN).setAdditionalProperty(\"additional\", \"try me\")\n )\n )\n )\n);" }, "browse": { @@ -917,7 +917,7 @@ }, "batchDictionaryEntries": { "replace": "const response = await client.batchDictionaryEntries({\n dictionaryName: 'plurals',\n batchDictionaryEntriesParams: {\n clearExistingDictionaryEntries: true,\n requests: [\n {\n action: 'addEntry',\n body: {\n objectID: '1',\n language: 'en',\n word: 'fancy',\n words: ['believe', 'algolia'],\n decomposition: ['trust', 'algolia'],\n state: 'enabled',\n },\n },\n ],\n },\n});\n\n// use typed response\nconsole.log(response);", - "delete": "const response = await client.batchDictionaryEntries({\n dictionaryName: 'plurals',\n batchDictionaryEntriesParams: {\n clearExistingDictionaryEntries: true,\n requests: [\n {\n action: 'deleteEntry',\n body: {\n objectID: '1',\n language: 'en',\n word: 'fancy',\n words: ['believe', 'algolia'],\n decomposition: ['trust', 'algolia'],\n state: 'enabled',\n },\n },\n ],\n },\n});\n\n// use typed response\nconsole.log(response);", + "delete": "const response = await client.batchDictionaryEntries({\n dictionaryName: 'plurals',\n batchDictionaryEntriesParams: {\n clearExistingDictionaryEntries: true,\n requests: [{ action: 'deleteEntry', body: { objectID: '1' } }],\n },\n});\n\n// use typed response\nconsole.log(response);", "append": "const response = await client.batchDictionaryEntries({\n dictionaryName: 'stopwords',\n batchDictionaryEntriesParams: {\n requests: [\n {\n action: 'addEntry',\n body: { objectID: '1', language: 'en', additional: 'try me' },\n },\n ],\n },\n});\n\n// use typed response\nconsole.log(response);" }, "browse": { @@ -1139,7 +1139,7 @@ }, "batchDictionaryEntries": { "replace": "var response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.entries.first { it.value == \"plurals\" },\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = true,\n requests = listOf(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.entries.first { it.value == \"addEntry\" },\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.entries.first { it.value == \"en\" },\n word = \"fancy\",\n words = listOf(\"believe\", \"algolia\"),\n decomposition = listOf(\"trust\", \"algolia\"),\n state = DictionaryEntryState.entries.first { it.value == \"enabled\" },\n ),\n ),\n ),\n ),\n)\n\n// Use the response\nprintln(response)", - "delete": "var response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.entries.first { it.value == \"plurals\" },\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = true,\n requests = listOf(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.entries.first { it.value == \"deleteEntry\" },\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.entries.first { it.value == \"en\" },\n word = \"fancy\",\n words = listOf(\"believe\", \"algolia\"),\n decomposition = listOf(\"trust\", \"algolia\"),\n state = DictionaryEntryState.entries.first { it.value == \"enabled\" },\n ),\n ),\n ),\n ),\n)\n\n// Use the response\nprintln(response)", + "delete": "var response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.entries.first { it.value == \"plurals\" },\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = true,\n requests = listOf(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.entries.first { it.value == \"deleteEntry\" },\n body = DictionaryEntry(\n objectID = \"1\",\n ),\n ),\n ),\n ),\n)\n\n// Use the response\nprintln(response)", "append": "var response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.entries.first { it.value == \"stopwords\" },\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n requests = listOf(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.entries.first { it.value == \"addEntry\" },\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.entries.first { it.value == \"en\" },\n additionalProperties = mapOf(\n \"additional\" to JsonPrimitive(\"try me\"),\n ),\n ),\n ),\n ),\n ),\n)\n\n// Use the response\nprintln(response)" }, "browse": { @@ -1361,7 +1361,7 @@ }, "batchDictionaryEntries": { "replace": "$response = $client->batchDictionaryEntries(\n 'plurals',\n ['clearExistingDictionaryEntries' => true,\n 'requests' => [\n ['action' => 'addEntry',\n 'body' => ['objectID' => '1',\n 'language' => 'en',\n 'word' => 'fancy',\n 'words' => [\n 'believe',\n\n 'algolia',\n ],\n 'decomposition' => [\n 'trust',\n\n 'algolia',\n ],\n 'state' => 'enabled',\n ],\n ],\n ],\n ],\n);\n\n// play with the response\nvar_dump($response);", - "delete": "$response = $client->batchDictionaryEntries(\n 'plurals',\n ['clearExistingDictionaryEntries' => true,\n 'requests' => [\n ['action' => 'deleteEntry',\n 'body' => ['objectID' => '1',\n 'language' => 'en',\n 'word' => 'fancy',\n 'words' => [\n 'believe',\n\n 'algolia',\n ],\n 'decomposition' => [\n 'trust',\n\n 'algolia',\n ],\n 'state' => 'enabled',\n ],\n ],\n ],\n ],\n);\n\n// play with the response\nvar_dump($response);", + "delete": "$response = $client->batchDictionaryEntries(\n 'plurals',\n ['clearExistingDictionaryEntries' => true,\n 'requests' => [\n ['action' => 'deleteEntry',\n 'body' => ['objectID' => '1',\n ],\n ],\n ],\n ],\n);\n\n// play with the response\nvar_dump($response);", "append": "$response = $client->batchDictionaryEntries(\n 'stopwords',\n ['requests' => [\n ['action' => 'addEntry',\n 'body' => ['objectID' => '1',\n 'language' => 'en',\n 'additional' => 'try me',\n ],\n ],\n ],\n ],\n);\n\n// play with the response\nvar_dump($response);" }, "browse": { @@ -1583,7 +1583,7 @@ }, "batchDictionaryEntries": { "replace": "response = await _client.batch_dictionary_entries(\n dictionary_name=\"plurals\",\n batch_dictionary_entries_params={\n \"clearExistingDictionaryEntries\": True,\n \"requests\": [\n {\n \"action\": \"addEntry\",\n \"body\": {\n \"objectID\": \"1\",\n \"language\": \"en\",\n \"word\": \"fancy\",\n \"words\": [\n \"believe\",\n \"algolia\",\n ],\n \"decomposition\": [\n \"trust\",\n \"algolia\",\n ],\n \"state\": \"enabled\",\n },\n },\n ],\n },\n)\n\n# use the class directly\nprint(response)\n\n# print the JSON response\nprint(response.to_json())", - "delete": "response = await _client.batch_dictionary_entries(\n dictionary_name=\"plurals\",\n batch_dictionary_entries_params={\n \"clearExistingDictionaryEntries\": True,\n \"requests\": [\n {\n \"action\": \"deleteEntry\",\n \"body\": {\n \"objectID\": \"1\",\n \"language\": \"en\",\n \"word\": \"fancy\",\n \"words\": [\n \"believe\",\n \"algolia\",\n ],\n \"decomposition\": [\n \"trust\",\n \"algolia\",\n ],\n \"state\": \"enabled\",\n },\n },\n ],\n },\n)\n\n# use the class directly\nprint(response)\n\n# print the JSON response\nprint(response.to_json())", + "delete": "response = await _client.batch_dictionary_entries(\n dictionary_name=\"plurals\",\n batch_dictionary_entries_params={\n \"clearExistingDictionaryEntries\": True,\n \"requests\": [\n {\n \"action\": \"deleteEntry\",\n \"body\": {\n \"objectID\": \"1\",\n },\n },\n ],\n },\n)\n\n# use the class directly\nprint(response)\n\n# print the JSON response\nprint(response.to_json())", "append": "response = await _client.batch_dictionary_entries(\n dictionary_name=\"stopwords\",\n batch_dictionary_entries_params={\n \"requests\": [\n {\n \"action\": \"addEntry\",\n \"body\": {\n \"objectID\": \"1\",\n \"language\": \"en\",\n \"additional\": \"try me\",\n },\n },\n ],\n },\n)\n\n# use the class directly\nprint(response)\n\n# print the JSON response\nprint(response.to_json())" }, "browse": { @@ -1805,7 +1805,7 @@ }, "batchDictionaryEntries": { "replace": "response = client.batch_dictionary_entries(\n \"plurals\",\n BatchDictionaryEntriesParams.new(\n clear_existing_dictionary_entries: true,\n requests: [\n BatchDictionaryEntriesRequest.new(\n action: \"addEntry\",\n body: DictionaryEntry.new(\n object_id: \"1\",\n language: \"en\",\n word: \"fancy\",\n words: [\"believe\", \"algolia\"],\n decomposition: [\"trust\", \"algolia\"],\n state: \"enabled\"\n )\n )\n ]\n )\n)\n\n# use the class directly\nputs(response)\n\n# print the JSON response\nputs(response.to_json)", - "delete": "response = client.batch_dictionary_entries(\n \"plurals\",\n BatchDictionaryEntriesParams.new(\n clear_existing_dictionary_entries: true,\n requests: [\n BatchDictionaryEntriesRequest.new(\n action: \"deleteEntry\",\n body: DictionaryEntry.new(\n object_id: \"1\",\n language: \"en\",\n word: \"fancy\",\n words: [\"believe\", \"algolia\"],\n decomposition: [\"trust\", \"algolia\"],\n state: \"enabled\"\n )\n )\n ]\n )\n)\n\n# use the class directly\nputs(response)\n\n# print the JSON response\nputs(response.to_json)", + "delete": "response = client.batch_dictionary_entries(\n \"plurals\",\n BatchDictionaryEntriesParams.new(\n clear_existing_dictionary_entries: true,\n requests: [BatchDictionaryEntriesRequest.new(action: \"deleteEntry\", body: DictionaryEntry.new(object_id: \"1\"))]\n )\n)\n\n# use the class directly\nputs(response)\n\n# print the JSON response\nputs(response.to_json)", "append": "response = client.batch_dictionary_entries(\n \"stopwords\",\n BatchDictionaryEntriesParams.new(\n requests: [\n BatchDictionaryEntriesRequest.new(\n action: \"addEntry\",\n body: DictionaryEntry.new(object_id: \"1\", language: \"en\", additional: \"try me\")\n )\n ]\n )\n)\n\n# use the class directly\nputs(response)\n\n# print the JSON response\nputs(response.to_json)" }, "browse": { @@ -2026,9 +2026,9 @@ "default": "val response = client.batchAssignUserIds(\n xAlgoliaUserID = \"userID\",\n batchAssignUserIdsParams = BatchAssignUserIdsParams(\n cluster = \"theCluster\",\n users = Seq(\"user1\", \"user2\")\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" }, "batchDictionaryEntries": { - "replace": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"plurals\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = Some(true),\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"addEntry\"),\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.withName(\"en\"),\n word = Some(\"fancy\"),\n words = Some(Seq(\"believe\", \"algolia\")),\n decomposition = Some(Seq(\"trust\", \"algolia\")),\n state = Some(DictionaryEntryState.withName(\"enabled\"))\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))", - "delete": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"plurals\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = Some(true),\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"deleteEntry\"),\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.withName(\"en\"),\n word = Some(\"fancy\"),\n words = Some(Seq(\"believe\", \"algolia\")),\n decomposition = Some(Seq(\"trust\", \"algolia\")),\n state = Some(DictionaryEntryState.withName(\"enabled\"))\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))", - "append": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"stopwords\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"addEntry\"),\n body = DictionaryEntry(\n objectID = \"1\",\n language = SupportedLanguage.withName(\"en\"),\n additionalProperties = Some(List(JField(\"additional\", JString(\"try me\"))))\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" + "replace": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"plurals\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = Some(true),\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"addEntry\"),\n body = DictionaryEntry(\n objectID = \"1\",\n language = Some(SupportedLanguage.withName(\"en\")),\n word = Some(\"fancy\"),\n words = Some(Seq(\"believe\", \"algolia\")),\n decomposition = Some(Seq(\"trust\", \"algolia\")),\n state = Some(DictionaryEntryState.withName(\"enabled\"))\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))", + "delete": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"plurals\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries = Some(true),\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"deleteEntry\"),\n body = DictionaryEntry(\n objectID = \"1\"\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))", + "append": "val response = client.batchDictionaryEntries(\n dictionaryName = DictionaryType.withName(\"stopwords\"),\n batchDictionaryEntriesParams = BatchDictionaryEntriesParams(\n requests = Seq(\n BatchDictionaryEntriesRequest(\n action = DictionaryAction.withName(\"addEntry\"),\n body = DictionaryEntry(\n objectID = \"1\",\n language = Some(SupportedLanguage.withName(\"en\")),\n additionalProperties = Some(List(JField(\"additional\", JString(\"try me\"))))\n )\n )\n )\n )\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" }, "browse": { "default": "val response = client.browse(\n indexName = \"cts_e2e_browse\"\n)\n\n// Use the response\nval value = Await.result(response, Duration(100, \"sec\"))" @@ -2249,7 +2249,7 @@ }, "batchDictionaryEntries": { "replace": "let response = try await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.plurals,\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [BatchDictionaryEntriesRequest(\n action: DictionaryAction.addEntry,\n body: DictionaryEntry(\n objectID: \"1\",\n language: SearchSupportedLanguage.en,\n word: \"fancy\",\n words: [\"believe\", \"algolia\"],\n decomposition: [\"trust\", \"algolia\"],\n state: DictionaryEntryState.enabled\n )\n )]\n )\n)", - "delete": "let response = try await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.plurals,\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [BatchDictionaryEntriesRequest(\n action: DictionaryAction.deleteEntry,\n body: DictionaryEntry(\n objectID: \"1\",\n language: SearchSupportedLanguage.en,\n word: \"fancy\",\n words: [\"believe\", \"algolia\"],\n decomposition: [\"trust\", \"algolia\"],\n state: DictionaryEntryState.enabled\n )\n )]\n )\n)", + "delete": "let response = try await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.plurals,\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(\n clearExistingDictionaryEntries: true,\n requests: [BatchDictionaryEntriesRequest(\n action: DictionaryAction.deleteEntry,\n body: DictionaryEntry(objectID: \"1\")\n )]\n )\n)", "append": "let response = try await client.batchDictionaryEntries(\n dictionaryName: DictionaryType.stopwords,\n batchDictionaryEntriesParams: BatchDictionaryEntriesParams(requests: [BatchDictionaryEntriesRequest(\n action: DictionaryAction.addEntry,\n body: DictionaryEntry(from: [\n \"objectID\": AnyCodable(\"1\"),\n \"language\": AnyCodable(SearchSupportedLanguage.en),\n \"additional\": AnyCodable(\"try me\"),\n ])\n )])\n)" }, "browse": { diff --git a/snippets/java/src/test/java/com/algolia/Search.java b/snippets/java/src/test/java/com/algolia/Search.java index 32acfaaea0..da8d7d2807 100644 --- a/snippets/java/src/test/java/com/algolia/Search.java +++ b/snippets/java/src/test/java/com/algolia/Search.java @@ -247,17 +247,7 @@ void snippetForBatchDictionaryEntries1() { .setClearExistingDictionaryEntries(true) .setRequests( List.of( - new BatchDictionaryEntriesRequest() - .setAction(DictionaryAction.DELETE_ENTRY) - .setBody( - new DictionaryEntry() - .setObjectID("1") - .setLanguage(SupportedLanguage.EN) - .setWord("fancy") - .setWords(List.of("believe", "algolia")) - .setDecomposition(List.of("trust", "algolia")) - .setState(DictionaryEntryState.ENABLED) - ) + new BatchDictionaryEntriesRequest().setAction(DictionaryAction.DELETE_ENTRY).setBody(new DictionaryEntry().setObjectID("1")) ) ) ); diff --git a/snippets/javascript/src/search.ts b/snippets/javascript/src/search.ts index 58e389d9be..b8f430ac85 100644 --- a/snippets/javascript/src/search.ts +++ b/snippets/javascript/src/search.ts @@ -306,19 +306,7 @@ export async function snippetForBatchDictionaryEntries1(): Promise { dictionaryName: 'plurals', batchDictionaryEntriesParams: { clearExistingDictionaryEntries: true, - requests: [ - { - action: 'deleteEntry', - body: { - objectID: '1', - language: 'en', - word: 'fancy', - words: ['believe', 'algolia'], - decomposition: ['trust', 'algolia'], - state: 'enabled', - }, - }, - ], + requests: [{ action: 'deleteEntry', body: { objectID: '1' } }], }, }); diff --git a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt b/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt index 49fe88c449..414c1a5cf7 100644 --- a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt +++ b/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt @@ -393,11 +393,6 @@ class SnippetSearchClient { action = DictionaryAction.entries.first { it.value == "deleteEntry" }, body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.entries.first { it.value == "en" }, - word = "fancy", - words = listOf("believe", "algolia"), - decomposition = listOf("trust", "algolia"), - state = DictionaryEntryState.entries.first { it.value == "enabled" }, ), ), ), diff --git a/snippets/php/src/Search.php b/snippets/php/src/Search.php index 9ea82d4d3d..63cac3bdd6 100644 --- a/snippets/php/src/Search.php +++ b/snippets/php/src/Search.php @@ -402,19 +402,6 @@ public function snippetForBatchDictionaryEntries1() 'requests' => [ ['action' => 'deleteEntry', 'body' => ['objectID' => '1', - 'language' => 'en', - 'word' => 'fancy', - 'words' => [ - 'believe', - - 'algolia', - ], - 'decomposition' => [ - 'trust', - - 'algolia', - ], - 'state' => 'enabled', ], ], ], diff --git a/snippets/python/search.py b/snippets/python/search.py index def00455ed..d7c2a3cf6f 100644 --- a/snippets/python/search.py +++ b/snippets/python/search.py @@ -449,17 +449,6 @@ async def snippet_for_batch_dictionary_entries1(): "action": "deleteEntry", "body": { "objectID": "1", - "language": "en", - "word": "fancy", - "words": [ - "believe", - "algolia", - ], - "decomposition": [ - "trust", - "algolia", - ], - "state": "enabled", }, }, ], diff --git a/snippets/ruby/search.rb b/snippets/ruby/search.rb index 2ffa0cf443..6facadfd1e 100644 --- a/snippets/ruby/search.rb +++ b/snippets/ruby/search.rb @@ -319,19 +319,7 @@ def snippet_for_batch_dictionary_entries1 "plurals", BatchDictionaryEntriesParams.new( clear_existing_dictionary_entries: true, - requests: [ - BatchDictionaryEntriesRequest.new( - action: "deleteEntry", - body: DictionaryEntry.new( - object_id: "1", - language: "en", - word: "fancy", - words: ["believe", "algolia"], - decomposition: ["trust", "algolia"], - state: "enabled" - ) - ) - ] + requests: [BatchDictionaryEntriesRequest.new(action: "deleteEntry", body: DictionaryEntry.new(object_id: "1"))] ) ) diff --git a/snippets/scala/src/main/scala/Search.scala b/snippets/scala/src/main/scala/Search.scala index 1656966afb..b6ed45750b 100644 --- a/snippets/scala/src/main/scala/Search.scala +++ b/snippets/scala/src/main/scala/Search.scala @@ -341,7 +341,7 @@ class SnippetSearchClient { action = DictionaryAction.withName("addEntry"), body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.withName("en"), + language = Some(SupportedLanguage.withName("en")), word = Some("fancy"), words = Some(Seq("believe", "algolia")), decomposition = Some(Seq("trust", "algolia")), @@ -375,12 +375,7 @@ class SnippetSearchClient { BatchDictionaryEntriesRequest( action = DictionaryAction.withName("deleteEntry"), body = DictionaryEntry( - objectID = "1", - language = SupportedLanguage.withName("en"), - word = Some("fancy"), - words = Some(Seq("believe", "algolia")), - decomposition = Some(Seq("trust", "algolia")), - state = Some(DictionaryEntryState.withName("enabled")) + objectID = "1" ) ) ) @@ -410,7 +405,7 @@ class SnippetSearchClient { action = DictionaryAction.withName("addEntry"), body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.withName("en"), + language = Some(SupportedLanguage.withName("en")), additionalProperties = Some(List(JField("additional", JString("try me")))) ) ) diff --git a/snippets/swift/Sources/Search.swift b/snippets/swift/Sources/Search.swift index ca4efb3cbf..438bb227d6 100644 --- a/snippets/swift/Sources/Search.swift +++ b/snippets/swift/Sources/Search.swift @@ -268,14 +268,7 @@ final class SearchClientSnippet { clearExistingDictionaryEntries: true, requests: [BatchDictionaryEntriesRequest( action: DictionaryAction.deleteEntry, - body: DictionaryEntry( - objectID: "1", - language: SearchSupportedLanguage.en, - word: "fancy", - words: ["believe", "algolia"], - decomposition: ["trust", "algolia"], - state: DictionaryEntryState.enabled - ) + body: DictionaryEntry(objectID: "1") )] ) ) diff --git a/specs/bundled/search.doc.yml b/specs/bundled/search.doc.yml index fa78f02837..e94ab9f625 100644 --- a/specs/bundled/search.doc.yml +++ b/specs/bundled/search.doc.yml @@ -10331,7 +10331,7 @@ paths: action = DictionaryAction.withName("addEntry"), body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.withName("en"), + language = Some(SupportedLanguage.withName("en")), word = Some("fancy"), words = Some(Seq("believe", "algolia")), decomposition = Some(Seq("trust", "algolia")), @@ -19364,7 +19364,6 @@ components: additionalProperties: true required: - objectID - - language properties: objectID: type: string diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index 3728dd45e5..903b7bdccd 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -7320,7 +7320,6 @@ components: additionalProperties: true required: - objectID - - language properties: objectID: type: string diff --git a/tests/output/csharp/src/generated/requests/Search.test.cs b/tests/output/csharp/src/generated/requests/Search.test.cs index 4ea320ba99..5a3ebd3e18 100644 --- a/tests/output/csharp/src/generated/requests/Search.test.cs +++ b/tests/output/csharp/src/generated/requests/Search.test.cs @@ -418,15 +418,7 @@ await client.BatchDictionaryEntriesAsync( new BatchDictionaryEntriesRequest { Action = Enum.Parse("DeleteEntry"), - Body = new DictionaryEntry - { - ObjectID = "1", - Language = Enum.Parse("En"), - Word = "fancy", - Words = new List { "believe", "algolia" }, - Decomposition = new List { "trust", "algolia" }, - State = Enum.Parse("Enabled"), - }, + Body = new DictionaryEntry { ObjectID = "1", }, } }, } @@ -436,7 +428,7 @@ await client.BatchDictionaryEntriesAsync( Assert.Equal("/1/dictionaries/plurals/batch", req.Path); Assert.Equal("POST", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\",\"word\":\"fancy\",\"words\":[\"believe\",\"algolia\"],\"decomposition\":[\"trust\",\"algolia\"],\"state\":\"enabled\"}}]}", + "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\"}}]}", req.Body, new JsonDiffConfig(false) ); diff --git a/tests/output/dart/test/requests/search_test.dart b/tests/output/dart/test/requests/search_test.dart index 8e8f67fdb2..18ff02d9af 100644 --- a/tests/output/dart/test/requests/search_test.dart +++ b/tests/output/dart/test/requests/search_test.dart @@ -446,17 +446,6 @@ void main() { action: DictionaryAction.fromJson("deleteEntry"), body: DictionaryEntry( objectID: "1", - language: SupportedLanguage.fromJson("en"), - word: "fancy", - words: [ - "believe", - "algolia", - ], - decomposition: [ - "trust", - "algolia", - ], - state: DictionaryEntryState.fromJson("enabled"), ), ), ], @@ -466,7 +455,7 @@ void main() { expectPath(request.path, '/1/dictionaries/plurals/batch'); expect(request.method, 'post'); expectBody(request.body, - """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}"""); + """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}"""); }, ), ); diff --git a/tests/output/go/tests/requests/search_test.go b/tests/output/go/tests/requests/search_test.go index 9d7cba23a0..30df084828 100644 --- a/tests/output/go/tests/requests/search_test.go +++ b/tests/output/go/tests/requests/search_test.go @@ -286,9 +286,7 @@ func TestSearch_BatchDictionaryEntries(t *testing.T) { search.DictionaryType("plurals"), search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests( []search.BatchDictionaryEntriesRequest{*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction("deleteEntry")).SetBody( - search.NewEmptyDictionaryEntry().SetObjectID("1").SetLanguage(search.SupportedLanguage("en")).SetWord("fancy").SetWords( - []string{"believe", "algolia"}).SetDecomposition( - []string{"trust", "algolia"}).SetState(search.DictionaryEntryState("enabled")))}), + search.NewEmptyDictionaryEntry().SetObjectID("1"))}), )) require.NoError(t, err) @@ -296,7 +294,7 @@ func TestSearch_BatchDictionaryEntries(t *testing.T) { require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}`) + ja.Assertf(*echo.Body, `{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}`) }) t.Run("append", func(t *testing.T) { _, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest( diff --git a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java index dd9bd4ca12..addbd3dbab 100644 --- a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java +++ b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java @@ -366,17 +366,7 @@ void batchDictionaryEntriesTest1() { .setClearExistingDictionaryEntries(true) .setRequests( List.of( - new BatchDictionaryEntriesRequest() - .setAction(DictionaryAction.DELETE_ENTRY) - .setBody( - new DictionaryEntry() - .setObjectID("1") - .setLanguage(SupportedLanguage.EN) - .setWord("fancy") - .setWords(List.of("believe", "algolia")) - .setDecomposition(List.of("trust", "algolia")) - .setState(DictionaryEntryState.ENABLED) - ) + new BatchDictionaryEntriesRequest().setAction(DictionaryAction.DELETE_ENTRY).setBody(new DictionaryEntry().setObjectID("1")) ) ) ); @@ -386,7 +376,7 @@ void batchDictionaryEntriesTest1() { assertEquals("POST", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\",\"word\":\"fancy\",\"words\":[\"believe\",\"algolia\"],\"decomposition\":[\"trust\",\"algolia\"],\"state\":\"enabled\"}}]}", + "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\"}}]}", req.body, JSONCompareMode.STRICT ) diff --git a/tests/output/javascript/src/requests/search.test.ts b/tests/output/javascript/src/requests/search.test.ts index f7d1ec2b5a..57ea350e74 100644 --- a/tests/output/javascript/src/requests/search.test.ts +++ b/tests/output/javascript/src/requests/search.test.ts @@ -290,19 +290,7 @@ describe('batchDictionaryEntries', () => { dictionaryName: 'plurals', batchDictionaryEntriesParams: { clearExistingDictionaryEntries: true, - requests: [ - { - action: 'deleteEntry', - body: { - objectID: '1', - language: 'en', - word: 'fancy', - words: ['believe', 'algolia'], - decomposition: ['trust', 'algolia'], - state: 'enabled', - }, - }, - ], + requests: [{ action: 'deleteEntry', body: { objectID: '1' } }], }, })) as unknown as EchoResponse; @@ -310,19 +298,7 @@ describe('batchDictionaryEntries', () => { expect(req.method).toEqual('POST'); expect(req.data).toEqual({ clearExistingDictionaryEntries: true, - requests: [ - { - action: 'deleteEntry', - body: { - objectID: '1', - language: 'en', - word: 'fancy', - words: ['believe', 'algolia'], - decomposition: ['trust', 'algolia'], - state: 'enabled', - }, - }, - ], + requests: [{ action: 'deleteEntry', body: { objectID: '1' } }], }); expect(req.searchParams).toStrictEqual(undefined); }); diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt index 56e431b010..062b5fd7a2 100644 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt +++ b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt @@ -422,11 +422,6 @@ class SearchTest { action = DictionaryAction.entries.first { it.value == "deleteEntry" }, body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.entries.first { it.value == "en" }, - word = "fancy", - words = listOf("believe", "algolia"), - decomposition = listOf("trust", "algolia"), - state = DictionaryEntryState.entries.first { it.value == "enabled" }, ), ), ), @@ -436,7 +431,7 @@ class SearchTest { intercept = { assertEquals("/1/dictionaries/plurals/batch".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}""", it.body) + assertJsonBody("""{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}""", it.body) }, ) } diff --git a/tests/output/php/src/requests/SearchTest.php b/tests/output/php/src/requests/SearchTest.php index 7844e9946e..81f992fb0d 100644 --- a/tests/output/php/src/requests/SearchTest.php +++ b/tests/output/php/src/requests/SearchTest.php @@ -384,19 +384,6 @@ public function testBatchDictionaryEntries1() 'requests' => [ ['action' => 'deleteEntry', 'body' => ['objectID' => '1', - 'language' => 'en', - 'word' => 'fancy', - 'words' => [ - 'believe', - - 'algolia', - ], - 'decomposition' => [ - 'trust', - - 'algolia', - ], - 'state' => 'enabled', ], ], ], @@ -407,7 +394,7 @@ public function testBatchDictionaryEntries1() [ 'path' => '/1/dictionaries/plurals/batch', 'method' => 'POST', - 'body' => json_decode('{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}'), + 'body' => json_decode('{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}'), ], ]); } diff --git a/tests/output/python/tests/requests/search_test.py b/tests/output/python/tests/requests/search_test.py index 760bf56bfc..b83ce385e4 100644 --- a/tests/output/python/tests/requests/search_test.py +++ b/tests/output/python/tests/requests/search_test.py @@ -377,17 +377,6 @@ async def test_batch_dictionary_entries_1(self): "action": "deleteEntry", "body": { "objectID": "1", - "language": "en", - "word": "fancy", - "words": [ - "believe", - "algolia", - ], - "decomposition": [ - "trust", - "algolia", - ], - "state": "enabled", }, }, ], @@ -399,7 +388,7 @@ async def test_batch_dictionary_entries_1(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}""" + """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}""" ) async def test_batch_dictionary_entries_2(self): diff --git a/tests/output/ruby/test/requests/search_test.rb b/tests/output/ruby/test/requests/search_test.rb index 3f2a6e25aa..43cb2fd744 100644 --- a/tests/output/ruby/test/requests/search_test.rb +++ b/tests/output/ruby/test/requests/search_test.rb @@ -273,19 +273,7 @@ def test_batch_dictionary_entries1 "plurals", BatchDictionaryEntriesParams.new( clear_existing_dictionary_entries: true, - requests: [ - BatchDictionaryEntriesRequest.new( - action: "deleteEntry", - body: DictionaryEntry.new( - object_id: "1", - language: "en", - word: "fancy", - words: ["believe", "algolia"], - decomposition: ["trust", "algolia"], - state: "enabled" - ) - ) - ] + requests: [BatchDictionaryEntriesRequest.new(action: "deleteEntry", body: DictionaryEntry.new(object_id: "1"))] ) ) @@ -295,7 +283,7 @@ def test_batch_dictionary_entries1 assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( JSON.parse( - "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\",\"word\":\"fancy\",\"words\":[\"believe\",\"algolia\"],\"decomposition\":[\"trust\",\"algolia\"],\"state\":\"enabled\"}}]}" + "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\"}}]}" ), JSON.parse(req.body) ) 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 18aea9ddb3..edc19ac056 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala @@ -353,7 +353,7 @@ class SearchTest extends AnyFunSuite { action = DictionaryAction.withName("addEntry"), body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.withName("en"), + language = Some(SupportedLanguage.withName("en")), word = Some("fancy"), words = Some(Seq("believe", "algolia")), decomposition = Some(Seq("trust", "algolia")), @@ -386,12 +386,7 @@ class SearchTest extends AnyFunSuite { BatchDictionaryEntriesRequest( action = DictionaryAction.withName("deleteEntry"), body = DictionaryEntry( - objectID = "1", - language = SupportedLanguage.withName("en"), - word = Some("fancy"), - words = Some(Seq("believe", "algolia")), - decomposition = Some(Seq("trust", "algolia")), - state = Some(DictionaryEntryState.withName("enabled")) + objectID = "1" ) ) ) @@ -403,9 +398,8 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/dictionaries/plurals/batch") assert(res.method == "POST") - val expectedBody = parse( - """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}""" - ) + val expectedBody = + parse("""{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } @@ -420,7 +414,7 @@ class SearchTest extends AnyFunSuite { action = DictionaryAction.withName("addEntry"), body = DictionaryEntry( objectID = "1", - language = SupportedLanguage.withName("en"), + language = Some(SupportedLanguage.withName("en")), additionalProperties = Some(List(JField("additional", JString("try me")))) ) ) diff --git a/tests/output/swift/Tests/requests/SearchTests.swift b/tests/output/swift/Tests/requests/SearchTests.swift index 5757f32d48..f372dcedb0 100644 --- a/tests/output/swift/Tests/requests/SearchTests.swift +++ b/tests/output/swift/Tests/requests/SearchTests.swift @@ -521,14 +521,7 @@ final class SearchClientRequestsTests: XCTestCase { clearExistingDictionaryEntries: true, requests: [BatchDictionaryEntriesRequest( action: DictionaryAction.deleteEntry, - body: DictionaryEntry( - objectID: "1", - language: SearchSupportedLanguage.en, - word: "fancy", - words: ["believe", "algolia"], - decomposition: ["trust", "algolia"], - state: DictionaryEntryState.enabled - ) + body: DictionaryEntry(objectID: "1") )] ) ) @@ -539,7 +532,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) let expectedBodyData = - "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\",\"word\":\"fancy\",\"words\":[\"believe\",\"algolia\"],\"decomposition\":[\"trust\",\"algolia\"],\"state\":\"enabled\"}}]}" + "{\"clearExistingDictionaryEntries\":true,\"requests\":[{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"1\"}}]}" .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString)