mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
765 lines
48 KiB
Swift
765 lines
48 KiB
Swift
//
|
|
// IndexAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
open class IndexAPI {
|
|
|
|
/**
|
|
Deletes an index and everything in it.
|
|
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func deleteIndexIndexesByUid(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await deleteIndexIndexesByUidWithRequestBuilder(uid: uid, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Deletes an index and everything in it.
|
|
- DELETE /v1/index/indexes/{uid}
|
|
- Deletes an index and everything in it. Drops the index and every document in it from the caller's own org, and answers the dialect's EnqueuedTask. This is the only way to retire an index; without it a mistaken uid is permanent. Deleting an index that is not there succeeds, so a cleanup pass is safe to re-run. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the documents are already gone when this answers.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func deleteIndexIndexesByUidWithRequestBuilder(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Deletes one document by its primary key.
|
|
|
|
- parameter uid: (path)
|
|
- parameter id: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func deleteIndexIndexesByUidDocumentsById(uid: String, id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await deleteIndexIndexesByUidDocumentsByIdWithRequestBuilder(uid: uid, id: id, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Deletes one document by its primary key.
|
|
- DELETE /v1/index/indexes/{uid}/documents/{id}
|
|
- Deletes one document by its primary key. Removes the document from the caller's own org and answers the dialect's EnqueuedTask. Deleting a key that is not there succeeds, so a client reconciling its own corpus can delete without checking first. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the document is already gone when this answers.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter id: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func deleteIndexIndexesByUidDocumentsByIdWithRequestBuilder(uid: String, id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents/{id}"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
|
|
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reports whether the search plane can serve.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexHealth
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexHealth(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexHealth {
|
|
return try await getIndexHealthWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reports whether the search plane can serve.
|
|
- GET /v1/index/health
|
|
- Reports whether the search plane can serve. Answers the dialect's `{\"status\":\"available\"}` when the index store is readable. It FAILS CLOSED — an unreadable store answers 503 with `{\"status\":\"unavailable\"}` rather than an empty result set, because a Meilisearch client probes this before it will use a server at all and a cheerful 200 over a broken volume turns \"search is down\" into \"nothing matched\". It requires no principal and reads no tenant data.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexHealth>
|
|
*/
|
|
open class func getIndexHealthWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexHealth> {
|
|
let localVariablePath = "/v1/index/health"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexHealth>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Lists the indexes your org holds.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexList
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexIndexes(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexList {
|
|
return try await getIndexIndexesWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Lists the indexes your org holds.
|
|
- GET /v1/index/indexes
|
|
- Lists the indexes your org holds. Answers every index in the caller's own org with its primary key and timestamps. Without it an index whose uid a caller has forgotten is unreachable — there is no other way to enumerate what an org holds. The page is the whole set: an org's index count is small by construction, so `limit` and `total` both report it. The tenant is the org minted from the VALIDATED bearer's owner claim, never a client-supplied header, and two orgs may both hold an index named \"messages\" without either seeing the other. Without a validated principal the answer is 403 carrying the dialect's `invalid_api_key` body.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexList>
|
|
*/
|
|
open class func getIndexIndexesWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexList> {
|
|
let localVariablePath = "/v1/index/indexes"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexList>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reads one index's definition.
|
|
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexView
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexIndexesByUid(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexView {
|
|
return try await getIndexIndexesByUidWithRequestBuilder(uid: uid, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reads one index's definition.
|
|
- GET /v1/index/indexes/{uid}
|
|
- Reads one index's definition. Answers the index's uid, primary key and timestamps. An index this org does not hold answers 404 carrying the dialect's `index_not_found` — the code a Meilisearch client reads as permission to create it, which is why this is a refusal rather than an empty object. The uid is scoped to the caller's own org, so another tenant's index is indistinguishable from one that never existed: this surface is not an existence oracle.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexView>
|
|
*/
|
|
open class func getIndexIndexesByUidWithRequestBuilder(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexView> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Pages through the documents in an index.
|
|
|
|
- parameter uid: (path)
|
|
- parameter limit: (query) (optional)
|
|
- parameter offset: (query) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexDocuments
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexIndexesByUidDocuments(uid: String, limit: String? = nil, offset: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexDocuments {
|
|
return try await getIndexIndexesByUidDocumentsWithRequestBuilder(uid: uid, limit: limit, offset: offset, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Pages through the documents in an index.
|
|
- GET /v1/index/indexes/{uid}/documents
|
|
- Pages through the documents in an index. Answers the org's stored documents in insertion order, whole, with the page's bounds and the index's total. It is the enumeration surface — search ranks by relevance and cannot walk a corpus — so a caller reconciling what it has written reads it here. An index this org does not hold answers 404 carrying the dialect's `index_not_found`.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter limit: (query) (optional)
|
|
- parameter offset: (query) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexDocuments>
|
|
*/
|
|
open class func getIndexIndexesByUidDocumentsWithRequestBuilder(uid: String, limit: String? = nil, offset: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexDocuments> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
"offset": (wrappedValue: offset?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexDocuments>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reads one document by its primary key.
|
|
|
|
- parameter uid: (path)
|
|
- parameter id: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: JSONValue
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexIndexesByUidDocumentsById(uid: String, id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> JSONValue {
|
|
return try await getIndexIndexesByUidDocumentsByIdWithRequestBuilder(uid: uid, id: id, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reads one document by its primary key.
|
|
- GET /v1/index/indexes/{uid}/documents/{id}
|
|
- Reads one document by its primary key. Answers the stored document exactly as it was written — this surface keeps documents whole rather than projecting them, so what comes back is what went in. A primary key this index does not hold answers 404 carrying the dialect's `document_not_found`; an index this org does not hold answers `index_not_found`, and the two are different facts a client acts on differently.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter id: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<JSONValue>
|
|
*/
|
|
open class func getIndexIndexesByUidDocumentsByIdWithRequestBuilder(uid: String, id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<JSONValue> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents/{id}"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
|
|
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<JSONValue>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reads an index's filterable attributes.
|
|
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexSettings
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexIndexesByUidSettings(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexSettings {
|
|
return try await getIndexIndexesByUidSettingsWithRequestBuilder(uid: uid, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reads an index's filterable attributes.
|
|
- GET /v1/index/indexes/{uid}/settings
|
|
- Reads an index's filterable attributes. Answers the settings subset this surface implements: the attributes a search `filter` may constrain. An index this org does not hold answers 404 carrying the dialect's `index_not_found`.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexSettings>
|
|
*/
|
|
open class func getIndexIndexesByUidSettingsWithRequestBuilder(uid: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexSettings> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/settings"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexSettings>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Counts the documents in each of your indexes.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexStats
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexStats(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexStats {
|
|
return try await getIndexStatsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Counts the documents in each of your indexes.
|
|
- GET /v1/index/stats
|
|
- Counts the documents in each of your indexes. Reports every index the caller's own org holds with its document count, plus the org's total. `isIndexing` is always false because writes here are applied before their response — there is never a background pass to wait on. The tenant is the org minted from the VALIDATED bearer's owner claim, never a client-supplied header, so this counts the caller's own documents and no other tenant's. Without a validated principal the answer is 403 carrying the dialect's `invalid_api_key` body.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexStats>
|
|
*/
|
|
open class func getIndexStatsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexStats> {
|
|
let localVariablePath = "/v1/index/stats"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexStats>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Checks a write task, which has already finished.
|
|
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexTask
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexTasksByUid(uid: Int64, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexTask {
|
|
return try await getIndexTasksByUidWithRequestBuilder(uid: uid, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Checks a write task, which has already finished.
|
|
- GET /v1/index/tasks/{uid}
|
|
- Checks a write task, which has already finished. Always reports `succeeded`. Writes here are applied to SQLite before their EnqueuedTask is returned, so a client polling waitForTask resolves on its first call rather than waiting for a queue that was never there. The three timestamps are the same instant for the same reason. It requires a validated principal but reads no tenant data: the task id it echoes was minted by this process and names nothing about any org.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexTask>
|
|
*/
|
|
open class func getIndexTasksByUidWithRequestBuilder(uid: Int64, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexTask> {
|
|
var localVariablePath = "/v1/index/tasks/{uid}"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexTask>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Identifies the search implementation answering.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexVersion
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getIndexVersion(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexVersion {
|
|
return try await getIndexVersionWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Identifies the search implementation answering.
|
|
- GET /v1/index/version
|
|
- Identifies the search implementation answering. Reports the dialect's version shape with `commitSha` naming this implementation rather than a Meilisearch build, so a client that logs the version records which server answered instead of implying a release of software this is not. It requires no principal and reads no tenant data.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexVersion>
|
|
*/
|
|
open class func getIndexVersionWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexVersion> {
|
|
let localVariablePath = "/v1/index/version"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexVersion>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Sets which attributes an index can be filtered on.
|
|
|
|
- parameter uid: (path)
|
|
- parameter indexFilter: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func patchIndexIndexesByUidSettings(uid: String, indexFilter: IndexFilter, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await patchIndexIndexesByUidSettingsWithRequestBuilder(uid: uid, indexFilter: indexFilter, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Sets which attributes an index can be filtered on.
|
|
- PATCH /v1/index/indexes/{uid}/settings
|
|
- Sets which attributes an index can be filtered on. Replaces the whole filterable set. An attribute not listed here cannot be used in a search `filter`, so this is what makes a per-user or per-tag narrowing possible at all. It CREATES the index when it is missing rather than answering 404, because a Meilisearch client configures settings on an index it has just asked for and a refusal there leaves the client with no index at all. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the setting is already applied when this answers.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter indexFilter: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func patchIndexIndexesByUidSettingsWithRequestBuilder(uid: String, indexFilter: IndexFilter, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/settings"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: indexFilter, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Creates an index.
|
|
|
|
- parameter indexNew: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postIndexIndexes(indexNew: IndexNew, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await postIndexIndexesWithRequestBuilder(indexNew: indexNew, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Creates an index.
|
|
- POST /v1/index/indexes
|
|
- Creates an index. Registers a named index in the caller's own org and answers the dialect's EnqueuedTask. It is idempotent: creating an index that already exists returns the same receipt and changes nothing, which is what lets a client create on startup without checking first. `primaryKey` is optional — the first write establishes one when it is omitted. An index is a ROW here rather than a table, so an unusual uid is stored verbatim instead of being sanitised into a schema name. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the write is already applied when this answers. A client that polls waitForTask resolves immediately.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter indexNew: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func postIndexIndexesWithRequestBuilder(indexNew: IndexNew, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
let localVariablePath = "/v1/index/indexes"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: indexNew, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Add or replace documents in an index
|
|
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postIndexIndexesByUidDocuments(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await postIndexIndexesByUidDocumentsWithRequestBuilder(uid: uid, requestBody: requestBody, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Add or replace documents in an index
|
|
- POST /v1/index/indexes/{uid}/documents
|
|
- Writes documents into the caller's own index, keyed by the index's primary key: a document whose key is already present is REPLACED whole. The body is the dialect's own — an array of documents, or a single document — and each is stored verbatim, so a read gives back exactly what was written. The index is CREATED when it is missing rather than refused, because a Meilisearch client writes before it configures. The tenant is the org minted from the VALIDATED bearer's owner claim, never a client-supplied header, so two orgs may both hold an index named \"messages\" and neither can see the other's documents. Without a validated principal the answer is 403 carrying the dialect's `invalid_api_key` body. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the documents are searchable when this answers, and a client that polls waitForTask resolves immediately.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func postIndexIndexesByUidDocumentsWithRequestBuilder(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Delete many documents by primary key in one call
|
|
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postIndexIndexesByUidDocumentsDeleteBatch(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await postIndexIndexesByUidDocumentsDeleteBatchWithRequestBuilder(uid: uid, requestBody: requestBody, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Delete many documents by primary key in one call
|
|
- POST /v1/index/indexes/{uid}/documents/delete-batch
|
|
- Removes every named document from the caller's own index. The body is the dialect's own: a bare array of primary keys, which may be strings or numbers. A key that is not there is not an error, so a client reconciling its own corpus can send one list rather than checking each key first. The tenant is the org minted from the VALIDATED bearer's owner claim, never a client-supplied header. Without a validated principal the answer is 403 carrying the dialect's `invalid_api_key` body. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the documents are already gone when this answers.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func postIndexIndexesByUidDocumentsDeleteBatchWithRequestBuilder(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents/delete-batch"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Searches an index, forgiving typos.
|
|
|
|
- parameter uid: (path)
|
|
- parameter indexQuery: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexHits
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postIndexIndexesByUidSearch(uid: String, indexQuery: IndexQuery, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexHits {
|
|
return try await postIndexIndexesByUidSearchWithRequestBuilder(uid: uid, indexQuery: indexQuery, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Searches an index, forgiving typos.
|
|
- POST /v1/index/indexes/{uid}/search
|
|
- Searches an index, forgiving typos. Ranks the org's documents in one index against `q` and answers the matching documents whole, most relevant first. A prefix matches, so a partial word finds the documents containing it, and `filter` narrows the result to documents whose filterable attributes match — which is how a caller scopes results to one end user within its own org. `estimatedTotalHits` is the dialect's name for the count; every hit is materialised here, so for this page it is exact. An index this org does not hold answers 404 carrying the dialect's `index_not_found`.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter indexQuery: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexHits>
|
|
*/
|
|
open class func postIndexIndexesByUidSearchWithRequestBuilder(uid: String, indexQuery: IndexQuery, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexHits> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/search"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: indexQuery, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexHits>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Add or update documents in an index
|
|
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: IndexEnqueued
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func putIndexIndexesByUidDocuments(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> IndexEnqueued {
|
|
return try await putIndexIndexesByUidDocumentsWithRequestBuilder(uid: uid, requestBody: requestBody, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Add or update documents in an index
|
|
- PUT /v1/index/indexes/{uid}/documents
|
|
- The dialect's update spelling of the write above, and the same act: an upsert keyed by the index's primary key. The JS client's addDocuments and updateDocuments both reduce to this for whole documents, so both spellings are served and both behave identically. The tenant is the org minted from the VALIDATED bearer's owner claim, never a client-supplied header. Without a validated principal the answer is 403 carrying the dialect's `invalid_api_key` body. The 202 and its `enqueued` task are DIALECT COMPATIBILITY, not a promise of later work: the write is already applied when this answers.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter uid: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<IndexEnqueued>
|
|
*/
|
|
open class func putIndexIndexesByUidDocumentsWithRequestBuilder(uid: String, requestBody: [JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<IndexEnqueued> {
|
|
var localVariablePath = "/v1/index/indexes/{uid}/documents"
|
|
let uidPreEscape = "\(APIHelper.mapValueToPathItem(uid))"
|
|
let uidPostEscape = uidPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{uid}", with: uidPostEscape, options: .literal, range: nil)
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody, codableHelper: apiConfiguration.codableHelper)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<IndexEnqueued>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
}
|