mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
56 lines
2.2 KiB
Swift
56 lines
2.2 KiB
Swift
//
|
|
// ContextManagementAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
#if canImport(AnyCodable)
|
|
import AnyCodable
|
|
#endif
|
|
|
|
open class ContextManagementAPI {
|
|
|
|
/**
|
|
|
|
- parameter contextManageRequest: (body)
|
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
@discardableResult
|
|
open class func manageContext(contextManageRequest: ContextManageRequest, apiResponseQueue: DispatchQueue = GooseAPIAPI.apiResponseQueue, completion: @escaping ((_ data: ContextManageResponse?, _ error: Error?) -> Void)) -> RequestTask {
|
|
return manageContextWithRequestBuilder(contextManageRequest: contextManageRequest).execute(apiResponseQueue) { result in
|
|
switch result {
|
|
case let .success(response):
|
|
completion(response.body, nil)
|
|
case let .failure(error):
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
- POST /context/manage
|
|
- parameter contextManageRequest: (body)
|
|
- returns: RequestBuilder<ContextManageResponse>
|
|
*/
|
|
open class func manageContextWithRequestBuilder(contextManageRequest: ContextManageRequest) -> RequestBuilder<ContextManageResponse> {
|
|
let localVariablePath = "/context/manage"
|
|
let localVariableURLString = GooseAPIAPI.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: contextManageRequest)
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: Any?] = [
|
|
"Content-Type": "application/json",
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<ContextManageResponse>.Type = GooseAPIAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false)
|
|
}
|
|
}
|