Files
zeekay 1df3ddf6bd Regenerate against the document the deployment answers for
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.
2026-09-05 18:55:38 -07:00

511 lines
34 KiB
Swift

//
// CampaignAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class CampaignAPI {
/**
Removes one campaign of the caller's org and answers 204 with no body.
- parameter id: (path) ID is the campaign's server-minted handle, \"cmp_\"-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: Void
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteCampaignById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await deleteCampaignByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Removes one campaign of the caller's org and answers 204 with no body.
- DELETE /v1/campaign/{id}
- Removes one campaign of the caller's org and answers 204 with no body. 404 when the org has no campaign with that id. It deletes the RECORD, not the executions: a campaign whose channels are live on a provider should be paused first, or those executions keep running with nothing here to report them.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign's server-minted handle, \"cmp_\"-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func deleteCampaignByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
var localVariablePath = "/v1/campaign/{id}"
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<Void>.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder()
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Drops one channel from a campaign and returns the updated campaign.
- parameter id: (path) ID is the campaign, from the path.
- parameter kind: (path) Kind is the channel to remove: paid, organic or email.
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignRecord
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteCampaignByIdChannelsByKind(id: String, kind: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignRecord {
return try await deleteCampaignByIdChannelsByKindWithRequestBuilder(id: id, kind: kind, apiConfiguration: apiConfiguration).execute().body
}
/**
Drops one channel from a campaign and returns the updated campaign.
- DELETE /v1/campaign/{id}/channels/{kind}
- Drops one channel from a campaign and returns the updated campaign. 404 when the campaign carries no channel of that kind. It removes the channel from the PLAN. A channel that is live at its provider should be paused first — dropping the row here leaves nothing to pause it with afterwards.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign, from the path.
- parameter kind: (path) Kind is the channel to remove: paid, organic or email.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignRecord>
*/
open class func deleteCampaignByIdChannelsByKindWithRequestBuilder(id: String, kind: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignRecord> {
var localVariablePath = "/v1/campaign/{id}/channels/{kind}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
let kindPreEscape = "\(APIHelper.mapValueToPathItem(kind))"
let kindPostEscape = kindPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{kind}", with: kindPostEscape, 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<CampaignRecord>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's campaigns, newest first, optionally narrowed to one status.
- parameter status: (query) Status keeps only campaigns in that state: draft, live, paused or failed. Empty means any. (optional)
- parameter limit: (query) Limit bounds the page. 0 or less means the default of 200; anything above 1000 is clamped to 1000. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignPage
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getCampaign(status: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignPage {
return try await getCampaignWithRequestBuilder(status: status, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's campaigns, newest first, optionally narrowed to one status.
- GET /v1/campaign
- Returns the org's campaigns, newest first, optionally narrowed to one status. A campaign is the top-level go-to-market object: a value that SPANS channels (paid, organic, email) and fans out to the executor for each. The listing is org-scoped server-side, so one org can never see another's campaigns.
- Bearer Token:
- type: http
- name: bearer
- parameter status: (query) Status keeps only campaigns in that state: draft, live, paused or failed. Empty means any. (optional)
- parameter limit: (query) Limit bounds the page. 0 or less means the default of 200; anything above 1000 is clamped to 1000. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignPage>
*/
open class func getCampaignWithRequestBuilder(status: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignPage> {
let localVariablePath = "/v1/campaign"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"status": (wrappedValue: status?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<CampaignPage>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns one campaign of the caller's org — its name, audience, creatives, channels with their per-channel launch state, schedule, budget and status.
- parameter id: (path) ID is the campaign&#39;s server-minted handle, \&quot;cmp_\&quot;-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignRecord
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getCampaignById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignRecord {
return try await getCampaignByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns one campaign of the caller's org — its name, audience, creatives, channels with their per-channel launch state, schedule, budget and status.
- GET /v1/campaign/{id}
- Returns one campaign of the caller's org — its name, audience, creatives, channels with their per-channel launch state, schedule, budget and status. 404 when the org has no campaign with that id.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign&#39;s server-minted handle, \&quot;cmp_\&quot;-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignRecord>
*/
open class func getCampaignByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignRecord> {
var localVariablePath = "/v1/campaign/{id}"
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<CampaignRecord>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns a campaign's results over a window: the analytics funnel (impressions, clicks, conversions, revenue, visitors), the spend each channel's connector reports, and the derived growth KPIs — CTR, CVR, CAC and ROAS.
- parameter id: (path) ID is the campaign to report on, from the path.
- parameter range: (query) Range is the lookback window: 24h, 7d, 30d or 90d. Anything else, including empty, reads as 30d. (optional)
- parameter start: (query) Start is an explicit RFC3339 window start. Honored only together with End, and only when End is after it. (optional)
- parameter end: (query) End is an explicit RFC3339 window end. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignResults
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getCampaignByIdMetrics(id: String, range: String? = nil, start: String? = nil, end: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignResults {
return try await getCampaignByIdMetricsWithRequestBuilder(id: id, range: range, start: start, end: end, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns a campaign's results over a window: the analytics funnel (impressions, clicks, conversions, revenue, visitors), the spend each channel's connector reports, and the derived growth KPIs — CTR, CVR, CAC and ROAS.
- GET /v1/campaign/{id}/metrics
- Returns a campaign's results over a window: the analytics funnel (impressions, clicks, conversions, revenue, visitors), the spend each channel's connector reports, and the derived growth KPIs — CTR, CVR, CAC and ROAS. There is exactly ONE metrics plane and nothing is stored here: the funnel is an analytics query over the campaign's utm_campaign-tagged events, and the spend is each provider's own number read through the org's connector. A warehouse that is not emitting yet degrades to available:false with zeroes — honest-empty, never a 500 and never a fabricated number. When the campaign runs more than one creative and an experiment is wired, abTest carries the A/B analysis.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign to report on, from the path.
- parameter range: (query) Range is the lookback window: 24h, 7d, 30d or 90d. Anything else, including empty, reads as 30d. (optional)
- parameter start: (query) Start is an explicit RFC3339 window start. Honored only together with End, and only when End is after it. (optional)
- parameter end: (query) End is an explicit RFC3339 window end. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignResults>
*/
open class func getCampaignByIdMetricsWithRequestBuilder(id: String, range: String? = nil, start: String? = nil, end: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignResults> {
var localVariablePath = "/v1/campaign/{id}/metrics"
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
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"range": (wrappedValue: range?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"start": (wrappedValue: start?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"end": (wrappedValue: end?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<CampaignResults>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's go-to-market roll-up: how many campaigns exist, how many are live, their total budget in cents, and which channel executors this deployment can actually reach.
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignSummary
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getCampaignSummary(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignSummary {
return try await getCampaignSummaryWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's go-to-market roll-up: how many campaigns exist, how many are live, their total budget in cents, and which channel executors this deployment can actually reach.
- GET /v1/campaign/summary
- Returns the org's go-to-market roll-up: how many campaigns exist, how many are live, their total budget in cents, and which channel executors this deployment can actually reach. The channel list is the deployment's honest capability, not a wish: a kind missing from it is one a launch will record as \"unavailable\" rather than fail on.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignSummary>
*/
open class func getCampaignSummaryWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignSummary> {
let localVariablePath = "/v1/campaign/summary"
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<CampaignSummary>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Creates a campaign as a DRAFT and returns it.
- parameter campaignWrite: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignRecord
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postCampaign(campaignWrite: CampaignWrite, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignRecord {
return try await postCampaignWithRequestBuilder(campaignWrite: campaignWrite, apiConfiguration: apiConfiguration).execute().body
}
/**
Creates a campaign as a DRAFT and returns it.
- POST /v1/campaign
- Creates a campaign as a DRAFT and returns it. A draft is inert: nothing is sent, no connector is touched and no budget is committed until the campaign is launched. The channels named here are validated and de-duplicated by kind (one executor per kind), and every channel starts \"pending\" whatever the caller claims — a client can never assert a launched state.
- Bearer Token:
- type: http
- name: bearer
- parameter campaignWrite: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignRecord>
*/
open class func postCampaignWithRequestBuilder(campaignWrite: CampaignWrite, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignRecord> {
let localVariablePath = "/v1/campaign"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: campaignWrite, 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<CampaignRecord>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Adds a channel to a campaign, or REPLACES the one it already has of that kind, and returns the updated campaign.
- parameter id: (path) ID is the campaign to add the channel to, from the path.
- parameter channelAdd: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignRecord
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postCampaignByIdChannels(id: String, channelAdd: ChannelAdd, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignRecord {
return try await postCampaignByIdChannelsWithRequestBuilder(id: id, channelAdd: channelAdd, apiConfiguration: apiConfiguration).execute().body
}
/**
Adds a channel to a campaign, or REPLACES the one it already has of that kind, and returns the updated campaign.
- POST /v1/campaign/{id}/channels
- Adds a channel to a campaign, or REPLACES the one it already has of that kind, and returns the updated campaign. A campaign carries at most one channel per kind, because the kind IS the executor: adding a second \"paid\" channel would mean two ad accounts running one campaign with no way to tell their results apart. The new channel starts \"pending\" — adding it does not launch it.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign to add the channel to, from the path.
- parameter channelAdd: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignRecord>
*/
open class func postCampaignByIdChannelsWithRequestBuilder(id: String, channelAdd: ChannelAdd, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignRecord> {
var localVariablePath = "/v1/campaign/{id}/channels"
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 = JSONEncodingHelper.encodingParameters(forEncodableObject: channelAdd, 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<CampaignRecord>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Launch a campaign across every channel it declares
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: Void
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postCampaignByIdLaunch(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postCampaignByIdLaunchWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Launch a campaign across every channel it declares
- POST /v1/campaign/{id}/launch
- Pushes the campaign live on each of its channels through that channel's executor and answers the whole campaign with the per-channel outcome written back onto it. The fan-out is BEST-EFFORT PER CHANNEL, and the honest reading of the result is the rule most callers get wrong: one channel failing never aborts the others, so each channel row carries its own `live`, `failed` or `unavailable` status and detail, and a paid launch can be live while an email launch failed. The campaign itself is `live` when AT LEAST ONE channel launched and `failed` only when none did — `live` is not a claim that every channel launched. Repeating the call is safe: a channel already live is skipped, never re-launched. A campaign carrying more than one creative has its variant assigned here by the experiment client and tagged as `utm_content`. Org-scoped and fails closed: a valid bearer is required (403 without one), the campaign is read under the caller's OWN org so another tenant's id is a 404, and a campaign with no channels is a 400 — there is nothing to launch. Each executor resolves its own org's connector token from the org passed to it, so a launch can never spend through another tenant's connector.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postCampaignByIdLaunchWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
var localVariablePath = "/v1/campaign/{id}/launch"
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<Void>.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Pause every live channel on a campaign at its provider
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: Void
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postCampaignByIdPause(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postCampaignByIdPauseWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Pause every live channel on a campaign at its provider
- POST /v1/campaign/{id}/pause
- Pauses each live channel on its provider and answers the whole campaign, moved to `paused`, with the per-channel outcome written back onto it. Only channels that are live and carry a provider reference are touched; a channel whose executor is no longer wired is marked `unavailable` and one whose pause errored is marked `failed`, with the reason on the row. The campaign still reports `paused` in both cases, and that is deliberate rather than sloppy: no live channel remains that this process will meter, and the rows say exactly which provider was not reached so it can be settled by hand. Org-scoped and fails closed: a valid bearer is required (403 without one) and the campaign is read under the caller's OWN org, so another tenant's id is a 404.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postCampaignByIdPauseWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
var localVariablePath = "/v1/campaign/{id}/pause"
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<Void>.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Rewrites a campaign's core fields — name, audience, creatives, schedule and budget — and returns the updated campaign.
- parameter id: (path) ID is the campaign to update, from the path.
- parameter campaignUpdate: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: CampaignRecord
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func putCampaignById(id: String, campaignUpdate: CampaignUpdate, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CampaignRecord {
return try await putCampaignByIdWithRequestBuilder(id: id, campaignUpdate: campaignUpdate, apiConfiguration: apiConfiguration).execute().body
}
/**
Rewrites a campaign's core fields — name, audience, creatives, schedule and budget — and returns the updated campaign.
- PUT /v1/campaign/{id}
- Rewrites a campaign's core fields — name, audience, creatives, schedule and budget — and returns the updated campaign. Channels are replaced ONLY while the campaign is still a draft. Once it is launched its channels carry provider state (an external id, a live status), so they are added and removed explicitly through the channels sub-resource instead; a whole-object write would silently orphan a running execution.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the campaign to update, from the path.
- parameter campaignUpdate: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CampaignRecord>
*/
open class func putCampaignByIdWithRequestBuilder(id: String, campaignUpdate: CampaignUpdate, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CampaignRecord> {
var localVariablePath = "/v1/campaign/{id}"
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 = JSONEncodingHelper.encodingParameters(forEncodableObject: campaignUpdate, 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<CampaignRecord>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}