Skip to content

Commit

Permalink
fix(specs): body is not required in multiple batch request (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3454

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Kai Welke <[email protected]>
  • Loading branch information
algolia-bot and kai687 committed Aug 3, 2024
1 parent 429fa99 commit a84bba0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Search/Models/MultipleBatchRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}

0 comments on commit a84bba0

Please sign in to comment.