@@ -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}
0 commit comments