mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The forge tree held the package scaffolding and none of the generated sources — 2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply absent, so anything depending on this copy had a package that compiled to nothing usable. Generated from the current API document rather than reconciled with the other copy: a client is a function of the spec, so regenerating answers "which history wins" without anyone having to choose. .spec-lock records which document, so the next reader can tell.
94 lines
5.2 KiB
Swift
94 lines
5.2 KiB
Swift
//
|
|
// PubsubAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
open class PubsubAPI {
|
|
|
|
/**
|
|
Publish puts one message on the org's bus.
|
|
|
|
- parameter busPublish: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: BusAck
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postPubsubPublish(busPublish: BusPublish, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BusAck {
|
|
return try await postPubsubPublishWithRequestBuilder(busPublish: busPublish, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Publish puts one message on the org's bus.
|
|
- POST /v1/pubsub/publish
|
|
- Publish puts one message on the org's bus. When a stream captures the subject the write is DURABLE — the receipt names the stream and sequence only after JetStream has it on storage, and a repeated Nats-Msg-Id header within the dedup window answers duplicate instead of storing twice. When nothing captures it, the message goes out core NATS: delivered to current subscribers, receipt {ok}, nothing retained.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter busPublish: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<BusAck>
|
|
*/
|
|
open class func postPubsubPublishWithRequestBuilder(busPublish: BusPublish, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BusAck> {
|
|
let localVariablePath = "/v1/pubsub/publish"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: busPublish, 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<BusAck>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Request sends one request on the org's bus and waits for one reply — the synchronous half of pub/sub, for callers speaking to a responder subscribed on the NATS port.
|
|
|
|
- parameter busRequest: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: BusMessage
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postPubsubRequest(busRequest: BusRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BusMessage {
|
|
return try await postPubsubRequestWithRequestBuilder(busRequest: busRequest, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Request sends one request on the org's bus and waits for one reply — the synchronous half of pub/sub, for callers speaking to a responder subscribed on the NATS port.
|
|
- POST /v1/pubsub/request
|
|
- Request sends one request on the org's bus and waits for one reply — the synchronous half of pub/sub, for callers speaking to a responder subscribed on the NATS port. 404 when nobody is listening on the subject; 408 when a responder exists but no reply arrived within the timeout.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter busRequest: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<BusMessage>
|
|
*/
|
|
open class func postPubsubRequestWithRequestBuilder(busRequest: BusRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BusMessage> {
|
|
let localVariablePath = "/v1/pubsub/request"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: busRequest, 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<BusMessage>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
}
|