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.
229 lines
15 KiB
Swift
229 lines
15 KiB
Swift
//
|
|
// DestinationAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
open class DestinationAPI {
|
|
|
|
/**
|
|
Forgets a destination for the caller's org: every credential held in KMS, then the stored config.
|
|
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: DestinationDisconnected
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func deleteDestinationByPlatform(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DestinationDisconnected {
|
|
return try await deleteDestinationByPlatformWithRequestBuilder(platform: platform, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Forgets a destination for the caller's org: every credential held in KMS, then the stored config.
|
|
- DELETE /v1/destination/{platform}
|
|
- Forgets a destination for the caller's org: every credential held in KMS, then the stored config. Idempotent, and it requires org admin.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<DestinationDisconnected>
|
|
*/
|
|
open class func deleteDestinationByPlatformWithRequestBuilder(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DestinationDisconnected> {
|
|
var localVariablePath = "/v1/destination/{platform}"
|
|
let platformPreEscape = "\(APIHelper.mapValueToPathItem(platform))"
|
|
let platformPostEscape = platformPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{platform}", with: platformPostEscape, 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<DestinationDisconnected>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reports every destination this deployment can forward to, each with the caller org's connection state: whether it is connected, whether it is enabled, whether a credential resolves right now, and the config fields the console renders for it.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: DestinationList
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getDestination(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DestinationList {
|
|
return try await getDestinationWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reports every destination this deployment can forward to, each with the caller org's connection state: whether it is connected, whether it is enabled, whether a credential resolves right now, and the config fields the console renders for it.
|
|
- GET /v1/destination
|
|
- Reports every destination this deployment can forward to, each with the caller org's connection state: whether it is connected, whether it is enabled, whether a credential resolves right now, and the config fields the console renders for it.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<DestinationList>
|
|
*/
|
|
open class func getDestinationWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DestinationList> {
|
|
let localVariablePath = "/v1/destination"
|
|
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<DestinationList>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reports one destination's card for the caller's org — its config fields, its connection state, and whether a credential resolves right now.
|
|
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: DestinationStatus
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getDestinationByPlatform(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DestinationStatus {
|
|
return try await getDestinationByPlatformWithRequestBuilder(platform: platform, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reports one destination's card for the caller's org — its config fields, its connection state, and whether a credential resolves right now.
|
|
- GET /v1/destination/{platform}
|
|
- Reports one destination's card for the caller's org — its config fields, its connection state, and whether a credential resolves right now. A platform this deployment does not carry is not found.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<DestinationStatus>
|
|
*/
|
|
open class func getDestinationByPlatformWithRequestBuilder(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DestinationStatus> {
|
|
var localVariablePath = "/v1/destination/{platform}"
|
|
let platformPreEscape = "\(APIHelper.mapValueToPathItem(platform))"
|
|
let platformPostEscape = platformPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{platform}", with: platformPostEscape, 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<DestinationStatus>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Connect one conversion destination for your org, or update the one you have
|
|
|
|
- parameter platform: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: DestinationStatus
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postDestinationByPlatform(platform: String, requestBody: [String: JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DestinationStatus {
|
|
return try await postDestinationByPlatformWithRequestBuilder(platform: platform, requestBody: requestBody, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Connect one conversion destination for your org, or update the one you have
|
|
- POST /v1/destination/{platform}
|
|
- Stores the addressed platform's non-secret ids (its measurement, pixel or dataset ids) and seals its API credential into KMS under a path scoped to the caller's own org, then answers the same status card the read routes do — with live telling you whether the credential actually resolves right now. The body's property NAMES are the platform's own: each field the platform declares, plus each secret under its camelCase name, so the accepted keys differ per platform and a missing REQUIRED field is refused. Connecting is an ORG ADMIN action — a validated member without the admin bit gets 403 — and it fails closed with 503 when the KMS master key is unavailable rather than persisting a destination whose secret was never sealed. The secret itself never appears in the response, in the store, or in a log line; only its NAME is ever published. Set enabled to false to keep the connection but stop the analytics fan-out to it.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter platform: (path)
|
|
- parameter requestBody: (body) (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<DestinationStatus>
|
|
*/
|
|
open class func postDestinationByPlatformWithRequestBuilder(platform: String, requestBody: [String: JSONValue]? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DestinationStatus> {
|
|
var localVariablePath = "/v1/destination/{platform}"
|
|
let platformPreEscape = "\(APIHelper.mapValueToPathItem(platform))"
|
|
let platformPostEscape = platformPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{platform}", with: platformPostEscape, 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<DestinationStatus>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Sends ONE synthetic pageview through the connected destination end to end and reports what the platform said.
|
|
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: DestinationTest
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postDestinationByPlatformTest(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DestinationTest {
|
|
return try await postDestinationByPlatformTestWithRequestBuilder(platform: platform, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Sends ONE synthetic pageview through the connected destination end to end and reports what the platform said.
|
|
- POST /v1/destination/{platform}/test
|
|
- Sends ONE synthetic pageview through the connected destination end to end and reports what the platform said. A send the platform refuses is reported as data — {\"ok\": false, \"error\": …} at 200 — so the console shows the platform's own words rather than an error about Hanzo. It requires org admin.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter platform: (path) Platform is the destination to act on, from the path: ga4 | meta | tiktok | linkedin | x | reddit | insights | analytics.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<DestinationTest>
|
|
*/
|
|
open class func postDestinationByPlatformTestWithRequestBuilder(platform: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DestinationTest> {
|
|
var localVariablePath = "/v1/destination/{platform}/test"
|
|
let platformPreEscape = "\(APIHelper.mapValueToPathItem(platform))"
|
|
let platformPostEscape = platformPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{platform}", with: platformPostEscape, 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<DestinationTest>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
}
|