Skip to content

Commit 8288fca

Browse files
algolia-botFluf22shortcuts
committed
chore: generated code for commit c91ca54f. [skip ci]
algolia/api-clients-automation@c91ca54 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]> Co-authored-by: shortcuts <[email protected]>
1 parent a6782c7 commit 8288fca

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

Sources/Ingestion/IngestionClient.swift

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,4 +2411,120 @@ open class IngestionClient {
24112411
requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
24122412
)
24132413
}
2414+
2415+
/// - parameter sourceCreate: (body) (optional)
2416+
/// - returns: SourceValidateResponse
2417+
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
2418+
open func validateSource(
2419+
sourceCreate: SourceCreate? = nil,
2420+
requestOptions: RequestOptions? = nil
2421+
) async throws -> SourceValidateResponse {
2422+
let response: Response<SourceValidateResponse> = try await validateSourceWithHTTPInfo(
2423+
sourceCreate: sourceCreate,
2424+
requestOptions: requestOptions
2425+
)
2426+
2427+
guard let body = response.body else {
2428+
throw AlgoliaError.missingData
2429+
}
2430+
2431+
return body
2432+
}
2433+
2434+
// Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
2435+
// Required API Key ACLs:
2436+
// - addObject
2437+
// - deleteIndex
2438+
// - editSettings
2439+
//
2440+
// - parameter sourceCreate: (body) (optional)
2441+
// - returns: RequestBuilder<SourceValidateResponse>
2442+
2443+
open func validateSourceWithHTTPInfo(
2444+
sourceCreate: SourceCreate? = nil,
2445+
requestOptions userRequestOptions: RequestOptions? = nil
2446+
) async throws -> Response<SourceValidateResponse> {
2447+
let resourcePath = "/1/sources/validate"
2448+
let body = sourceCreate
2449+
let queryParameters: [String: Any?]? = nil
2450+
2451+
let nillableHeaders: [String: Any?]? = nil
2452+
2453+
let headers = APIHelper.rejectNilHeaders(nillableHeaders)
2454+
2455+
return try await self.transporter.send(
2456+
method: "POST",
2457+
path: resourcePath,
2458+
data: body ?? AnyCodable(),
2459+
requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
2460+
)
2461+
}
2462+
2463+
/// - parameter sourceID: (path) Unique identifier of a source.
2464+
/// - parameter sourceUpdate: (body)
2465+
/// - returns: SourceValidateResponse
2466+
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
2467+
open func validateSourceBeforeUpdate(
2468+
sourceID: String,
2469+
sourceUpdate: SourceUpdate,
2470+
requestOptions: RequestOptions? = nil
2471+
) async throws -> SourceValidateResponse {
2472+
let response: Response<SourceValidateResponse> = try await validateSourceBeforeUpdateWithHTTPInfo(
2473+
sourceID: sourceID,
2474+
sourceUpdate: sourceUpdate,
2475+
requestOptions: requestOptions
2476+
)
2477+
2478+
guard let body = response.body else {
2479+
throw AlgoliaError.missingData
2480+
}
2481+
2482+
return body
2483+
}
2484+
2485+
// Validates an update of a source payload to ensure it can be created and that the data source can be reached by
2486+
// Algolia.
2487+
// Required API Key ACLs:
2488+
// - addObject
2489+
// - deleteIndex
2490+
// - editSettings
2491+
//
2492+
// - parameter sourceID: (path) Unique identifier of a source.
2493+
//
2494+
// - parameter sourceUpdate: (body)
2495+
// - returns: RequestBuilder<SourceValidateResponse>
2496+
2497+
open func validateSourceBeforeUpdateWithHTTPInfo(
2498+
sourceID: String,
2499+
sourceUpdate: SourceUpdate,
2500+
requestOptions userRequestOptions: RequestOptions? = nil
2501+
) async throws -> Response<SourceValidateResponse> {
2502+
guard !sourceID.isEmpty else {
2503+
throw AlgoliaError.invalidArgument("sourceID", "validateSourceBeforeUpdate")
2504+
}
2505+
2506+
var resourcePath = "/1/sources/{sourceID}/validate"
2507+
let sourceIDPreEscape = "\(APIHelper.mapValueToPathItem(sourceID))"
2508+
let sourceIDPostEscape = sourceIDPreEscape
2509+
.addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
2510+
resourcePath = resourcePath.replacingOccurrences(
2511+
of: "{sourceID}",
2512+
with: sourceIDPostEscape,
2513+
options: .literal,
2514+
range: nil
2515+
)
2516+
let body = sourceUpdate
2517+
let queryParameters: [String: Any?]? = nil
2518+
2519+
let nillableHeaders: [String: Any?]? = nil
2520+
2521+
let headers = APIHelper.rejectNilHeaders(nillableHeaders)
2522+
2523+
return try await self.transporter.send(
2524+
method: "POST",
2525+
path: resourcePath,
2526+
data: body,
2527+
requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
2528+
)
2529+
}
24142530
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
public struct SourceValidateResponse: Codable, JSONEncodable {
10+
/// Universally unique identifier (UUID) of a task run.
11+
public var runID: String?
12+
/// depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
13+
public var data: [AnyCodable]?
14+
/// in case of error, observability events will be added to the response, if any.
15+
public var events: [Event]?
16+
/// a message describing the outcome of a validate run.
17+
public var message: String
18+
19+
public init(runID: String? = nil, data: [AnyCodable]? = nil, events: [Event]? = nil, message: String) {
20+
self.runID = runID
21+
self.data = data
22+
self.events = events
23+
self.message = message
24+
}
25+
26+
public enum CodingKeys: String, CodingKey, CaseIterable {
27+
case runID
28+
case data
29+
case events
30+
case message
31+
}
32+
33+
// Encodable protocol methods
34+
35+
public func encode(to encoder: Encoder) throws {
36+
var container = encoder.container(keyedBy: CodingKeys.self)
37+
try container.encodeIfPresent(self.runID, forKey: .runID)
38+
try container.encodeIfPresent(self.data, forKey: .data)
39+
try container.encodeIfPresent(self.events, forKey: .events)
40+
try container.encode(self.message, forKey: .message)
41+
}
42+
}
43+
44+
extension SourceValidateResponse: Equatable {
45+
public static func ==(lhs: SourceValidateResponse, rhs: SourceValidateResponse) -> Bool {
46+
lhs.runID == rhs.runID &&
47+
lhs.data == rhs.data &&
48+
lhs.events == rhs.events &&
49+
lhs.message == rhs.message
50+
}
51+
}
52+
53+
extension SourceValidateResponse: Hashable {
54+
public func hash(into hasher: inout Hasher) {
55+
hasher.combine(self.runID?.hashValue)
56+
hasher.combine(self.data?.hashValue)
57+
hasher.combine(self.events?.hashValue)
58+
hasher.combine(self.message.hashValue)
59+
}
60+
}

0 commit comments

Comments
 (0)