diff --git a/.fern/metadata.json b/.fern/metadata.json index 8ad6b8fa..cd4e25b6 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "5.51.2", + "cliVersion": "5.89.2", "generatorName": "fernapi/fern-swift-sdk", "generatorVersion": "0.31.0", "generatorConfig": { @@ -7,6 +7,6 @@ "moduleName": "Vapi", "environmentEnumName": "VapiEnvironment" }, - "originGitCommit": "5a015aa01196915bea6110904c69d5804f457ff5", - "sdkVersion": "1.0.0" + "originGitCommit": "548dddb5e7bc17a9e26b0832d0359a988546b0ba", + "sdkVersion": "1.0.1" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock new file mode 100644 index 00000000..aceafc27 --- /dev/null +++ b/.fern/replay.lock @@ -0,0 +1,16 @@ +# DO NOT EDIT MANUALLY - Managed by Fern Replay +version: "1.0" +generations: + - commit_sha: bc96c4695643e2ce65ba9bbc8f013ec90faf6884 + tree_hash: 0275948394219614d4d7f64cab0b932e7c2a767a + timestamp: 2026-07-31T22:03:56.153Z + cli_version: unknown + generator_versions: {} + - commit_sha: 9743cab4fce1af520335cf7555dcb560da6ce498 + tree_hash: d59a94ca4377b9bd04b846ddaf50eebab1958667 + timestamp: 2026-07-31T22:03:57.021Z + cli_version: unknown + generator_versions: + fernapi/fern-swift-sdk: 0.31.0 +current_generation: 9743cab4fce1af520335cf7555dcb560da6ce498 +patches: [] diff --git a/.fernignore b/.fernignore index 978b3fa6..0e6333fe 100644 --- a/.fernignore +++ b/.fernignore @@ -1,3 +1,6 @@ # Specify files that shouldn't be modified by Fern .github/workflows/sdk-release-pr-notification.yml changelog.md +.fern/replay.lock +.fern/replay.yml +.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..74928d6a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.fern/replay.lock linguist-generated=true diff --git a/Sources/Requests/Requests+CreateBoardDto.swift b/Sources/Requests/Requests+CreateBoardDto.swift new file mode 100644 index 00000000..d608f672 --- /dev/null +++ b/Sources/Requests/Requests+CreateBoardDto.swift @@ -0,0 +1,58 @@ +import Foundation + +extension Requests { + public struct CreateBoardDto: Codable, Hashable, Sendable { + /// This is the contents of the Board, which is an array of objects defining the type, contents, and position of the widgets on the Board. + public let items: [CreateBoardDtoItemsItem]? + /// This is the name of the Board. + public let name: String + /// This is the layout of the Board. + public let layout: BoardLayout + /// This is the timerange override for the board. + /// By default, individual insights have their own timerange. + /// This is a global override for the board which will be passed to all insights on the board. + public let timeRangeOverride: InsightTimeRangeWithStep? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + items: [CreateBoardDtoItemsItem]? = nil, + name: String, + layout: BoardLayout, + timeRangeOverride: InsightTimeRangeWithStep? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.items = items + self.name = name + self.layout = layout + self.timeRangeOverride = timeRangeOverride + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.items = try container.decodeIfPresent([CreateBoardDtoItemsItem].self, forKey: .items) + self.name = try container.decode(String.self, forKey: .name) + self.layout = try container.decode(BoardLayout.self, forKey: .layout) + self.timeRangeOverride = try container.decodeIfPresent(InsightTimeRangeWithStep.self, forKey: .timeRangeOverride) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.items, forKey: .items) + try container.encode(self.name, forKey: .name) + try container.encode(self.layout, forKey: .layout) + try container.encodeIfPresent(self.timeRangeOverride, forKey: .timeRangeOverride) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case items + case name + case layout + case timeRangeOverride + } + } +} \ No newline at end of file diff --git a/Sources/Requests/Requests+CreateCallDto.swift b/Sources/Requests/Requests+CreateCallDto.swift index fa7e9466..1a84622e 100644 --- a/Sources/Requests/Requests+CreateCallDto.swift +++ b/Sources/Requests/Requests+CreateCallDto.swift @@ -2,6 +2,11 @@ import Foundation extension Requests { public struct CreateCallDto: Codable, Hashable, Sendable { + /// This is the assistant version to use for this call. Supported only with + /// direct `assistantId`. Omit to follow the latest version. + public let assistantVersion: Nullable? + /// This is the transport of the call. + public let transport: CreateCallDtoTransport? /// This is used to issue batch calls to multiple customers. /// /// Only relevant for `outboundPhoneCall`. To call a single customer, use `customer` instead. @@ -10,8 +15,6 @@ extension Requests { public let name: String? /// This is the schedule plan of the call. public let schedulePlan: SchedulePlan? - /// This is the transport of the call. - public let transport: [String: JSONValue]? /// This is the assistant ID that will be used for the call. To use a transient assistant, use `assistant` instead. /// /// To start a call with: @@ -81,10 +84,11 @@ extension Requests { public let additionalProperties: [String: JSONValue] public init( + assistantVersion: Nullable? = nil, + transport: CreateCallDtoTransport? = nil, customers: [CreateCustomerDto]? = nil, name: String? = nil, schedulePlan: SchedulePlan? = nil, - transport: [String: JSONValue]? = nil, assistantId: String? = nil, assistant: CreateAssistantDto? = nil, assistantOverrides: AssistantOverrides? = nil, @@ -100,10 +104,11 @@ extension Requests { customer: CreateCustomerDto? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.assistantVersion = assistantVersion + self.transport = transport self.customers = customers self.name = name self.schedulePlan = schedulePlan - self.transport = transport self.assistantId = assistantId self.assistant = assistant self.assistantOverrides = assistantOverrides @@ -122,10 +127,11 @@ extension Requests { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) + self.transport = try container.decodeIfPresent(CreateCallDtoTransport.self, forKey: .transport) self.customers = try container.decodeIfPresent([CreateCustomerDto].self, forKey: .customers) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) - self.transport = try container.decodeIfPresent([String: JSONValue].self, forKey: .transport) self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.assistant = try container.decodeIfPresent(CreateAssistantDto.self, forKey: .assistant) self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) @@ -145,10 +151,11 @@ extension Requests { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) + try container.encodeIfPresent(self.transport, forKey: .transport) try container.encodeIfPresent(self.customers, forKey: .customers) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) - try container.encodeIfPresent(self.transport, forKey: .transport) try container.encodeIfPresent(self.assistantId, forKey: .assistantId) try container.encodeIfPresent(self.assistant, forKey: .assistant) try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) @@ -166,10 +173,11 @@ extension Requests { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case assistantVersion + case transport case customers case name case schedulePlan - case transport case assistantId case assistant case assistantOverrides diff --git a/Sources/Requests/Requests+CreateCampaignDto.swift b/Sources/Requests/Requests+CreateCampaignDto.swift deleted file mode 100644 index 78923e2d..00000000 --- a/Sources/Requests/Requests+CreateCampaignDto.swift +++ /dev/null @@ -1,84 +0,0 @@ -import Foundation - -extension Requests { - public struct CreateCampaignDto: Codable, Hashable, Sendable { - /// This is the name of the campaign. This is just for your own reference. - public let name: String - /// This is the assistant ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. - public let assistantId: String? - /// This is the workflow ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. - public let workflowId: String? - /// This is the squad ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. - public let squadId: String? - /// This is the phone number ID that will be used for the campaign calls. Required if dialPlan is not provided. Note: phoneNumberId and dialPlan are mutually exclusive. - public let phoneNumberId: String? - /// This is a list of dial entries, each specifying a phone number and the customers to call using that number. Use this when you want different phone numbers to call different sets of customers. Note: phoneNumberId and dialPlan are mutually exclusive. - public let dialPlan: [DialPlanEntry]? - /// This is the schedule plan for the campaign. Calls will start at startedAt and continue until your organization’s concurrency limit is reached. Any remaining calls will be retried for up to one hour as capacity becomes available. After that hour or after latestAt, whichever comes first, any calls that couldn’t be placed won’t be retried. - public let schedulePlan: SchedulePlan? - /// These are the customers that will be called in the campaign. Required if dialPlan is not provided. - public let customers: [CreateCustomerDto]? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - name: String, - assistantId: String? = nil, - workflowId: String? = nil, - squadId: String? = nil, - phoneNumberId: String? = nil, - dialPlan: [DialPlanEntry]? = nil, - schedulePlan: SchedulePlan? = nil, - customers: [CreateCustomerDto]? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.name = name - self.assistantId = assistantId - self.workflowId = workflowId - self.squadId = squadId - self.phoneNumberId = phoneNumberId - self.dialPlan = dialPlan - self.schedulePlan = schedulePlan - self.customers = customers - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.name = try container.decode(String.self, forKey: .name) - self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) - self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) - self.squadId = try container.decodeIfPresent(String.self, forKey: .squadId) - self.phoneNumberId = try container.decodeIfPresent(String.self, forKey: .phoneNumberId) - self.dialPlan = try container.decodeIfPresent([DialPlanEntry].self, forKey: .dialPlan) - self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) - self.customers = try container.decodeIfPresent([CreateCustomerDto].self, forKey: .customers) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.name, forKey: .name) - try container.encodeIfPresent(self.assistantId, forKey: .assistantId) - try container.encodeIfPresent(self.workflowId, forKey: .workflowId) - try container.encodeIfPresent(self.squadId, forKey: .squadId) - try container.encodeIfPresent(self.phoneNumberId, forKey: .phoneNumberId) - try container.encodeIfPresent(self.dialPlan, forKey: .dialPlan) - try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) - try container.encodeIfPresent(self.customers, forKey: .customers) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case name - case assistantId - case workflowId - case squadId - case phoneNumberId - case dialPlan - case schedulePlan - case customers - } - } -} \ No newline at end of file diff --git a/Sources/Requests/Requests+CreateFileDto.swift b/Sources/Requests/Requests+CreateFileDto.swift index d3bfadc9..75afa51f 100644 --- a/Sources/Requests/Requests+CreateFileDto.swift +++ b/Sources/Requests/Requests+CreateFileDto.swift @@ -1,6 +1,7 @@ import Foundation extension Requests { + /// A file-upload request containing the file to store and process in Vapi. public struct CreateFileDto { /// This is the File you want to upload for use with the Knowledge Base. public let file: FormFile diff --git a/Sources/Requests/Requests+InsightRunDto.swift b/Sources/Requests/Requests+InsightRunDto.swift index 01eb8db7..2abd44e7 100644 --- a/Sources/Requests/Requests+InsightRunDto.swift +++ b/Sources/Requests/Requests+InsightRunDto.swift @@ -2,6 +2,7 @@ import Foundation extension Requests { public struct InsightRunDto: Codable, Hashable, Sendable { + /// Output-formatting instructions applied to the insight run. public let formatPlan: InsightRunFormatPlan? /// This is the optional time range override for the insight. /// If provided, overrides every field in the insight's timeRange. @@ -11,16 +12,21 @@ extension Requests { /// step default - "day" /// For Pie and Text Insights, step will be ignored even if provided. public let timeRangeOverride: InsightTimeRangeWithStep? + /// Optional runtime assistant scope for dashboards. + /// This is applied to call-table queries without mutating the saved insight. + public let assistantId: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( formatPlan: InsightRunFormatPlan? = nil, timeRangeOverride: InsightTimeRangeWithStep? = nil, + assistantId: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.formatPlan = formatPlan self.timeRangeOverride = timeRangeOverride + self.assistantId = assistantId self.additionalProperties = additionalProperties } @@ -28,6 +34,7 @@ extension Requests { let container = try decoder.container(keyedBy: CodingKeys.self) self.formatPlan = try container.decodeIfPresent(InsightRunFormatPlan.self, forKey: .formatPlan) self.timeRangeOverride = try container.decodeIfPresent(InsightTimeRangeWithStep.self, forKey: .timeRangeOverride) + self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -36,12 +43,14 @@ extension Requests { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.formatPlan, forKey: .formatPlan) try container.encodeIfPresent(self.timeRangeOverride, forKey: .timeRangeOverride) + try container.encodeIfPresent(self.assistantId, forKey: .assistantId) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case formatPlan case timeRangeOverride + case assistantId } } } \ No newline at end of file diff --git a/Sources/Requests/Requests+UpdateAssistantDto.swift b/Sources/Requests/Requests+UpdateAssistantDto.swift index b4d38e14..159a4ee7 100644 --- a/Sources/Requests/Requests+UpdateAssistantDto.swift +++ b/Sources/Requests/Requests+UpdateAssistantDto.swift @@ -12,6 +12,7 @@ extension Requests { /// /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. public let firstMessage: String? + /// Set to `true` to allow the user to interrupt the assistant while it speaks the first message. Default is `false`. public let firstMessageInterruptionsEnabled: Bool? /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// @@ -64,6 +65,7 @@ extension Requests { public let endCallMessage: String? /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. public let endCallPhrases: [String]? + /// Compliance settings for the assistant, including HIPAA and PCI behavior, security filtering, and recording consent. public let compliancePlan: CompliancePlan? /// This is for metadata you want to store on the assistant. public let metadata: [String: JSONValue]? @@ -116,6 +118,7 @@ extension Requests { /// 2. phoneNumber.serverUrl /// 3. org.serverUrl public let server: Server? + /// Configuration for collecting and processing DTMF keypad input during calls. public let keypadInputPlan: KeypadInputPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Requests/Requests+UpdateBoardDto.swift b/Sources/Requests/Requests+UpdateBoardDto.swift new file mode 100644 index 00000000..c22e9046 --- /dev/null +++ b/Sources/Requests/Requests+UpdateBoardDto.swift @@ -0,0 +1,58 @@ +import Foundation + +extension Requests { + public struct UpdateBoardDto: Codable, Hashable, Sendable { + /// This is the contents of the Board, which is an array of objects defining the type, contents, and position of the widgets on the Board. + public let items: [UpdateBoardDtoItemsItem]? + /// This is the name of the Board. + public let name: String? + /// This is the layout of the Board. + public let layout: BoardLayout? + /// This is the timerange override for the board. + /// By default, individual insights have their own timerange. + /// This is a global override for the board which will be passed to all insights on the board. + public let timeRangeOverride: InsightTimeRangeWithStep? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + items: [UpdateBoardDtoItemsItem]? = nil, + name: String? = nil, + layout: BoardLayout? = nil, + timeRangeOverride: InsightTimeRangeWithStep? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.items = items + self.name = name + self.layout = layout + self.timeRangeOverride = timeRangeOverride + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.items = try container.decodeIfPresent([UpdateBoardDtoItemsItem].self, forKey: .items) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.layout = try container.decodeIfPresent(BoardLayout.self, forKey: .layout) + self.timeRangeOverride = try container.decodeIfPresent(InsightTimeRangeWithStep.self, forKey: .timeRangeOverride) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.items, forKey: .items) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.layout, forKey: .layout) + try container.encodeIfPresent(self.timeRangeOverride, forKey: .timeRangeOverride) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case items + case name + case layout + case timeRangeOverride + } + } +} \ No newline at end of file diff --git a/Sources/Requests/Requests+UpdateCampaignDto.swift b/Sources/Requests/Requests+UpdateCampaignDto.swift deleted file mode 100644 index fd3c7b57..00000000 --- a/Sources/Requests/Requests+UpdateCampaignDto.swift +++ /dev/null @@ -1,92 +0,0 @@ -import Foundation - -extension Requests { - public struct UpdateCampaignDto: Codable, Hashable, Sendable { - /// This is the name of the campaign. This is just for your own reference. - public let name: String? - /// This is the assistant ID that will be used for the campaign calls. - /// Can only be updated if campaign is not in progress or has ended. - public let assistantId: String? - /// This is the workflow ID that will be used for the campaign calls. - /// Can only be updated if campaign is not in progress or has ended. - public let workflowId: String? - /// This is the squad ID that will be used for the campaign calls. - /// Can only be updated if campaign is not in progress or has ended. - public let squadId: String? - /// This is the phone number ID that will be used for the campaign calls. - /// Can only be updated if campaign is not in progress or has ended. - /// Note: `phoneNumberId` and `dialPlan` are mutually exclusive. - public let phoneNumberId: String? - /// This is a list of dial entries, each specifying a phone number and the customers to call using that number. Can only be updated if campaign is not in progress or has ended. Note: phoneNumberId and dialPlan are mutually exclusive. - public let dialPlan: [DialPlanEntry]? - /// This is the schedule plan for the campaign. - /// Can only be updated if campaign is not in progress or has ended. - public let schedulePlan: SchedulePlan? - /// This is the status of the campaign. - /// Can only be updated to 'ended' if you want to end the campaign. - /// When set to 'ended', it will delete all scheduled calls. Calls in progress will be allowed to complete. - public let status: UpdateCampaignDtoStatus? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - name: String? = nil, - assistantId: String? = nil, - workflowId: String? = nil, - squadId: String? = nil, - phoneNumberId: String? = nil, - dialPlan: [DialPlanEntry]? = nil, - schedulePlan: SchedulePlan? = nil, - status: UpdateCampaignDtoStatus? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.name = name - self.assistantId = assistantId - self.workflowId = workflowId - self.squadId = squadId - self.phoneNumberId = phoneNumberId - self.dialPlan = dialPlan - self.schedulePlan = schedulePlan - self.status = status - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.name = try container.decodeIfPresent(String.self, forKey: .name) - self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) - self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) - self.squadId = try container.decodeIfPresent(String.self, forKey: .squadId) - self.phoneNumberId = try container.decodeIfPresent(String.self, forKey: .phoneNumberId) - self.dialPlan = try container.decodeIfPresent([DialPlanEntry].self, forKey: .dialPlan) - self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) - self.status = try container.decodeIfPresent(UpdateCampaignDtoStatus.self, forKey: .status) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.name, forKey: .name) - try container.encodeIfPresent(self.assistantId, forKey: .assistantId) - try container.encodeIfPresent(self.workflowId, forKey: .workflowId) - try container.encodeIfPresent(self.squadId, forKey: .squadId) - try container.encodeIfPresent(self.phoneNumberId, forKey: .phoneNumberId) - try container.encodeIfPresent(self.dialPlan, forKey: .dialPlan) - try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) - try container.encodeIfPresent(self.status, forKey: .status) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case name - case assistantId - case workflowId - case squadId - case phoneNumberId - case dialPlan - case schedulePlan - case status - } - } -} \ No newline at end of file diff --git a/Sources/Requests/Requests+UpdateStructuredOutputDto.swift b/Sources/Requests/Requests+UpdateStructuredOutputDto.swift index 48b3fb8d..128e2d64 100644 --- a/Sources/Requests/Requests+UpdateStructuredOutputDto.swift +++ b/Sources/Requests/Requests+UpdateStructuredOutputDto.swift @@ -34,6 +34,8 @@ extension Requests { public let model: UpdateStructuredOutputDtoModel? /// Compliance configuration for this output. Only enable overrides if no sensitive data will be stored. public let compliancePlan: ComplianceOverride? + /// These are the conditions that gate the execution of this structured output. Every condition must pass for the structured output to run (AND semantics). When omitted or empty, no user-defined conditions gate this output. Send null to clear a previously saved gate. + public let conditions: Nullable<[UpdateStructuredOutputDtoConditionsItem]>? /// This is the name of the structured output. public let name: String? /// This is the description of what the structured output extracts. @@ -66,6 +68,7 @@ extension Requests { regex: String? = nil, model: UpdateStructuredOutputDtoModel? = nil, compliancePlan: ComplianceOverride? = nil, + conditions: Nullable<[UpdateStructuredOutputDtoConditionsItem]>? = nil, name: String? = nil, description: String? = nil, assistantIds: [String]? = nil, @@ -77,6 +80,7 @@ extension Requests { self.regex = regex self.model = model self.compliancePlan = compliancePlan + self.conditions = conditions self.name = name self.description = description self.assistantIds = assistantIds @@ -91,6 +95,7 @@ extension Requests { self.regex = try container.decodeIfPresent(String.self, forKey: .regex) self.model = try container.decodeIfPresent(UpdateStructuredOutputDtoModel.self, forKey: .model) self.compliancePlan = try container.decodeIfPresent(ComplianceOverride.self, forKey: .compliancePlan) + self.conditions = try container.decodeNullableIfPresent([UpdateStructuredOutputDtoConditionsItem].self, forKey: .conditions) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.assistantIds = try container.decodeIfPresent([String].self, forKey: .assistantIds) @@ -106,6 +111,7 @@ extension Requests { try container.encodeIfPresent(self.regex, forKey: .regex) try container.encodeIfPresent(self.model, forKey: .model) try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeNullableIfPresent(self.conditions, forKey: .conditions) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.description, forKey: .description) try container.encodeIfPresent(self.assistantIds, forKey: .assistantIds) @@ -119,6 +125,7 @@ extension Requests { case regex case model case compliancePlan + case conditions case name case description case assistantIds diff --git a/Sources/Resources/Analytics/AnalyticsClient.swift b/Sources/Resources/Analytics/AnalyticsClient.swift index 9bd5b94c..f4854d54 100644 --- a/Sources/Resources/Analytics/AnalyticsClient.swift +++ b/Sources/Resources/Analytics/AnalyticsClient.swift @@ -7,6 +7,9 @@ public final class AnalyticsClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Runs one or more metric queries against call or subscription data using the requested time range, groupings, and aggregate operations. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(request: Requests.AnalyticsQueryDto, requestOptions: RequestOptions? = nil) async throws -> [AnalyticsQueryResult] { return try await httpClient.performRequest( method: .post, diff --git a/Sources/Resources/Assistants/AssistantsClient.swift b/Sources/Resources/Assistants/AssistantsClient.swift index 3faa4045..59f9634c 100644 --- a/Sources/Resources/Assistants/AssistantsClient.swift +++ b/Sources/Resources/Assistants/AssistantsClient.swift @@ -7,6 +7,18 @@ public final class AssistantsClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns assistants for the authenticated organization. Filter results by creation or update timestamps and limit the number returned. + /// + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func list(limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> [Assistant] { return try await httpClient.performRequest( method: .get, @@ -27,6 +39,9 @@ public final class AssistantsClient: Sendable { ) } + /// Creates a reusable assistant configuration containing the model, voice, transcriber, tools, prompts, and call behavior. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: CreateAssistantDto, requestOptions: RequestOptions? = nil) async throws -> Assistant { return try await httpClient.performRequest( method: .post, @@ -37,6 +52,10 @@ public final class AssistantsClient: Sendable { ) } + /// Returns the assistant identified by its ID. + /// + /// - Parameter id: The unique identifier of the assistant. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> Assistant { return try await httpClient.performRequest( method: .get, @@ -46,6 +65,10 @@ public final class AssistantsClient: Sendable { ) } + /// Deletes the assistant identified by its ID. + /// + /// - Parameter id: The unique identifier of the assistant. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, requestOptions: RequestOptions? = nil) async throws -> Assistant { return try await httpClient.performRequest( method: .delete, @@ -55,6 +78,10 @@ public final class AssistantsClient: Sendable { ) } + /// Updates the specified fields of the assistant identified by its ID. + /// + /// - Parameter id: The unique identifier of the assistant. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: Requests.UpdateAssistantDto, requestOptions: RequestOptions? = nil) async throws -> Assistant { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Resources/Board/BoardClient.swift b/Sources/Resources/Board/BoardClient.swift new file mode 100644 index 00000000..d1c4be1b --- /dev/null +++ b/Sources/Resources/Board/BoardClient.swift @@ -0,0 +1,79 @@ +import Foundation + +public final class BoardClient: Sendable { + private let httpClient: HTTPClient + + init(config: ClientConfig) { + self.httpClient = HTTPClient(config: config) + } + + public func boardControllerFindAll(page: Double? = nil, sortOrder: BoardControllerFindAllRequestSortOrder? = nil, sortBy: BoardControllerFindAllRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> BoardPaginatedResponse { + return try await httpClient.performRequest( + method: .get, + path: "/reporting/board", + queryParams: [ + "page": page.map { .double($0) }, + "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, + "limit": limit.map { .double($0) }, + "createdAtGt": createdAtGt.map { .date($0) }, + "createdAtLt": createdAtLt.map { .date($0) }, + "createdAtGe": createdAtGe.map { .date($0) }, + "createdAtLe": createdAtLe.map { .date($0) }, + "updatedAtGt": updatedAtGt.map { .date($0) }, + "updatedAtLt": updatedAtLt.map { .date($0) }, + "updatedAtGe": updatedAtGe.map { .date($0) }, + "updatedAtLe": updatedAtLe.map { .date($0) } + ], + requestOptions: requestOptions, + responseType: BoardPaginatedResponse.self + ) + } + + public func boardControllerCreate(request: Requests.CreateBoardDto, requestOptions: RequestOptions? = nil) async throws -> Board { + return try await httpClient.performRequest( + method: .post, + path: "/reporting/board", + body: request, + requestOptions: requestOptions, + responseType: Board.self + ) + } + + public func boardControllerMetricsOverviewEnsure(requestOptions: RequestOptions? = nil) async throws -> Board { + return try await httpClient.performRequest( + method: .get, + path: "/reporting/board/default/metrics-overview", + requestOptions: requestOptions, + responseType: Board.self + ) + } + + public func boardControllerFindOne(id: String, requestOptions: RequestOptions? = nil) async throws -> Board { + return try await httpClient.performRequest( + method: .get, + path: "/reporting/board/\(id)", + requestOptions: requestOptions, + responseType: Board.self + ) + } + + public func boardControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> Board { + return try await httpClient.performRequest( + method: .delete, + path: "/reporting/board/\(id)", + requestOptions: requestOptions, + responseType: Board.self + ) + } + + public func boardControllerUpdate(id: String, request: Requests.UpdateBoardDto, requestOptions: RequestOptions? = nil) async throws -> Board { + return try await httpClient.performRequest( + method: .patch, + path: "/reporting/board/\(id)", + body: request, + requestOptions: requestOptions, + responseType: Board.self + ) + } +} \ No newline at end of file diff --git a/Sources/Resources/Calls/CallsClient.swift b/Sources/Resources/Calls/CallsClient.swift index b19d0481..46f22789 100644 --- a/Sources/Resources/Calls/CallsClient.swift +++ b/Sources/Resources/Calls/CallsClient.swift @@ -7,6 +7,23 @@ public final class CallsClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns calls for the authenticated organization. Filter results by call ID, assistant ID, phone number ID, or creation and update timestamps. + /// + /// - Parameter id: This is the unique identifier for the call. + /// - Parameter assistantId: This will return calls with the specified assistantId. + /// - Parameter phoneNumberId: This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead. + /// + /// Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func list(id: String? = nil, assistantId: String? = nil, phoneNumberId: String? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> [Call] { return try await httpClient.performRequest( method: .get, @@ -30,6 +47,9 @@ public final class CallsClient: Sendable { ) } + /// Creates a call using an assistant or squad. The request can reference saved resources or include transient configurations. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: Requests.CreateCallDto, requestOptions: RequestOptions? = nil) async throws -> CreateCallsResponse { return try await httpClient.performRequest( method: .post, @@ -40,6 +60,10 @@ public final class CallsClient: Sendable { ) } + /// Returns the call identified by its ID, including its status, configuration, and available call data. + /// + /// - Parameter id: The unique identifier of the call. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> Call { return try await httpClient.performRequest( method: .get, @@ -49,6 +73,9 @@ public final class CallsClient: Sendable { ) } + /// Deletes the call identified by its ID. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, request: Requests.DeleteCallDto, requestOptions: RequestOptions? = nil) async throws -> Call { return try await httpClient.performRequest( method: .delete, @@ -59,6 +86,10 @@ public final class CallsClient: Sendable { ) } + /// Updates the call identified by its ID. + /// + /// - Parameter id: The unique identifier of the call. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: Requests.UpdateCallDto, requestOptions: RequestOptions? = nil) async throws -> Call { return try await httpClient.performRequest( method: .patch, @@ -68,4 +99,60 @@ public final class CallsClient: Sendable { responseType: Call.self ) } + + public func callArtifactControllerMonoRecordingDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/mono-recording", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerStereoRecordingDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/stereo-recording", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerVideoRecordingDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/video-recording", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerCustomerRecordingDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/customer-recording", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerAssistantRecordingDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/assistant-recording", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerPcapDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/pcap", + requestOptions: requestOptions + ) + } + + public func callArtifactControllerCallLogsDownload(id: String, requestOptions: RequestOptions? = nil) async throws -> Void { + return try await httpClient.performRequest( + method: .get, + path: "/call/\(id)/call-logs", + requestOptions: requestOptions + ) + } } \ No newline at end of file diff --git a/Sources/Resources/Campaigns/CampaignsClient.swift b/Sources/Resources/Campaigns/CampaignsClient.swift index d6278018..0d8b2d04 100644 --- a/Sources/Resources/Campaigns/CampaignsClient.swift +++ b/Sources/Resources/Campaigns/CampaignsClient.swift @@ -7,7 +7,24 @@ public final class CampaignsClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func campaignControllerFindAll(id: String? = nil, status: CampaignControllerFindAllRequestStatus? = nil, page: Double? = nil, sortOrder: CampaignControllerFindAllRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> CampaignPaginatedResponse { + /// Returns outbound calling campaigns for the authenticated organization. Filter results by campaign ID, status, or creation and update timestamps. + /// + /// - Parameter id: Filters campaigns by ID. + /// - Parameter status: Filters campaigns by status. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func campaignControllerFindAll(id: String? = nil, status: CampaignControllerFindAllRequestStatus? = nil, page: Double? = nil, sortOrder: CampaignControllerFindAllRequestSortOrder? = nil, sortBy: CampaignControllerFindAllRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> CampaignPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/campaign", @@ -16,6 +33,7 @@ public final class CampaignsClient: Sendable { "status": status.map { .string($0.rawValue) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -31,7 +49,10 @@ public final class CampaignsClient: Sendable { ) } - public func campaignControllerCreate(request: Requests.CreateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { + /// Creates an outbound calling campaign that calls a set of customers. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func campaignControllerCreate(request: CreateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { return try await httpClient.performRequest( method: .post, path: "/campaign", @@ -41,6 +62,73 @@ public final class CampaignsClient: Sendable { ) } + public func campaignControllerFindAllV2(id: String? = nil, status: CampaignControllerFindAllV2RequestStatus? = nil, page: Double? = nil, sortOrder: CampaignControllerFindAllV2RequestSortOrder? = nil, sortBy: CampaignControllerFindAllV2RequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> CampaignPaginatedResponse { + return try await httpClient.performRequest( + method: .get, + path: "/v2/campaign", + queryParams: [ + "id": id.map { .string($0) }, + "status": status.map { .string($0.rawValue) }, + "page": page.map { .double($0) }, + "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, + "limit": limit.map { .double($0) }, + "createdAtGt": createdAtGt.map { .date($0) }, + "createdAtLt": createdAtLt.map { .date($0) }, + "createdAtGe": createdAtGe.map { .date($0) }, + "createdAtLe": createdAtLe.map { .date($0) }, + "updatedAtGt": updatedAtGt.map { .date($0) }, + "updatedAtLt": updatedAtLt.map { .date($0) }, + "updatedAtGe": updatedAtGe.map { .date($0) }, + "updatedAtLe": updatedAtLe.map { .date($0) } + ], + requestOptions: requestOptions, + responseType: CampaignPaginatedResponse.self + ) + } + + public func campaignControllerCreateV2(request: CreateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { + return try await httpClient.performRequest( + method: .post, + path: "/v2/campaign", + body: request, + requestOptions: requestOptions, + responseType: Campaign.self + ) + } + + public func campaignControllerFindOneV2(id: String, requestOptions: RequestOptions? = nil) async throws -> Campaign { + return try await httpClient.performRequest( + method: .get, + path: "/v2/campaign/\(id)", + requestOptions: requestOptions, + responseType: Campaign.self + ) + } + + public func campaignControllerRemoveV2(id: String, requestOptions: RequestOptions? = nil) async throws -> Campaign { + return try await httpClient.performRequest( + method: .delete, + path: "/v2/campaign/\(id)", + requestOptions: requestOptions, + responseType: Campaign.self + ) + } + + public func campaignControllerUpdateV2(id: String, request: UpdateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { + return try await httpClient.performRequest( + method: .patch, + path: "/v2/campaign/\(id)", + body: request, + requestOptions: requestOptions, + responseType: Campaign.self + ) + } + + /// Returns the outbound calling campaign identified by its ID. + /// + /// - Parameter id: The unique identifier of the campaign. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func campaignControllerFindOne(id: String, requestOptions: RequestOptions? = nil) async throws -> Campaign { return try await httpClient.performRequest( method: .get, @@ -50,6 +138,10 @@ public final class CampaignsClient: Sendable { ) } + /// Deletes the outbound calling campaign identified by its ID. + /// + /// - Parameter id: The unique identifier of the campaign. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func campaignControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> Campaign { return try await httpClient.performRequest( method: .delete, @@ -59,7 +151,11 @@ public final class CampaignsClient: Sendable { ) } - public func campaignControllerUpdate(id: String, request: Requests.UpdateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { + /// Updates the outbound calling campaign identified by its ID. Campaigns can be ended by updating their status to `ended`. + /// + /// - Parameter id: The unique identifier of the campaign. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func campaignControllerUpdate(id: String, request: UpdateCampaignDto, requestOptions: RequestOptions? = nil) async throws -> Campaign { return try await httpClient.performRequest( method: .patch, path: "/campaign/\(id)", diff --git a/Sources/Resources/Chats/ChatsClient.swift b/Sources/Resources/Chats/ChatsClient.swift index 82fb5778..2e199b23 100644 --- a/Sources/Resources/Chats/ChatsClient.swift +++ b/Sources/Resources/Chats/ChatsClient.swift @@ -7,7 +7,7 @@ public final class ChatsClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func list(id: String? = nil, assistantId: String? = nil, assistantIdAny: String? = nil, squadId: String? = nil, sessionId: String? = nil, previousChatId: String? = nil, page: Double? = nil, sortOrder: ListChatsRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ChatPaginatedResponse { + public func list(id: String? = nil, assistantId: String? = nil, assistantIdAny: String? = nil, squadId: String? = nil, sessionId: String? = nil, previousChatId: String? = nil, page: Double? = nil, sortOrder: ListChatsRequestSortOrder? = nil, sortBy: ListChatsRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ChatPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/chat", @@ -20,6 +20,7 @@ public final class ChatsClient: Sendable { "previousChatId": previousChatId.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, diff --git a/Sources/Resources/Eval/EvalClient.swift b/Sources/Resources/Eval/EvalClient.swift index 80546086..e424f564 100644 --- a/Sources/Resources/Eval/EvalClient.swift +++ b/Sources/Resources/Eval/EvalClient.swift @@ -7,7 +7,23 @@ public final class EvalClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func evalControllerGetPaginated(id: String? = nil, page: Double? = nil, sortOrder: EvalControllerGetPaginatedRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> EvalPaginatedResponse { + /// Returns eval definitions for the authenticated organization. Filter results by ID or creation and update timestamps. + /// + /// - Parameter id: Filters eval definitions by ID. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func evalControllerGetPaginated(id: String? = nil, page: Double? = nil, sortOrder: EvalControllerGetPaginatedRequestSortOrder? = nil, sortBy: EvalControllerGetPaginatedRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> EvalPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/eval", @@ -15,6 +31,7 @@ public final class EvalClient: Sendable { "id": id.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -30,6 +47,9 @@ public final class EvalClient: Sendable { ) } + /// Creates a reusable eval that defines a mock conversation and checkpoints for evaluating assistant responses and tool calls. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerCreate(request: CreateEvalDto, requestOptions: RequestOptions? = nil) async throws -> Eval { return try await httpClient.performRequest( method: .post, @@ -40,6 +60,10 @@ public final class EvalClient: Sendable { ) } + /// Returns the eval definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the eval definition. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerGet(id: String, requestOptions: RequestOptions? = nil) async throws -> Eval { return try await httpClient.performRequest( method: .get, @@ -49,6 +73,10 @@ public final class EvalClient: Sendable { ) } + /// Deletes the eval definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the eval definition. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> Eval { return try await httpClient.performRequest( method: .delete, @@ -58,6 +86,10 @@ public final class EvalClient: Sendable { ) } + /// Updates the eval definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the eval definition. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerUpdate(id: String, request: Requests.UpdateEvalDto, requestOptions: RequestOptions? = nil) async throws -> Eval { return try await httpClient.performRequest( method: .patch, @@ -68,6 +100,10 @@ public final class EvalClient: Sendable { ) } + /// Returns the eval run identified by its ID. + /// + /// - Parameter id: The unique identifier of the eval run. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerGetRun(id: String, requestOptions: RequestOptions? = nil) async throws -> EvalRun { return try await httpClient.performRequest( method: .get, @@ -77,6 +113,10 @@ public final class EvalClient: Sendable { ) } + /// Deletes the eval run identified by its ID. + /// + /// - Parameter id: The unique identifier of the eval run. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerRemoveRun(id: String, requestOptions: RequestOptions? = nil) async throws -> EvalRun { return try await httpClient.performRequest( method: .delete, @@ -86,7 +126,23 @@ public final class EvalClient: Sendable { ) } - public func evalControllerGetRunsPaginated(id: String? = nil, page: Double? = nil, sortOrder: EvalControllerGetRunsPaginatedRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> EvalRunPaginatedResponse { + /// Returns eval runs for the authenticated organization. Filter results by ID or creation and update timestamps. + /// + /// - Parameter id: Filters eval runs by ID. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func evalControllerGetRunsPaginated(id: String? = nil, page: Double? = nil, sortOrder: EvalControllerGetRunsPaginatedRequestSortOrder? = nil, sortBy: EvalControllerGetRunsPaginatedRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> EvalRunPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/eval/run", @@ -94,6 +150,7 @@ public final class EvalClient: Sendable { "id": id.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -109,6 +166,9 @@ public final class EvalClient: Sendable { ) } + /// Runs a saved or transient eval against an assistant or squad and creates an eval-run record containing the results. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func evalControllerRun(request: Requests.CreateEvalRunDto, requestOptions: RequestOptions? = nil) async throws -> [String: JSONValue] { return try await httpClient.performRequest( method: .post, diff --git a/Sources/Resources/Files/FilesClient.swift b/Sources/Resources/Files/FilesClient.swift index bc08e82a..8fbca606 100644 --- a/Sources/Resources/Files/FilesClient.swift +++ b/Sources/Resources/Files/FilesClient.swift @@ -7,15 +7,25 @@ public final class FilesClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func list(requestOptions: RequestOptions? = nil) async throws -> [File] { + /// Returns files uploaded to the authenticated organization. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func list(purpose: String, requestOptions: RequestOptions? = nil) async throws -> [File] { return try await httpClient.performRequest( method: .get, path: "/file", + queryParams: [ + "purpose": .string(purpose) + ], requestOptions: requestOptions, responseType: [File].self ) } + /// Uploads a file for use with a Vapi knowledge base. + /// + /// - Parameter request: A file-upload request containing the file to store and process in Vapi. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: Requests.CreateFileDto, requestOptions: RequestOptions? = nil) async throws -> File { return try await httpClient.performRequest( method: .post, @@ -27,6 +37,10 @@ public final class FilesClient: Sendable { ) } + /// Returns the uploaded file identified by its ID. + /// + /// - Parameter id: The unique identifier of the file. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> File { return try await httpClient.performRequest( method: .get, @@ -36,6 +50,10 @@ public final class FilesClient: Sendable { ) } + /// Deletes the uploaded file identified by its ID. + /// + /// - Parameter id: The unique identifier of the file. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, requestOptions: RequestOptions? = nil) async throws -> File { return try await httpClient.performRequest( method: .delete, @@ -45,6 +63,10 @@ public final class FilesClient: Sendable { ) } + /// Updates the name of the uploaded file identified by its ID. + /// + /// - Parameter id: The unique identifier of the file. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: Requests.UpdateFileDto, requestOptions: RequestOptions? = nil) async throws -> File { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Resources/Insight/InsightClient.swift b/Sources/Resources/Insight/InsightClient.swift index 2896b3f6..73f14dc1 100644 --- a/Sources/Resources/Insight/InsightClient.swift +++ b/Sources/Resources/Insight/InsightClient.swift @@ -7,7 +7,23 @@ public final class InsightClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func insightControllerFindAll(id: String? = nil, page: Double? = nil, sortOrder: InsightControllerFindAllRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> InsightPaginatedResponse { + /// Returns saved reporting insights for the authenticated organization. Filter results by ID or creation and update timestamps. + /// + /// - Parameter id: Filters reporting insights by ID. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func insightControllerFindAll(id: String? = nil, page: Double? = nil, sortOrder: InsightControllerFindAllRequestSortOrder? = nil, sortBy: InsightControllerFindAllRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> InsightPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/reporting/insight", @@ -15,6 +31,7 @@ public final class InsightClient: Sendable { "id": id.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -30,6 +47,9 @@ public final class InsightClient: Sendable { ) } + /// Creates a saved reporting insight that queries call data and presents the results as a bar chart, pie chart, line chart, or text value. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerCreate(request: InsightControllerCreateRequest, requestOptions: RequestOptions? = nil) async throws -> InsightControllerCreateResponse { return try await httpClient.performRequest( method: .post, @@ -40,6 +60,10 @@ public final class InsightClient: Sendable { ) } + /// Returns the reporting insight identified by its ID. + /// + /// - Parameter id: The unique identifier of the reporting insight. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerFindOne(id: String, requestOptions: RequestOptions? = nil) async throws -> InsightControllerFindOneResponse { return try await httpClient.performRequest( method: .get, @@ -49,6 +73,10 @@ public final class InsightClient: Sendable { ) } + /// Deletes the reporting insight identified by its ID. + /// + /// - Parameter id: The unique identifier of the reporting insight. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> InsightControllerRemoveResponse { return try await httpClient.performRequest( method: .delete, @@ -58,6 +86,10 @@ public final class InsightClient: Sendable { ) } + /// Updates the reporting insight identified by its ID. + /// + /// - Parameter id: The unique identifier of the reporting insight. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerUpdate(id: String, request: InsightControllerUpdateRequestBody, requestOptions: RequestOptions? = nil) async throws -> InsightControllerUpdateResponse { return try await httpClient.performRequest( method: .patch, @@ -68,6 +100,10 @@ public final class InsightClient: Sendable { ) } + /// Runs a saved reporting insight, optionally overriding its time range and response format. + /// + /// - Parameter id: The unique identifier of the reporting insight. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerRun(id: String, request: Requests.InsightRunDto, requestOptions: RequestOptions? = nil) async throws -> InsightRunResponse { return try await httpClient.performRequest( method: .post, @@ -78,6 +114,9 @@ public final class InsightClient: Sendable { ) } + /// Runs an insight definition without first saving it, returning a preview of the resulting chart or text value. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func insightControllerPreview(request: InsightControllerPreviewRequest, requestOptions: RequestOptions? = nil) async throws -> InsightRunResponse { return try await httpClient.performRequest( method: .post, diff --git a/Sources/Resources/ObservabilityScorecard/ObservabilityScorecardClient.swift b/Sources/Resources/ObservabilityScorecard/ObservabilityScorecardClient.swift index b6261b75..7590ccb6 100644 --- a/Sources/Resources/ObservabilityScorecard/ObservabilityScorecardClient.swift +++ b/Sources/Resources/ObservabilityScorecard/ObservabilityScorecardClient.swift @@ -7,6 +7,10 @@ public final class ObservabilityScorecardClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns the scorecard identified by its ID. + /// + /// - Parameter id: The unique identifier of the scorecard. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func scorecardControllerGet(id: String, requestOptions: RequestOptions? = nil) async throws -> Scorecard { return try await httpClient.performRequest( method: .get, @@ -16,6 +20,10 @@ public final class ObservabilityScorecardClient: Sendable { ) } + /// Deletes the scorecard identified by its ID. + /// + /// - Parameter id: The unique identifier of the scorecard. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func scorecardControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> Scorecard { return try await httpClient.performRequest( method: .delete, @@ -25,6 +33,10 @@ public final class ObservabilityScorecardClient: Sendable { ) } + /// Updates the scorecard identified by its ID. + /// + /// - Parameter id: The unique identifier of the scorecard. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func scorecardControllerUpdate(id: String, request: Requests.UpdateScorecardDto, requestOptions: RequestOptions? = nil) async throws -> Scorecard { return try await httpClient.performRequest( method: .patch, @@ -35,7 +47,23 @@ public final class ObservabilityScorecardClient: Sendable { ) } - public func scorecardControllerGetPaginated(id: String? = nil, page: Double? = nil, sortOrder: ScorecardControllerGetPaginatedRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ScorecardPaginatedResponse { + /// Returns scorecards for the authenticated organization. Filter results by ID or creation and update timestamps. + /// + /// - Parameter id: Filters scorecards by ID. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func scorecardControllerGetPaginated(id: String? = nil, page: Double? = nil, sortOrder: ScorecardControllerGetPaginatedRequestSortOrder? = nil, sortBy: ScorecardControllerGetPaginatedRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ScorecardPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/observability/scorecard", @@ -43,6 +71,7 @@ public final class ObservabilityScorecardClient: Sendable { "id": id.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -58,6 +87,9 @@ public final class ObservabilityScorecardClient: Sendable { ) } + /// Creates a scorecard containing metrics, scoring conditions, and optional links to assistants whose calls should be evaluated. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func scorecardControllerCreate(request: CreateScorecardDto, requestOptions: RequestOptions? = nil) async throws -> Scorecard { return try await httpClient.performRequest( method: .post, diff --git a/Sources/Resources/PhoneNumbers/PhoneNumbersClient.swift b/Sources/Resources/PhoneNumbers/PhoneNumbersClient.swift index e5ae7d16..76943853 100644 --- a/Sources/Resources/PhoneNumbers/PhoneNumbersClient.swift +++ b/Sources/Resources/PhoneNumbers/PhoneNumbersClient.swift @@ -7,6 +7,18 @@ public final class PhoneNumbersClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns phone numbers for the authenticated organization. Filter results by creation or update timestamps and limit the number returned. + /// + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func list(limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> [ListPhoneNumbersResponseItem] { return try await httpClient.performRequest( method: .get, @@ -27,6 +39,9 @@ public final class PhoneNumbersClient: Sendable { ) } + /// Creates a Vapi phone number or imports a phone number from a supported provider, including Twilio, Vonage, Telnyx, or a bring-your-own provider. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: CreatePhoneNumbersRequest, requestOptions: RequestOptions? = nil) async throws -> CreatePhoneNumbersResponse { return try await httpClient.performRequest( method: .post, @@ -37,7 +52,23 @@ public final class PhoneNumbersClient: Sendable { ) } - public func phoneNumberControllerFindAllPaginated(search: String? = nil, page: Double? = nil, sortOrder: PhoneNumberControllerFindAllPaginatedRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> PhoneNumberPaginatedResponse { + /// Returns a paginated list of phone numbers for the authenticated organization. Search by name, number, or SIP URI using a partial, case-insensitive match, and filter by creation or update timestamps. + /// + /// - Parameter search: This will search phone numbers by name, number, or SIP URI (partial match, case-insensitive). + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func phoneNumberControllerFindAllPaginated(search: String? = nil, page: Double? = nil, sortOrder: PhoneNumberControllerFindAllPaginatedRequestSortOrder? = nil, sortBy: PhoneNumberControllerFindAllPaginatedRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> PhoneNumberPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/v2/phone-number", @@ -45,6 +76,7 @@ public final class PhoneNumbersClient: Sendable { "search": search.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -60,6 +92,10 @@ public final class PhoneNumbersClient: Sendable { ) } + /// Returns the phone number resource identified by its ID. + /// + /// - Parameter id: The unique identifier of the phone number. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> GetPhoneNumbersResponse { return try await httpClient.performRequest( method: .get, @@ -69,6 +105,10 @@ public final class PhoneNumbersClient: Sendable { ) } + /// Deletes the phone number resource identified by its ID. + /// + /// - Parameter id: The unique identifier of the phone number. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, requestOptions: RequestOptions? = nil) async throws -> DeletePhoneNumbersResponse { return try await httpClient.performRequest( method: .delete, @@ -78,6 +118,10 @@ public final class PhoneNumbersClient: Sendable { ) } + /// Updates the specified fields of the phone number resource identified by its ID. + /// + /// - Parameter id: The unique identifier of the phone number. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: UpdatePhoneNumbersRequestBody, requestOptions: RequestOptions? = nil) async throws -> UpdatePhoneNumbersResponse { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Resources/ProviderResources/ProviderResourcesClient.swift b/Sources/Resources/ProviderResources/ProviderResourcesClient.swift index 0e5e1501..8352c99c 100644 --- a/Sources/Resources/ProviderResources/ProviderResourcesClient.swift +++ b/Sources/Resources/ProviderResources/ProviderResourcesClient.swift @@ -7,7 +7,26 @@ public final class ProviderResourcesClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func providerResourceControllerGetProviderResourcesPaginated(provider: String, resourceName: String, id: String? = nil, resourceId: String? = nil, page: Double? = nil, sortOrder: ProviderResourceControllerGetProviderResourcesPaginatedRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ProviderResourcePaginatedResponse { + /// Returns a paginated list of provider resources for the authenticated organization. Filter pronunciation dictionaries by provider, resource ID, or creation and update timestamps. + /// + /// - Parameter provider: The provider (e.g., 11labs) + /// - Parameter resourceName: The resource name (e.g., pronunciation-dictionary) + /// - Parameter id: Filters provider resources by their resource ID. + /// - Parameter resourceId: Filters provider resources by their provider-specific resource ID. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func providerResourceControllerGetProviderResourcesPaginated(provider: String, resourceName: String, id: String? = nil, resourceId: String? = nil, page: Double? = nil, sortOrder: ProviderResourceControllerGetProviderResourcesPaginatedRequestSortOrder? = nil, sortBy: ProviderResourceControllerGetProviderResourcesPaginatedRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> ProviderResourcePaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/provider/\(provider)/\(resourceName)", @@ -16,6 +35,7 @@ public final class ProviderResourcesClient: Sendable { "resourceId": resourceId.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -31,6 +51,11 @@ public final class ProviderResourcesClient: Sendable { ) } + /// Creates a pronunciation-dictionary resource for a supported provider, currently Cartesia or ElevenLabs. + /// + /// - Parameter provider: The provider (e.g., 11labs) + /// - Parameter resourceName: The resource name (e.g., pronunciation-dictionary) + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func providerResourceControllerCreateProviderResource(provider: String, resourceName: String, requestOptions: RequestOptions? = nil) async throws -> ProviderResource { return try await httpClient.performRequest( method: .post, @@ -40,6 +65,12 @@ public final class ProviderResourcesClient: Sendable { ) } + /// Returns the provider resource identified by its Vapi resource ID. + /// + /// - Parameter provider: The provider (e.g., 11labs) + /// - Parameter resourceName: The resource name (e.g., pronunciation-dictionary) + /// - Parameter id: The unique identifier of the provider resource. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func providerResourceControllerGetProviderResource(provider: String, resourceName: String, id: String, requestOptions: RequestOptions? = nil) async throws -> ProviderResource { return try await httpClient.performRequest( method: .get, @@ -49,6 +80,12 @@ public final class ProviderResourcesClient: Sendable { ) } + /// Deletes the provider resource identified by its Vapi resource ID. + /// + /// - Parameter provider: The provider (e.g., 11labs) + /// - Parameter resourceName: The resource name (e.g., pronunciation-dictionary) + /// - Parameter id: The unique identifier of the provider resource. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func providerResourceControllerDeleteProviderResource(provider: String, resourceName: String, id: String, requestOptions: RequestOptions? = nil) async throws -> ProviderResource { return try await httpClient.performRequest( method: .delete, @@ -58,6 +95,12 @@ public final class ProviderResourcesClient: Sendable { ) } + /// Updates the provider resource identified by its Vapi resource ID. + /// + /// - Parameter provider: The provider (e.g., 11labs) + /// - Parameter resourceName: The resource name (e.g., pronunciation-dictionary) + /// - Parameter id: The unique identifier of the provider resource. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func providerResourceControllerUpdateProviderResource(provider: String, resourceName: String, id: String, requestOptions: RequestOptions? = nil) async throws -> ProviderResource { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Resources/Sessions/SessionsClient.swift b/Sources/Resources/Sessions/SessionsClient.swift index a7bcc80d..e401ac40 100644 --- a/Sources/Resources/Sessions/SessionsClient.swift +++ b/Sources/Resources/Sessions/SessionsClient.swift @@ -7,7 +7,7 @@ public final class SessionsClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func list(id: String? = nil, name: String? = nil, assistantId: String? = nil, assistantIdAny: String? = nil, squadId: String? = nil, workflowId: String? = nil, numberE164CheckEnabled: Bool? = nil, extension: String? = nil, assistantOverrides: String? = nil, number: String? = nil, sipUri: String? = nil, email: String? = nil, externalId: String? = nil, customerNumberAny: String? = nil, phoneNumberId: String? = nil, phoneNumberIdAny: String? = nil, page: Double? = nil, sortOrder: ListSessionsRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> SessionPaginatedResponse { + public func list(id: String? = nil, name: String? = nil, assistantId: String? = nil, assistantIdAny: String? = nil, squadId: String? = nil, workflowId: String? = nil, numberE164CheckEnabled: Bool? = nil, extension: String? = nil, assistantOverrides: String? = nil, squadOverrides: String? = nil, number: String? = nil, sipUri: String? = nil, email: String? = nil, externalId: String? = nil, customerNumberAny: String? = nil, phoneNumberId: String? = nil, phoneNumberIdAny: String? = nil, page: Double? = nil, sortOrder: ListSessionsRequestSortOrder? = nil, sortBy: ListSessionsRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> SessionPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/session", @@ -21,6 +21,7 @@ public final class SessionsClient: Sendable { "numberE164CheckEnabled": numberE164CheckEnabled.map { .bool($0) }, "extension": `extension`.map { .string($0) }, "assistantOverrides": assistantOverrides.map { .string($0) }, + "squadOverrides": squadOverrides.map { .string($0) }, "number": number.map { .string($0) }, "sipUri": sipUri.map { .string($0) }, "email": email.map { .string($0) }, @@ -30,6 +31,7 @@ public final class SessionsClient: Sendable { "phoneNumberIdAny": phoneNumberIdAny.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, diff --git a/Sources/Resources/Squads/SquadsClient.swift b/Sources/Resources/Squads/SquadsClient.swift index ef6e4838..aa06ba09 100644 --- a/Sources/Resources/Squads/SquadsClient.swift +++ b/Sources/Resources/Squads/SquadsClient.swift @@ -7,6 +7,18 @@ public final class SquadsClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns squads for the authenticated organization. Filter results by creation or update timestamps and limit the number returned. + /// + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func list(limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> [Squad] { return try await httpClient.performRequest( method: .get, @@ -27,6 +39,9 @@ public final class SquadsClient: Sendable { ) } + /// Creates a squad that coordinates multiple assistants and their handoffs during a conversation. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: CreateSquadDto, requestOptions: RequestOptions? = nil) async throws -> Squad { return try await httpClient.performRequest( method: .post, @@ -37,6 +52,10 @@ public final class SquadsClient: Sendable { ) } + /// Returns the squad identified by its ID. + /// + /// - Parameter id: The unique identifier of the squad. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> Squad { return try await httpClient.performRequest( method: .get, @@ -46,6 +65,10 @@ public final class SquadsClient: Sendable { ) } + /// Deletes the squad identified by its ID. + /// + /// - Parameter id: The unique identifier of the squad. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, requestOptions: RequestOptions? = nil) async throws -> Squad { return try await httpClient.performRequest( method: .delete, @@ -55,6 +78,10 @@ public final class SquadsClient: Sendable { ) } + /// Updates the specified fields of the squad identified by its ID. + /// + /// - Parameter id: The unique identifier of the squad. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: Requests.UpdateSquadDto, requestOptions: RequestOptions? = nil) async throws -> Squad { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Resources/StructuredOutputs/StructuredOutputsClient.swift b/Sources/Resources/StructuredOutputs/StructuredOutputsClient.swift index 5827f4bc..6bb4df2d 100644 --- a/Sources/Resources/StructuredOutputs/StructuredOutputsClient.swift +++ b/Sources/Resources/StructuredOutputs/StructuredOutputsClient.swift @@ -7,7 +7,24 @@ public final class StructuredOutputsClient: Sendable { self.httpClient = HTTPClient(config: config) } - public func structuredOutputControllerFindAll(id: String? = nil, name: String? = nil, page: Double? = nil, sortOrder: StructuredOutputControllerFindAllRequestSortOrder? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> StructuredOutputPaginatedResponse { + /// Returns structured-output definitions for the authenticated organization. Filter results by ID, name, or creation and update timestamps. + /// + /// - Parameter id: This will return structured outputs where the id matches the specified value. + /// - Parameter name: This will return structured outputs where the name matches the specified value. + /// - Parameter page: This is the page number to return. Defaults to 1. + /// - Parameter sortOrder: This is the sort order for pagination. Defaults to 'DESC'. + /// - Parameter sortBy: This is the column to sort by. Defaults to 'createdAt'. + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func structuredOutputControllerFindAll(id: String? = nil, name: String? = nil, page: Double? = nil, sortOrder: StructuredOutputControllerFindAllRequestSortOrder? = nil, sortBy: StructuredOutputControllerFindAllRequestSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> StructuredOutputPaginatedResponse { return try await httpClient.performRequest( method: .get, path: "/structured-output", @@ -16,6 +33,7 @@ public final class StructuredOutputsClient: Sendable { "name": name.map { .string($0) }, "page": page.map { .double($0) }, "sortOrder": sortOrder.map { .string($0.rawValue) }, + "sortBy": sortBy.map { .string($0.rawValue) }, "limit": limit.map { .double($0) }, "createdAtGt": createdAtGt.map { .date($0) }, "createdAtLt": createdAtLt.map { .date($0) }, @@ -31,6 +49,9 @@ public final class StructuredOutputsClient: Sendable { ) } + /// Creates a reusable definition for extracting validated data from conversations using an AI model or regular expression. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func structuredOutputControllerCreate(request: CreateStructuredOutputDto, requestOptions: RequestOptions? = nil) async throws -> StructuredOutput { return try await httpClient.performRequest( method: .post, @@ -41,6 +62,10 @@ public final class StructuredOutputsClient: Sendable { ) } + /// Returns the structured-output definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the structured output. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func structuredOutputControllerFindOne(id: String, requestOptions: RequestOptions? = nil) async throws -> StructuredOutput { return try await httpClient.performRequest( method: .get, @@ -50,6 +75,10 @@ public final class StructuredOutputsClient: Sendable { ) } + /// Deletes the structured-output definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the structured output. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func structuredOutputControllerRemove(id: String, requestOptions: RequestOptions? = nil) async throws -> StructuredOutput { return try await httpClient.performRequest( method: .delete, @@ -59,6 +88,11 @@ public final class StructuredOutputsClient: Sendable { ) } + /// Updates the structured-output definition identified by its ID. + /// + /// - Parameter id: The unique identifier of the structured output. + /// - Parameter schemaOverride: Set to the string `true` to allow changing the schema's top-level type. Other values do not enable schema type changes. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func structuredOutputControllerUpdate(id: String, schemaOverride: String, request: Requests.UpdateStructuredOutputDto, requestOptions: RequestOptions? = nil) async throws -> StructuredOutput { return try await httpClient.performRequest( method: .patch, @@ -72,13 +106,16 @@ public final class StructuredOutputsClient: Sendable { ) } - public func structuredOutputControllerRun(request: Requests.StructuredOutputRunDto, requestOptions: RequestOptions? = nil) async throws -> StructuredOutput { + /// Runs a saved or transient structured-output definition against one or more calls, optionally returning a preview without updating call artifacts. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. + public func structuredOutputControllerRun(request: Requests.StructuredOutputRunDto, requestOptions: RequestOptions? = nil) async throws -> StructuredOutputControllerRunResponse { return try await httpClient.performRequest( method: .post, path: "/structured-output/run", body: request, requestOptions: requestOptions, - responseType: StructuredOutput.self + responseType: StructuredOutputControllerRunResponse.self ) } } \ No newline at end of file diff --git a/Sources/Resources/Tools/ToolsClient.swift b/Sources/Resources/Tools/ToolsClient.swift index 9dbb028d..4a095337 100644 --- a/Sources/Resources/Tools/ToolsClient.swift +++ b/Sources/Resources/Tools/ToolsClient.swift @@ -7,6 +7,18 @@ public final class ToolsClient: Sendable { self.httpClient = HTTPClient(config: config) } + /// Returns reusable tools for the authenticated organization. Filter results by creation or update timestamps and limit the number returned. + /// + /// - Parameter limit: This is the maximum number of items to return. Defaults to 100. + /// - Parameter createdAtGt: This will return items where the createdAt is greater than the specified value. + /// - Parameter createdAtLt: This will return items where the createdAt is less than the specified value. + /// - Parameter createdAtGe: This will return items where the createdAt is greater than or equal to the specified value. + /// - Parameter createdAtLe: This will return items where the createdAt is less than or equal to the specified value. + /// - Parameter updatedAtGt: This will return items where the updatedAt is greater than the specified value. + /// - Parameter updatedAtLt: This will return items where the updatedAt is less than the specified value. + /// - Parameter updatedAtGe: This will return items where the updatedAt is greater than or equal to the specified value. + /// - Parameter updatedAtLe: This will return items where the updatedAt is less than or equal to the specified value. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func list(limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, createdAtGe: Date? = nil, createdAtLe: Date? = nil, updatedAtGt: Date? = nil, updatedAtLt: Date? = nil, updatedAtGe: Date? = nil, updatedAtLe: Date? = nil, requestOptions: RequestOptions? = nil) async throws -> [ListToolsResponseItem] { return try await httpClient.performRequest( method: .get, @@ -27,6 +39,9 @@ public final class ToolsClient: Sendable { ) } + /// Creates a reusable tool that assistants can invoke during conversations. + /// + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func create(request: CreateToolsRequest, requestOptions: RequestOptions? = nil) async throws -> CreateToolsResponse { return try await httpClient.performRequest( method: .post, @@ -37,6 +52,10 @@ public final class ToolsClient: Sendable { ) } + /// Returns the tool identified by its ID. + /// + /// - Parameter id: The unique identifier of the tool. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func get(id: String, requestOptions: RequestOptions? = nil) async throws -> GetToolsResponse { return try await httpClient.performRequest( method: .get, @@ -46,6 +65,10 @@ public final class ToolsClient: Sendable { ) } + /// Deletes the tool identified by its ID. + /// + /// - Parameter id: The unique identifier of the tool. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func delete(id: String, requestOptions: RequestOptions? = nil) async throws -> DeleteToolsResponse { return try await httpClient.performRequest( method: .delete, @@ -55,6 +78,10 @@ public final class ToolsClient: Sendable { ) } + /// Updates the specified fields of the tool identified by its ID. + /// + /// - Parameter id: The unique identifier of the tool. + /// - Parameter requestOptions: Additional options for configuring the request, such as custom headers or timeout settings. public func update(id: String, request: UpdateToolsRequestBody, requestOptions: RequestOptions? = nil) async throws -> UpdateToolsResponse { return try await httpClient.performRequest( method: .patch, diff --git a/Sources/Schemas/AiEdgeCondition.swift b/Sources/Schemas/AiEdgeCondition.swift index d0f64fcc..1b8df4e7 100644 --- a/Sources/Schemas/AiEdgeCondition.swift +++ b/Sources/Schemas/AiEdgeCondition.swift @@ -1,6 +1,8 @@ import Foundation +/// An AI-evaluated boolean condition that determines whether a workflow follows an edge. public struct AiEdgeCondition: Codable, Hashable, Sendable { + /// Selects an AI-evaluated workflow edge condition. public let type: AiEdgeConditionType /// This is the prompt for the AI edge condition. It should evaluate to a boolean. public let prompt: String diff --git a/Sources/Schemas/AiEdgeConditionType.swift b/Sources/Schemas/AiEdgeConditionType.swift index 71c5c59a..3a3cf315 100644 --- a/Sources/Schemas/AiEdgeConditionType.swift +++ b/Sources/Schemas/AiEdgeConditionType.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects an AI-evaluated workflow edge condition. public enum AiEdgeConditionType: String, Codable, Hashable, CaseIterable, Sendable { case ai } \ No newline at end of file diff --git a/Sources/Schemas/Analysis.swift b/Sources/Schemas/Analysis.swift index 576c7a9d..3fed1368 100644 --- a/Sources/Schemas/Analysis.swift +++ b/Sources/Schemas/Analysis.swift @@ -1,5 +1,6 @@ import Foundation +/// Post-call analysis results, including summary, structured data, and success evaluation outputs. public struct Analysis: Codable, Hashable, Sendable { /// This is the summary of the call. Customize by setting `assistant.analysisPlan.summaryPrompt`. public let summary: String? diff --git a/Sources/Schemas/AnalysisCost.swift b/Sources/Schemas/AnalysisCost.swift index 25ae2fb8..fbe1631d 100644 --- a/Sources/Schemas/AnalysisCost.swift +++ b/Sources/Schemas/AnalysisCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Cost for an individual analysis request, including analysis type, model, token usage, and amount. public struct AnalysisCost: Codable, Hashable, Sendable { /// This is the type of analysis performed. public let analysisType: AnalysisCostAnalysisType diff --git a/Sources/Schemas/AnalysisCostBreakdown.swift b/Sources/Schemas/AnalysisCostBreakdown.swift index b7ed26a6..db037f65 100644 --- a/Sources/Schemas/AnalysisCostBreakdown.swift +++ b/Sources/Schemas/AnalysisCostBreakdown.swift @@ -1,5 +1,6 @@ import Foundation +/// Analysis costs and token usage grouped by summary, structured data, success evaluation, and structured-output generation. public struct AnalysisCostBreakdown: Codable, Hashable, Sendable { /// This is the cost to summarize the call. public let summary: Double? diff --git a/Sources/Schemas/AnalysisPlan.swift b/Sources/Schemas/AnalysisPlan.swift index 0ec0ce27..86e01a17 100644 --- a/Sources/Schemas/AnalysisPlan.swift +++ b/Sources/Schemas/AnalysisPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for post-call analysis of summaries, structured-data extraction, success evaluation, and outcomes. public struct AnalysisPlan: Codable, Hashable, Sendable { /// The minimum number of messages required to run the analysis plan. /// If the number of messages is less than this, analysis will be skipped. diff --git a/Sources/Schemas/AnalyticsOperation.swift b/Sources/Schemas/AnalyticsOperation.swift index b7f8c5ca..c16e01d3 100644 --- a/Sources/Schemas/AnalyticsOperation.swift +++ b/Sources/Schemas/AnalyticsOperation.swift @@ -1,5 +1,6 @@ import Foundation +/// An aggregation or history operation applied to an analytics column, with an optional response alias. public struct AnalyticsOperation: Codable, Hashable, Sendable { /// This is the aggregation operation you want to perform. public let operation: AnalyticsOperationOperation diff --git a/Sources/Schemas/AnalyticsQuery.swift b/Sources/Schemas/AnalyticsQuery.swift index 6470ce19..a610f860 100644 --- a/Sources/Schemas/AnalyticsQuery.swift +++ b/Sources/Schemas/AnalyticsQuery.swift @@ -1,5 +1,6 @@ import Foundation +/// A named analytics query against call or subscription data, including grouping, time range, and aggregation operations. public struct AnalyticsQuery: Codable, Hashable, Sendable { /// This is the table you want to query. public let table: AnalyticsQueryTable diff --git a/Sources/Schemas/AnalyticsQueryResult.swift b/Sources/Schemas/AnalyticsQueryResult.swift index 56c4243f..e9453a64 100644 --- a/Sources/Schemas/AnalyticsQueryResult.swift +++ b/Sources/Schemas/AnalyticsQueryResult.swift @@ -1,5 +1,6 @@ import Foundation +/// The result of a named analytics query, including the evaluated time range and returned metric data. public struct AnalyticsQueryResult: Codable, Hashable, Sendable { /// This is the unique key for the query. public let name: String diff --git a/Sources/Schemas/AnthropicBedrockCredentialRegion.swift b/Sources/Schemas/AnthropicBedrockCredentialRegion.swift index d363512c..4c61bec0 100644 --- a/Sources/Schemas/AnthropicBedrockCredentialRegion.swift +++ b/Sources/Schemas/AnthropicBedrockCredentialRegion.swift @@ -4,6 +4,7 @@ import Foundation public enum AnthropicBedrockCredentialRegion: String, Codable, Hashable, CaseIterable, Sendable { case usEast1 = "us-east-1" case usWest2 = "us-west-2" + case euCentral1 = "eu-central-1" case euWest1 = "eu-west-1" case euWest3 = "eu-west-3" case apNortheast1 = "ap-northeast-1" diff --git a/Sources/Schemas/AnthropicBedrockModel.swift b/Sources/Schemas/AnthropicBedrockModel.swift index e625a9f3..2e1a18ec 100644 --- a/Sources/Schemas/AnthropicBedrockModel.swift +++ b/Sources/Schemas/AnthropicBedrockModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Anthropic models through Amazon Bedrock, including model, prompts, tools, knowledge-base access, reasoning, and generation settings. public struct AnthropicBedrockModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,6 +12,11 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// The specific Anthropic/Claude model that will be used via Bedrock. @@ -19,7 +25,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { /// Only applicable for claude-3-7-sonnet-20250219 model. /// If provided, maxTokens must be greater than thinking.budgetTokens. public let thinking: AnthropicThinkingConfig? - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -42,6 +48,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [AnthropicBedrockModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: AnthropicBedrockModelModel, thinking: AnthropicThinkingConfig? = nil, @@ -54,6 +61,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.thinking = thinking @@ -69,6 +77,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([AnthropicBedrockModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(AnthropicBedrockModelModel.self, forKey: .model) self.thinking = try container.decodeIfPresent(AnthropicThinkingConfig.self, forKey: .thinking) @@ -85,6 +94,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.thinking, forKey: .thinking) @@ -99,6 +109,7 @@ public struct AnthropicBedrockModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case thinking diff --git a/Sources/Schemas/AnthropicBedrockModelModel.swift b/Sources/Schemas/AnthropicBedrockModelModel.swift index c6ae20d9..43e54352 100644 --- a/Sources/Schemas/AnthropicBedrockModelModel.swift +++ b/Sources/Schemas/AnthropicBedrockModelModel.swift @@ -16,4 +16,5 @@ public enum AnthropicBedrockModelModel: String, Codable, Hashable, CaseIterable, case claudeSonnet4520250929 = "claude-sonnet-4-5-20250929" case claudeSonnet46 = "claude-sonnet-4-6" case claudeHaiku4520251001 = "claude-haiku-4-5-20251001" + case globalAnthropicClaudeHaiku4520251001V10 = "global.anthropic.claude-haiku-4-5-20251001-v1:0" } \ No newline at end of file diff --git a/Sources/Schemas/AnthropicModel.swift b/Sources/Schemas/AnthropicModel.swift index 414e336c..a6ac2961 100644 --- a/Sources/Schemas/AnthropicModel.swift +++ b/Sources/Schemas/AnthropicModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Anthropic, including model, prompts, tools, knowledge-base access, reasoning, and generation settings. public struct AnthropicModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,6 +12,11 @@ public struct AnthropicModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// The specific Anthropic/Claude model that will be used. @@ -19,7 +25,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { /// Only applicable for claude-3-7-sonnet-20250219 model. /// If provided, maxTokens must be greater than thinking.budgetTokens. public let thinking: AnthropicThinkingConfig? - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -42,6 +48,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [AnthropicModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: AnthropicModelModel, thinking: AnthropicThinkingConfig? = nil, @@ -54,6 +61,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.thinking = thinking @@ -69,6 +77,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([AnthropicModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(AnthropicModelModel.self, forKey: .model) self.thinking = try container.decodeIfPresent(AnthropicThinkingConfig.self, forKey: .thinking) @@ -85,6 +94,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.thinking, forKey: .thinking) @@ -99,6 +109,7 @@ public struct AnthropicModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case thinking diff --git a/Sources/Schemas/AnthropicModelModel.swift b/Sources/Schemas/AnthropicModelModel.swift index dbd8121e..582b4f61 100644 --- a/Sources/Schemas/AnthropicModelModel.swift +++ b/Sources/Schemas/AnthropicModelModel.swift @@ -15,5 +15,6 @@ public enum AnthropicModelModel: String, Codable, Hashable, CaseIterable, Sendab case claudeSonnet420250514 = "claude-sonnet-4-20250514" case claudeSonnet4520250929 = "claude-sonnet-4-5-20250929" case claudeSonnet46 = "claude-sonnet-4-6" + case claudeSonnet5 = "claude-sonnet-5" case claudeHaiku4520251001 = "claude-haiku-4-5-20251001" } \ No newline at end of file diff --git a/Sources/Schemas/AnthropicThinkingConfig.swift b/Sources/Schemas/AnthropicThinkingConfig.swift index 61e1de47..ceb0800c 100644 --- a/Sources/Schemas/AnthropicThinkingConfig.swift +++ b/Sources/Schemas/AnthropicThinkingConfig.swift @@ -1,6 +1,8 @@ import Foundation +/// Enables Anthropic extended thinking with a maximum thinking-token budget. public struct AnthropicThinkingConfig: Codable, Hashable, Sendable { + /// Enables Anthropic extended thinking. public let type: AnthropicThinkingConfigType /// The maximum number of tokens to allocate for thinking. /// Must be between 1024 and 100000 tokens. diff --git a/Sources/Schemas/AnthropicThinkingConfigType.swift b/Sources/Schemas/AnthropicThinkingConfigType.swift index 4738bf9f..f6ea8778 100644 --- a/Sources/Schemas/AnthropicThinkingConfigType.swift +++ b/Sources/Schemas/AnthropicThinkingConfigType.swift @@ -1,5 +1,6 @@ import Foundation +/// Enables Anthropic extended thinking. public enum AnthropicThinkingConfigType: String, Codable, Hashable, CaseIterable, Sendable { case enabled } \ No newline at end of file diff --git a/Sources/Schemas/AnyscaleModel.swift b/Sources/Schemas/AnyscaleModel.swift index e9a99508..4dfa3293 100644 --- a/Sources/Schemas/AnyscaleModel.swift +++ b/Sources/Schemas/AnyscaleModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Anyscale, including model, prompts, tools, knowledge-base access, and generation settings. public struct AnyscaleModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [AnyscaleModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: String, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([AnyscaleModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct AnyscaleModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/ApiRequestTool.swift b/Sources/Schemas/ApiRequestTool.swift index cbd35b8d..7258c084 100644 --- a/Sources/Schemas/ApiRequestTool.swift +++ b/Sources/Schemas/ApiRequestTool.swift @@ -1,10 +1,15 @@ import Foundation +/// A reusable tool that sends HTTP requests to a configured API and can authenticate, retry failures, and extract variables from responses. public struct ApiRequestTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [ApiRequestToolMessagesItem]? + /// This is the name of the tool. This will be passed to the model. + /// + /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. + public let name: String? + /// The HTTP method used for the API request. public let method: ApiRequestToolMethod /// This is the timeout in seconds for the request. Defaults to 20 seconds. /// @@ -103,10 +108,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { /// } /// ``` public let rejectionPlan: ToolRejectionPlan? - /// This is the name of the tool. This will be passed to the model. - /// - /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. - public let name: String? /// This is the description of the tool. This will be passed to the model. public let description: String? /// This is where the request will be sent. @@ -277,7 +278,9 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [ApiRequestToolMessagesItem]? = nil, + name: String? = nil, method: ApiRequestToolMethod, timeoutSeconds: Double? = nil, credentialId: String? = nil, @@ -288,7 +291,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { createdAt: Date, updatedAt: Date, rejectionPlan: ToolRejectionPlan? = nil, - name: String? = nil, description: String? = nil, url: String, body: JsonSchema? = nil, @@ -297,7 +299,9 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { variableExtractionPlan: VariableExtractionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages + self.name = name self.method = method self.timeoutSeconds = timeoutSeconds self.credentialId = credentialId @@ -308,7 +312,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { self.createdAt = createdAt self.updatedAt = updatedAt self.rejectionPlan = rejectionPlan - self.name = name self.description = description self.url = url self.body = body @@ -320,7 +323,9 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([ApiRequestToolMessagesItem].self, forKey: .messages) + self.name = try container.decodeIfPresent(String.self, forKey: .name) self.method = try container.decode(ApiRequestToolMethod.self, forKey: .method) self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) @@ -331,7 +336,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) - self.name = try container.decodeIfPresent(String.self, forKey: .name) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.url = try container.decode(String.self, forKey: .url) self.body = try container.decodeIfPresent(JsonSchema.self, forKey: .body) @@ -344,7 +348,9 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.name, forKey: .name) try container.encode(self.method, forKey: .method) try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) try container.encodeIfPresent(self.credentialId, forKey: .credentialId) @@ -355,7 +361,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) - try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.description, forKey: .description) try container.encode(self.url, forKey: .url) try container.encodeIfPresent(self.body, forKey: .body) @@ -366,7 +371,9 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages + case name case method case timeoutSeconds case credentialId @@ -377,7 +384,6 @@ public struct ApiRequestTool: Codable, Hashable, Sendable { case createdAt case updatedAt case rejectionPlan - case name case description case url case body diff --git a/Sources/Schemas/ApiRequestToolMethod.swift b/Sources/Schemas/ApiRequestToolMethod.swift index 3d16bf18..57d0bd84 100644 --- a/Sources/Schemas/ApiRequestToolMethod.swift +++ b/Sources/Schemas/ApiRequestToolMethod.swift @@ -1,5 +1,6 @@ import Foundation +/// The HTTP method used for the API request. public enum ApiRequestToolMethod: String, Codable, Hashable, CaseIterable, Sendable { case post = "POST" case get = "GET" diff --git a/Sources/Schemas/Artifact.swift b/Sources/Schemas/Artifact.swift index 035161d2..72a095b5 100644 --- a/Sources/Schemas/Artifact.swift +++ b/Sources/Schemas/Artifact.swift @@ -1,10 +1,16 @@ import Foundation +/// Artifacts generated during a call, including messages, recordings, transcript, logs, packet capture, workflow-node data, variables, performance metrics, structured outputs, scorecards, and transfers. public struct Artifact: Codable, Hashable, Sendable { /// These are the messages that were spoken during the call. public let messages: [ArtifactMessagesItem]? /// These are the messages that were spoken during the call, formatted for OpenAI. public let messagesOpenAiFormatted: [OpenAiMessage]? + /// Structured outputs skipped because their conditions were not met, keyed by saved or runtime output ID. + public let skippedStructuredOutputs: [String: SkippedStructuredOutput]? + /// These are the transfer records for the call's transfer attempts (warm and blind), including + /// destination, mode, and status. Warm transfer records also include transcripts and messages. + public let transfers: [TransferArtifact]? /// This is the recording url for the call. To enable, set `assistant.artifactPlan.recordingEnabled`. public let recordingUrl: String? /// This is the stereo recording url for the call. To enable, set `assistant.artifactPlan.recordingEnabled`. @@ -35,16 +41,46 @@ public struct Artifact: Codable, Hashable, Sendable { /// These are the scorecards that have been evaluated based on the structured outputs extracted during the call. /// To enable, set `assistant.artifactPlan.scorecardIds` or `assistant.artifactPlan.scorecards` with the IDs or objects of the scorecards you want to evaluate. public let scorecards: [String: JSONValue]? - /// These are the transfer records from warm transfers, including destinations, transcripts, and status. - public let transfers: [String]? /// This is when the structured outputs were last updated public let structuredOutputsLastUpdatedAt: Date? + /// This is a presigned URL to download the mono recording without + /// authentication. Populated on API responses and server messages; never + /// stored. Expires at `presignedUrlsExpiresAt` — after that, use + /// `GET /call/{id}/mono-recording`. + public let presignedMonoUrl: String? + /// This is a presigned URL to download the stereo recording without + /// authentication. Expires at `presignedUrlsExpiresAt` — after that, use + /// `GET /call/{id}/stereo-recording`. + public let presignedStereoUrl: String? + /// This is a presigned URL to download the video recording without + /// authentication. Expires at `presignedUrlsExpiresAt` — after that, use + /// `GET /call/{id}/video-recording`. + public let presignedVideoUrl: String? + /// This is a presigned URL to download the assistant-channel mono recording + /// without authentication. Expires at `presignedUrlsExpiresAt`. + public let presignedAssistantUrl: String? + /// This is a presigned URL to download the customer-channel mono recording + /// without authentication. Expires at `presignedUrlsExpiresAt`. + public let presignedCustomerUrl: String? + /// This is a presigned URL to download the packet capture without + /// authentication. Expires at `presignedUrlsExpiresAt`. + public let presignedPcapUrl: String? + /// This is a presigned URL to download the call logs without + /// authentication. Expires at `presignedUrlsExpiresAt`. + public let presignedLogUrl: String? + /// This is when the presigned URLs above expire, as an ISO 8601 timestamp. + /// The raw `*Url` fields remain the stable identifiers and do not expire. + /// Presigned URLs are regenerated per response and per webhook delivery, so + /// values differ across retries. + public let presignedUrlsExpiresAt: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( messages: [ArtifactMessagesItem]? = nil, messagesOpenAiFormatted: [OpenAiMessage]? = nil, + skippedStructuredOutputs: [String: SkippedStructuredOutput]? = nil, + transfers: [TransferArtifact]? = nil, recordingUrl: String? = nil, stereoRecordingUrl: String? = nil, videoRecordingUrl: String? = nil, @@ -59,12 +95,21 @@ public struct Artifact: Codable, Hashable, Sendable { performanceMetrics: PerformanceMetrics? = nil, structuredOutputs: [String: JSONValue]? = nil, scorecards: [String: JSONValue]? = nil, - transfers: [String]? = nil, structuredOutputsLastUpdatedAt: Date? = nil, + presignedMonoUrl: String? = nil, + presignedStereoUrl: String? = nil, + presignedVideoUrl: String? = nil, + presignedAssistantUrl: String? = nil, + presignedCustomerUrl: String? = nil, + presignedPcapUrl: String? = nil, + presignedLogUrl: String? = nil, + presignedUrlsExpiresAt: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages self.messagesOpenAiFormatted = messagesOpenAiFormatted + self.skippedStructuredOutputs = skippedStructuredOutputs + self.transfers = transfers self.recordingUrl = recordingUrl self.stereoRecordingUrl = stereoRecordingUrl self.videoRecordingUrl = videoRecordingUrl @@ -79,8 +124,15 @@ public struct Artifact: Codable, Hashable, Sendable { self.performanceMetrics = performanceMetrics self.structuredOutputs = structuredOutputs self.scorecards = scorecards - self.transfers = transfers self.structuredOutputsLastUpdatedAt = structuredOutputsLastUpdatedAt + self.presignedMonoUrl = presignedMonoUrl + self.presignedStereoUrl = presignedStereoUrl + self.presignedVideoUrl = presignedVideoUrl + self.presignedAssistantUrl = presignedAssistantUrl + self.presignedCustomerUrl = presignedCustomerUrl + self.presignedPcapUrl = presignedPcapUrl + self.presignedLogUrl = presignedLogUrl + self.presignedUrlsExpiresAt = presignedUrlsExpiresAt self.additionalProperties = additionalProperties } @@ -88,6 +140,8 @@ public struct Artifact: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([ArtifactMessagesItem].self, forKey: .messages) self.messagesOpenAiFormatted = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messagesOpenAiFormatted) + self.skippedStructuredOutputs = try container.decodeIfPresent([String: SkippedStructuredOutput].self, forKey: .skippedStructuredOutputs) + self.transfers = try container.decodeIfPresent([TransferArtifact].self, forKey: .transfers) self.recordingUrl = try container.decodeIfPresent(String.self, forKey: .recordingUrl) self.stereoRecordingUrl = try container.decodeIfPresent(String.self, forKey: .stereoRecordingUrl) self.videoRecordingUrl = try container.decodeIfPresent(String.self, forKey: .videoRecordingUrl) @@ -102,8 +156,15 @@ public struct Artifact: Codable, Hashable, Sendable { self.performanceMetrics = try container.decodeIfPresent(PerformanceMetrics.self, forKey: .performanceMetrics) self.structuredOutputs = try container.decodeIfPresent([String: JSONValue].self, forKey: .structuredOutputs) self.scorecards = try container.decodeIfPresent([String: JSONValue].self, forKey: .scorecards) - self.transfers = try container.decodeIfPresent([String].self, forKey: .transfers) self.structuredOutputsLastUpdatedAt = try container.decodeIfPresent(Date.self, forKey: .structuredOutputsLastUpdatedAt) + self.presignedMonoUrl = try container.decodeIfPresent(String.self, forKey: .presignedMonoUrl) + self.presignedStereoUrl = try container.decodeIfPresent(String.self, forKey: .presignedStereoUrl) + self.presignedVideoUrl = try container.decodeIfPresent(String.self, forKey: .presignedVideoUrl) + self.presignedAssistantUrl = try container.decodeIfPresent(String.self, forKey: .presignedAssistantUrl) + self.presignedCustomerUrl = try container.decodeIfPresent(String.self, forKey: .presignedCustomerUrl) + self.presignedPcapUrl = try container.decodeIfPresent(String.self, forKey: .presignedPcapUrl) + self.presignedLogUrl = try container.decodeIfPresent(String.self, forKey: .presignedLogUrl) + self.presignedUrlsExpiresAt = try container.decodeIfPresent(String.self, forKey: .presignedUrlsExpiresAt) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -112,6 +173,8 @@ public struct Artifact: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.messagesOpenAiFormatted, forKey: .messagesOpenAiFormatted) + try container.encodeIfPresent(self.skippedStructuredOutputs, forKey: .skippedStructuredOutputs) + try container.encodeIfPresent(self.transfers, forKey: .transfers) try container.encodeIfPresent(self.recordingUrl, forKey: .recordingUrl) try container.encodeIfPresent(self.stereoRecordingUrl, forKey: .stereoRecordingUrl) try container.encodeIfPresent(self.videoRecordingUrl, forKey: .videoRecordingUrl) @@ -126,14 +189,23 @@ public struct Artifact: Codable, Hashable, Sendable { try container.encodeIfPresent(self.performanceMetrics, forKey: .performanceMetrics) try container.encodeIfPresent(self.structuredOutputs, forKey: .structuredOutputs) try container.encodeIfPresent(self.scorecards, forKey: .scorecards) - try container.encodeIfPresent(self.transfers, forKey: .transfers) try container.encodeIfPresent(self.structuredOutputsLastUpdatedAt, forKey: .structuredOutputsLastUpdatedAt) + try container.encodeIfPresent(self.presignedMonoUrl, forKey: .presignedMonoUrl) + try container.encodeIfPresent(self.presignedStereoUrl, forKey: .presignedStereoUrl) + try container.encodeIfPresent(self.presignedVideoUrl, forKey: .presignedVideoUrl) + try container.encodeIfPresent(self.presignedAssistantUrl, forKey: .presignedAssistantUrl) + try container.encodeIfPresent(self.presignedCustomerUrl, forKey: .presignedCustomerUrl) + try container.encodeIfPresent(self.presignedPcapUrl, forKey: .presignedPcapUrl) + try container.encodeIfPresent(self.presignedLogUrl, forKey: .presignedLogUrl) + try container.encodeIfPresent(self.presignedUrlsExpiresAt, forKey: .presignedUrlsExpiresAt) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages case messagesOpenAiFormatted = "messagesOpenAIFormatted" + case skippedStructuredOutputs + case transfers case recordingUrl case stereoRecordingUrl case videoRecordingUrl @@ -148,7 +220,14 @@ public struct Artifact: Codable, Hashable, Sendable { case performanceMetrics case structuredOutputs case scorecards - case transfers case structuredOutputsLastUpdatedAt + case presignedMonoUrl + case presignedStereoUrl + case presignedVideoUrl + case presignedAssistantUrl + case presignedCustomerUrl + case presignedPcapUrl + case presignedLogUrl + case presignedUrlsExpiresAt } } \ No newline at end of file diff --git a/Sources/Schemas/ArtifactPlan.swift b/Sources/Schemas/ArtifactPlan.swift index d9532c15..8f6691f2 100644 --- a/Sources/Schemas/ArtifactPlan.swift +++ b/Sources/Schemas/ArtifactPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls artifacts generated and stored for calls, including recordings, packet captures, logs, transcripts, structured outputs, scorecards, and custom storage paths. public struct ArtifactPlan: Codable, Hashable, Sendable { /// This determines whether assistant's calls are recorded. Defaults to true. /// @@ -23,6 +24,8 @@ public struct ArtifactPlan: Codable, Hashable, Sendable { /// - Set to false if you have custom storage configured but want to store recordings on Vapi's storage for this assistant. /// - Set to true (or leave unset) to use your custom storage for recordings when available. /// + /// If your organization has ZDR (zero data retention) or PCI enabled, recordings are never written to Vapi storage. In that case, false means "do not use my custom storage", so nothing is stored at all. + /// /// @default true public let recordingUseCustomStorageEnabled: Bool? /// This determines whether the video is recorded during the call. Defaults to false. Only relevant for `webCall` type. @@ -57,6 +60,8 @@ public struct ArtifactPlan: Codable, Hashable, Sendable { /// - Set to false if you have custom storage configured but want to store packet captures on Vapi's storage for this assistant. /// - Set to true (or leave unset) to use your custom storage for packet captures when available. /// + /// If your organization has ZDR (zero data retention) or PCI enabled, packet captures are never written to Vapi storage. In that case, false means "do not use my custom storage", so nothing is stored at all. + /// /// @default true public let pcapUseCustomStorageEnabled: Bool? /// This determines whether the call logs are enabled. Defaults to true. @@ -71,6 +76,8 @@ public struct ArtifactPlan: Codable, Hashable, Sendable { /// - Set to false if you have custom storage configured but want to store logs on Vapi's storage for this assistant. /// - Set to true (or leave unset) to use your custom storage for logs when available. /// + /// If your organization has ZDR (zero data retention) or PCI enabled, logs are never written to Vapi storage. In that case, false means "do not use my custom storage", so nothing is stored at all. + /// /// @default true public let loggingUseCustomStorageEnabled: Bool? /// This is the plan for `call.artifact.transcript`. To disable, set `transcriptPlan.enabled` to false. diff --git a/Sources/Schemas/AssemblyAiTranscriber.swift b/Sources/Schemas/AssemblyAiTranscriber.swift index d01714c9..c4f93f06 100644 --- a/Sources/Schemas/AssemblyAiTranscriber.swift +++ b/Sources/Schemas/AssemblyAiTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with AssemblyAI, including language, streaming model, endpointing, vocabulary, and fallback settings. public struct AssemblyAiTranscriber: Codable, Hashable, Sendable { /// This is the language that will be set for the transcription. public let language: AssemblyAiTranscriberLanguage? diff --git a/Sources/Schemas/Assistant.swift b/Sources/Schemas/Assistant.swift index ef30b534..fc280c93 100644 --- a/Sources/Schemas/Assistant.swift +++ b/Sources/Schemas/Assistant.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved assistant configuration returned by the Vapi API. It defines how the assistant listens, reasons, speaks, handles conversations, sends events, and produces artifacts and analysis. public struct Assistant: Codable, Hashable, Sendable { /// These are the options for the assistant's transcriber. public let transcriber: AssistantTranscriber? @@ -11,6 +12,7 @@ public struct Assistant: Codable, Hashable, Sendable { /// /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. public let firstMessage: String? + /// Set to `true` to allow the user to interrupt the assistant while it speaks the first message. Default is `false`. public let firstMessageInterruptionsEnabled: Bool? /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// @@ -49,6 +51,11 @@ public struct Assistant: Codable, Hashable, Sendable { public let credentials: [AssistantCredentialsItem]? /// This is a set of actions that will be performed on certain events. public let hooks: [AssistantHooksItem]? + /// This is the latest version label (e.g. `v3`) of the assistant in the + /// version history. `null` while the org is not yet + /// onboarded to versioning, or for assistants that have not yet been + /// published under it. + public let latestVersion: Nullable? /// This is the name of the assistant. /// /// This is required when you want to transfer between assistants in a call. @@ -63,6 +70,7 @@ public struct Assistant: Codable, Hashable, Sendable { public let endCallMessage: String? /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. public let endCallPhrases: [String]? + /// Compliance settings for the assistant, including HIPAA and PCI behavior, security filtering, and recording consent. public let compliancePlan: CompliancePlan? /// This is for metadata you want to store on the assistant. public let metadata: [String: JSONValue]? @@ -115,6 +123,7 @@ public struct Assistant: Codable, Hashable, Sendable { /// 2. phoneNumber.serverUrl /// 3. org.serverUrl public let server: Server? + /// Configuration for collecting and processing DTMF keypad input during calls. public let keypadInputPlan: KeypadInputPlan? /// This is the unique identifier for the assistant. public let id: String @@ -144,6 +153,7 @@ public struct Assistant: Codable, Hashable, Sendable { observabilityPlan: LangfuseObservabilityPlan? = nil, credentials: [AssistantCredentialsItem]? = nil, hooks: [AssistantHooksItem]? = nil, + latestVersion: Nullable? = nil, name: String? = nil, voicemailMessage: String? = nil, endCallMessage: String? = nil, @@ -181,6 +191,7 @@ public struct Assistant: Codable, Hashable, Sendable { self.observabilityPlan = observabilityPlan self.credentials = credentials self.hooks = hooks + self.latestVersion = latestVersion self.name = name self.voicemailMessage = voicemailMessage self.endCallMessage = endCallMessage @@ -221,6 +232,7 @@ public struct Assistant: Codable, Hashable, Sendable { self.observabilityPlan = try container.decodeIfPresent(LangfuseObservabilityPlan.self, forKey: .observabilityPlan) self.credentials = try container.decodeIfPresent([AssistantCredentialsItem].self, forKey: .credentials) self.hooks = try container.decodeIfPresent([AssistantHooksItem].self, forKey: .hooks) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.voicemailMessage = try container.decodeIfPresent(String.self, forKey: .voicemailMessage) self.endCallMessage = try container.decodeIfPresent(String.self, forKey: .endCallMessage) @@ -262,6 +274,7 @@ public struct Assistant: Codable, Hashable, Sendable { try container.encodeIfPresent(self.observabilityPlan, forKey: .observabilityPlan) try container.encodeIfPresent(self.credentials, forKey: .credentials) try container.encodeIfPresent(self.hooks, forKey: .hooks) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.voicemailMessage, forKey: .voicemailMessage) try container.encodeIfPresent(self.endCallMessage, forKey: .endCallMessage) @@ -301,6 +314,7 @@ public struct Assistant: Codable, Hashable, Sendable { case observabilityPlan case credentials case hooks + case latestVersion case name case voicemailMessage case endCallMessage diff --git a/Sources/Schemas/AssistantActivation.swift b/Sources/Schemas/AssistantActivation.swift index 985cb95a..246043c6 100644 --- a/Sources/Schemas/AssistantActivation.swift +++ b/Sources/Schemas/AssistantActivation.swift @@ -1,6 +1,12 @@ import Foundation +/// Identifies an assistant that became active during a call. public struct AssistantActivation: Codable, Hashable, Sendable { + /// This is the version label (e.g. `v3`) of the assistant active when + /// the activation row was recorded. `null` for inline assistants, + /// orgs not on assistant versioning, and parent assistants that have + /// not yet been published under it. + public let assistantVersion: Nullable? /// This is the name of the assistant that was active during the call. public let assistantName: String /// This is the ID of the assistant that was active during the call. @@ -9,10 +15,12 @@ public struct AssistantActivation: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + assistantVersion: Nullable? = nil, assistantName: String, assistantId: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.assistantVersion = assistantVersion self.assistantName = assistantName self.assistantId = assistantId self.additionalProperties = additionalProperties @@ -20,6 +28,7 @@ public struct AssistantActivation: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.assistantName = try container.decode(String.self, forKey: .assistantName) self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +37,14 @@ public struct AssistantActivation: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.assistantName, forKey: .assistantName) try container.encodeIfPresent(self.assistantId, forKey: .assistantId) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case assistantVersion case assistantName case assistantId } diff --git a/Sources/Schemas/AssistantCredentialsItem.swift b/Sources/Schemas/AssistantCredentialsItem.swift index 9f2fa54b..52a17eb3 100644 --- a/Sources/Schemas/AssistantCredentialsItem.swift +++ b/Sources/Schemas/AssistantCredentialsItem.swift @@ -33,6 +33,7 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum AssistantCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/AssistantCustomEndpointingRule.swift b/Sources/Schemas/AssistantCustomEndpointingRule.swift index 96729d16..fd2fa243 100644 --- a/Sources/Schemas/AssistantCustomEndpointingRule.swift +++ b/Sources/Schemas/AssistantCustomEndpointingRule.swift @@ -1,5 +1,6 @@ import Foundation +/// A custom endpointing rule that matches the assistant's last message and applies a configured timeout. public struct AssistantCustomEndpointingRule: Codable, Hashable, Sendable { /// This is the regex pattern to match. /// diff --git a/Sources/Schemas/AssistantDraft.swift b/Sources/Schemas/AssistantDraft.swift new file mode 100644 index 00000000..9a27e03c --- /dev/null +++ b/Sources/Schemas/AssistantDraft.swift @@ -0,0 +1,343 @@ +import Foundation + +public struct AssistantDraft: Codable, Hashable, Sendable { + /// These are the options for the assistant's transcriber. + public let transcriber: AssistantDraftTranscriber? + /// These are the options for the assistant's LLM. + public let model: AssistantDraftModel? + /// These are the options for the assistant's voice. + public let voice: AssistantDraftVoice? + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + public let firstMessage: String? + public let firstMessageInterruptionsEnabled: Bool? + /// This is the mode for the first message. Default is 'assistant-speaks-first'. + /// + /// Use: + /// - 'assistant-speaks-first' to have the assistant speak first. + /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. + /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: AssistantDraftFirstMessageMode? + /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + /// By default, voicemail detection is disabled. + public let voicemailDetection: AssistantDraftVoicemailDetection? + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started,assistant.started. You can check the shape of the messages in ClientMessage schema. + public let clientMessages: [AssistantDraftClientMessagesItem]? + /// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,handoff-destination-request,user-interrupted,assistant.started. You can check the shape of the messages in ServerMessage schema. + public let serverMessages: [AssistantDraftServerMessagesItem]? + /// This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + /// + /// @default 600 (10 minutes) + public let maxDurationSeconds: Double? + /// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + /// You can also provide a custom sound by providing a URL to an audio file. + public let backgroundSound: AssistantDraftBackgroundSound? + /// This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + /// + /// @default false + public let modelOutputInMessagesEnabled: Bool? + /// These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + public let transportConfigurations: [TransportConfigurationTwilio]? + /// This is the plan for observability of assistant's calls. + /// + /// Currently, only Langfuse is supported. + public let observabilityPlan: LangfuseObservabilityPlan? + /// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials. + public let credentials: [AssistantDraftCredentialsItem]? + /// This is a set of actions that will be performed on certain events. + public let hooks: [AssistantDraftHooksItem]? + /// This is the name of the assistant. + /// + /// This is required when you want to transfer between assistants in a call. + public let name: String? + /// This is the message that the assistant will say if the call is forwarded to voicemail. + /// + /// If unspecified, it will hang up. + public let voicemailMessage: String? + /// This is the message that the assistant will say if it ends the call. + /// + /// If unspecified, it will hang up without saying anything. + public let endCallMessage: String? + /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + public let endCallPhrases: [String]? + public let compliancePlan: CompliancePlan? + /// This is for metadata you want to store on the assistant. + public let metadata: [String: JSONValue]? + /// This enables filtering of noise and background speech while the user is talking. + /// + /// Features: + /// - Smart denoising using Krisp + /// - Fourier denoising + /// + /// Smart denoising can be combined with or used independently of Fourier denoising. + /// + /// Order of precedence: + /// - Smart denoising + /// - Fourier denoising + public let backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? + /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. + public let analysisPlan: AnalysisPlan? + /// This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`. + public let artifactPlan: ArtifactPlan? + /// This is the plan for when the assistant should start talking. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to start talking after the customer is done speaking. + /// - The assistant is too fast to start talking after the customer is done speaking. + /// - The assistant is so fast that it's actually interrupting the customer. + public let startSpeakingPlan: StartSpeakingPlan? + /// This is the plan for when assistant should stop talking on customer interruption. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to recognize customer's interruption. + /// - The assistant is too fast to recognize customer's interruption. + /// - The assistant is getting interrupted by phrases that are just acknowledgments. + /// - The assistant is getting interrupted by background noises. + /// - The assistant is not properly stopping -- it starts talking right after getting interrupted. + public let stopSpeakingPlan: StopSpeakingPlan? + /// This is the plan for real-time monitoring of the assistant's calls. + /// + /// Usage: + /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. + /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. + /// - To attach monitors to the assistant, set `monitorPlan.monitorIds` to the set of monitor ids. + public let monitorPlan: MonitorPlan? + /// These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + public let credentialIds: [String]? + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + public let server: Server? + public let keypadInputPlan: KeypadInputPlan? + /// Server-resolved baseVersion (always set after POST). + public let baseVersion: String + /// Surrogate key used as `draftId` in URLs. + public let id: String + /// Org this draft belongs to. + public let orgId: String + /// Parent assistant the draft was forked from. FK to assistant.id ON DELETE CASCADE. + public let assistantId: String + /// Email when JWT, null when API or external JWT. Set on POST, never rewritten on PATCH. + public let createdBy: Nullable? + public let createdAt: Date + public let updatedAt: Date + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + transcriber: AssistantDraftTranscriber? = nil, + model: AssistantDraftModel? = nil, + voice: AssistantDraftVoice? = nil, + firstMessage: String? = nil, + firstMessageInterruptionsEnabled: Bool? = nil, + firstMessageMode: AssistantDraftFirstMessageMode? = nil, + voicemailDetection: AssistantDraftVoicemailDetection? = nil, + clientMessages: [AssistantDraftClientMessagesItem]? = nil, + serverMessages: [AssistantDraftServerMessagesItem]? = nil, + maxDurationSeconds: Double? = nil, + backgroundSound: AssistantDraftBackgroundSound? = nil, + modelOutputInMessagesEnabled: Bool? = nil, + transportConfigurations: [TransportConfigurationTwilio]? = nil, + observabilityPlan: LangfuseObservabilityPlan? = nil, + credentials: [AssistantDraftCredentialsItem]? = nil, + hooks: [AssistantDraftHooksItem]? = nil, + name: String? = nil, + voicemailMessage: String? = nil, + endCallMessage: String? = nil, + endCallPhrases: [String]? = nil, + compliancePlan: CompliancePlan? = nil, + metadata: [String: JSONValue]? = nil, + backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? = nil, + analysisPlan: AnalysisPlan? = nil, + artifactPlan: ArtifactPlan? = nil, + startSpeakingPlan: StartSpeakingPlan? = nil, + stopSpeakingPlan: StopSpeakingPlan? = nil, + monitorPlan: MonitorPlan? = nil, + credentialIds: [String]? = nil, + server: Server? = nil, + keypadInputPlan: KeypadInputPlan? = nil, + baseVersion: String, + id: String, + orgId: String, + assistantId: String, + createdBy: Nullable? = nil, + createdAt: Date, + updatedAt: Date, + additionalProperties: [String: JSONValue] = .init() + ) { + self.transcriber = transcriber + self.model = model + self.voice = voice + self.firstMessage = firstMessage + self.firstMessageInterruptionsEnabled = firstMessageInterruptionsEnabled + self.firstMessageMode = firstMessageMode + self.voicemailDetection = voicemailDetection + self.clientMessages = clientMessages + self.serverMessages = serverMessages + self.maxDurationSeconds = maxDurationSeconds + self.backgroundSound = backgroundSound + self.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled + self.transportConfigurations = transportConfigurations + self.observabilityPlan = observabilityPlan + self.credentials = credentials + self.hooks = hooks + self.name = name + self.voicemailMessage = voicemailMessage + self.endCallMessage = endCallMessage + self.endCallPhrases = endCallPhrases + self.compliancePlan = compliancePlan + self.metadata = metadata + self.backgroundSpeechDenoisingPlan = backgroundSpeechDenoisingPlan + self.analysisPlan = analysisPlan + self.artifactPlan = artifactPlan + self.startSpeakingPlan = startSpeakingPlan + self.stopSpeakingPlan = stopSpeakingPlan + self.monitorPlan = monitorPlan + self.credentialIds = credentialIds + self.server = server + self.keypadInputPlan = keypadInputPlan + self.baseVersion = baseVersion + self.id = id + self.orgId = orgId + self.assistantId = assistantId + self.createdBy = createdBy + self.createdAt = createdAt + self.updatedAt = updatedAt + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.transcriber = try container.decodeIfPresent(AssistantDraftTranscriber.self, forKey: .transcriber) + self.model = try container.decodeIfPresent(AssistantDraftModel.self, forKey: .model) + self.voice = try container.decodeIfPresent(AssistantDraftVoice.self, forKey: .voice) + self.firstMessage = try container.decodeIfPresent(String.self, forKey: .firstMessage) + self.firstMessageInterruptionsEnabled = try container.decodeIfPresent(Bool.self, forKey: .firstMessageInterruptionsEnabled) + self.firstMessageMode = try container.decodeIfPresent(AssistantDraftFirstMessageMode.self, forKey: .firstMessageMode) + self.voicemailDetection = try container.decodeIfPresent(AssistantDraftVoicemailDetection.self, forKey: .voicemailDetection) + self.clientMessages = try container.decodeIfPresent([AssistantDraftClientMessagesItem].self, forKey: .clientMessages) + self.serverMessages = try container.decodeIfPresent([AssistantDraftServerMessagesItem].self, forKey: .serverMessages) + self.maxDurationSeconds = try container.decodeIfPresent(Double.self, forKey: .maxDurationSeconds) + self.backgroundSound = try container.decodeIfPresent(AssistantDraftBackgroundSound.self, forKey: .backgroundSound) + self.modelOutputInMessagesEnabled = try container.decodeIfPresent(Bool.self, forKey: .modelOutputInMessagesEnabled) + self.transportConfigurations = try container.decodeIfPresent([TransportConfigurationTwilio].self, forKey: .transportConfigurations) + self.observabilityPlan = try container.decodeIfPresent(LangfuseObservabilityPlan.self, forKey: .observabilityPlan) + self.credentials = try container.decodeIfPresent([AssistantDraftCredentialsItem].self, forKey: .credentials) + self.hooks = try container.decodeIfPresent([AssistantDraftHooksItem].self, forKey: .hooks) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.voicemailMessage = try container.decodeIfPresent(String.self, forKey: .voicemailMessage) + self.endCallMessage = try container.decodeIfPresent(String.self, forKey: .endCallMessage) + self.endCallPhrases = try container.decodeIfPresent([String].self, forKey: .endCallPhrases) + self.compliancePlan = try container.decodeIfPresent(CompliancePlan.self, forKey: .compliancePlan) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.backgroundSpeechDenoisingPlan = try container.decodeIfPresent(BackgroundSpeechDenoisingPlan.self, forKey: .backgroundSpeechDenoisingPlan) + self.analysisPlan = try container.decodeIfPresent(AnalysisPlan.self, forKey: .analysisPlan) + self.artifactPlan = try container.decodeIfPresent(ArtifactPlan.self, forKey: .artifactPlan) + self.startSpeakingPlan = try container.decodeIfPresent(StartSpeakingPlan.self, forKey: .startSpeakingPlan) + self.stopSpeakingPlan = try container.decodeIfPresent(StopSpeakingPlan.self, forKey: .stopSpeakingPlan) + self.monitorPlan = try container.decodeIfPresent(MonitorPlan.self, forKey: .monitorPlan) + self.credentialIds = try container.decodeIfPresent([String].self, forKey: .credentialIds) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.keypadInputPlan = try container.decodeIfPresent(KeypadInputPlan.self, forKey: .keypadInputPlan) + self.baseVersion = try container.decode(String.self, forKey: .baseVersion) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.assistantId = try container.decode(String.self, forKey: .assistantId) + self.createdBy = try container.decodeNullableIfPresent(String.self, forKey: .createdBy) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.transcriber, forKey: .transcriber) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessage, forKey: .firstMessage) + try container.encodeIfPresent(self.firstMessageInterruptionsEnabled, forKey: .firstMessageInterruptionsEnabled) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) + try container.encodeIfPresent(self.voicemailDetection, forKey: .voicemailDetection) + try container.encodeIfPresent(self.clientMessages, forKey: .clientMessages) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.maxDurationSeconds, forKey: .maxDurationSeconds) + try container.encodeIfPresent(self.backgroundSound, forKey: .backgroundSound) + try container.encodeIfPresent(self.modelOutputInMessagesEnabled, forKey: .modelOutputInMessagesEnabled) + try container.encodeIfPresent(self.transportConfigurations, forKey: .transportConfigurations) + try container.encodeIfPresent(self.observabilityPlan, forKey: .observabilityPlan) + try container.encodeIfPresent(self.credentials, forKey: .credentials) + try container.encodeIfPresent(self.hooks, forKey: .hooks) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.voicemailMessage, forKey: .voicemailMessage) + try container.encodeIfPresent(self.endCallMessage, forKey: .endCallMessage) + try container.encodeIfPresent(self.endCallPhrases, forKey: .endCallPhrases) + try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.backgroundSpeechDenoisingPlan, forKey: .backgroundSpeechDenoisingPlan) + try container.encodeIfPresent(self.analysisPlan, forKey: .analysisPlan) + try container.encodeIfPresent(self.artifactPlan, forKey: .artifactPlan) + try container.encodeIfPresent(self.startSpeakingPlan, forKey: .startSpeakingPlan) + try container.encodeIfPresent(self.stopSpeakingPlan, forKey: .stopSpeakingPlan) + try container.encodeIfPresent(self.monitorPlan, forKey: .monitorPlan) + try container.encodeIfPresent(self.credentialIds, forKey: .credentialIds) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.keypadInputPlan, forKey: .keypadInputPlan) + try container.encode(self.baseVersion, forKey: .baseVersion) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.assistantId, forKey: .assistantId) + try container.encodeNullableIfPresent(self.createdBy, forKey: .createdBy) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encode(self.updatedAt, forKey: .updatedAt) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case transcriber + case model + case voice + case firstMessage + case firstMessageInterruptionsEnabled + case firstMessageMode + case voicemailDetection + case clientMessages + case serverMessages + case maxDurationSeconds + case backgroundSound + case modelOutputInMessagesEnabled + case transportConfigurations + case observabilityPlan + case credentials + case hooks + case name + case voicemailMessage + case endCallMessage + case endCallPhrases + case compliancePlan + case metadata + case backgroundSpeechDenoisingPlan + case analysisPlan + case artifactPlan + case startSpeakingPlan + case stopSpeakingPlan + case monitorPlan + case credentialIds + case server + case keypadInputPlan + case baseVersion + case id + case orgId + case assistantId + case createdBy + case createdAt + case updatedAt + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftBackgroundSound.swift b/Sources/Schemas/AssistantDraftBackgroundSound.swift new file mode 100644 index 00000000..18f9b6bf --- /dev/null +++ b/Sources/Schemas/AssistantDraftBackgroundSound.swift @@ -0,0 +1,32 @@ +import Foundation + +/// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. +/// You can also provide a custom sound by providing a URL to an audio file. +public enum AssistantDraftBackgroundSound: Codable, Hashable, Sendable { + case assistantDraftBackgroundSoundZero(AssistantDraftBackgroundSoundZero) + case string(String) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AssistantDraftBackgroundSoundZero.self) { + self = .assistantDraftBackgroundSoundZero(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .assistantDraftBackgroundSoundZero(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftBackgroundSoundZero.swift b/Sources/Schemas/AssistantDraftBackgroundSoundZero.swift new file mode 100644 index 00000000..aa891cae --- /dev/null +++ b/Sources/Schemas/AssistantDraftBackgroundSoundZero.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum AssistantDraftBackgroundSoundZero: String, Codable, Hashable, CaseIterable, Sendable { + case off + case office +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftClientMessagesItem.swift b/Sources/Schemas/AssistantDraftClientMessagesItem.swift new file mode 100644 index 00000000..3be7208e --- /dev/null +++ b/Sources/Schemas/AssistantDraftClientMessagesItem.swift @@ -0,0 +1,23 @@ +import Foundation + +public enum AssistantDraftClientMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case conversationUpdate = "conversation-update" + case assistantSpeechStarted = "assistant.speechStarted" + case functionCall = "function-call" + case functionCallResult = "function-call-result" + case hang + case languageChanged = "language-changed" + case metadata + case modelOutput = "model-output" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case toolCalls = "tool-calls" + case toolCallsResult = "tool-calls-result" + case toolCompleted = "tool.completed" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case workflowNodeStarted = "workflow.node.started" + case assistantStarted = "assistant.started" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftConflictResponseDto.swift b/Sources/Schemas/AssistantDraftConflictResponseDto.swift new file mode 100644 index 00000000..eed4233a --- /dev/null +++ b/Sources/Schemas/AssistantDraftConflictResponseDto.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct AssistantDraftConflictResponseDto: Codable, Hashable, Sendable { + public let existingDraftId: Nullable + public let error: String + public let message: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + existingDraftId: Nullable, + error: String, + message: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.existingDraftId = existingDraftId + self.error = error + self.message = message + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.existingDraftId = try container.decode(Nullable.self, forKey: .existingDraftId) + self.error = try container.decode(String.self, forKey: .error) + self.message = try container.decode(String.self, forKey: .message) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.existingDraftId, forKey: .existingDraftId) + try container.encode(self.error, forKey: .error) + try container.encode(self.message, forKey: .message) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case existingDraftId + case error + case message + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftCredentialsItem.swift b/Sources/Schemas/AssistantDraftCredentialsItem.swift new file mode 100644 index 00000000..f44ab3f4 --- /dev/null +++ b/Sources/Schemas/AssistantDraftCredentialsItem.swift @@ -0,0 +1,370 @@ +import Foundation + +public enum AssistantDraftCredentialsItem: Codable, Hashable, Sendable { + case anthropic(CreateAnthropicCredentialDto) + case anthropicBedrock(CreateAnthropicBedrockCredentialDto) + case anyscale(CreateAnyscaleCredentialDto) + case assemblyAi(CreateAssemblyAiCredentialDto) + case azure(CreateAzureCredentialDto) + case azureOpenai(CreateAzureOpenAiCredentialDto) + case byoSipTrunk(CreateByoSipTrunkCredentialDto) + case cartesia(CreateCartesiaCredentialDto) + case cerebras(CreateCerebrasCredentialDto) + case cloudflare(CreateCloudflareCredentialDto) + case customCredential(CreateCustomCredentialDto) + case customLlm(CreateCustomLlmCredentialDto) + case deepgram(CreateDeepgramCredentialDto) + case deepinfra(CreateDeepInfraCredentialDto) + case deepSeek(CreateDeepSeekCredentialDto) + case elevenLabs(CreateElevenLabsCredentialDto) + case email(CreateEmailCredentialDto) + case gcp(CreateGcpCredentialDto) + case ghlOauth2Authorization(CreateGoHighLevelMcpCredentialDto) + case gladia(CreateGladiaCredentialDto) + case gohighlevel(CreateGoHighLevelCredentialDto) + case google(CreateGoogleCredentialDto) + case googleCalendarOauth2Authorization(CreateGoogleCalendarOAuth2AuthorizationCredentialDto) + case googleCalendarOauth2Client(CreateGoogleCalendarOAuth2ClientCredentialDto) + case googleSheetsOauth2Authorization(CreateGoogleSheetsOAuth2AuthorizationCredentialDto) + case groq(CreateGroqCredentialDto) + case hume(CreateHumeCredentialDto) + case inflectionAi(CreateInflectionAiCredentialDto) + case inworld(CreateInworldCredentialDto) + case langfuse(CreateLangfuseCredentialDto) + case lmnt(CreateLmntCredentialDto) + case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) + case minimax(CreateMinimaxCredentialDto) + case mistral(CreateMistralCredentialDto) + case neuphonic(CreateNeuphonicCredentialDto) + case openai(CreateOpenAiCredentialDto) + case openrouter(CreateOpenRouterCredentialDto) + case perplexityAi(CreatePerplexityAiCredentialDto) + case playht(CreatePlayHtCredentialDto) + case rimeAi(CreateRimeAiCredentialDto) + case runpod(CreateRunpodCredentialDto) + case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) + case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) + case slackWebhook(CreateSlackWebhookCredentialDto) + case smallestAi(CreateSmallestAiCredentialDto) + case soniox(CreateSonioxCredentialDto) + case speechmatics(CreateSpeechmaticsCredentialDto) + case supabase(CreateSupabaseCredentialDto) + case tavus(CreateTavusCredentialDto) + case togetherAi(CreateTogetherAiCredentialDto) + case twilio(CreateTwilioCredentialDto) + case vonage(CreateVonageCredentialDto) + case webhook(CreateWebhookCredentialDto) + case wellsaid(CreateWellSaidCredentialDto) + case xai(CreateXAiCredentialDto) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try CreateAnthropicCredentialDto(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try CreateAnthropicBedrockCredentialDto(from: decoder)) + case "anyscale": + self = .anyscale(try CreateAnyscaleCredentialDto(from: decoder)) + case "assembly-ai": + self = .assemblyAi(try CreateAssemblyAiCredentialDto(from: decoder)) + case "azure": + self = .azure(try CreateAzureCredentialDto(from: decoder)) + case "azure-openai": + self = .azureOpenai(try CreateAzureOpenAiCredentialDto(from: decoder)) + case "byo-sip-trunk": + self = .byoSipTrunk(try CreateByoSipTrunkCredentialDto(from: decoder)) + case "cartesia": + self = .cartesia(try CreateCartesiaCredentialDto(from: decoder)) + case "cerebras": + self = .cerebras(try CreateCerebrasCredentialDto(from: decoder)) + case "cloudflare": + self = .cloudflare(try CreateCloudflareCredentialDto(from: decoder)) + case "custom-credential": + self = .customCredential(try CreateCustomCredentialDto(from: decoder)) + case "custom-llm": + self = .customLlm(try CreateCustomLlmCredentialDto(from: decoder)) + case "deepgram": + self = .deepgram(try CreateDeepgramCredentialDto(from: decoder)) + case "deepinfra": + self = .deepinfra(try CreateDeepInfraCredentialDto(from: decoder)) + case "deep-seek": + self = .deepSeek(try CreateDeepSeekCredentialDto(from: decoder)) + case "11labs": + self = .elevenLabs(try CreateElevenLabsCredentialDto(from: decoder)) + case "email": + self = .email(try CreateEmailCredentialDto(from: decoder)) + case "gcp": + self = .gcp(try CreateGcpCredentialDto(from: decoder)) + case "ghl.oauth2-authorization": + self = .ghlOauth2Authorization(try CreateGoHighLevelMcpCredentialDto(from: decoder)) + case "gladia": + self = .gladia(try CreateGladiaCredentialDto(from: decoder)) + case "gohighlevel": + self = .gohighlevel(try CreateGoHighLevelCredentialDto(from: decoder)) + case "google": + self = .google(try CreateGoogleCredentialDto(from: decoder)) + case "google.calendar.oauth2-authorization": + self = .googleCalendarOauth2Authorization(try CreateGoogleCalendarOAuth2AuthorizationCredentialDto(from: decoder)) + case "google.calendar.oauth2-client": + self = .googleCalendarOauth2Client(try CreateGoogleCalendarOAuth2ClientCredentialDto(from: decoder)) + case "google.sheets.oauth2-authorization": + self = .googleSheetsOauth2Authorization(try CreateGoogleSheetsOAuth2AuthorizationCredentialDto(from: decoder)) + case "groq": + self = .groq(try CreateGroqCredentialDto(from: decoder)) + case "hume": + self = .hume(try CreateHumeCredentialDto(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try CreateInflectionAiCredentialDto(from: decoder)) + case "inworld": + self = .inworld(try CreateInworldCredentialDto(from: decoder)) + case "langfuse": + self = .langfuse(try CreateLangfuseCredentialDto(from: decoder)) + case "lmnt": + self = .lmnt(try CreateLmntCredentialDto(from: decoder)) + case "make": + self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) + case "minimax": + self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) + case "mistral": + self = .mistral(try CreateMistralCredentialDto(from: decoder)) + case "neuphonic": + self = .neuphonic(try CreateNeuphonicCredentialDto(from: decoder)) + case "openai": + self = .openai(try CreateOpenAiCredentialDto(from: decoder)) + case "openrouter": + self = .openrouter(try CreateOpenRouterCredentialDto(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try CreatePerplexityAiCredentialDto(from: decoder)) + case "playht": + self = .playht(try CreatePlayHtCredentialDto(from: decoder)) + case "rime-ai": + self = .rimeAi(try CreateRimeAiCredentialDto(from: decoder)) + case "runpod": + self = .runpod(try CreateRunpodCredentialDto(from: decoder)) + case "s3": + self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) + case "slack.oauth2-authorization": + self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) + case "slack-webhook": + self = .slackWebhook(try CreateSlackWebhookCredentialDto(from: decoder)) + case "smallest-ai": + self = .smallestAi(try CreateSmallestAiCredentialDto(from: decoder)) + case "soniox": + self = .soniox(try CreateSonioxCredentialDto(from: decoder)) + case "speechmatics": + self = .speechmatics(try CreateSpeechmaticsCredentialDto(from: decoder)) + case "supabase": + self = .supabase(try CreateSupabaseCredentialDto(from: decoder)) + case "tavus": + self = .tavus(try CreateTavusCredentialDto(from: decoder)) + case "together-ai": + self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) + case "twilio": + self = .twilio(try CreateTwilioCredentialDto(from: decoder)) + case "vonage": + self = .vonage(try CreateVonageCredentialDto(from: decoder)) + case "webhook": + self = .webhook(try CreateWebhookCredentialDto(from: decoder)) + case "wellsaid": + self = .wellsaid(try CreateWellSaidCredentialDto(from: decoder)) + case "xai": + self = .xai(try CreateXAiCredentialDto(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .azureOpenai(let data): + try container.encode("azure-openai", forKey: .provider) + try data.encode(to: encoder) + case .byoSipTrunk(let data): + try container.encode("byo-sip-trunk", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .cloudflare(let data): + try container.encode("cloudflare", forKey: .provider) + try data.encode(to: encoder) + case .customCredential(let data): + try container.encode("custom-credential", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .email(let data): + try container.encode("email", forKey: .provider) + try data.encode(to: encoder) + case .gcp(let data): + try container.encode("gcp", forKey: .provider) + try data.encode(to: encoder) + case .ghlOauth2Authorization(let data): + try container.encode("ghl.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .gohighlevel(let data): + try container.encode("gohighlevel", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Authorization(let data): + try container.encode("google.calendar.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Client(let data): + try container.encode("google.calendar.oauth2-client", forKey: .provider) + try data.encode(to: encoder) + case .googleSheetsOauth2Authorization(let data): + try container.encode("google.sheets.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .langfuse(let data): + try container.encode("langfuse", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .make(let data): + try container.encode("make", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .mistral(let data): + try container.encode("mistral", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .runpod(let data): + try container.encode("runpod", forKey: .provider) + try data.encode(to: encoder) + case .s3(let data): + try container.encode("s3", forKey: .provider) + try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) + case .slackOauth2Authorization(let data): + try container.encode("slack.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .slackWebhook(let data): + try container.encode("slack-webhook", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .supabase(let data): + try container.encode("supabase", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + case .webhook(let data): + try container.encode("webhook", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftFirstMessageMode.swift b/Sources/Schemas/AssistantDraftFirstMessageMode.swift new file mode 100644 index 00000000..aadf8b14 --- /dev/null +++ b/Sources/Schemas/AssistantDraftFirstMessageMode.swift @@ -0,0 +1,15 @@ +import Foundation + +/// This is the mode for the first message. Default is 'assistant-speaks-first'. +/// +/// Use: +/// - 'assistant-speaks-first' to have the assistant speak first. +/// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. +/// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). +/// +/// @default 'assistant-speaks-first' +public enum AssistantDraftFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantSpeaksFirstWithModelGeneratedMessage = "assistant-speaks-first-with-model-generated-message" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftHooksItem.swift b/Sources/Schemas/AssistantDraftHooksItem.swift new file mode 100644 index 00000000..e54e4183 --- /dev/null +++ b/Sources/Schemas/AssistantDraftHooksItem.swift @@ -0,0 +1,45 @@ +import Foundation + +public enum AssistantDraftHooksItem: Codable, Hashable, Sendable { + case callHookAssistantSpeechInterrupted(CallHookAssistantSpeechInterrupted) + case callHookCallEnding(CallHookCallEnding) + case callHookCustomerSpeechInterrupted(CallHookCustomerSpeechInterrupted) + case callHookCustomerSpeechTimeout(CallHookCustomerSpeechTimeout) + case sessionCreatedHook(SessionCreatedHook) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CallHookAssistantSpeechInterrupted.self) { + self = .callHookAssistantSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCallEnding.self) { + self = .callHookCallEnding(value) + } else if let value = try? container.decode(CallHookCustomerSpeechInterrupted.self) { + self = .callHookCustomerSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCustomerSpeechTimeout.self) { + self = .callHookCustomerSpeechTimeout(value) + } else if let value = try? container.decode(SessionCreatedHook.self) { + self = .sessionCreatedHook(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .callHookAssistantSpeechInterrupted(let value): + try container.encode(value) + case .callHookCallEnding(let value): + try container.encode(value) + case .callHookCustomerSpeechInterrupted(let value): + try container.encode(value) + case .callHookCustomerSpeechTimeout(let value): + try container.encode(value) + case .sessionCreatedHook(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftModel.swift b/Sources/Schemas/AssistantDraftModel.swift new file mode 100644 index 00000000..5203b274 --- /dev/null +++ b/Sources/Schemas/AssistantDraftModel.swift @@ -0,0 +1,131 @@ +import Foundation + +/// These are the options for the assistant's LLM. +public enum AssistantDraftModel: Codable, Hashable, Sendable { + case anthropic(AnthropicModel) + case anthropicBedrock(AnthropicBedrockModel) + case anyscale(AnyscaleModel) + case cerebras(CerebrasModel) + case customLlm(CustomLlmModel) + case deepinfra(DeepInfraModel) + case deepSeek(DeepSeekModel) + case google(GoogleModel) + case groq(GroqModel) + case inflectionAi(InflectionAiModel) + case minimax(MinimaxLlmModel) + case openai(OpenAiModel) + case openrouter(OpenRouterModel) + case perplexityAi(PerplexityAiModel) + case togetherAi(TogetherAiModel) + case vapi(VapiModel) + case xai(XaiModel) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try AnthropicModel(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try AnthropicBedrockModel(from: decoder)) + case "anyscale": + self = .anyscale(try AnyscaleModel(from: decoder)) + case "cerebras": + self = .cerebras(try CerebrasModel(from: decoder)) + case "custom-llm": + self = .customLlm(try CustomLlmModel(from: decoder)) + case "deepinfra": + self = .deepinfra(try DeepInfraModel(from: decoder)) + case "deep-seek": + self = .deepSeek(try DeepSeekModel(from: decoder)) + case "google": + self = .google(try GoogleModel(from: decoder)) + case "groq": + self = .groq(try GroqModel(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try InflectionAiModel(from: decoder)) + case "minimax": + self = .minimax(try MinimaxLlmModel(from: decoder)) + case "openai": + self = .openai(try OpenAiModel(from: decoder)) + case "openrouter": + self = .openrouter(try OpenRouterModel(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try PerplexityAiModel(from: decoder)) + case "together-ai": + self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) + case "xai": + self = .xai(try XaiModel(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftPaginatedMetadata.swift b/Sources/Schemas/AssistantDraftPaginatedMetadata.swift new file mode 100644 index 00000000..a5c266de --- /dev/null +++ b/Sources/Schemas/AssistantDraftPaginatedMetadata.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct AssistantDraftPaginatedMetadata: Codable, Hashable, Sendable { + public let nextCursor: Nullable + public let hasNextPage: Bool + public let limit: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + nextCursor: Nullable, + hasNextPage: Bool, + limit: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.nextCursor = nextCursor + self.hasNextPage = hasNextPage + self.limit = limit + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.nextCursor = try container.decode(Nullable.self, forKey: .nextCursor) + self.hasNextPage = try container.decode(Bool.self, forKey: .hasNextPage) + self.limit = try container.decode(Double.self, forKey: .limit) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.nextCursor, forKey: .nextCursor) + try container.encode(self.hasNextPage, forKey: .hasNextPage) + try container.encode(self.limit, forKey: .limit) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case nextCursor + case hasNextPage + case limit + } +} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseCreate.swift b/Sources/Schemas/AssistantDraftPaginatedResponse.swift similarity index 51% rename from Sources/Schemas/TrieveKnowledgeBaseCreate.swift rename to Sources/Schemas/AssistantDraftPaginatedResponse.swift index c7a64743..123e51db 100644 --- a/Sources/Schemas/TrieveKnowledgeBaseCreate.swift +++ b/Sources/Schemas/AssistantDraftPaginatedResponse.swift @@ -1,40 +1,38 @@ import Foundation -public struct TrieveKnowledgeBaseCreate: Codable, Hashable, Sendable { - /// This is to create a new dataset on Trieve. - public let type: TrieveKnowledgeBaseCreateType - /// These are the chunk plans used to create the dataset. - public let chunkPlans: [TrieveKnowledgeBaseChunkPlan] +public struct AssistantDraftPaginatedResponse: Codable, Hashable, Sendable { + public let results: [AssistantDraft] + public let metadata: AssistantDraftPaginatedMetadata /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - type: TrieveKnowledgeBaseCreateType, - chunkPlans: [TrieveKnowledgeBaseChunkPlan], + results: [AssistantDraft], + metadata: AssistantDraftPaginatedMetadata, additionalProperties: [String: JSONValue] = .init() ) { - self.type = type - self.chunkPlans = chunkPlans + self.results = results + self.metadata = metadata self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.type = try container.decode(TrieveKnowledgeBaseCreateType.self, forKey: .type) - self.chunkPlans = try container.decode([TrieveKnowledgeBaseChunkPlan].self, forKey: .chunkPlans) + self.results = try container.decode([AssistantDraft].self, forKey: .results) + self.metadata = try container.decode(AssistantDraftPaginatedMetadata.self, forKey: .metadata) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.type, forKey: .type) - try container.encode(self.chunkPlans, forKey: .chunkPlans) + try container.encode(self.results, forKey: .results) + try container.encode(self.metadata, forKey: .metadata) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case type - case chunkPlans + case results + case metadata } } \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftServerMessagesItem.swift b/Sources/Schemas/AssistantDraftServerMessagesItem.swift new file mode 100644 index 00000000..f82073c7 --- /dev/null +++ b/Sources/Schemas/AssistantDraftServerMessagesItem.swift @@ -0,0 +1,31 @@ +import Foundation + +public enum AssistantDraftServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case assistantStarted = "assistant.started" + case assistantSpeechStarted = "assistant.speechStarted" + case conversationUpdate = "conversation-update" + case endOfCallReport = "end-of-call-report" + case functionCall = "function-call" + case hang + case languageChanged = "language-changed" + case languageChangeDetected = "language-change-detected" + case modelOutput = "model-output" + case phoneCallControl = "phone-call-control" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case transcriptTranscriptTypeFinal = "transcript[transcriptType=\"final\"]" + case toolCalls = "tool-calls" + case transferDestinationRequest = "transfer-destination-request" + case handoffDestinationRequest = "handoff-destination-request" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case chatCreated = "chat.created" + case chatDeleted = "chat.deleted" + case sessionCreated = "session.created" + case sessionUpdated = "session.updated" + case sessionDeleted = "session.deleted" + case callDeleted = "call.deleted" + case callDeleteFailed = "call.delete.failed" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftTranscriber.swift b/Sources/Schemas/AssistantDraftTranscriber.swift new file mode 100644 index 00000000..23a22841 --- /dev/null +++ b/Sources/Schemas/AssistantDraftTranscriber.swift @@ -0,0 +1,113 @@ +import Foundation + +/// These are the options for the assistant's transcriber. +public enum AssistantDraftTranscriber: Codable, Hashable, Sendable { + case assemblyAi(AssemblyAiTranscriber) + case azure(AzureSpeechTranscriber) + case cartesia(CartesiaTranscriber) + case customTranscriber(CustomTranscriber) + case deepgram(DeepgramTranscriber) + case elevenLabs(ElevenLabsTranscriber) + case gladia(GladiaTranscriber) + case google(GoogleTranscriber) + case openai(OpenAiTranscriber) + case soniox(SonioxTranscriber) + case speechmatics(SpeechmaticsTranscriber) + case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "assembly-ai": + self = .assemblyAi(try AssemblyAiTranscriber(from: decoder)) + case "azure": + self = .azure(try AzureSpeechTranscriber(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaTranscriber(from: decoder)) + case "custom-transcriber": + self = .customTranscriber(try CustomTranscriber(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramTranscriber(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsTranscriber(from: decoder)) + case "gladia": + self = .gladia(try GladiaTranscriber(from: decoder)) + case "google": + self = .google(try GoogleTranscriber(from: decoder)) + case "openai": + self = .openai(try OpenAiTranscriber(from: decoder)) + case "soniox": + self = .soniox(try SonioxTranscriber(from: decoder)) + case "speechmatics": + self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) + case "talkscriber": + self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customTranscriber(let data): + try container.encode("custom-transcriber", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .talkscriber(let data): + try container.encode("talkscriber", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftVoice.swift b/Sources/Schemas/AssistantDraftVoice.swift new file mode 100644 index 00000000..93f92afa --- /dev/null +++ b/Sources/Schemas/AssistantDraftVoice.swift @@ -0,0 +1,149 @@ +import Foundation + +/// These are the options for the assistant's voice. +public enum AssistantDraftVoice: Codable, Hashable, Sendable { + case azure(AzureVoice) + case cartesia(CartesiaVoice) + case customVoice(CustomVoice) + case deepgram(DeepgramVoice) + case elevenLabs(ElevenLabsVoice) + case hume(HumeVoice) + case inworld(InworldVoice) + case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) + case minimax(MinimaxVoice) + case neuphonic(NeuphonicVoice) + case openai(OpenAiVoice) + case playht(PlayHtVoice) + case rimeAi(RimeAiVoice) + case sesame(SesameVoice) + case smallestAi(SmallestAiVoice) + case tavus(TavusVoice) + case vapi(VapiVoice) + case wellsaid(WellSaidVoice) + case xai(XaiVoice) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "azure": + self = .azure(try AzureVoice(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaVoice(from: decoder)) + case "custom-voice": + self = .customVoice(try CustomVoice(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramVoice(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsVoice(from: decoder)) + case "hume": + self = .hume(try HumeVoice(from: decoder)) + case "inworld": + self = .inworld(try InworldVoice(from: decoder)) + case "lmnt": + self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) + case "minimax": + self = .minimax(try MinimaxVoice(from: decoder)) + case "neuphonic": + self = .neuphonic(try NeuphonicVoice(from: decoder)) + case "openai": + self = .openai(try OpenAiVoice(from: decoder)) + case "playht": + self = .playht(try PlayHtVoice(from: decoder)) + case "rime-ai": + self = .rimeAi(try RimeAiVoice(from: decoder)) + case "sesame": + self = .sesame(try SesameVoice(from: decoder)) + case "smallest-ai": + self = .smallestAi(try SmallestAiVoice(from: decoder)) + case "tavus": + self = .tavus(try TavusVoice(from: decoder)) + case "vapi": + self = .vapi(try VapiVoice(from: decoder)) + case "wellsaid": + self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customVoice(let data): + try container.encode("custom-voice", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .sesame(let data): + try container.encode("sesame", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftVoicemailDetection.swift b/Sources/Schemas/AssistantDraftVoicemailDetection.swift new file mode 100644 index 00000000..426255e1 --- /dev/null +++ b/Sources/Schemas/AssistantDraftVoicemailDetection.swift @@ -0,0 +1,47 @@ +import Foundation + +/// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. +/// By default, voicemail detection is disabled. +public enum AssistantDraftVoicemailDetection: Codable, Hashable, Sendable { + case assistantDraftVoicemailDetectionZero(AssistantDraftVoicemailDetectionZero) + case googleVoicemailDetectionPlan(GoogleVoicemailDetectionPlan) + case openAiVoicemailDetectionPlan(OpenAiVoicemailDetectionPlan) + case twilioVoicemailDetectionPlan(TwilioVoicemailDetectionPlan) + case vapiVoicemailDetectionPlan(VapiVoicemailDetectionPlan) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AssistantDraftVoicemailDetectionZero.self) { + self = .assistantDraftVoicemailDetectionZero(value) + } else if let value = try? container.decode(GoogleVoicemailDetectionPlan.self) { + self = .googleVoicemailDetectionPlan(value) + } else if let value = try? container.decode(OpenAiVoicemailDetectionPlan.self) { + self = .openAiVoicemailDetectionPlan(value) + } else if let value = try? container.decode(TwilioVoicemailDetectionPlan.self) { + self = .twilioVoicemailDetectionPlan(value) + } else if let value = try? container.decode(VapiVoicemailDetectionPlan.self) { + self = .vapiVoicemailDetectionPlan(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .assistantDraftVoicemailDetectionZero(let value): + try container.encode(value) + case .googleVoicemailDetectionPlan(let value): + try container.encode(value) + case .openAiVoicemailDetectionPlan(let value): + try container.encode(value) + case .twilioVoicemailDetectionPlan(let value): + try container.encode(value) + case .vapiVoicemailDetectionPlan(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantDraftVoicemailDetectionZero.swift b/Sources/Schemas/AssistantDraftVoicemailDetectionZero.swift new file mode 100644 index 00000000..0ef197d6 --- /dev/null +++ b/Sources/Schemas/AssistantDraftVoicemailDetectionZero.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum AssistantDraftVoicemailDetectionZero: String, Codable, Hashable, CaseIterable, Sendable { + case off +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantMessage.swift b/Sources/Schemas/AssistantMessage.swift index 1592a89d..48dc4c1e 100644 --- a/Sources/Schemas/AssistantMessage.swift +++ b/Sources/Schemas/AssistantMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// An assistant-authored message, including content, refusal text, tool calls, participant name, and metadata. public struct AssistantMessage: Codable, Hashable, Sendable { /// This is the role of the message author public let role: AssistantMessageRole diff --git a/Sources/Schemas/AssistantMessageEvaluationContinuePlan.swift b/Sources/Schemas/AssistantMessageEvaluationContinuePlan.swift index be93babe..2fe57415 100644 --- a/Sources/Schemas/AssistantMessageEvaluationContinuePlan.swift +++ b/Sources/Schemas/AssistantMessageEvaluationContinuePlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls how an evaluation proceeds after judging an assistant message, including failure handling and optional message overrides. public struct AssistantMessageEvaluationContinuePlan: Codable, Hashable, Sendable { /// This is whether the evaluation should exit if the assistant message evaluates to false. /// By default, it is false and the evaluation will continue. diff --git a/Sources/Schemas/AssistantMessageJudgePlanAi.swift b/Sources/Schemas/AssistantMessageJudgePlanAi.swift index 33d35f0a..7eeace5f 100644 --- a/Sources/Schemas/AssistantMessageJudgePlanAi.swift +++ b/Sources/Schemas/AssistantMessageJudgePlanAi.swift @@ -1,5 +1,6 @@ import Foundation +/// Evaluates an assistant message with an LLM judge and a configured evaluation model. public struct AssistantMessageJudgePlanAi: Codable, Hashable, Sendable { /// This is the model to use for the LLM-as-a-judge. /// If not provided, will default to the assistant's model. diff --git a/Sources/Schemas/AssistantMessageJudgePlanExact.swift b/Sources/Schemas/AssistantMessageJudgePlanExact.swift index d1c6d6f2..5889e541 100644 --- a/Sources/Schemas/AssistantMessageJudgePlanExact.swift +++ b/Sources/Schemas/AssistantMessageJudgePlanExact.swift @@ -1,5 +1,6 @@ import Foundation +/// Evaluates an assistant message using case-insensitive exact content matching and expected tool calls. public struct AssistantMessageJudgePlanExact: Codable, Hashable, Sendable { /// This is what that will be used to evaluate the model's message content. /// If you provide a string, the assistant message content will be evaluated against it as an exact match, case-insensitive. diff --git a/Sources/Schemas/AssistantMessageJudgePlanRegex.swift b/Sources/Schemas/AssistantMessageJudgePlanRegex.swift index bdb5e609..fd54cb26 100644 --- a/Sources/Schemas/AssistantMessageJudgePlanRegex.swift +++ b/Sources/Schemas/AssistantMessageJudgePlanRegex.swift @@ -1,5 +1,6 @@ import Foundation +/// Evaluates assistant-message content and tool-call arguments using regular-expression patterns. public struct AssistantMessageJudgePlanRegex: Codable, Hashable, Sendable { /// This is what that will be used to evaluate the model's message content. /// The content will be evaluated against the regex pattern provided in the Judge Plan content field. diff --git a/Sources/Schemas/AssistantModel.swift b/Sources/Schemas/AssistantModel.swift index 8d20ade5..a0f10111 100644 --- a/Sources/Schemas/AssistantModel.swift +++ b/Sources/Schemas/AssistantModel.swift @@ -17,6 +17,7 @@ public enum AssistantModel: Codable, Hashable, Sendable { case openrouter(OpenRouterModel) case perplexityAi(PerplexityAiModel) case togetherAi(TogetherAiModel) + case vapi(VapiModel) case xai(XaiModel) public init(from decoder: Decoder) throws { @@ -53,6 +54,8 @@ public enum AssistantModel: Codable, Hashable, Sendable { self = .perplexityAi(try PerplexityAiModel(from: decoder)) case "together-ai": self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) case "xai": self = .xai(try XaiModel(from: decoder)) default: @@ -113,6 +116,9 @@ public enum AssistantModel: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) case .xai(let data): try container.encode("xai", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/AssistantOverrides.swift b/Sources/Schemas/AssistantOverrides.swift index 3ff03dc0..510b3ef1 100644 --- a/Sources/Schemas/AssistantOverrides.swift +++ b/Sources/Schemas/AssistantOverrides.swift @@ -1,5 +1,6 @@ import Foundation +/// Per-call or handoff overrides for an assistant's providers, messages, tools, credentials, call behavior, and server configuration. public struct AssistantOverrides: Codable, Hashable, Sendable { /// These are the options for the assistant's transcriber. public let transcriber: AssistantOverridesTranscriber? @@ -11,6 +12,7 @@ public struct AssistantOverrides: Codable, Hashable, Sendable { /// /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. public let firstMessage: String? + /// Set to `true` to allow the user to interrupt the assistant while it speaks the first message. Default is `false`. public let firstMessageInterruptionsEnabled: Bool? /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// @@ -49,6 +51,7 @@ public struct AssistantOverrides: Codable, Hashable, Sendable { public let credentials: [AssistantOverridesCredentialsItem]? /// This is a set of actions that will be performed on certain events. public let hooks: [AssistantOverridesHooksItem]? + /// Tools to append to the assistant's existing tool configuration. public let toolsAppend: [AssistantOverridesToolsAppendItem]? /// These are values that will be used to replace the template variables in the assistant messages and other text-based fields. /// This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html @@ -72,6 +75,7 @@ public struct AssistantOverrides: Codable, Hashable, Sendable { public let endCallMessage: String? /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. public let endCallPhrases: [String]? + /// Compliance settings to apply, including HIPAA and PCI behavior, security filtering, and recording consent. public let compliancePlan: CompliancePlan? /// This is for metadata you want to store on the assistant. public let metadata: [String: JSONValue]? @@ -124,6 +128,7 @@ public struct AssistantOverrides: Codable, Hashable, Sendable { /// 2. phoneNumber.serverUrl /// 3. org.serverUrl public let server: Server? + /// Configuration for collecting and processing DTMF keypad input. public let keypadInputPlan: KeypadInputPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/AssistantOverridesCredentialsItem.swift b/Sources/Schemas/AssistantOverridesCredentialsItem.swift index be7e1b61..d4ed1b8b 100644 --- a/Sources/Schemas/AssistantOverridesCredentialsItem.swift +++ b/Sources/Schemas/AssistantOverridesCredentialsItem.swift @@ -33,6 +33,7 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum AssistantOverridesCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/AssistantOverridesModel.swift b/Sources/Schemas/AssistantOverridesModel.swift index bfe49909..89dd1e18 100644 --- a/Sources/Schemas/AssistantOverridesModel.swift +++ b/Sources/Schemas/AssistantOverridesModel.swift @@ -17,6 +17,7 @@ public indirect enum AssistantOverridesModel: Codable, Hashable, Sendable { case openrouter(OpenRouterModel) case perplexityAi(PerplexityAiModel) case togetherAi(TogetherAiModel) + case vapi(VapiModel) case xai(XaiModel) public init(from decoder: Decoder) throws { @@ -53,6 +54,8 @@ public indirect enum AssistantOverridesModel: Codable, Hashable, Sendable { self = .perplexityAi(try PerplexityAiModel(from: decoder)) case "together-ai": self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) case "xai": self = .xai(try XaiModel(from: decoder)) default: @@ -113,6 +116,9 @@ public indirect enum AssistantOverridesModel: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) case .xai(let data): try container.encode("xai", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/AssistantOverridesTranscriber.swift b/Sources/Schemas/AssistantOverridesTranscriber.swift index fe56bdaf..581d2612 100644 --- a/Sources/Schemas/AssistantOverridesTranscriber.swift +++ b/Sources/Schemas/AssistantOverridesTranscriber.swift @@ -14,6 +14,8 @@ public enum AssistantOverridesTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,10 @@ public enum AssistantOverridesTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -92,6 +98,12 @@ public enum AssistantOverridesTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/AssistantOverridesVoice.swift b/Sources/Schemas/AssistantOverridesVoice.swift index b943276e..fd638a4a 100644 --- a/Sources/Schemas/AssistantOverridesVoice.swift +++ b/Sources/Schemas/AssistantOverridesVoice.swift @@ -10,6 +10,7 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -20,6 +21,7 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -41,6 +43,8 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -61,6 +65,8 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -98,6 +104,9 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -128,6 +137,9 @@ public enum AssistantOverridesVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/AssistantPinnedConflictResponseDto.swift b/Sources/Schemas/AssistantPinnedConflictResponseDto.swift new file mode 100644 index 00000000..7d05cd32 --- /dev/null +++ b/Sources/Schemas/AssistantPinnedConflictResponseDto.swift @@ -0,0 +1,39 @@ +import Foundation + +public struct AssistantPinnedConflictResponseDto: Codable, Hashable, Sendable { + public let error: AssistantPinnedConflictResponseDtoError + /// Human-readable reason the parent-assistant delete was rejected. + public let message: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + error: AssistantPinnedConflictResponseDtoError, + message: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.error = error + self.message = message + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.error = try container.decode(AssistantPinnedConflictResponseDtoError.self, forKey: .error) + self.message = try container.decode(String.self, forKey: .message) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.error, forKey: .error) + try container.encode(self.message, forKey: .message) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case error + case message + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantPinnedConflictResponseDtoError.swift b/Sources/Schemas/AssistantPinnedConflictResponseDtoError.swift new file mode 100644 index 00000000..b5b0ed08 --- /dev/null +++ b/Sources/Schemas/AssistantPinnedConflictResponseDtoError.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum AssistantPinnedConflictResponseDtoError: String, Codable, Hashable, CaseIterable, Sendable { + case assistantPinned = "assistant_pinned" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantTranscriber.swift b/Sources/Schemas/AssistantTranscriber.swift index 04b0d489..fb58889f 100644 --- a/Sources/Schemas/AssistantTranscriber.swift +++ b/Sources/Schemas/AssistantTranscriber.swift @@ -14,6 +14,8 @@ public enum AssistantTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,10 @@ public enum AssistantTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -92,6 +98,12 @@ public enum AssistantTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/AssistantVersion.swift b/Sources/Schemas/AssistantVersion.swift new file mode 100644 index 00000000..267d49e2 --- /dev/null +++ b/Sources/Schemas/AssistantVersion.swift @@ -0,0 +1,374 @@ +import Foundation + +public struct AssistantVersion: Codable, Hashable, Sendable { + /// These are the options for the assistant's transcriber. + public let transcriber: AssistantVersionTranscriber? + /// These are the options for the assistant's LLM. + public let model: AssistantVersionModel? + /// These are the options for the assistant's voice. + public let voice: AssistantVersionVoice? + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + public let firstMessage: String? + public let firstMessageInterruptionsEnabled: Bool? + /// This is the mode for the first message. Default is 'assistant-speaks-first'. + /// + /// Use: + /// - 'assistant-speaks-first' to have the assistant speak first. + /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. + /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: AssistantVersionFirstMessageMode? + /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + /// By default, voicemail detection is disabled. + public let voicemailDetection: AssistantVersionVoicemailDetection? + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started,assistant.started. You can check the shape of the messages in ClientMessage schema. + public let clientMessages: [AssistantVersionClientMessagesItem]? + /// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,handoff-destination-request,user-interrupted,assistant.started. You can check the shape of the messages in ServerMessage schema. + public let serverMessages: [AssistantVersionServerMessagesItem]? + /// This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + /// + /// @default 600 (10 minutes) + public let maxDurationSeconds: Double? + /// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + /// You can also provide a custom sound by providing a URL to an audio file. + public let backgroundSound: AssistantVersionBackgroundSound? + /// This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + /// + /// @default false + public let modelOutputInMessagesEnabled: Bool? + /// These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + public let transportConfigurations: [TransportConfigurationTwilio]? + /// This is the plan for observability of assistant's calls. + /// + /// Currently, only Langfuse is supported. + public let observabilityPlan: LangfuseObservabilityPlan? + /// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials. + public let credentials: [AssistantVersionCredentialsItem]? + /// This is a set of actions that will be performed on certain events. + public let hooks: [AssistantVersionHooksItem]? + /// Optional human-readable label for this version. Pass `null` to clear. + public let versionName: Nullable? + /// Optional description for this version. Pass `null` to clear. + public let versionDescription: Nullable? + /// This is the unique identifier for the version row. + public let id: String + /// This is the unique identifier for the org that owns this version. + public let orgId: String + /// This is the unique identifier for the assistant this version was snapshotted from. + public let assistantId: String + /// This is the public monotonic version label, e.g. "v1". + /// System-owned and incremented per assistant; never user-supplied. + public let version: String + /// This is the SHA-256 hex of the snapshotted content used for no-op detection. + public let configHash: String + /// This is the prior version label (vN-1). Null on v1 or for branch roots. + public let parentVersion: Nullable? + /// This is the actor that wrote this version. Email when created via JWT, null when created via API. + public let createdBy: Nullable? + /// This is the soft-delete timestamp. Null when active. + public let deletedAt: Nullable? + /// This is the ISO 8601 date-time string of when the version was created. + public let createdAt: Date + /// This is the name of the assistant. + /// + /// This is required when you want to transfer between assistants in a call. + public let name: String? + /// This is the message that the assistant will say if the call is forwarded to voicemail. + /// + /// If unspecified, it will hang up. + public let voicemailMessage: String? + /// This is the message that the assistant will say if it ends the call. + /// + /// If unspecified, it will hang up without saying anything. + public let endCallMessage: String? + /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + public let endCallPhrases: [String]? + public let compliancePlan: CompliancePlan? + /// This is for metadata you want to store on the assistant. + public let metadata: [String: JSONValue]? + /// This enables filtering of noise and background speech while the user is talking. + /// + /// Features: + /// - Smart denoising using Krisp + /// - Fourier denoising + /// + /// Smart denoising can be combined with or used independently of Fourier denoising. + /// + /// Order of precedence: + /// - Smart denoising + /// - Fourier denoising + public let backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? + /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. + public let analysisPlan: AnalysisPlan? + /// This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`. + public let artifactPlan: ArtifactPlan? + /// This is the plan for when the assistant should start talking. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to start talking after the customer is done speaking. + /// - The assistant is too fast to start talking after the customer is done speaking. + /// - The assistant is so fast that it's actually interrupting the customer. + public let startSpeakingPlan: StartSpeakingPlan? + /// This is the plan for when assistant should stop talking on customer interruption. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to recognize customer's interruption. + /// - The assistant is too fast to recognize customer's interruption. + /// - The assistant is getting interrupted by phrases that are just acknowledgments. + /// - The assistant is getting interrupted by background noises. + /// - The assistant is not properly stopping -- it starts talking right after getting interrupted. + public let stopSpeakingPlan: StopSpeakingPlan? + /// This is the plan for real-time monitoring of the assistant's calls. + /// + /// Usage: + /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. + /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. + /// - To attach monitors to the assistant, set `monitorPlan.monitorIds` to the set of monitor ids. + public let monitorPlan: MonitorPlan? + /// These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + public let credentialIds: [String]? + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + public let server: Server? + public let keypadInputPlan: KeypadInputPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + transcriber: AssistantVersionTranscriber? = nil, + model: AssistantVersionModel? = nil, + voice: AssistantVersionVoice? = nil, + firstMessage: String? = nil, + firstMessageInterruptionsEnabled: Bool? = nil, + firstMessageMode: AssistantVersionFirstMessageMode? = nil, + voicemailDetection: AssistantVersionVoicemailDetection? = nil, + clientMessages: [AssistantVersionClientMessagesItem]? = nil, + serverMessages: [AssistantVersionServerMessagesItem]? = nil, + maxDurationSeconds: Double? = nil, + backgroundSound: AssistantVersionBackgroundSound? = nil, + modelOutputInMessagesEnabled: Bool? = nil, + transportConfigurations: [TransportConfigurationTwilio]? = nil, + observabilityPlan: LangfuseObservabilityPlan? = nil, + credentials: [AssistantVersionCredentialsItem]? = nil, + hooks: [AssistantVersionHooksItem]? = nil, + versionName: Nullable? = nil, + versionDescription: Nullable? = nil, + id: String, + orgId: String, + assistantId: String, + version: String, + configHash: String, + parentVersion: Nullable? = nil, + createdBy: Nullable? = nil, + deletedAt: Nullable? = nil, + createdAt: Date, + name: String? = nil, + voicemailMessage: String? = nil, + endCallMessage: String? = nil, + endCallPhrases: [String]? = nil, + compliancePlan: CompliancePlan? = nil, + metadata: [String: JSONValue]? = nil, + backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? = nil, + analysisPlan: AnalysisPlan? = nil, + artifactPlan: ArtifactPlan? = nil, + startSpeakingPlan: StartSpeakingPlan? = nil, + stopSpeakingPlan: StopSpeakingPlan? = nil, + monitorPlan: MonitorPlan? = nil, + credentialIds: [String]? = nil, + server: Server? = nil, + keypadInputPlan: KeypadInputPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.transcriber = transcriber + self.model = model + self.voice = voice + self.firstMessage = firstMessage + self.firstMessageInterruptionsEnabled = firstMessageInterruptionsEnabled + self.firstMessageMode = firstMessageMode + self.voicemailDetection = voicemailDetection + self.clientMessages = clientMessages + self.serverMessages = serverMessages + self.maxDurationSeconds = maxDurationSeconds + self.backgroundSound = backgroundSound + self.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled + self.transportConfigurations = transportConfigurations + self.observabilityPlan = observabilityPlan + self.credentials = credentials + self.hooks = hooks + self.versionName = versionName + self.versionDescription = versionDescription + self.id = id + self.orgId = orgId + self.assistantId = assistantId + self.version = version + self.configHash = configHash + self.parentVersion = parentVersion + self.createdBy = createdBy + self.deletedAt = deletedAt + self.createdAt = createdAt + self.name = name + self.voicemailMessage = voicemailMessage + self.endCallMessage = endCallMessage + self.endCallPhrases = endCallPhrases + self.compliancePlan = compliancePlan + self.metadata = metadata + self.backgroundSpeechDenoisingPlan = backgroundSpeechDenoisingPlan + self.analysisPlan = analysisPlan + self.artifactPlan = artifactPlan + self.startSpeakingPlan = startSpeakingPlan + self.stopSpeakingPlan = stopSpeakingPlan + self.monitorPlan = monitorPlan + self.credentialIds = credentialIds + self.server = server + self.keypadInputPlan = keypadInputPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.transcriber = try container.decodeIfPresent(AssistantVersionTranscriber.self, forKey: .transcriber) + self.model = try container.decodeIfPresent(AssistantVersionModel.self, forKey: .model) + self.voice = try container.decodeIfPresent(AssistantVersionVoice.self, forKey: .voice) + self.firstMessage = try container.decodeIfPresent(String.self, forKey: .firstMessage) + self.firstMessageInterruptionsEnabled = try container.decodeIfPresent(Bool.self, forKey: .firstMessageInterruptionsEnabled) + self.firstMessageMode = try container.decodeIfPresent(AssistantVersionFirstMessageMode.self, forKey: .firstMessageMode) + self.voicemailDetection = try container.decodeIfPresent(AssistantVersionVoicemailDetection.self, forKey: .voicemailDetection) + self.clientMessages = try container.decodeIfPresent([AssistantVersionClientMessagesItem].self, forKey: .clientMessages) + self.serverMessages = try container.decodeIfPresent([AssistantVersionServerMessagesItem].self, forKey: .serverMessages) + self.maxDurationSeconds = try container.decodeIfPresent(Double.self, forKey: .maxDurationSeconds) + self.backgroundSound = try container.decodeIfPresent(AssistantVersionBackgroundSound.self, forKey: .backgroundSound) + self.modelOutputInMessagesEnabled = try container.decodeIfPresent(Bool.self, forKey: .modelOutputInMessagesEnabled) + self.transportConfigurations = try container.decodeIfPresent([TransportConfigurationTwilio].self, forKey: .transportConfigurations) + self.observabilityPlan = try container.decodeIfPresent(LangfuseObservabilityPlan.self, forKey: .observabilityPlan) + self.credentials = try container.decodeIfPresent([AssistantVersionCredentialsItem].self, forKey: .credentials) + self.hooks = try container.decodeIfPresent([AssistantVersionHooksItem].self, forKey: .hooks) + self.versionName = try container.decodeNullableIfPresent(String.self, forKey: .versionName) + self.versionDescription = try container.decodeNullableIfPresent(String.self, forKey: .versionDescription) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.assistantId = try container.decode(String.self, forKey: .assistantId) + self.version = try container.decode(String.self, forKey: .version) + self.configHash = try container.decode(String.self, forKey: .configHash) + self.parentVersion = try container.decodeNullableIfPresent(String.self, forKey: .parentVersion) + self.createdBy = try container.decodeNullableIfPresent(String.self, forKey: .createdBy) + self.deletedAt = try container.decodeNullableIfPresent(Date.self, forKey: .deletedAt) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.voicemailMessage = try container.decodeIfPresent(String.self, forKey: .voicemailMessage) + self.endCallMessage = try container.decodeIfPresent(String.self, forKey: .endCallMessage) + self.endCallPhrases = try container.decodeIfPresent([String].self, forKey: .endCallPhrases) + self.compliancePlan = try container.decodeIfPresent(CompliancePlan.self, forKey: .compliancePlan) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.backgroundSpeechDenoisingPlan = try container.decodeIfPresent(BackgroundSpeechDenoisingPlan.self, forKey: .backgroundSpeechDenoisingPlan) + self.analysisPlan = try container.decodeIfPresent(AnalysisPlan.self, forKey: .analysisPlan) + self.artifactPlan = try container.decodeIfPresent(ArtifactPlan.self, forKey: .artifactPlan) + self.startSpeakingPlan = try container.decodeIfPresent(StartSpeakingPlan.self, forKey: .startSpeakingPlan) + self.stopSpeakingPlan = try container.decodeIfPresent(StopSpeakingPlan.self, forKey: .stopSpeakingPlan) + self.monitorPlan = try container.decodeIfPresent(MonitorPlan.self, forKey: .monitorPlan) + self.credentialIds = try container.decodeIfPresent([String].self, forKey: .credentialIds) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.keypadInputPlan = try container.decodeIfPresent(KeypadInputPlan.self, forKey: .keypadInputPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.transcriber, forKey: .transcriber) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessage, forKey: .firstMessage) + try container.encodeIfPresent(self.firstMessageInterruptionsEnabled, forKey: .firstMessageInterruptionsEnabled) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) + try container.encodeIfPresent(self.voicemailDetection, forKey: .voicemailDetection) + try container.encodeIfPresent(self.clientMessages, forKey: .clientMessages) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.maxDurationSeconds, forKey: .maxDurationSeconds) + try container.encodeIfPresent(self.backgroundSound, forKey: .backgroundSound) + try container.encodeIfPresent(self.modelOutputInMessagesEnabled, forKey: .modelOutputInMessagesEnabled) + try container.encodeIfPresent(self.transportConfigurations, forKey: .transportConfigurations) + try container.encodeIfPresent(self.observabilityPlan, forKey: .observabilityPlan) + try container.encodeIfPresent(self.credentials, forKey: .credentials) + try container.encodeIfPresent(self.hooks, forKey: .hooks) + try container.encodeNullableIfPresent(self.versionName, forKey: .versionName) + try container.encodeNullableIfPresent(self.versionDescription, forKey: .versionDescription) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.assistantId, forKey: .assistantId) + try container.encode(self.version, forKey: .version) + try container.encode(self.configHash, forKey: .configHash) + try container.encodeNullableIfPresent(self.parentVersion, forKey: .parentVersion) + try container.encodeNullableIfPresent(self.createdBy, forKey: .createdBy) + try container.encodeNullableIfPresent(self.deletedAt, forKey: .deletedAt) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.voicemailMessage, forKey: .voicemailMessage) + try container.encodeIfPresent(self.endCallMessage, forKey: .endCallMessage) + try container.encodeIfPresent(self.endCallPhrases, forKey: .endCallPhrases) + try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.backgroundSpeechDenoisingPlan, forKey: .backgroundSpeechDenoisingPlan) + try container.encodeIfPresent(self.analysisPlan, forKey: .analysisPlan) + try container.encodeIfPresent(self.artifactPlan, forKey: .artifactPlan) + try container.encodeIfPresent(self.startSpeakingPlan, forKey: .startSpeakingPlan) + try container.encodeIfPresent(self.stopSpeakingPlan, forKey: .stopSpeakingPlan) + try container.encodeIfPresent(self.monitorPlan, forKey: .monitorPlan) + try container.encodeIfPresent(self.credentialIds, forKey: .credentialIds) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.keypadInputPlan, forKey: .keypadInputPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case transcriber + case model + case voice + case firstMessage + case firstMessageInterruptionsEnabled + case firstMessageMode + case voicemailDetection + case clientMessages + case serverMessages + case maxDurationSeconds + case backgroundSound + case modelOutputInMessagesEnabled + case transportConfigurations + case observabilityPlan + case credentials + case hooks + case versionName + case versionDescription + case id + case orgId + case assistantId + case version + case configHash + case parentVersion + case createdBy + case deletedAt + case createdAt + case name + case voicemailMessage + case endCallMessage + case endCallPhrases + case compliancePlan + case metadata + case backgroundSpeechDenoisingPlan + case analysisPlan + case artifactPlan + case startSpeakingPlan + case stopSpeakingPlan + case monitorPlan + case credentialIds + case server + case keypadInputPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionBackgroundSound.swift b/Sources/Schemas/AssistantVersionBackgroundSound.swift new file mode 100644 index 00000000..c77bf065 --- /dev/null +++ b/Sources/Schemas/AssistantVersionBackgroundSound.swift @@ -0,0 +1,32 @@ +import Foundation + +/// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. +/// You can also provide a custom sound by providing a URL to an audio file. +public enum AssistantVersionBackgroundSound: Codable, Hashable, Sendable { + case assistantVersionBackgroundSoundZero(AssistantVersionBackgroundSoundZero) + case string(String) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AssistantVersionBackgroundSoundZero.self) { + self = .assistantVersionBackgroundSoundZero(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .assistantVersionBackgroundSoundZero(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionBackgroundSoundZero.swift b/Sources/Schemas/AssistantVersionBackgroundSoundZero.swift new file mode 100644 index 00000000..a4fc8541 --- /dev/null +++ b/Sources/Schemas/AssistantVersionBackgroundSoundZero.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum AssistantVersionBackgroundSoundZero: String, Codable, Hashable, CaseIterable, Sendable { + case off + case office +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionClientMessagesItem.swift b/Sources/Schemas/AssistantVersionClientMessagesItem.swift new file mode 100644 index 00000000..1e523a76 --- /dev/null +++ b/Sources/Schemas/AssistantVersionClientMessagesItem.swift @@ -0,0 +1,23 @@ +import Foundation + +public enum AssistantVersionClientMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case conversationUpdate = "conversation-update" + case assistantSpeechStarted = "assistant.speechStarted" + case functionCall = "function-call" + case functionCallResult = "function-call-result" + case hang + case languageChanged = "language-changed" + case metadata + case modelOutput = "model-output" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case toolCalls = "tool-calls" + case toolCallsResult = "tool-calls-result" + case toolCompleted = "tool.completed" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case workflowNodeStarted = "workflow.node.started" + case assistantStarted = "assistant.started" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionCredentialsItem.swift b/Sources/Schemas/AssistantVersionCredentialsItem.swift new file mode 100644 index 00000000..e5648f7a --- /dev/null +++ b/Sources/Schemas/AssistantVersionCredentialsItem.swift @@ -0,0 +1,370 @@ +import Foundation + +public enum AssistantVersionCredentialsItem: Codable, Hashable, Sendable { + case anthropic(CreateAnthropicCredentialDto) + case anthropicBedrock(CreateAnthropicBedrockCredentialDto) + case anyscale(CreateAnyscaleCredentialDto) + case assemblyAi(CreateAssemblyAiCredentialDto) + case azure(CreateAzureCredentialDto) + case azureOpenai(CreateAzureOpenAiCredentialDto) + case byoSipTrunk(CreateByoSipTrunkCredentialDto) + case cartesia(CreateCartesiaCredentialDto) + case cerebras(CreateCerebrasCredentialDto) + case cloudflare(CreateCloudflareCredentialDto) + case customCredential(CreateCustomCredentialDto) + case customLlm(CreateCustomLlmCredentialDto) + case deepgram(CreateDeepgramCredentialDto) + case deepinfra(CreateDeepInfraCredentialDto) + case deepSeek(CreateDeepSeekCredentialDto) + case elevenLabs(CreateElevenLabsCredentialDto) + case email(CreateEmailCredentialDto) + case gcp(CreateGcpCredentialDto) + case ghlOauth2Authorization(CreateGoHighLevelMcpCredentialDto) + case gladia(CreateGladiaCredentialDto) + case gohighlevel(CreateGoHighLevelCredentialDto) + case google(CreateGoogleCredentialDto) + case googleCalendarOauth2Authorization(CreateGoogleCalendarOAuth2AuthorizationCredentialDto) + case googleCalendarOauth2Client(CreateGoogleCalendarOAuth2ClientCredentialDto) + case googleSheetsOauth2Authorization(CreateGoogleSheetsOAuth2AuthorizationCredentialDto) + case groq(CreateGroqCredentialDto) + case hume(CreateHumeCredentialDto) + case inflectionAi(CreateInflectionAiCredentialDto) + case inworld(CreateInworldCredentialDto) + case langfuse(CreateLangfuseCredentialDto) + case lmnt(CreateLmntCredentialDto) + case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) + case minimax(CreateMinimaxCredentialDto) + case mistral(CreateMistralCredentialDto) + case neuphonic(CreateNeuphonicCredentialDto) + case openai(CreateOpenAiCredentialDto) + case openrouter(CreateOpenRouterCredentialDto) + case perplexityAi(CreatePerplexityAiCredentialDto) + case playht(CreatePlayHtCredentialDto) + case rimeAi(CreateRimeAiCredentialDto) + case runpod(CreateRunpodCredentialDto) + case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) + case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) + case slackWebhook(CreateSlackWebhookCredentialDto) + case smallestAi(CreateSmallestAiCredentialDto) + case soniox(CreateSonioxCredentialDto) + case speechmatics(CreateSpeechmaticsCredentialDto) + case supabase(CreateSupabaseCredentialDto) + case tavus(CreateTavusCredentialDto) + case togetherAi(CreateTogetherAiCredentialDto) + case twilio(CreateTwilioCredentialDto) + case vonage(CreateVonageCredentialDto) + case webhook(CreateWebhookCredentialDto) + case wellsaid(CreateWellSaidCredentialDto) + case xai(CreateXAiCredentialDto) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try CreateAnthropicCredentialDto(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try CreateAnthropicBedrockCredentialDto(from: decoder)) + case "anyscale": + self = .anyscale(try CreateAnyscaleCredentialDto(from: decoder)) + case "assembly-ai": + self = .assemblyAi(try CreateAssemblyAiCredentialDto(from: decoder)) + case "azure": + self = .azure(try CreateAzureCredentialDto(from: decoder)) + case "azure-openai": + self = .azureOpenai(try CreateAzureOpenAiCredentialDto(from: decoder)) + case "byo-sip-trunk": + self = .byoSipTrunk(try CreateByoSipTrunkCredentialDto(from: decoder)) + case "cartesia": + self = .cartesia(try CreateCartesiaCredentialDto(from: decoder)) + case "cerebras": + self = .cerebras(try CreateCerebrasCredentialDto(from: decoder)) + case "cloudflare": + self = .cloudflare(try CreateCloudflareCredentialDto(from: decoder)) + case "custom-credential": + self = .customCredential(try CreateCustomCredentialDto(from: decoder)) + case "custom-llm": + self = .customLlm(try CreateCustomLlmCredentialDto(from: decoder)) + case "deepgram": + self = .deepgram(try CreateDeepgramCredentialDto(from: decoder)) + case "deepinfra": + self = .deepinfra(try CreateDeepInfraCredentialDto(from: decoder)) + case "deep-seek": + self = .deepSeek(try CreateDeepSeekCredentialDto(from: decoder)) + case "11labs": + self = .elevenLabs(try CreateElevenLabsCredentialDto(from: decoder)) + case "email": + self = .email(try CreateEmailCredentialDto(from: decoder)) + case "gcp": + self = .gcp(try CreateGcpCredentialDto(from: decoder)) + case "ghl.oauth2-authorization": + self = .ghlOauth2Authorization(try CreateGoHighLevelMcpCredentialDto(from: decoder)) + case "gladia": + self = .gladia(try CreateGladiaCredentialDto(from: decoder)) + case "gohighlevel": + self = .gohighlevel(try CreateGoHighLevelCredentialDto(from: decoder)) + case "google": + self = .google(try CreateGoogleCredentialDto(from: decoder)) + case "google.calendar.oauth2-authorization": + self = .googleCalendarOauth2Authorization(try CreateGoogleCalendarOAuth2AuthorizationCredentialDto(from: decoder)) + case "google.calendar.oauth2-client": + self = .googleCalendarOauth2Client(try CreateGoogleCalendarOAuth2ClientCredentialDto(from: decoder)) + case "google.sheets.oauth2-authorization": + self = .googleSheetsOauth2Authorization(try CreateGoogleSheetsOAuth2AuthorizationCredentialDto(from: decoder)) + case "groq": + self = .groq(try CreateGroqCredentialDto(from: decoder)) + case "hume": + self = .hume(try CreateHumeCredentialDto(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try CreateInflectionAiCredentialDto(from: decoder)) + case "inworld": + self = .inworld(try CreateInworldCredentialDto(from: decoder)) + case "langfuse": + self = .langfuse(try CreateLangfuseCredentialDto(from: decoder)) + case "lmnt": + self = .lmnt(try CreateLmntCredentialDto(from: decoder)) + case "make": + self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) + case "minimax": + self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) + case "mistral": + self = .mistral(try CreateMistralCredentialDto(from: decoder)) + case "neuphonic": + self = .neuphonic(try CreateNeuphonicCredentialDto(from: decoder)) + case "openai": + self = .openai(try CreateOpenAiCredentialDto(from: decoder)) + case "openrouter": + self = .openrouter(try CreateOpenRouterCredentialDto(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try CreatePerplexityAiCredentialDto(from: decoder)) + case "playht": + self = .playht(try CreatePlayHtCredentialDto(from: decoder)) + case "rime-ai": + self = .rimeAi(try CreateRimeAiCredentialDto(from: decoder)) + case "runpod": + self = .runpod(try CreateRunpodCredentialDto(from: decoder)) + case "s3": + self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) + case "slack.oauth2-authorization": + self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) + case "slack-webhook": + self = .slackWebhook(try CreateSlackWebhookCredentialDto(from: decoder)) + case "smallest-ai": + self = .smallestAi(try CreateSmallestAiCredentialDto(from: decoder)) + case "soniox": + self = .soniox(try CreateSonioxCredentialDto(from: decoder)) + case "speechmatics": + self = .speechmatics(try CreateSpeechmaticsCredentialDto(from: decoder)) + case "supabase": + self = .supabase(try CreateSupabaseCredentialDto(from: decoder)) + case "tavus": + self = .tavus(try CreateTavusCredentialDto(from: decoder)) + case "together-ai": + self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) + case "twilio": + self = .twilio(try CreateTwilioCredentialDto(from: decoder)) + case "vonage": + self = .vonage(try CreateVonageCredentialDto(from: decoder)) + case "webhook": + self = .webhook(try CreateWebhookCredentialDto(from: decoder)) + case "wellsaid": + self = .wellsaid(try CreateWellSaidCredentialDto(from: decoder)) + case "xai": + self = .xai(try CreateXAiCredentialDto(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .azureOpenai(let data): + try container.encode("azure-openai", forKey: .provider) + try data.encode(to: encoder) + case .byoSipTrunk(let data): + try container.encode("byo-sip-trunk", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .cloudflare(let data): + try container.encode("cloudflare", forKey: .provider) + try data.encode(to: encoder) + case .customCredential(let data): + try container.encode("custom-credential", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .email(let data): + try container.encode("email", forKey: .provider) + try data.encode(to: encoder) + case .gcp(let data): + try container.encode("gcp", forKey: .provider) + try data.encode(to: encoder) + case .ghlOauth2Authorization(let data): + try container.encode("ghl.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .gohighlevel(let data): + try container.encode("gohighlevel", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Authorization(let data): + try container.encode("google.calendar.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Client(let data): + try container.encode("google.calendar.oauth2-client", forKey: .provider) + try data.encode(to: encoder) + case .googleSheetsOauth2Authorization(let data): + try container.encode("google.sheets.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .langfuse(let data): + try container.encode("langfuse", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .make(let data): + try container.encode("make", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .mistral(let data): + try container.encode("mistral", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .runpod(let data): + try container.encode("runpod", forKey: .provider) + try data.encode(to: encoder) + case .s3(let data): + try container.encode("s3", forKey: .provider) + try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) + case .slackOauth2Authorization(let data): + try container.encode("slack.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .slackWebhook(let data): + try container.encode("slack-webhook", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .supabase(let data): + try container.encode("supabase", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + case .webhook(let data): + try container.encode("webhook", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionFirstMessageMode.swift b/Sources/Schemas/AssistantVersionFirstMessageMode.swift new file mode 100644 index 00000000..2235aa7f --- /dev/null +++ b/Sources/Schemas/AssistantVersionFirstMessageMode.swift @@ -0,0 +1,15 @@ +import Foundation + +/// This is the mode for the first message. Default is 'assistant-speaks-first'. +/// +/// Use: +/// - 'assistant-speaks-first' to have the assistant speak first. +/// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. +/// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). +/// +/// @default 'assistant-speaks-first' +public enum AssistantVersionFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantSpeaksFirstWithModelGeneratedMessage = "assistant-speaks-first-with-model-generated-message" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionHooksItem.swift b/Sources/Schemas/AssistantVersionHooksItem.swift new file mode 100644 index 00000000..be6eba70 --- /dev/null +++ b/Sources/Schemas/AssistantVersionHooksItem.swift @@ -0,0 +1,45 @@ +import Foundation + +public enum AssistantVersionHooksItem: Codable, Hashable, Sendable { + case callHookAssistantSpeechInterrupted(CallHookAssistantSpeechInterrupted) + case callHookCallEnding(CallHookCallEnding) + case callHookCustomerSpeechInterrupted(CallHookCustomerSpeechInterrupted) + case callHookCustomerSpeechTimeout(CallHookCustomerSpeechTimeout) + case sessionCreatedHook(SessionCreatedHook) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CallHookAssistantSpeechInterrupted.self) { + self = .callHookAssistantSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCallEnding.self) { + self = .callHookCallEnding(value) + } else if let value = try? container.decode(CallHookCustomerSpeechInterrupted.self) { + self = .callHookCustomerSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCustomerSpeechTimeout.self) { + self = .callHookCustomerSpeechTimeout(value) + } else if let value = try? container.decode(SessionCreatedHook.self) { + self = .sessionCreatedHook(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .callHookAssistantSpeechInterrupted(let value): + try container.encode(value) + case .callHookCallEnding(let value): + try container.encode(value) + case .callHookCustomerSpeechInterrupted(let value): + try container.encode(value) + case .callHookCustomerSpeechTimeout(let value): + try container.encode(value) + case .sessionCreatedHook(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionModel.swift b/Sources/Schemas/AssistantVersionModel.swift new file mode 100644 index 00000000..9d5e4564 --- /dev/null +++ b/Sources/Schemas/AssistantVersionModel.swift @@ -0,0 +1,131 @@ +import Foundation + +/// These are the options for the assistant's LLM. +public enum AssistantVersionModel: Codable, Hashable, Sendable { + case anthropic(AnthropicModel) + case anthropicBedrock(AnthropicBedrockModel) + case anyscale(AnyscaleModel) + case cerebras(CerebrasModel) + case customLlm(CustomLlmModel) + case deepinfra(DeepInfraModel) + case deepSeek(DeepSeekModel) + case google(GoogleModel) + case groq(GroqModel) + case inflectionAi(InflectionAiModel) + case minimax(MinimaxLlmModel) + case openai(OpenAiModel) + case openrouter(OpenRouterModel) + case perplexityAi(PerplexityAiModel) + case togetherAi(TogetherAiModel) + case vapi(VapiModel) + case xai(XaiModel) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try AnthropicModel(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try AnthropicBedrockModel(from: decoder)) + case "anyscale": + self = .anyscale(try AnyscaleModel(from: decoder)) + case "cerebras": + self = .cerebras(try CerebrasModel(from: decoder)) + case "custom-llm": + self = .customLlm(try CustomLlmModel(from: decoder)) + case "deepinfra": + self = .deepinfra(try DeepInfraModel(from: decoder)) + case "deep-seek": + self = .deepSeek(try DeepSeekModel(from: decoder)) + case "google": + self = .google(try GoogleModel(from: decoder)) + case "groq": + self = .groq(try GroqModel(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try InflectionAiModel(from: decoder)) + case "minimax": + self = .minimax(try MinimaxLlmModel(from: decoder)) + case "openai": + self = .openai(try OpenAiModel(from: decoder)) + case "openrouter": + self = .openrouter(try OpenRouterModel(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try PerplexityAiModel(from: decoder)) + case "together-ai": + self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) + case "xai": + self = .xai(try XaiModel(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionPaginatedMetadata.swift b/Sources/Schemas/AssistantVersionPaginatedMetadata.swift new file mode 100644 index 00000000..ff0e99f3 --- /dev/null +++ b/Sources/Schemas/AssistantVersionPaginatedMetadata.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct AssistantVersionPaginatedMetadata: Codable, Hashable, Sendable { + public let nextCursor: Nullable? + public let hasNextPage: Bool + public let limit: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + nextCursor: Nullable? = nil, + hasNextPage: Bool, + limit: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.nextCursor = nextCursor + self.hasNextPage = hasNextPage + self.limit = limit + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.nextCursor = try container.decodeNullableIfPresent(String.self, forKey: .nextCursor) + self.hasNextPage = try container.decode(Bool.self, forKey: .hasNextPage) + self.limit = try container.decode(Double.self, forKey: .limit) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.nextCursor, forKey: .nextCursor) + try container.encode(self.hasNextPage, forKey: .hasNextPage) + try container.encode(self.limit, forKey: .limit) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case nextCursor + case hasNextPage + case limit + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionPaginatedResponse.swift b/Sources/Schemas/AssistantVersionPaginatedResponse.swift index 278778ee..a5fa9aea 100644 --- a/Sources/Schemas/AssistantVersionPaginatedResponse.swift +++ b/Sources/Schemas/AssistantVersionPaginatedResponse.swift @@ -1,29 +1,25 @@ import Foundation public struct AssistantVersionPaginatedResponse: Codable, Hashable, Sendable { - public let results: [JSONValue] - public let metadata: PaginationMeta - public let nextPageState: String? + public let results: [AssistantVersion] + public let metadata: AssistantVersionPaginatedMetadata /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - results: [JSONValue], - metadata: PaginationMeta, - nextPageState: String? = nil, + results: [AssistantVersion], + metadata: AssistantVersionPaginatedMetadata, additionalProperties: [String: JSONValue] = .init() ) { self.results = results self.metadata = metadata - self.nextPageState = nextPageState self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.results = try container.decode([JSONValue].self, forKey: .results) - self.metadata = try container.decode(PaginationMeta.self, forKey: .metadata) - self.nextPageState = try container.decodeIfPresent(String.self, forKey: .nextPageState) + self.results = try container.decode([AssistantVersion].self, forKey: .results) + self.metadata = try container.decode(AssistantVersionPaginatedMetadata.self, forKey: .metadata) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -32,13 +28,11 @@ public struct AssistantVersionPaginatedResponse: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.results, forKey: .results) try container.encode(self.metadata, forKey: .metadata) - try container.encodeIfPresent(self.nextPageState, forKey: .nextPageState) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case results case metadata - case nextPageState } } \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionServerMessagesItem.swift b/Sources/Schemas/AssistantVersionServerMessagesItem.swift new file mode 100644 index 00000000..bc7227d2 --- /dev/null +++ b/Sources/Schemas/AssistantVersionServerMessagesItem.swift @@ -0,0 +1,31 @@ +import Foundation + +public enum AssistantVersionServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case assistantStarted = "assistant.started" + case assistantSpeechStarted = "assistant.speechStarted" + case conversationUpdate = "conversation-update" + case endOfCallReport = "end-of-call-report" + case functionCall = "function-call" + case hang + case languageChanged = "language-changed" + case languageChangeDetected = "language-change-detected" + case modelOutput = "model-output" + case phoneCallControl = "phone-call-control" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case transcriptTranscriptTypeFinal = "transcript[transcriptType=\"final\"]" + case toolCalls = "tool-calls" + case transferDestinationRequest = "transfer-destination-request" + case handoffDestinationRequest = "handoff-destination-request" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case chatCreated = "chat.created" + case chatDeleted = "chat.deleted" + case sessionCreated = "session.created" + case sessionUpdated = "session.updated" + case sessionDeleted = "session.deleted" + case callDeleted = "call.deleted" + case callDeleteFailed = "call.delete.failed" +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionTranscriber.swift b/Sources/Schemas/AssistantVersionTranscriber.swift new file mode 100644 index 00000000..5cefe856 --- /dev/null +++ b/Sources/Schemas/AssistantVersionTranscriber.swift @@ -0,0 +1,113 @@ +import Foundation + +/// These are the options for the assistant's transcriber. +public enum AssistantVersionTranscriber: Codable, Hashable, Sendable { + case assemblyAi(AssemblyAiTranscriber) + case azure(AzureSpeechTranscriber) + case cartesia(CartesiaTranscriber) + case customTranscriber(CustomTranscriber) + case deepgram(DeepgramTranscriber) + case elevenLabs(ElevenLabsTranscriber) + case gladia(GladiaTranscriber) + case google(GoogleTranscriber) + case openai(OpenAiTranscriber) + case soniox(SonioxTranscriber) + case speechmatics(SpeechmaticsTranscriber) + case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "assembly-ai": + self = .assemblyAi(try AssemblyAiTranscriber(from: decoder)) + case "azure": + self = .azure(try AzureSpeechTranscriber(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaTranscriber(from: decoder)) + case "custom-transcriber": + self = .customTranscriber(try CustomTranscriber(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramTranscriber(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsTranscriber(from: decoder)) + case "gladia": + self = .gladia(try GladiaTranscriber(from: decoder)) + case "google": + self = .google(try GoogleTranscriber(from: decoder)) + case "openai": + self = .openai(try OpenAiTranscriber(from: decoder)) + case "soniox": + self = .soniox(try SonioxTranscriber(from: decoder)) + case "speechmatics": + self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) + case "talkscriber": + self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customTranscriber(let data): + try container.encode("custom-transcriber", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .talkscriber(let data): + try container.encode("talkscriber", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionVoice.swift b/Sources/Schemas/AssistantVersionVoice.swift new file mode 100644 index 00000000..e51e7cd6 --- /dev/null +++ b/Sources/Schemas/AssistantVersionVoice.swift @@ -0,0 +1,149 @@ +import Foundation + +/// These are the options for the assistant's voice. +public enum AssistantVersionVoice: Codable, Hashable, Sendable { + case azure(AzureVoice) + case cartesia(CartesiaVoice) + case customVoice(CustomVoice) + case deepgram(DeepgramVoice) + case elevenLabs(ElevenLabsVoice) + case hume(HumeVoice) + case inworld(InworldVoice) + case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) + case minimax(MinimaxVoice) + case neuphonic(NeuphonicVoice) + case openai(OpenAiVoice) + case playht(PlayHtVoice) + case rimeAi(RimeAiVoice) + case sesame(SesameVoice) + case smallestAi(SmallestAiVoice) + case tavus(TavusVoice) + case vapi(VapiVoice) + case wellsaid(WellSaidVoice) + case xai(XaiVoice) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "azure": + self = .azure(try AzureVoice(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaVoice(from: decoder)) + case "custom-voice": + self = .customVoice(try CustomVoice(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramVoice(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsVoice(from: decoder)) + case "hume": + self = .hume(try HumeVoice(from: decoder)) + case "inworld": + self = .inworld(try InworldVoice(from: decoder)) + case "lmnt": + self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) + case "minimax": + self = .minimax(try MinimaxVoice(from: decoder)) + case "neuphonic": + self = .neuphonic(try NeuphonicVoice(from: decoder)) + case "openai": + self = .openai(try OpenAiVoice(from: decoder)) + case "playht": + self = .playht(try PlayHtVoice(from: decoder)) + case "rime-ai": + self = .rimeAi(try RimeAiVoice(from: decoder)) + case "sesame": + self = .sesame(try SesameVoice(from: decoder)) + case "smallest-ai": + self = .smallestAi(try SmallestAiVoice(from: decoder)) + case "tavus": + self = .tavus(try TavusVoice(from: decoder)) + case "vapi": + self = .vapi(try VapiVoice(from: decoder)) + case "wellsaid": + self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customVoice(let data): + try container.encode("custom-voice", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .sesame(let data): + try container.encode("sesame", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionVoicemailDetection.swift b/Sources/Schemas/AssistantVersionVoicemailDetection.swift new file mode 100644 index 00000000..a57638b5 --- /dev/null +++ b/Sources/Schemas/AssistantVersionVoicemailDetection.swift @@ -0,0 +1,47 @@ +import Foundation + +/// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. +/// By default, voicemail detection is disabled. +public enum AssistantVersionVoicemailDetection: Codable, Hashable, Sendable { + case assistantVersionVoicemailDetectionZero(AssistantVersionVoicemailDetectionZero) + case googleVoicemailDetectionPlan(GoogleVoicemailDetectionPlan) + case openAiVoicemailDetectionPlan(OpenAiVoicemailDetectionPlan) + case twilioVoicemailDetectionPlan(TwilioVoicemailDetectionPlan) + case vapiVoicemailDetectionPlan(VapiVoicemailDetectionPlan) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AssistantVersionVoicemailDetectionZero.self) { + self = .assistantVersionVoicemailDetectionZero(value) + } else if let value = try? container.decode(GoogleVoicemailDetectionPlan.self) { + self = .googleVoicemailDetectionPlan(value) + } else if let value = try? container.decode(OpenAiVoicemailDetectionPlan.self) { + self = .openAiVoicemailDetectionPlan(value) + } else if let value = try? container.decode(TwilioVoicemailDetectionPlan.self) { + self = .twilioVoicemailDetectionPlan(value) + } else if let value = try? container.decode(VapiVoicemailDetectionPlan.self) { + self = .vapiVoicemailDetectionPlan(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .assistantVersionVoicemailDetectionZero(let value): + try container.encode(value) + case .googleVoicemailDetectionPlan(let value): + try container.encode(value) + case .openAiVoicemailDetectionPlan(let value): + try container.encode(value) + case .twilioVoicemailDetectionPlan(let value): + try container.encode(value) + case .vapiVoicemailDetectionPlan(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVersionVoicemailDetectionZero.swift b/Sources/Schemas/AssistantVersionVoicemailDetectionZero.swift new file mode 100644 index 00000000..a0471a9f --- /dev/null +++ b/Sources/Schemas/AssistantVersionVoicemailDetectionZero.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum AssistantVersionVoicemailDetectionZero: String, Codable, Hashable, CaseIterable, Sendable { + case off +} \ No newline at end of file diff --git a/Sources/Schemas/AssistantVoice.swift b/Sources/Schemas/AssistantVoice.swift index 808b8fe6..9754914b 100644 --- a/Sources/Schemas/AssistantVoice.swift +++ b/Sources/Schemas/AssistantVoice.swift @@ -10,6 +10,7 @@ public enum AssistantVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -20,6 +21,7 @@ public enum AssistantVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -41,6 +43,8 @@ public enum AssistantVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -61,6 +65,8 @@ public enum AssistantVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -98,6 +104,9 @@ public enum AssistantVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -128,6 +137,9 @@ public enum AssistantVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/AudioFormat.swift b/Sources/Schemas/AudioFormat.swift new file mode 100644 index 00000000..a4400369 --- /dev/null +++ b/Sources/Schemas/AudioFormat.swift @@ -0,0 +1,53 @@ +import Foundation + +public struct AudioFormat: Codable, Hashable, Sendable { + /// This is the sample rate of the call. + /// + /// @default 16000 + public let sampleRate: Double + /// This is the audio format of the call. + /// + /// @default 'pcm_s16le' + public let format: [String: JSONValue] + /// This is the container format of the call. + /// + /// @default 'raw' + public let container: AudioFormatContainer? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + sampleRate: Double, + format: [String: JSONValue], + container: AudioFormatContainer? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.sampleRate = sampleRate + self.format = format + self.container = container + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.sampleRate = try container.decode(Double.self, forKey: .sampleRate) + self.format = try container.decode([String: JSONValue].self, forKey: .format) + self.container = try container.decodeIfPresent(AudioFormatContainer.self, forKey: .container) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.sampleRate, forKey: .sampleRate) + try container.encode(self.format, forKey: .format) + try container.encodeIfPresent(self.container, forKey: .container) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case sampleRate + case format + case container + } +} \ No newline at end of file diff --git a/Sources/Schemas/AudioFormatContainer.swift b/Sources/Schemas/AudioFormatContainer.swift new file mode 100644 index 00000000..3e0adefd --- /dev/null +++ b/Sources/Schemas/AudioFormatContainer.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the container format of the call. +/// +/// @default 'raw' +public enum AudioFormatContainer: String, Codable, Hashable, CaseIterable, Sendable { + case raw +} \ No newline at end of file diff --git a/Sources/Schemas/AwsStsAuthenticationPlan.swift b/Sources/Schemas/AwsStsAuthenticationPlan.swift index 3c8ff4d6..c2e6c98b 100644 --- a/Sources/Schemas/AwsStsAuthenticationPlan.swift +++ b/Sources/Schemas/AwsStsAuthenticationPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// AWS Security Token Service role-assumption configuration used to authenticate requests. public struct AwsStsAuthenticationPlan: Codable, Hashable, Sendable { /// This is the role ARN for the AWS credential public let roleArn: String diff --git a/Sources/Schemas/AwsiamCredentialsAuthenticationPlan.swift b/Sources/Schemas/AwsiamCredentialsAuthenticationPlan.swift index 78b167b0..4eeee394 100644 --- a/Sources/Schemas/AwsiamCredentialsAuthenticationPlan.swift +++ b/Sources/Schemas/AwsiamCredentialsAuthenticationPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Direct AWS IAM credentials used to authenticate requests. public struct AwsiamCredentialsAuthenticationPlan: Codable, Hashable, Sendable { /// AWS Access Key ID. This is not returned in the API. public let awsAccessKeyId: String diff --git a/Sources/Schemas/AzureBlobStorageBucketPlan.swift b/Sources/Schemas/AzureBlobStorageBucketPlan.swift index 51cb3abf..3f35171c 100644 --- a/Sources/Schemas/AzureBlobStorageBucketPlan.swift +++ b/Sources/Schemas/AzureBlobStorageBucketPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Azure Blob Storage container configuration for call artifacts, including its connection string, container name, and storage path. public struct AzureBlobStorageBucketPlan: Codable, Hashable, Sendable { /// This is the blob storage connection string for the Azure resource. public let connectionString: String diff --git a/Sources/Schemas/AzureCredentialRegion.swift b/Sources/Schemas/AzureCredentialRegion.swift index 7b79bd50..acfe8519 100644 --- a/Sources/Schemas/AzureCredentialRegion.swift +++ b/Sources/Schemas/AzureCredentialRegion.swift @@ -20,6 +20,8 @@ public enum AzureCredentialRegion: String, Codable, Hashable, CaseIterable, Send case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/AzureOpenAiCredentialModelsItem.swift b/Sources/Schemas/AzureOpenAiCredentialModelsItem.swift index 8efba3aa..a1236c8c 100644 --- a/Sources/Schemas/AzureOpenAiCredentialModelsItem.swift +++ b/Sources/Schemas/AzureOpenAiCredentialModelsItem.swift @@ -24,4 +24,7 @@ public enum AzureOpenAiCredentialModelsItem: String, Codable, Hashable, CaseIter case gpt40613 = "gpt-4-0613" case gpt35Turbo0125 = "gpt-35-turbo-0125" case gpt35Turbo1106 = "gpt-35-turbo-1106" + case gpt4O = "gpt-4o" + case gpt41 = "gpt-4.1" + case gpt54Mini20260317 = "gpt-5.4-mini-2026-03-17" } \ No newline at end of file diff --git a/Sources/Schemas/AzureOpenAiCredentialRegion.swift b/Sources/Schemas/AzureOpenAiCredentialRegion.swift index bfec3690..ccd97c34 100644 --- a/Sources/Schemas/AzureOpenAiCredentialRegion.swift +++ b/Sources/Schemas/AzureOpenAiCredentialRegion.swift @@ -19,6 +19,8 @@ public enum AzureOpenAiCredentialRegion: String, Codable, Hashable, CaseIterable case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/AzureSpeechTranscriber.swift b/Sources/Schemas/AzureSpeechTranscriber.swift index 3e21e08f..5f80ab6d 100644 --- a/Sources/Schemas/AzureSpeechTranscriber.swift +++ b/Sources/Schemas/AzureSpeechTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Azure Speech, including language, segmentation, and fallback settings. public struct AzureSpeechTranscriber: Codable, Hashable, Sendable { /// This is the language that will be set for the transcription. The list of languages Azure supports can be found here: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt public let language: AzureSpeechTranscriberLanguage? diff --git a/Sources/Schemas/AzureVoice.swift b/Sources/Schemas/AzureVoice.swift index c1ac304b..c6004a9d 100644 --- a/Sources/Schemas/AzureVoice.swift +++ b/Sources/Schemas/AzureVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Azure, including voice selection, speed, chunking, caching, and fallback settings. public struct AzureVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/BackgroundSpeechDenoisingPlan.swift b/Sources/Schemas/BackgroundSpeechDenoisingPlan.swift index e2ff972e..173250ff 100644 --- a/Sources/Schemas/BackgroundSpeechDenoisingPlan.swift +++ b/Sources/Schemas/BackgroundSpeechDenoisingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls smart and Fourier denoising applied to customer audio before transcription. public struct BackgroundSpeechDenoisingPlan: Codable, Hashable, Sendable { /// Whether smart denoising using Krisp is enabled. public let smartDenoisingPlan: SmartDenoisingPlan? diff --git a/Sources/Schemas/BackoffPlan.swift b/Sources/Schemas/BackoffPlan.swift index 3a18444b..75d7fdd4 100644 --- a/Sources/Schemas/BackoffPlan.swift +++ b/Sources/Schemas/BackoffPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls retry behavior for failed server requests, including strategy, maximum retries, base delay, and status codes excluded from retries. public struct BackoffPlan: Codable, Hashable, Sendable { /// This is the type of backoff plan to use. Defaults to fixed. /// @@ -9,10 +10,9 @@ public struct BackoffPlan: Codable, Hashable, Sendable { /// /// @default 0 public let maxRetries: Double - /// This is the base delay in seconds. For linear backoff, this is the delay between each retry. For exponential backoff, this is the initial delay. + /// Base delay in seconds. For fixed backoff, this is the delay between retries. For exponential backoff, this is the initial delay. public let baseDelaySeconds: Double - /// This is the excluded status codes. If the response status code is in this list, the request will not be retried. - /// By default, the request will be retried for any non-2xx status code. + /// HTTP status codes that should not trigger a retry. By default, any non-2xx status code not listed here can be retried. public let excludedStatusCodes: [[String: JSONValue]]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/BarInsight.swift b/Sources/Schemas/BarInsight.swift index 80826bb0..42a9b41a 100644 --- a/Sources/Schemas/BarInsight.swift +++ b/Sources/Schemas/BarInsight.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved bar-chart insight containing its call-data queries, formulas, grouping, stepped time range, metadata, and lifecycle information. public struct BarInsight: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct BarInsight: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: BarInsightMetadata? + /// The time range and interval used to aggregate the bar-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. @@ -36,6 +38,8 @@ public struct BarInsight: Codable, Hashable, Sendable { public let createdAt: Date /// This is the ISO 8601 date-time string of when the Insight was last updated. public let updatedAt: Date + /// Stable server-owned identifier for system-created insights. + public let systemKey: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -50,6 +54,7 @@ public struct BarInsight: Codable, Hashable, Sendable { orgId: String, createdAt: Date, updatedAt: Date, + systemKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name @@ -62,6 +67,7 @@ public struct BarInsight: Codable, Hashable, Sendable { self.orgId = orgId self.createdAt = createdAt self.updatedAt = updatedAt + self.systemKey = systemKey self.additionalProperties = additionalProperties } @@ -77,6 +83,7 @@ public struct BarInsight: Codable, Hashable, Sendable { self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -93,6 +100,7 @@ public struct BarInsight: Codable, Hashable, Sendable { try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) } /// Keys for encoding/decoding struct properties. @@ -107,5 +115,6 @@ public struct BarInsight: Codable, Hashable, Sendable { case orgId case createdAt case updatedAt + case systemKey } } \ No newline at end of file diff --git a/Sources/Schemas/BarInsightMetadata.swift b/Sources/Schemas/BarInsightMetadata.swift index d98b620f..ebe43c22 100644 --- a/Sources/Schemas/BarInsightMetadata.swift +++ b/Sources/Schemas/BarInsightMetadata.swift @@ -1,10 +1,16 @@ import Foundation +/// Display settings for a bar insight, including chart name, axis labels, and optional y-axis bounds. public struct BarInsightMetadata: Codable, Hashable, Sendable { + /// Label displayed on the chart's x-axis. public let xAxisLabel: String? + /// Label displayed on the chart's y-axis. public let yAxisLabel: String? + /// Minimum value displayed on the chart's y-axis. public let yAxisMin: Double? + /// Maximum value displayed on the chart's y-axis. public let yAxisMax: Double? + /// Display name for the insight chart. public let name: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/BashTool.swift b/Sources/Schemas/BashTool.swift index b43fac68..30605ef2 100644 --- a/Sources/Schemas/BashTool.swift +++ b/Sources/Schemas/BashTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that executes shell commands in a configured environment. public struct BashTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [BashToolMessagesItem]? /// The sub type of tool. public let subType: BashToolSubType @@ -110,6 +110,7 @@ public struct BashTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [BashToolMessagesItem]? = nil, subType: BashToolSubType, server: Server? = nil, @@ -121,6 +122,7 @@ public struct BashTool: Codable, Hashable, Sendable { name: BashToolName, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.subType = subType self.server = server @@ -135,6 +137,7 @@ public struct BashTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([BashToolMessagesItem].self, forKey: .messages) self.subType = try container.decode(BashToolSubType.self, forKey: .subType) self.server = try container.decodeIfPresent(Server.self, forKey: .server) @@ -150,6 +153,7 @@ public struct BashTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.subType, forKey: .subType) try container.encodeIfPresent(self.server, forKey: .server) @@ -163,6 +167,7 @@ public struct BashTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case subType case server diff --git a/Sources/Schemas/BashToolWithToolCall.swift b/Sources/Schemas/BashToolWithToolCall.swift index fedf1e8b..4f83f303 100644 --- a/Sources/Schemas/BashToolWithToolCall.swift +++ b/Sources/Schemas/BashToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct BashToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [BashToolWithToolCallMessagesItem]? /// The sub type of tool. public let subType: BashToolWithToolCallSubType diff --git a/Sources/Schemas/BearerAuthenticationPlan.swift b/Sources/Schemas/BearerAuthenticationPlan.swift index 01b48e51..ddb6b9a9 100644 --- a/Sources/Schemas/BearerAuthenticationPlan.swift +++ b/Sources/Schemas/BearerAuthenticationPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for authenticating outbound requests with a bearer token, including header name and optional `Bearer` prefix. public struct BearerAuthenticationPlan: Codable, Hashable, Sendable { /// This is the bearer token value. public let token: String diff --git a/Sources/Schemas/Board.swift b/Sources/Schemas/Board.swift new file mode 100644 index 00000000..3c8ba436 --- /dev/null +++ b/Sources/Schemas/Board.swift @@ -0,0 +1,92 @@ +import Foundation + +public struct Board: Codable, Hashable, Sendable { + /// This is the contents of the Board, which is an array of objects defining the type, contents, and position of the widgets on the Board. + public let items: [BoardItemsItem]? + /// This is the unique identifier for the Board. + public let id: String + /// This is the unique identifier for the org that this Board belongs to. + public let orgId: String + /// This is the ISO 8601 date-time string of when the Board was created. + public let createdAt: Date + /// This is the ISO 8601 date-time string of when the Board was last updated. + public let updatedAt: Date + /// Server-owned key for system-provisioned boards. User create/update DTOs do + /// not accept this field. + public let systemKey: String? + /// This is the name of the Board. + public let name: String + /// This is the layout of the Board. + public let layout: BoardLayout + /// This is the timerange override for the board. + /// By default, individual insights have their own timerange. + /// This is a global override for the board which will be passed to all insights on the board. + public let timeRangeOverride: InsightTimeRangeWithStep? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + items: [BoardItemsItem]? = nil, + id: String, + orgId: String, + createdAt: Date, + updatedAt: Date, + systemKey: String? = nil, + name: String, + layout: BoardLayout, + timeRangeOverride: InsightTimeRangeWithStep? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.items = items + self.id = id + self.orgId = orgId + self.createdAt = createdAt + self.updatedAt = updatedAt + self.systemKey = systemKey + self.name = name + self.layout = layout + self.timeRangeOverride = timeRangeOverride + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.items = try container.decodeIfPresent([BoardItemsItem].self, forKey: .items) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) + self.name = try container.decode(String.self, forKey: .name) + self.layout = try container.decode(BoardLayout.self, forKey: .layout) + self.timeRangeOverride = try container.decodeIfPresent(InsightTimeRangeWithStep.self, forKey: .timeRangeOverride) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.items, forKey: .items) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) + try container.encode(self.name, forKey: .name) + try container.encode(self.layout, forKey: .layout) + try container.encodeIfPresent(self.timeRangeOverride, forKey: .timeRangeOverride) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case items + case id + case orgId + case createdAt + case updatedAt + case systemKey + case name + case layout + case timeRangeOverride + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardControllerFindAllRequestSortBy.swift b/Sources/Schemas/BoardControllerFindAllRequestSortBy.swift new file mode 100644 index 00000000..a6856760 --- /dev/null +++ b/Sources/Schemas/BoardControllerFindAllRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum BoardControllerFindAllRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/BoardControllerFindAllRequestSortOrder.swift b/Sources/Schemas/BoardControllerFindAllRequestSortOrder.swift new file mode 100644 index 00000000..1533b0e7 --- /dev/null +++ b/Sources/Schemas/BoardControllerFindAllRequestSortOrder.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum BoardControllerFindAllRequestSortOrder: String, Codable, Hashable, CaseIterable, Sendable { + case asc = "ASC" + case desc = "DESC" +} \ No newline at end of file diff --git a/Sources/Schemas/BoardInsightItem.swift b/Sources/Schemas/BoardInsightItem.swift new file mode 100644 index 00000000..5c3fd2c6 --- /dev/null +++ b/Sources/Schemas/BoardInsightItem.swift @@ -0,0 +1,56 @@ +import Foundation + +public struct BoardInsightItem: Codable, Hashable, Sendable { + public let type: BoardInsightItemType + public let insightId: String + public let systemKey: String? + public let position: BoardItemPosition + public let size: BoardItemSize + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + type: BoardInsightItemType, + insightId: String, + systemKey: String? = nil, + position: BoardItemPosition, + size: BoardItemSize, + additionalProperties: [String: JSONValue] = .init() + ) { + self.type = type + self.insightId = insightId + self.systemKey = systemKey + self.position = position + self.size = size + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decode(BoardInsightItemType.self, forKey: .type) + self.insightId = try container.decode(String.self, forKey: .insightId) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) + self.position = try container.decode(BoardItemPosition.self, forKey: .position) + self.size = try container.decode(BoardItemSize.self, forKey: .size) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.type, forKey: .type) + try container.encode(self.insightId, forKey: .insightId) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) + try container.encode(self.position, forKey: .position) + try container.encode(self.size, forKey: .size) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case type + case insightId + case systemKey + case position + case size + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardInsightItemType.swift b/Sources/Schemas/BoardInsightItemType.swift new file mode 100644 index 00000000..4bc5350e --- /dev/null +++ b/Sources/Schemas/BoardInsightItemType.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum BoardInsightItemType: String, Codable, Hashable, CaseIterable, Sendable { + case insight +} \ No newline at end of file diff --git a/Sources/Schemas/BoardItemPosition.swift b/Sources/Schemas/BoardItemPosition.swift new file mode 100644 index 00000000..5ba1ae3b --- /dev/null +++ b/Sources/Schemas/BoardItemPosition.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct BoardItemPosition: Codable, Hashable, Sendable { + public let x: Double + public let y: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + x: Double, + y: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.x = x + self.y = y + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.x = try container.decode(Double.self, forKey: .x) + self.y = try container.decode(Double.self, forKey: .y) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.x, forKey: .x) + try container.encode(self.y, forKey: .y) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case x + case y + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardItemSize.swift b/Sources/Schemas/BoardItemSize.swift new file mode 100644 index 00000000..741ac069 --- /dev/null +++ b/Sources/Schemas/BoardItemSize.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct BoardItemSize: Codable, Hashable, Sendable { + public let width: Double + public let height: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + width: Double, + height: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.width = width + self.height = height + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.width = try container.decode(Double.self, forKey: .width) + self.height = try container.decode(Double.self, forKey: .height) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.width, forKey: .width) + try container.encode(self.height, forKey: .height) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case width + case height + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardItemsItem.swift b/Sources/Schemas/BoardItemsItem.swift new file mode 100644 index 00000000..668abafa --- /dev/null +++ b/Sources/Schemas/BoardItemsItem.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum BoardItemsItem: Codable, Hashable, Sendable { + case boardInsightItem(BoardInsightItem) + case boardMetricWidgetItem(BoardMetricWidgetItem) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(BoardInsightItem.self) { + self = .boardInsightItem(value) + } else if let value = try? container.decode(BoardMetricWidgetItem.self) { + self = .boardMetricWidgetItem(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .boardInsightItem(let value): + try container.encode(value) + case .boardMetricWidgetItem(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardLayout.swift b/Sources/Schemas/BoardLayout.swift new file mode 100644 index 00000000..9dbd02e0 --- /dev/null +++ b/Sources/Schemas/BoardLayout.swift @@ -0,0 +1,34 @@ +import Foundation + +public struct BoardLayout: Codable, Hashable, Sendable { + /// This is the number of columns in the Board. + /// For now, it is fixed to 6. + public let columns: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + columns: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.columns = columns + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.columns = try container.decode(Double.self, forKey: .columns) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.columns, forKey: .columns) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case columns + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardMetricWidgetItem.swift b/Sources/Schemas/BoardMetricWidgetItem.swift new file mode 100644 index 00000000..b6c143fc --- /dev/null +++ b/Sources/Schemas/BoardMetricWidgetItem.swift @@ -0,0 +1,56 @@ +import Foundation + +public struct BoardMetricWidgetItem: Codable, Hashable, Sendable { + public let type: BoardMetricWidgetItemType + public let position: BoardItemPosition + public let size: BoardItemSize + public let insightId: String? + public let systemKey: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + type: BoardMetricWidgetItemType, + position: BoardItemPosition, + size: BoardItemSize, + insightId: String? = nil, + systemKey: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.type = type + self.position = position + self.size = size + self.insightId = insightId + self.systemKey = systemKey + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decode(BoardMetricWidgetItemType.self, forKey: .type) + self.position = try container.decode(BoardItemPosition.self, forKey: .position) + self.size = try container.decode(BoardItemSize.self, forKey: .size) + self.insightId = try container.decodeIfPresent(String.self, forKey: .insightId) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.type, forKey: .type) + try container.encode(self.position, forKey: .position) + try container.encode(self.size, forKey: .size) + try container.encodeIfPresent(self.insightId, forKey: .insightId) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case type + case position + case size + case insightId + case systemKey + } +} \ No newline at end of file diff --git a/Sources/Schemas/BoardMetricWidgetItemType.swift b/Sources/Schemas/BoardMetricWidgetItemType.swift new file mode 100644 index 00000000..57327722 --- /dev/null +++ b/Sources/Schemas/BoardMetricWidgetItemType.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum BoardMetricWidgetItemType: String, Codable, Hashable, CaseIterable, Sendable { + case failedCallsList = "failed_calls_list" + case concurrencyChart = "concurrency_chart" + case averageCostBreakdownChart = "average_cost_breakdown_chart" +} \ No newline at end of file diff --git a/Sources/Schemas/BoardPaginatedResponse.swift b/Sources/Schemas/BoardPaginatedResponse.swift new file mode 100644 index 00000000..0438989f --- /dev/null +++ b/Sources/Schemas/BoardPaginatedResponse.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct BoardPaginatedResponse: Codable, Hashable, Sendable { + public let results: [Board] + public let metadata: PaginationMeta + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + results: [Board], + metadata: PaginationMeta, + additionalProperties: [String: JSONValue] = .init() + ) { + self.results = results + self.metadata = metadata + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.results = try container.decode([Board].self, forKey: .results) + self.metadata = try container.decode(PaginationMeta.self, forKey: .metadata) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.results, forKey: .results) + try container.encode(self.metadata, forKey: .metadata) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case results + case metadata + } +} \ No newline at end of file diff --git a/Sources/Schemas/BooleanComparatorScorecardMetricCondition.swift b/Sources/Schemas/BooleanComparatorScorecardMetricCondition.swift new file mode 100644 index 00000000..ddffb05c --- /dev/null +++ b/Sources/Schemas/BooleanComparatorScorecardMetricCondition.swift @@ -0,0 +1,56 @@ +import Foundation + +public struct BooleanComparatorScorecardMetricCondition: Codable, Hashable, Sendable { + /// This is the type of the condition. Currently only 'comparator' is supported. + public let type: BooleanComparatorScorecardMetricConditionType + /// The comparator can only be '=' for boolean conditions. + public let comparator: BooleanComparatorScorecardMetricConditionComparator + /// This is the value that will be used to compare the result of the structured output with the comparator. + /// If the result of the comparison is true, the points will be added to the overall score. + public let value: Bool + /// These are the points that will be added to the overall score if the condition is met. + /// The points must be between 0 and 100. + public let points: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + type: BooleanComparatorScorecardMetricConditionType, + comparator: BooleanComparatorScorecardMetricConditionComparator, + value: Bool, + points: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.type = type + self.comparator = comparator + self.value = value + self.points = points + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decode(BooleanComparatorScorecardMetricConditionType.self, forKey: .type) + self.comparator = try container.decode(BooleanComparatorScorecardMetricConditionComparator.self, forKey: .comparator) + self.value = try container.decode(Bool.self, forKey: .value) + self.points = try container.decode(Double.self, forKey: .points) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.type, forKey: .type) + try container.encode(self.comparator, forKey: .comparator) + try container.encode(self.value, forKey: .value) + try container.encode(self.points, forKey: .points) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case type + case comparator + case value + case points + } +} \ No newline at end of file diff --git a/Sources/Schemas/BooleanComparatorScorecardMetricConditionComparator.swift b/Sources/Schemas/BooleanComparatorScorecardMetricConditionComparator.swift new file mode 100644 index 00000000..6d6e07a0 --- /dev/null +++ b/Sources/Schemas/BooleanComparatorScorecardMetricConditionComparator.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The comparator can only be '=' for boolean conditions. +public enum BooleanComparatorScorecardMetricConditionComparator: String, Codable, Hashable, CaseIterable, Sendable { + case equalTo = "=" +} \ No newline at end of file diff --git a/Sources/Schemas/BooleanComparatorScorecardMetricConditionType.swift b/Sources/Schemas/BooleanComparatorScorecardMetricConditionType.swift new file mode 100644 index 00000000..502d95b0 --- /dev/null +++ b/Sources/Schemas/BooleanComparatorScorecardMetricConditionType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the type of the condition. Currently only 'comparator' is supported. +public enum BooleanComparatorScorecardMetricConditionType: String, Codable, Hashable, CaseIterable, Sendable { + case comparator +} \ No newline at end of file diff --git a/Sources/Schemas/BotMessage.swift b/Sources/Schemas/BotMessage.swift index eac33121..62d7bf24 100644 --- a/Sources/Schemas/BotMessage.swift +++ b/Sources/Schemas/BotMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// An assistant-authored entry in the call message history, including content, timing, source, and duration. public struct BotMessage: Codable, Hashable, Sendable { /// The role of the bot in the conversation. public let role: String @@ -15,6 +16,13 @@ public struct BotMessage: Codable, Hashable, Sendable { public let source: String? /// The duration of the message in seconds. public let duration: Double? + /// The name of the assistant that produced this message. In a squad or + /// handoff call this is the specific sub-agent active when the message was + /// spoken, letting the transcript label each message by speaker. + public let assistantName: String? + /// The ID of the assistant that produced this message. Stable reference for + /// the assistant named in `assistantName`. + public let assistantId: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -26,6 +34,8 @@ public struct BotMessage: Codable, Hashable, Sendable { secondsFromStart: Double, source: String? = nil, duration: Double? = nil, + assistantName: String? = nil, + assistantId: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.role = role @@ -35,6 +45,8 @@ public struct BotMessage: Codable, Hashable, Sendable { self.secondsFromStart = secondsFromStart self.source = source self.duration = duration + self.assistantName = assistantName + self.assistantId = assistantId self.additionalProperties = additionalProperties } @@ -47,6 +59,8 @@ public struct BotMessage: Codable, Hashable, Sendable { self.secondsFromStart = try container.decode(Double.self, forKey: .secondsFromStart) self.source = try container.decodeIfPresent(String.self, forKey: .source) self.duration = try container.decodeIfPresent(Double.self, forKey: .duration) + self.assistantName = try container.decodeIfPresent(String.self, forKey: .assistantName) + self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -60,6 +74,8 @@ public struct BotMessage: Codable, Hashable, Sendable { try container.encode(self.secondsFromStart, forKey: .secondsFromStart) try container.encodeIfPresent(self.source, forKey: .source) try container.encodeIfPresent(self.duration, forKey: .duration) + try container.encodeIfPresent(self.assistantName, forKey: .assistantName) + try container.encodeIfPresent(self.assistantId, forKey: .assistantId) } /// Keys for encoding/decoding struct properties. @@ -71,5 +87,7 @@ public struct BotMessage: Codable, Hashable, Sendable { case secondsFromStart case source case duration + case assistantName + case assistantId } } \ No newline at end of file diff --git a/Sources/Schemas/BothCustomEndpointingRule.swift b/Sources/Schemas/BothCustomEndpointingRule.swift index e9d992a8..01520f48 100644 --- a/Sources/Schemas/BothCustomEndpointingRule.swift +++ b/Sources/Schemas/BothCustomEndpointingRule.swift @@ -1,5 +1,6 @@ import Foundation +/// A custom endpointing rule that matches both the assistant's last message and the customer's current speech before applying a configured timeout. public struct BothCustomEndpointingRule: Codable, Hashable, Sendable { /// This is the regex pattern to match the assistant's message. /// @@ -14,6 +15,7 @@ public struct BothCustomEndpointingRule: Codable, Hashable, Sendable { /// /// @default [] public let assistantRegexOptions: [RegexOption]? + /// The regular expression pattern matched against the customer's speech. public let customerRegex: String /// These are the options for the customer's message regex match. Defaults to all disabled. /// diff --git a/Sources/Schemas/BucketPlan.swift b/Sources/Schemas/BucketPlan.swift index a3f62146..5be74d4a 100644 --- a/Sources/Schemas/BucketPlan.swift +++ b/Sources/Schemas/BucketPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Google Cloud Storage bucket configuration for call artifacts, including bucket name, region, path, and optional HMAC credentials. public struct BucketPlan: Codable, Hashable, Sendable { /// This is the name of the bucket. public let name: String diff --git a/Sources/Schemas/ByoPhoneNumber.swift b/Sources/Schemas/ByoPhoneNumber.swift index 3026f46a..3182f937 100644 --- a/Sources/Schemas/ByoPhoneNumber.swift +++ b/Sources/Schemas/ByoPhoneNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// A phone number connected to Vapi through a bring-your-own telephony provider, including its credential, routing, hooks, server settings, and lifecycle metadata. public struct ByoPhoneNumber: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/ByoSipTrunkCredential.swift b/Sources/Schemas/ByoSipTrunkCredential.swift index 98a6d7df..162fc67a 100644 --- a/Sources/Schemas/ByoSipTrunkCredential.swift +++ b/Sources/Schemas/ByoSipTrunkCredential.swift @@ -28,8 +28,6 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { public let techPrefix: String? /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. public let sipDiversionHeader: String? - /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. - public let sbcConfiguration: SbcConfiguration? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -45,7 +43,6 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { outboundLeadingPlusEnabled: Bool? = nil, techPrefix: String? = nil, sipDiversionHeader: String? = nil, - sbcConfiguration: SbcConfiguration? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.provider = provider @@ -59,7 +56,6 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { self.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled self.techPrefix = techPrefix self.sipDiversionHeader = sipDiversionHeader - self.sbcConfiguration = sbcConfiguration self.additionalProperties = additionalProperties } @@ -76,7 +72,6 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { self.outboundLeadingPlusEnabled = try container.decodeIfPresent(Bool.self, forKey: .outboundLeadingPlusEnabled) self.techPrefix = try container.decodeIfPresent(String.self, forKey: .techPrefix) self.sipDiversionHeader = try container.decodeIfPresent(String.self, forKey: .sipDiversionHeader) - self.sbcConfiguration = try container.decodeIfPresent(SbcConfiguration.self, forKey: .sbcConfiguration) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -94,7 +89,6 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { try container.encodeIfPresent(self.outboundLeadingPlusEnabled, forKey: .outboundLeadingPlusEnabled) try container.encodeIfPresent(self.techPrefix, forKey: .techPrefix) try container.encodeIfPresent(self.sipDiversionHeader, forKey: .sipDiversionHeader) - try container.encodeIfPresent(self.sbcConfiguration, forKey: .sbcConfiguration) } /// Keys for encoding/decoding struct properties. @@ -110,6 +104,5 @@ public struct ByoSipTrunkCredential: Codable, Hashable, Sendable { case outboundLeadingPlusEnabled case techPrefix case sipDiversionHeader - case sbcConfiguration } } \ No newline at end of file diff --git a/Sources/Schemas/Call.swift b/Sources/Schemas/Call.swift index 32cae0c4..75b97d2b 100644 --- a/Sources/Schemas/Call.swift +++ b/Sources/Schemas/Call.swift @@ -1,10 +1,12 @@ import Foundation +/// A call record returned by Vapi. It contains the configuration and resources used for the call, its lifecycle status and timestamps, conversation messages, artifacts, analysis, and costs. public struct Call: Codable, Hashable, Sendable { /// This is the type of call. public let type: CallType? /// These are the costs of individual components of the call in USD. public let costs: [CallCostsItem]? + /// Messages exchanged during the call, including user, assistant, system, tool-call, and tool-result messages. public let messages: [CallMessagesItem]? /// This is the provider of the call. /// @@ -22,6 +24,11 @@ public struct Call: Codable, Hashable, Sendable { public let endedMessage: String? /// This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty. public let destination: CallDestination? + /// This is the assistant version to use for this call. Supported only with + /// direct `assistantId`. Omit to follow the latest version. + public let assistantVersion: Nullable? + /// This is the transport of the call. + public let transport: CallTransport? /// This is the unique identifier for the call. public let id: String /// This is the unique identifier for the org that this call belongs to. @@ -123,10 +130,6 @@ public struct Call: Codable, Hashable, Sendable { public let name: String? /// This is the schedule plan of the call. public let schedulePlan: SchedulePlan? - /// This is the transport of the call. - public let transport: [String: JSONValue]? - /// These are the subscription limits for the org at the time of the call. Includes concurrency limit information. - public let subscriptionLimits: SubscriptionLimits? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -140,6 +143,8 @@ public struct Call: Codable, Hashable, Sendable { endedReason: CallEndedReason? = nil, endedMessage: String? = nil, destination: CallDestination? = nil, + assistantVersion: Nullable? = nil, + transport: CallTransport? = nil, id: String, orgId: String, createdAt: Date, @@ -170,8 +175,6 @@ public struct Call: Codable, Hashable, Sendable { customer: CreateCustomerDto? = nil, name: String? = nil, schedulePlan: SchedulePlan? = nil, - transport: [String: JSONValue]? = nil, - subscriptionLimits: SubscriptionLimits? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.type = type @@ -183,6 +186,8 @@ public struct Call: Codable, Hashable, Sendable { self.endedReason = endedReason self.endedMessage = endedMessage self.destination = destination + self.assistantVersion = assistantVersion + self.transport = transport self.id = id self.orgId = orgId self.createdAt = createdAt @@ -213,8 +218,6 @@ public struct Call: Codable, Hashable, Sendable { self.customer = customer self.name = name self.schedulePlan = schedulePlan - self.transport = transport - self.subscriptionLimits = subscriptionLimits self.additionalProperties = additionalProperties } @@ -229,6 +232,8 @@ public struct Call: Codable, Hashable, Sendable { self.endedReason = try container.decodeIfPresent(CallEndedReason.self, forKey: .endedReason) self.endedMessage = try container.decodeIfPresent(String.self, forKey: .endedMessage) self.destination = try container.decodeIfPresent(CallDestination.self, forKey: .destination) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) + self.transport = try container.decodeIfPresent(CallTransport.self, forKey: .transport) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -259,8 +264,6 @@ public struct Call: Codable, Hashable, Sendable { self.customer = try container.decodeIfPresent(CreateCustomerDto.self, forKey: .customer) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) - self.transport = try container.decodeIfPresent([String: JSONValue].self, forKey: .transport) - self.subscriptionLimits = try container.decodeIfPresent(SubscriptionLimits.self, forKey: .subscriptionLimits) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -276,6 +279,8 @@ public struct Call: Codable, Hashable, Sendable { try container.encodeIfPresent(self.endedReason, forKey: .endedReason) try container.encodeIfPresent(self.endedMessage, forKey: .endedMessage) try container.encodeIfPresent(self.destination, forKey: .destination) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) + try container.encodeIfPresent(self.transport, forKey: .transport) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -306,8 +311,6 @@ public struct Call: Codable, Hashable, Sendable { try container.encodeIfPresent(self.customer, forKey: .customer) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) - try container.encodeIfPresent(self.transport, forKey: .transport) - try container.encodeIfPresent(self.subscriptionLimits, forKey: .subscriptionLimits) } /// Keys for encoding/decoding struct properties. @@ -321,6 +324,8 @@ public struct Call: Codable, Hashable, Sendable { case endedReason case endedMessage case destination + case assistantVersion + case transport case id case orgId case createdAt @@ -351,7 +356,5 @@ public struct Call: Codable, Hashable, Sendable { case customer case name case schedulePlan - case transport - case subscriptionLimits } } \ No newline at end of file diff --git a/Sources/Schemas/CallBatchError.swift b/Sources/Schemas/CallBatchError.swift index cda37cf0..4769038e 100644 --- a/Sources/Schemas/CallBatchError.swift +++ b/Sources/Schemas/CallBatchError.swift @@ -1,7 +1,10 @@ import Foundation +/// Error returned for one customer entry in a batch call request. public struct CallBatchError: Codable, Hashable, Sendable { + /// Customer configuration associated with the failed call. public let customer: CreateCustomerDto + /// Error message explaining why the call could not be created. public let error: String /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/CallBatchResponse.swift b/Sources/Schemas/CallBatchResponse.swift index bc58f292..1df33f24 100644 --- a/Sources/Schemas/CallBatchResponse.swift +++ b/Sources/Schemas/CallBatchResponse.swift @@ -1,5 +1,6 @@ import Foundation +/// The result of a batch call creation request, containing successfully created calls, per-call failures, and subscription limits recorded at the end of the batch. public struct CallBatchResponse: Codable, Hashable, Sendable { /// Subscription limits at the end of this batch public let subscriptionLimits: SubscriptionLimits? diff --git a/Sources/Schemas/CallEndedReason.swift b/Sources/Schemas/CallEndedReason.swift index a12db02d..abe44f80 100644 --- a/Sources/Schemas/CallEndedReason.swift +++ b/Sources/Schemas/CallEndedReason.swift @@ -26,6 +26,7 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case callStartErrorSubscriptionUpgradeFailed = "call.start.error-subscription-upgrade-failed" case callStartErrorSubscriptionConcurrencyLimitReached = "call.start.error-subscription-concurrency-limit-reached" case callStartErrorEnterpriseFeatureNotAvailableRecordingConsent = "call.start.error-enterprise-feature-not-available-recording-consent" + case callStartAssistantVersionErrorValidation = "call.start.assistant-version-error-validation" case assistantNotValid = "assistant-not-valid" case callStartErrorVapifaultDatabaseError = "call.start.error-vapifault-database-error" case assistantNotFound = "assistant-not-found" @@ -45,6 +46,9 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case pipelineErrorInworldVoiceFailed = "pipeline-error-inworld-voice-failed" case pipelineErrorMinimaxVoiceFailed = "pipeline-error-minimax-voice-failed" case pipelineErrorWellsaidVoiceFailed = "pipeline-error-wellsaid-voice-failed" + case pipelineErrorXaiVoiceFailed = "pipeline-error-xai-voice-failed" + case pipelineErrorMicrosoftVoiceFailed = "pipeline-error-microsoft-voice-failed" + case pipelineErrorMicrosoftVoiceRequestCanceled = "pipeline-error-microsoft-voice-request-canceled" case pipelineErrorTavusVideoFailed = "pipeline-error-tavus-video-failed" case callInProgressErrorVapifaultOpenaiVoiceFailed = "call.in-progress.error-vapifault-openai-voice-failed" case callInProgressErrorVapifaultCartesiaVoiceFailed = "call.in-progress.error-vapifault-cartesia-voice-failed" @@ -62,6 +66,8 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case callInProgressErrorVapifaultInworldVoiceFailed = "call.in-progress.error-vapifault-inworld-voice-failed" case callInProgressErrorVapifaultMinimaxVoiceFailed = "call.in-progress.error-vapifault-minimax-voice-failed" case callInProgressErrorVapifaultWellsaidVoiceFailed = "call.in-progress.error-vapifault-wellsaid-voice-failed" + case callInProgressErrorVapifaultXaiVoiceFailed = "call.in-progress.error-vapifault-xai-voice-failed" + case callInProgressErrorVapifaultMicrosoftVoiceFailed = "call.in-progress.error-vapifault-microsoft-voice-failed" case callInProgressErrorVapifaultTavusVideoFailed = "call.in-progress.error-vapifault-tavus-video-failed" case pipelineErrorVapiLlmFailed = "pipeline-error-vapi-llm-failed" case pipelineErrorVapi400BadRequestValidationFailed = "pipeline-error-vapi-400-bad-request-validation-failed" @@ -71,12 +77,17 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case pipelineErrorVapi500ServerError = "pipeline-error-vapi-500-server-error" case pipelineErrorVapi503ServerOverloadedError = "pipeline-error-vapi-503-server-overloaded-error" case callInProgressErrorProviderfaultVapiLlmFailed = "call.in-progress.error-providerfault-vapi-llm-failed" + case callInProgressErrorVapifaultVapiLlmFailed = "call.in-progress.error-vapifault-vapi-llm-failed" case callInProgressErrorVapifaultVapi400BadRequestValidationFailed = "call.in-progress.error-vapifault-vapi-400-bad-request-validation-failed" case callInProgressErrorVapifaultVapi401Unauthorized = "call.in-progress.error-vapifault-vapi-401-unauthorized" case callInProgressErrorVapifaultVapi403ModelAccessDenied = "call.in-progress.error-vapifault-vapi-403-model-access-denied" case callInProgressErrorVapifaultVapi429ExceededQuota = "call.in-progress.error-vapifault-vapi-429-exceeded-quota" case callInProgressErrorProviderfaultVapi500ServerError = "call.in-progress.error-providerfault-vapi-500-server-error" case callInProgressErrorProviderfaultVapi503ServerOverloadedError = "call.in-progress.error-providerfault-vapi-503-server-overloaded-error" + case pipelineErrorVapiTranscriberFailed = "pipeline-error-vapi-transcriber-failed" + case callInProgressErrorVapifaultVapiTranscriberFailed = "call.in-progress.error-vapifault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiTranscriberFailed = "call.in-progress.error-providerfault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiVoiceFailed = "call.in-progress.error-providerfault-vapi-voice-failed" case pipelineErrorDeepgramTranscriberFailed = "pipeline-error-deepgram-transcriber-failed" case pipelineErrorDeepgramTranscriberApiKeyMissing = "pipeline-error-deepgram-transcriber-api-key-missing" case callInProgressErrorVapifaultDeepgramTranscriberFailed = "call.in-progress.error-vapifault-deepgram-transcriber-failed" @@ -116,6 +127,18 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case callInProgressErrorVapifaultSonioxTranscriberInvalidConfig = "call.in-progress.error-vapifault-soniox-transcriber-invalid-config" case callInProgressErrorVapifaultSonioxTranscriberServerError = "call.in-progress.error-vapifault-soniox-transcriber-server-error" case callInProgressErrorVapifaultSonioxTranscriberFailed = "call.in-progress.error-vapifault-soniox-transcriber-failed" + case pipelineErrorXaiTranscriberAuthFailed = "pipeline-error-xai-transcriber-auth-failed" + case pipelineErrorXaiTranscriberRateLimited = "pipeline-error-xai-transcriber-rate-limited" + case pipelineErrorXaiTranscriberInvalidConfig = "pipeline-error-xai-transcriber-invalid-config" + case pipelineErrorXaiTranscriberServerError = "pipeline-error-xai-transcriber-server-error" + case pipelineErrorXaiTranscriberFailed = "pipeline-error-xai-transcriber-failed" + case callInProgressErrorVapifaultXaiTranscriberAuthFailed = "call.in-progress.error-vapifault-xai-transcriber-auth-failed" + case callInProgressErrorVapifaultXaiTranscriberRateLimited = "call.in-progress.error-vapifault-xai-transcriber-rate-limited" + case callInProgressErrorVapifaultXaiTranscriberInvalidConfig = "call.in-progress.error-vapifault-xai-transcriber-invalid-config" + case callInProgressErrorVapifaultXaiTranscriberServerError = "call.in-progress.error-vapifault-xai-transcriber-server-error" + case callInProgressErrorVapifaultXaiTranscriberFailed = "call.in-progress.error-vapifault-xai-transcriber-failed" + case pipelineErrorCartesiaTranscriberFailed = "pipeline-error-cartesia-transcriber-failed" + case callInProgressErrorVapifaultCartesiaTranscriberFailed = "call.in-progress.error-vapifault-cartesia-transcriber-failed" case callInProgressErrorPipelineNoAvailableLlmModel = "call.in-progress.error-pipeline-no-available-llm-model" case workerShutdown = "worker-shutdown" case vonageDisconnected = "vonage-disconnected" @@ -558,6 +581,7 @@ public enum CallEndedReason: String, Codable, Hashable, CaseIterable, Sendable { case manuallyCanceled = "manually-canceled" case phoneCallProviderClosedWebsocket = "phone-call-provider-closed-websocket" case callForwardingOperatorBusy = "call.forwarding.operator-busy" + case callForwardingNoAnswer = "call.forwarding.no-answer" case silenceTimedOut = "silence-timed-out" case callInProgressErrorProviderfaultOutboundSip403Forbidden = "call.in-progress.error-providerfault-outbound-sip-403-forbidden" case callInProgressErrorProviderfaultOutboundSip407ProxyAuthenticationRequired = "call.in-progress.error-providerfault-outbound-sip-407-proxy-authentication-required" diff --git a/Sources/Schemas/CallHookAssistantSpeechInterrupted.swift b/Sources/Schemas/CallHookAssistantSpeechInterrupted.swift index f15d353c..c961ebea 100644 --- a/Sources/Schemas/CallHookAssistantSpeechInterrupted.swift +++ b/Sources/Schemas/CallHookAssistantSpeechInterrupted.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured actions when the customer's speech interrupts the assistant. public struct CallHookAssistantSpeechInterrupted: Codable, Hashable, Sendable { /// This is the event that triggers this hook public let on: CallHookAssistantSpeechInterruptedOn diff --git a/Sources/Schemas/CallHookCallEnding.swift b/Sources/Schemas/CallHookCallEnding.swift index 106c5416..4e177c1c 100644 --- a/Sources/Schemas/CallHookCallEnding.swift +++ b/Sources/Schemas/CallHookCallEnding.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured actions when a call is ending, optionally only when its filters match. public struct CallHookCallEnding: Codable, Hashable, Sendable { /// This is the event that triggers this hook public let on: CallHookCallEndingOn diff --git a/Sources/Schemas/CallHookCustomerSpeechInterrupted.swift b/Sources/Schemas/CallHookCustomerSpeechInterrupted.swift index 8379f072..ca61972c 100644 --- a/Sources/Schemas/CallHookCustomerSpeechInterrupted.swift +++ b/Sources/Schemas/CallHookCustomerSpeechInterrupted.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured actions when the assistant interrupts the customer's speech. public struct CallHookCustomerSpeechInterrupted: Codable, Hashable, Sendable { /// This is the event that triggers this hook public let on: CallHookCustomerSpeechInterruptedOn diff --git a/Sources/Schemas/CallHookCustomerSpeechTimeout.swift b/Sources/Schemas/CallHookCustomerSpeechTimeout.swift index 48bffbe4..3184e43c 100644 --- a/Sources/Schemas/CallHookCustomerSpeechTimeout.swift +++ b/Sources/Schemas/CallHookCustomerSpeechTimeout.swift @@ -1,11 +1,12 @@ import Foundation +/// Runs configured actions when the customer does not speak before the configured timeout, with support for trigger limits and named instances. public struct CallHookCustomerSpeechTimeout: Codable, Hashable, Sendable { /// Must be either "customer.speech.timeout" or match the pattern "customer.speech.timeout[property=value]" public let on: String /// This is the set of actions to perform when the hook triggers public let `do`: [CallHookCustomerSpeechTimeoutDoItem] - /// This is the set of filters that must match for the hook to trigger + /// Controls the speech timeout, maximum trigger count, and counter reset behavior for this hook. public let options: CustomerSpeechTimeoutOptions? /// This is the name of the hook, it can be set by the user to identify the hook. /// If no name is provided, the hook will be auto generated as UUID. diff --git a/Sources/Schemas/CallHookFilter.swift b/Sources/Schemas/CallHookFilter.swift index 4f544606..d01b1fd2 100644 --- a/Sources/Schemas/CallHookFilter.swift +++ b/Sources/Schemas/CallHookFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Matches a call field against one or more allowed values to determine whether a hook runs. public struct CallHookFilter: Codable, Hashable, Sendable { /// This is the type of filter - currently only "oneOf" is supported public let type: CallHookFilterType diff --git a/Sources/Schemas/CallHookModelResponseTimeout.swift b/Sources/Schemas/CallHookModelResponseTimeout.swift index 4065077e..689b43fb 100644 --- a/Sources/Schemas/CallHookModelResponseTimeout.swift +++ b/Sources/Schemas/CallHookModelResponseTimeout.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured actions when the language model does not respond before its timeout. public struct CallHookModelResponseTimeout: Codable, Hashable, Sendable { /// This is the event that triggers this hook public let on: CallHookModelResponseTimeoutOn diff --git a/Sources/Schemas/CallHookModelResponseTimeoutDoItem.swift b/Sources/Schemas/CallHookModelResponseTimeoutDoItem.swift index a0cc84aa..6fe5e58c 100644 --- a/Sources/Schemas/CallHookModelResponseTimeoutDoItem.swift +++ b/Sources/Schemas/CallHookModelResponseTimeoutDoItem.swift @@ -1,6 +1,6 @@ import Foundation -public enum CallHookModelResponseTimeoutDoItem: Codable, Hashable, Sendable { +public indirect enum CallHookModelResponseTimeoutDoItem: Codable, Hashable, Sendable { case messageAdd(MessageAddHookAction) case say(SayHookAction) case tool(ToolCallHookAction) diff --git a/Sources/Schemas/CallTransport.swift b/Sources/Schemas/CallTransport.swift new file mode 100644 index 00000000..78543bb4 --- /dev/null +++ b/Sources/Schemas/CallTransport.swift @@ -0,0 +1,65 @@ +import Foundation + +/// This is the transport of the call. +public enum CallTransport: Codable, Hashable, Sendable { + case daily(VapiWebCallTransport) + case telnyx(TelnyxTransport) + case twilio(TwilioTransport) + case vapiSip(VapiSipTransport) + case vapiWebsocket(VapiWebsocketTransport) + case vonage(VonageTransport) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "daily": + self = .daily(try VapiWebCallTransport(from: decoder)) + case "telnyx": + self = .telnyx(try TelnyxTransport(from: decoder)) + case "twilio": + self = .twilio(try TwilioTransport(from: decoder)) + case "vapi.sip": + self = .vapiSip(try VapiSipTransport(from: decoder)) + case "vapi.websocket": + self = .vapiWebsocket(try VapiWebsocketTransport(from: decoder)) + case "vonage": + self = .vonage(try VonageTransport(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .daily(let data): + try container.encode("daily", forKey: .provider) + try data.encode(to: encoder) + case .telnyx(let data): + try container.encode("telnyx", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vapiSip(let data): + try container.encode("vapi.sip", forKey: .provider) + try data.encode(to: encoder) + case .vapiWebsocket(let data): + try container.encode("vapi.websocket", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/Campaign.swift b/Sources/Schemas/Campaign.swift index 8df50329..d67bb120 100644 --- a/Sources/Schemas/Campaign.swift +++ b/Sources/Schemas/Campaign.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved outbound calling campaign, including its calling configuration, schedule, status, customers, calls, and call-progress counters. public struct Campaign: Codable, Hashable, Sendable { /// This is the status of the campaign. public let status: CampaignStatus @@ -19,8 +20,20 @@ public struct Campaign: Codable, Hashable, Sendable { public let dialPlan: [DialPlanEntry]? /// This is the schedule plan for the campaign. Calls will start at startedAt and continue until your organization’s concurrency limit is reached. Any remaining calls will be retried for up to one hour as capacity becomes available. After that hour or after latestAt, whichever comes first, any calls that couldn’t be placed won’t be retried. public let schedulePlan: SchedulePlan? - /// These are the customers that will be called in the campaign. Required if dialPlan is not provided. + /// These are the customers that will be called in the campaign. Required if dialPlan is not provided. Maximum of 10000 customers per campaign. public let customers: [CreateCustomerDto]? + /// This is the maximum number of concurrent calls that will be made for the campaign. Defaults to 10. + public let maxConcurrency: Double? + /// These are the overrides for the assistant's settings and template variables for the campaign. Use this when the campaign targets an `assistantId`. + public let assistantOverrides: AssistantOverrides? + /// These are the overrides for the squad and template variables for the campaign. Use this when the campaign targets a `squadId`. Per-contact `squadOverrides` are deep-merged on top of this at dispatch time. + public let squadOverrides: AssistantOverrides? + /// This is the server (URL, auth headers, timeout, etc.) for the campaign webhooks. + public let server: Server? + /// These are the messages that will be sent to your Server URL. + public let serverMessages: [CampaignServerMessagesItem]? + /// This opts the campaign into the blocking `campaign.predial` eligibility webhook. When set, every contact triggers a `campaign.predial` POST to the Server URL before dialing, and the response `{ eligible: boolean }` decides whether the call is placed. Requires `server`. When unset, no pre-dial webhook is sent. + public let predialPlan: CampaignPredialPlan? /// This is the unique identifier for the campaign. public let id: String /// This is the unique identifier for the org that this campaign belongs to. @@ -55,6 +68,12 @@ public struct Campaign: Codable, Hashable, Sendable { dialPlan: [DialPlanEntry]? = nil, schedulePlan: SchedulePlan? = nil, customers: [CreateCustomerDto]? = nil, + maxConcurrency: Double? = nil, + assistantOverrides: AssistantOverrides? = nil, + squadOverrides: AssistantOverrides? = nil, + server: Server? = nil, + serverMessages: [CampaignServerMessagesItem]? = nil, + predialPlan: CampaignPredialPlan? = nil, id: String, orgId: String, createdAt: Date, @@ -77,6 +96,12 @@ public struct Campaign: Codable, Hashable, Sendable { self.dialPlan = dialPlan self.schedulePlan = schedulePlan self.customers = customers + self.maxConcurrency = maxConcurrency + self.assistantOverrides = assistantOverrides + self.squadOverrides = squadOverrides + self.server = server + self.serverMessages = serverMessages + self.predialPlan = predialPlan self.id = id self.orgId = orgId self.createdAt = createdAt @@ -102,6 +127,12 @@ public struct Campaign: Codable, Hashable, Sendable { self.dialPlan = try container.decodeIfPresent([DialPlanEntry].self, forKey: .dialPlan) self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) self.customers = try container.decodeIfPresent([CreateCustomerDto].self, forKey: .customers) + self.maxConcurrency = try container.decodeIfPresent(Double.self, forKey: .maxConcurrency) + self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) + self.squadOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .squadOverrides) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.serverMessages = try container.decodeIfPresent([CampaignServerMessagesItem].self, forKey: .serverMessages) + self.predialPlan = try container.decodeIfPresent(CampaignPredialPlan.self, forKey: .predialPlan) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -128,6 +159,12 @@ public struct Campaign: Codable, Hashable, Sendable { try container.encodeIfPresent(self.dialPlan, forKey: .dialPlan) try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) try container.encodeIfPresent(self.customers, forKey: .customers) + try container.encodeIfPresent(self.maxConcurrency, forKey: .maxConcurrency) + try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) + try container.encodeIfPresent(self.squadOverrides, forKey: .squadOverrides) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.predialPlan, forKey: .predialPlan) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -152,6 +189,12 @@ public struct Campaign: Codable, Hashable, Sendable { case dialPlan case schedulePlan case customers + case maxConcurrency + case assistantOverrides + case squadOverrides + case server + case serverMessages + case predialPlan case id case orgId case createdAt diff --git a/Sources/Schemas/CampaignContact.swift b/Sources/Schemas/CampaignContact.swift new file mode 100644 index 00000000..3b953746 --- /dev/null +++ b/Sources/Schemas/CampaignContact.swift @@ -0,0 +1,81 @@ +import Foundation + +public struct CampaignContact: Codable, Hashable, Sendable { + public let id: String + public let campaignId: String + public let orgId: String + public let customerId: String? + public let number: String + public let name: String? + public let assistantOverrides: AssistantOverrides? + /// Use this when the campaign targets a `squadId`. Mirrors the call-level `squadOverrides` field. Merged with the campaign-level squadOverrides at dispatch time. + public let squadOverrides: AssistantOverrides? + public let createdAt: Date + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + id: String, + campaignId: String, + orgId: String, + customerId: String? = nil, + number: String, + name: String? = nil, + assistantOverrides: AssistantOverrides? = nil, + squadOverrides: AssistantOverrides? = nil, + createdAt: Date, + additionalProperties: [String: JSONValue] = .init() + ) { + self.id = id + self.campaignId = campaignId + self.orgId = orgId + self.customerId = customerId + self.number = number + self.name = name + self.assistantOverrides = assistantOverrides + self.squadOverrides = squadOverrides + self.createdAt = createdAt + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.id = try container.decode(String.self, forKey: .id) + self.campaignId = try container.decode(String.self, forKey: .campaignId) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.customerId = try container.decodeIfPresent(String.self, forKey: .customerId) + self.number = try container.decode(String.self, forKey: .number) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) + self.squadOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .squadOverrides) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.id, forKey: .id) + try container.encode(self.campaignId, forKey: .campaignId) + try container.encode(self.orgId, forKey: .orgId) + try container.encodeIfPresent(self.customerId, forKey: .customerId) + try container.encode(self.number, forKey: .number) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) + try container.encodeIfPresent(self.squadOverrides, forKey: .squadOverrides) + try container.encode(self.createdAt, forKey: .createdAt) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case id + case campaignId + case orgId + case customerId + case number + case name + case assistantOverrides + case squadOverrides + case createdAt + } +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignControllerFindAllRequestSortBy.swift b/Sources/Schemas/CampaignControllerFindAllRequestSortBy.swift new file mode 100644 index 00000000..d27e823c --- /dev/null +++ b/Sources/Schemas/CampaignControllerFindAllRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum CampaignControllerFindAllRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignControllerFindAllRequestStatus.swift b/Sources/Schemas/CampaignControllerFindAllRequestStatus.swift index 6d5f1649..e0365c08 100644 --- a/Sources/Schemas/CampaignControllerFindAllRequestStatus.swift +++ b/Sources/Schemas/CampaignControllerFindAllRequestStatus.swift @@ -4,4 +4,6 @@ public enum CampaignControllerFindAllRequestStatus: String, Codable, Hashable, C case scheduled case inProgress = "in-progress" case ended + case cancelled + case archived } \ No newline at end of file diff --git a/Sources/Schemas/CampaignControllerFindAllV2RequestSortBy.swift b/Sources/Schemas/CampaignControllerFindAllV2RequestSortBy.swift new file mode 100644 index 00000000..18d29344 --- /dev/null +++ b/Sources/Schemas/CampaignControllerFindAllV2RequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum CampaignControllerFindAllV2RequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignControllerFindAllV2RequestSortOrder.swift b/Sources/Schemas/CampaignControllerFindAllV2RequestSortOrder.swift new file mode 100644 index 00000000..30455471 --- /dev/null +++ b/Sources/Schemas/CampaignControllerFindAllV2RequestSortOrder.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum CampaignControllerFindAllV2RequestSortOrder: String, Codable, Hashable, CaseIterable, Sendable { + case asc = "ASC" + case desc = "DESC" +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignControllerFindAllV2RequestStatus.swift b/Sources/Schemas/CampaignControllerFindAllV2RequestStatus.swift new file mode 100644 index 00000000..ebbd92f4 --- /dev/null +++ b/Sources/Schemas/CampaignControllerFindAllV2RequestStatus.swift @@ -0,0 +1,9 @@ +import Foundation + +public enum CampaignControllerFindAllV2RequestStatus: String, Codable, Hashable, CaseIterable, Sendable { + case scheduled + case inProgress = "in-progress" + case ended + case cancelled + case archived +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignPaginatedResponse.swift b/Sources/Schemas/CampaignPaginatedResponse.swift index d34eae10..d7a39d42 100644 --- a/Sources/Schemas/CampaignPaginatedResponse.swift +++ b/Sources/Schemas/CampaignPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of outbound calling campaigns and metadata describing the result set. public struct CampaignPaginatedResponse: Codable, Hashable, Sendable { + /// The campaigns returned for the current page. public let results: [Campaign] + /// Pagination metadata for the campaign result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/CampaignPredialPlan.swift b/Sources/Schemas/CampaignPredialPlan.swift new file mode 100644 index 00000000..13eea849 --- /dev/null +++ b/Sources/Schemas/CampaignPredialPlan.swift @@ -0,0 +1,33 @@ +import Foundation + +public struct CampaignPredialPlan: Codable, Hashable, Sendable { + /// Whether the pre-dial eligibility webhook is active. Defaults to true when `predialPlan` is set. Set to false to keep the plan without running the webhook (useful when duplicating a campaign). + public let enabled: Bool? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + enabled: Bool? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.enabled = enabled + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.enabled, forKey: .enabled) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case enabled + } +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignServerMessagesItem.swift b/Sources/Schemas/CampaignServerMessagesItem.swift new file mode 100644 index 00000000..1222e468 --- /dev/null +++ b/Sources/Schemas/CampaignServerMessagesItem.swift @@ -0,0 +1,15 @@ +import Foundation + +public enum CampaignServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case campaignStarted = "campaign.started" + case campaignCancelled = "campaign.cancelled" + case campaignEnded = "campaign.ended" + case campaignArchived = "campaign.archived" + case campaignUnarchived = "campaign.unarchived" + case contactDispatched = "contact.dispatched" + case contactCompleted = "contact.completed" + case contactFailed = "contact.failed" + case contactSkipped = "contact.skipped" + case contactPredialFailed = "contact.predial-failed" + case campaignJobContinued = "campaign.job.continued" +} \ No newline at end of file diff --git a/Sources/Schemas/CampaignStatus.swift b/Sources/Schemas/CampaignStatus.swift index 9e198bbc..a292b35c 100644 --- a/Sources/Schemas/CampaignStatus.swift +++ b/Sources/Schemas/CampaignStatus.swift @@ -5,4 +5,6 @@ public enum CampaignStatus: String, Codable, Hashable, CaseIterable, Sendable { case scheduled case inProgress = "in-progress" case ended + case cancelled + case archived } \ No newline at end of file diff --git a/Sources/Schemas/CartesiaCredential.swift b/Sources/Schemas/CartesiaCredential.swift index de4bc4a8..82b3365c 100644 --- a/Sources/Schemas/CartesiaCredential.swift +++ b/Sources/Schemas/CartesiaCredential.swift @@ -14,6 +14,8 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { public let updatedAt: Date /// This is the name of credential. This is just for your reference. public let name: String? + /// This can be used to point to an onprem Cartesia instance. Defaults to api.cartesia.ai. + public let apiUrl: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -25,6 +27,7 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { createdAt: Date, updatedAt: Date, name: String? = nil, + apiUrl: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.provider = provider @@ -34,6 +37,7 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { self.createdAt = createdAt self.updatedAt = updatedAt self.name = name + self.apiUrl = apiUrl self.additionalProperties = additionalProperties } @@ -46,6 +50,7 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -59,6 +64,7 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) } /// Keys for encoding/decoding struct properties. @@ -70,5 +76,6 @@ public struct CartesiaCredential: Codable, Hashable, Sendable { case createdAt case updatedAt case name + case apiUrl } } \ No newline at end of file diff --git a/Sources/Schemas/CartesiaExperimentalControls.swift b/Sources/Schemas/CartesiaExperimentalControls.swift index c3e63da7..4eac021b 100644 --- a/Sources/Schemas/CartesiaExperimentalControls.swift +++ b/Sources/Schemas/CartesiaExperimentalControls.swift @@ -1,7 +1,10 @@ import Foundation +/// Cartesia voice controls for speed and emotion. public struct CartesiaExperimentalControls: Codable, Hashable, Sendable { + /// Speaking-speed control expressed as a preset or a value from -1 to 1. public let speed: CartesiaSpeedControl? + /// Emotion and intensity applied to the Cartesia voice. public let emotion: CartesiaExperimentalControlsEmotion? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/CartesiaExperimentalControlsEmotion.swift b/Sources/Schemas/CartesiaExperimentalControlsEmotion.swift index 45f4b308..a671b7ff 100644 --- a/Sources/Schemas/CartesiaExperimentalControlsEmotion.swift +++ b/Sources/Schemas/CartesiaExperimentalControlsEmotion.swift @@ -1,5 +1,6 @@ import Foundation +/// Emotion and intensity applied to the Cartesia voice. public enum CartesiaExperimentalControlsEmotion: String, Codable, Hashable, CaseIterable, Sendable { case angerLowest = "anger:lowest" case angerLow = "anger:low" diff --git a/Sources/Schemas/CartesiaGenerationConfig.swift b/Sources/Schemas/CartesiaGenerationConfig.swift index 65da02de..369c5d80 100644 --- a/Sources/Schemas/CartesiaGenerationConfig.swift +++ b/Sources/Schemas/CartesiaGenerationConfig.swift @@ -1,5 +1,6 @@ import Foundation +/// Generation controls for Cartesia Sonic 3 voices, including speed, volume, and accent localization. public struct CartesiaGenerationConfig: Codable, Hashable, Sendable { /// Fine-grained speed control for sonic-3. Only available for sonic-3 model. public let speed: Double? diff --git a/Sources/Schemas/CartesiaGenerationConfigExperimental.swift b/Sources/Schemas/CartesiaGenerationConfigExperimental.swift index b3450ff5..7580c4e3 100644 --- a/Sources/Schemas/CartesiaGenerationConfigExperimental.swift +++ b/Sources/Schemas/CartesiaGenerationConfigExperimental.swift @@ -1,5 +1,6 @@ import Foundation +/// Cartesia Sonic 3 generation controls, including accent localization. public struct CartesiaGenerationConfigExperimental: Codable, Hashable, Sendable { /// Toggle accent localization for sonic-3: 0 (disabled, default) or 1 (enabled). When enabled, the voice adapts to match the transcript language accent while preserving vocal characteristics. public let accentLocalization: Int? diff --git a/Sources/Schemas/CartesiaSpeedControl.swift b/Sources/Schemas/CartesiaSpeedControl.swift index 0f769527..122000cf 100644 --- a/Sources/Schemas/CartesiaSpeedControl.swift +++ b/Sources/Schemas/CartesiaSpeedControl.swift @@ -1,5 +1,6 @@ import Foundation +/// Speaking-speed control expressed as a preset or a value from -1 to 1. public enum CartesiaSpeedControl: Codable, Hashable, Sendable { case cartesiaSpeedControlZero(CartesiaSpeedControlZero) case double(Double) diff --git a/Sources/Schemas/CartesiaTranscriber.swift b/Sources/Schemas/CartesiaTranscriber.swift index d6a148e5..b176d096 100644 --- a/Sources/Schemas/CartesiaTranscriber.swift +++ b/Sources/Schemas/CartesiaTranscriber.swift @@ -1,7 +1,10 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Cartesia, including model, language, and fallback settings. public struct CartesiaTranscriber: Codable, Hashable, Sendable { + /// The Cartesia speech-to-text model used for transcription. public let model: CartesiaTranscriberModel? + /// The language code used for transcription. public let language: CartesiaTranscriberLanguage? /// This is the plan for transcriber provider fallbacks in the event that the primary transcriber provider fails. public let fallbackPlan: FallbackTranscriberPlan? diff --git a/Sources/Schemas/CartesiaTranscriberLanguage.swift b/Sources/Schemas/CartesiaTranscriberLanguage.swift index 5dabf21b..c52a2726 100644 --- a/Sources/Schemas/CartesiaTranscriberLanguage.swift +++ b/Sources/Schemas/CartesiaTranscriberLanguage.swift @@ -1,5 +1,6 @@ import Foundation +/// The language code used for transcription. public enum CartesiaTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case aa case ab diff --git a/Sources/Schemas/CartesiaTranscriberModel.swift b/Sources/Schemas/CartesiaTranscriberModel.swift index 301c8fc9..8c7f1f05 100644 --- a/Sources/Schemas/CartesiaTranscriberModel.swift +++ b/Sources/Schemas/CartesiaTranscriberModel.swift @@ -1,5 +1,7 @@ import Foundation +/// The Cartesia speech-to-text model used for transcription. public enum CartesiaTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { case inkWhisper = "ink-whisper" + case ink2 = "ink-2" } \ No newline at end of file diff --git a/Sources/Schemas/CartesiaVoice.swift b/Sources/Schemas/CartesiaVoice.swift index 789aa69c..fcc6e0b6 100644 --- a/Sources/Schemas/CartesiaVoice.swift +++ b/Sources/Schemas/CartesiaVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Cartesia, including voice and model selection, language, generation controls, pronunciation dictionaries, chunking, caching, and fallback settings. public struct CartesiaVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/CartesiaVoiceModel.swift b/Sources/Schemas/CartesiaVoiceModel.swift index 59ab8ac7..974754e3 100644 --- a/Sources/Schemas/CartesiaVoiceModel.swift +++ b/Sources/Schemas/CartesiaVoiceModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the model that will be used. This is optional and will default to the correct model for the voiceId. public enum CartesiaVoiceModel: String, Codable, Hashable, CaseIterable, Sendable { + case sonic35 = "sonic-3.5" + case sonic3520260504 = "sonic-3.5-2026-05-04" case sonic3 = "sonic-3" case sonic320260112 = "sonic-3-2026-01-12" case sonic320251027 = "sonic-3-2025-10-27" diff --git a/Sources/Schemas/CerebrasModel.swift b/Sources/Schemas/CerebrasModel.swift index 002b5581..7a681ede 100644 --- a/Sources/Schemas/CerebrasModel.swift +++ b/Sources/Schemas/CerebrasModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Cerebras, including model, prompts, tools, knowledge-base access, and generation settings. public struct CerebrasModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct CerebrasModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: CerebrasModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct CerebrasModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [CerebrasModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: CerebrasModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct CerebrasModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct CerebrasModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([CerebrasModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(CerebrasModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct CerebrasModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct CerebrasModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/ChatEvalAssistantMessageEvaluation.swift b/Sources/Schemas/ChatEvalAssistantMessageEvaluation.swift index 1a3b4222..13a4bfd0 100644 --- a/Sources/Schemas/ChatEvalAssistantMessageEvaluation.swift +++ b/Sources/Schemas/ChatEvalAssistantMessageEvaluation.swift @@ -1,5 +1,6 @@ import Foundation +/// An expected assistant turn in an evaluation, including the judge plan and how the evaluation should continue afterward. public struct ChatEvalAssistantMessageEvaluation: Codable, Hashable, Sendable { /// This is the role of the message author. /// For an assistant message evaluation, the role is always 'assistant' diff --git a/Sources/Schemas/ChatEvalAssistantMessageMock.swift b/Sources/Schemas/ChatEvalAssistantMessageMock.swift index cd7aab25..7fe09bd5 100644 --- a/Sources/Schemas/ChatEvalAssistantMessageMock.swift +++ b/Sources/Schemas/ChatEvalAssistantMessageMock.swift @@ -1,5 +1,6 @@ import Foundation +/// A simulated assistant turn in an evaluation conversation, with optional message content and tool calls. public struct ChatEvalAssistantMessageMock: Codable, Hashable, Sendable { /// This is the role of the message author. /// For a mock assistant message, the role is always 'assistant' diff --git a/Sources/Schemas/ChatEvalAssistantMessageMockToolCall.swift b/Sources/Schemas/ChatEvalAssistantMessageMockToolCall.swift index cbcc2f8e..cd365b41 100644 --- a/Sources/Schemas/ChatEvalAssistantMessageMockToolCall.swift +++ b/Sources/Schemas/ChatEvalAssistantMessageMockToolCall.swift @@ -1,5 +1,6 @@ import Foundation +/// A simulated assistant tool call with the tool name and optional arguments. public struct ChatEvalAssistantMessageMockToolCall: Codable, Hashable, Sendable { /// This is the name of the tool that will be called. /// It should be one of the tools created in the organization. diff --git a/Sources/Schemas/ChatEvalSystemMessageMock.swift b/Sources/Schemas/ChatEvalSystemMessageMock.swift index 5e4269a0..159034b7 100644 --- a/Sources/Schemas/ChatEvalSystemMessageMock.swift +++ b/Sources/Schemas/ChatEvalSystemMessageMock.swift @@ -1,5 +1,6 @@ import Foundation +/// A simulated system message in an evaluation conversation. public struct ChatEvalSystemMessageMock: Codable, Hashable, Sendable { /// This is the role of the message author. /// For a mock system message, the role is always 'system' diff --git a/Sources/Schemas/ChatEvalToolResponseMessageEvaluation.swift b/Sources/Schemas/ChatEvalToolResponseMessageEvaluation.swift index 1af9302d..b57990e2 100644 --- a/Sources/Schemas/ChatEvalToolResponseMessageEvaluation.swift +++ b/Sources/Schemas/ChatEvalToolResponseMessageEvaluation.swift @@ -1,5 +1,6 @@ import Foundation +/// An expected tool-response turn evaluated by a configured LLM judge. public struct ChatEvalToolResponseMessageEvaluation: Codable, Hashable, Sendable { /// This is the role of the message author. /// For a tool response message evaluation, the role is always 'tool' diff --git a/Sources/Schemas/ChatEvalToolResponseMessageMock.swift b/Sources/Schemas/ChatEvalToolResponseMessageMock.swift index 8f9c4ef6..bfaf7da6 100644 --- a/Sources/Schemas/ChatEvalToolResponseMessageMock.swift +++ b/Sources/Schemas/ChatEvalToolResponseMessageMock.swift @@ -1,5 +1,6 @@ import Foundation +/// A simulated tool response in an evaluation conversation. public struct ChatEvalToolResponseMessageMock: Codable, Hashable, Sendable { /// This is the role of the message author. /// For a mock tool response message, the role is always 'tool' diff --git a/Sources/Schemas/ChatEvalUserMessageMock.swift b/Sources/Schemas/ChatEvalUserMessageMock.swift index 578f1be1..7b682554 100644 --- a/Sources/Schemas/ChatEvalUserMessageMock.swift +++ b/Sources/Schemas/ChatEvalUserMessageMock.swift @@ -1,5 +1,6 @@ import Foundation +/// A simulated user message in an evaluation conversation. public struct ChatEvalUserMessageMock: Codable, Hashable, Sendable { /// This is the role of the message author. /// For a mock user message, the role is always 'user' diff --git a/Sources/Schemas/ChunkPlan.swift b/Sources/Schemas/ChunkPlan.swift index bd6e0608..acd54c45 100644 --- a/Sources/Schemas/ChunkPlan.swift +++ b/Sources/Schemas/ChunkPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls how model output is split into chunks before voice synthesis, including minimum length, punctuation boundaries, and formatting. public struct ChunkPlan: Codable, Hashable, Sendable { /// This determines whether the model output is chunked before being sent to the voice provider. Default `true`. /// diff --git a/Sources/Schemas/ClientMessageAssistantSpeech.swift b/Sources/Schemas/ClientMessageAssistantSpeech.swift index 5bf5f070..d6c4ab2a 100644 --- a/Sources/Schemas/ClientMessageAssistantSpeech.swift +++ b/Sources/Schemas/ClientMessageAssistantSpeech.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageAssistantSpeechPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "assistant-speech" is sent as assistant audio is being played. public let type: ClientMessageAssistantSpeechType /// The full assistant text for the current turn. This is the complete text, @@ -43,6 +48,7 @@ public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageAssistantSpeechPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageAssistantSpeechType, text: String, turn: Double? = nil, @@ -55,6 +61,7 @@ public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.text = text self.turn = turn @@ -70,6 +77,7 @@ public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageAssistantSpeechPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageAssistantSpeechType.self, forKey: .type) self.text = try container.decode(String.self, forKey: .text) self.turn = try container.decodeIfPresent(Double.self, forKey: .turn) @@ -86,6 +94,7 @@ public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.text, forKey: .text) try container.encodeIfPresent(self.turn, forKey: .turn) @@ -100,6 +109,7 @@ public struct ClientMessageAssistantSpeech: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case text case turn diff --git a/Sources/Schemas/ClientMessageAssistantStarted.swift b/Sources/Schemas/ClientMessageAssistantStarted.swift index a6a96a38..8879a43f 100644 --- a/Sources/Schemas/ClientMessageAssistantStarted.swift +++ b/Sources/Schemas/ClientMessageAssistantStarted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageAssistantStartedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "assistant.started" is sent when the assistant is started. public let type: ClientMessageAssistantStartedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageAssistantStartedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageAssistantStartedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageAssistantStartedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageAssistantStartedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageAssistantStarted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageCallDeleteFailed.swift b/Sources/Schemas/ClientMessageCallDeleteFailed.swift index 2d5e2e8d..05efcdba 100644 --- a/Sources/Schemas/ClientMessageCallDeleteFailed.swift +++ b/Sources/Schemas/ClientMessageCallDeleteFailed.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageCallDeleteFailedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "call.deleted" is sent when a call is deleted. public let type: ClientMessageCallDeleteFailedType /// This is the timestamp of the message. @@ -18,6 +23,7 @@ public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageCallDeleteFailedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageCallDeleteFailedType, timestamp: Double? = nil, call: Call? = nil, @@ -26,6 +32,7 @@ public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -37,6 +44,7 @@ public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageCallDeleteFailedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageCallDeleteFailedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -49,6 +57,7 @@ public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -59,6 +68,7 @@ public struct ClientMessageCallDeleteFailed: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageCallDeleted.swift b/Sources/Schemas/ClientMessageCallDeleted.swift index 63f1591f..2f6ed87a 100644 --- a/Sources/Schemas/ClientMessageCallDeleted.swift +++ b/Sources/Schemas/ClientMessageCallDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageCallDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "call.deleted" is sent when a call is deleted. public let type: ClientMessageCallDeletedType /// This is the timestamp of the message. @@ -18,6 +23,7 @@ public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageCallDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageCallDeletedType, timestamp: Double? = nil, call: Call? = nil, @@ -26,6 +32,7 @@ public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -37,6 +44,7 @@ public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageCallDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageCallDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -49,6 +57,7 @@ public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -59,6 +68,7 @@ public struct ClientMessageCallDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageChatCreated.swift b/Sources/Schemas/ClientMessageChatCreated.swift index 22c76cbd..8a82b894 100644 --- a/Sources/Schemas/ClientMessageChatCreated.swift +++ b/Sources/Schemas/ClientMessageChatCreated.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageChatCreated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageChatCreatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "chat.created" is sent when a new chat is created. public let type: ClientMessageChatCreatedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageChatCreated: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageChatCreatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageChatCreatedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageChatCreated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageChatCreated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageChatCreatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageChatCreatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageChatCreated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageChatCreated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageChatDeleted.swift b/Sources/Schemas/ClientMessageChatDeleted.swift index 1ae62511..f3362839 100644 --- a/Sources/Schemas/ClientMessageChatDeleted.swift +++ b/Sources/Schemas/ClientMessageChatDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageChatDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "chat.deleted" is sent when a chat is deleted. public let type: ClientMessageChatDeletedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageChatDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageChatDeletedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageChatDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageChatDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageChatDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageConversationUpdate.swift b/Sources/Schemas/ClientMessageConversationUpdate.swift index dd484db9..cef02db9 100644 --- a/Sources/Schemas/ClientMessageConversationUpdate.swift +++ b/Sources/Schemas/ClientMessageConversationUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageConversationUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "conversation-update" is sent when an update is committed to the conversation history. public let type: ClientMessageConversationUpdateType /// This is the most up-to-date conversation history at the time the message is sent. @@ -22,6 +27,7 @@ public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageConversationUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageConversationUpdateType, messages: [ClientMessageConversationUpdateMessagesItem]? = nil, messagesOpenAiFormatted: [OpenAiMessage], @@ -32,6 +38,7 @@ public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.messages = messages self.messagesOpenAiFormatted = messagesOpenAiFormatted @@ -45,6 +52,7 @@ public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageConversationUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageConversationUpdateType.self, forKey: .type) self.messages = try container.decodeIfPresent([ClientMessageConversationUpdateMessagesItem].self, forKey: .messages) self.messagesOpenAiFormatted = try container.decode([OpenAiMessage].self, forKey: .messagesOpenAiFormatted) @@ -59,6 +67,7 @@ public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.messagesOpenAiFormatted, forKey: .messagesOpenAiFormatted) @@ -71,6 +80,7 @@ public struct ClientMessageConversationUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case messages case messagesOpenAiFormatted = "messagesOpenAIFormatted" diff --git a/Sources/Schemas/ClientMessageHang.swift b/Sources/Schemas/ClientMessageHang.swift index 07389e0d..fe898b3c 100644 --- a/Sources/Schemas/ClientMessageHang.swift +++ b/Sources/Schemas/ClientMessageHang.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageHang: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageHangPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "hang" is sent when the assistant is hanging due to a delay. The delay can be caused by many factors, such as: /// - the model is too slow to respond /// - the voice is too slow to respond @@ -22,6 +27,7 @@ public struct ClientMessageHang: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageHangPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageHangType, timestamp: Double? = nil, call: Call? = nil, @@ -30,6 +36,7 @@ public struct ClientMessageHang: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageHang: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageHangPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageHangType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -53,6 +61,7 @@ public struct ClientMessageHang: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -63,6 +72,7 @@ public struct ClientMessageHang: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageLanguageChangeDetected.swift b/Sources/Schemas/ClientMessageLanguageChangeDetected.swift index 9d4daa2f..08857eda 100644 --- a/Sources/Schemas/ClientMessageLanguageChangeDetected.swift +++ b/Sources/Schemas/ClientMessageLanguageChangeDetected.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageLanguageChangeDetectedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "language-change-detected" is sent when the transcriber is automatically switched based on the detected language. public let type: ClientMessageLanguageChangeDetectedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageLanguageChangeDetectedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageLanguageChangeDetectedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageLanguageChangeDetectedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageLanguageChangeDetectedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageLanguageChangeDetected: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageMetadata.swift b/Sources/Schemas/ClientMessageMetadata.swift index 2bc617b6..7806b744 100644 --- a/Sources/Schemas/ClientMessageMetadata.swift +++ b/Sources/Schemas/ClientMessageMetadata.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageMetadata: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageMetadataPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "metadata" is sent to forward metadata to the client. public let type: ClientMessageMetadataType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageMetadata: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageMetadataPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageMetadataType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageMetadata: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageMetadata: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageMetadataPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageMetadataType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageMetadata: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageMetadata: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageModelOutput.swift b/Sources/Schemas/ClientMessageModelOutput.swift index 370d8d8c..a87d9293 100644 --- a/Sources/Schemas/ClientMessageModelOutput.swift +++ b/Sources/Schemas/ClientMessageModelOutput.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageModelOutput: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageModelOutputPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "model-output" is sent as the model outputs tokens. public let type: ClientMessageModelOutputType /// This is the unique identifier for the current LLM turn. All tokens from the same @@ -23,6 +28,7 @@ public struct ClientMessageModelOutput: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageModelOutputPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageModelOutputType, turnId: String? = nil, timestamp: Double? = nil, @@ -33,6 +39,7 @@ public struct ClientMessageModelOutput: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.turnId = turnId self.timestamp = timestamp @@ -46,6 +53,7 @@ public struct ClientMessageModelOutput: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageModelOutputPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageModelOutputType.self, forKey: .type) self.turnId = try container.decodeIfPresent(String.self, forKey: .turnId) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -60,6 +68,7 @@ public struct ClientMessageModelOutput: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.turnId, forKey: .turnId) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -72,6 +81,7 @@ public struct ClientMessageModelOutput: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case turnId case timestamp diff --git a/Sources/Schemas/ClientMessageSessionCreated.swift b/Sources/Schemas/ClientMessageSessionCreated.swift index a2a79767..e118effc 100644 --- a/Sources/Schemas/ClientMessageSessionCreated.swift +++ b/Sources/Schemas/ClientMessageSessionCreated.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageSessionCreatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.created" is sent when a new session is created. public let type: ClientMessageSessionCreatedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageSessionCreatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageSessionCreatedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageSessionCreatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageSessionCreatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageSessionCreated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageSessionDeleted.swift b/Sources/Schemas/ClientMessageSessionDeleted.swift index 852f24f3..289d92fb 100644 --- a/Sources/Schemas/ClientMessageSessionDeleted.swift +++ b/Sources/Schemas/ClientMessageSessionDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageSessionDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.deleted" is sent when a session is deleted. public let type: ClientMessageSessionDeletedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageSessionDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageSessionDeletedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageSessionDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageSessionDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageSessionDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageSessionUpdated.swift b/Sources/Schemas/ClientMessageSessionUpdated.swift index 5c01616c..d4169d40 100644 --- a/Sources/Schemas/ClientMessageSessionUpdated.swift +++ b/Sources/Schemas/ClientMessageSessionUpdated.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageSessionUpdatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.updated" is sent when a session is updated. public let type: ClientMessageSessionUpdatedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageSessionUpdatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageSessionUpdatedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageSessionUpdatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageSessionUpdatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageSessionUpdated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageSpeechUpdate.swift b/Sources/Schemas/ClientMessageSpeechUpdate.swift index 492afd87..e8ecce80 100644 --- a/Sources/Schemas/ClientMessageSpeechUpdate.swift +++ b/Sources/Schemas/ClientMessageSpeechUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageSpeechUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "speech-update" is sent whenever assistant or user start or stop speaking. public let type: ClientMessageSpeechUpdateType /// This is the status of the speech update. @@ -24,6 +29,7 @@ public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageSpeechUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageSpeechUpdateType, status: ClientMessageSpeechUpdateStatus, role: ClientMessageSpeechUpdateRole, @@ -35,6 +41,7 @@ public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.status = status self.role = role @@ -49,6 +56,7 @@ public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageSpeechUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageSpeechUpdateType.self, forKey: .type) self.status = try container.decode(ClientMessageSpeechUpdateStatus.self, forKey: .status) self.role = try container.decode(ClientMessageSpeechUpdateRole.self, forKey: .role) @@ -64,6 +72,7 @@ public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.status, forKey: .status) try container.encode(self.role, forKey: .role) @@ -77,6 +86,7 @@ public struct ClientMessageSpeechUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case status case role diff --git a/Sources/Schemas/ClientMessageToolCalls.swift b/Sources/Schemas/ClientMessageToolCalls.swift index 62bbf4b0..aa3b5c53 100644 --- a/Sources/Schemas/ClientMessageToolCalls.swift +++ b/Sources/Schemas/ClientMessageToolCalls.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageToolCalls: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageToolCallsPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "tool-calls" is sent to call a tool. public let type: ClientMessageToolCallsType? /// This is the list of tools calls that the model is requesting along with the original tool configuration. @@ -22,6 +27,7 @@ public struct ClientMessageToolCalls: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageToolCallsPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageToolCallsType? = nil, toolWithToolCallList: [ClientMessageToolCallsToolWithToolCallListItem], timestamp: Double? = nil, @@ -32,6 +38,7 @@ public struct ClientMessageToolCalls: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.toolWithToolCallList = toolWithToolCallList self.timestamp = timestamp @@ -45,6 +52,7 @@ public struct ClientMessageToolCalls: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageToolCallsPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decodeIfPresent(ClientMessageToolCallsType.self, forKey: .type) self.toolWithToolCallList = try container.decode([ClientMessageToolCallsToolWithToolCallListItem].self, forKey: .toolWithToolCallList) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -59,6 +67,7 @@ public struct ClientMessageToolCalls: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encodeIfPresent(self.type, forKey: .type) try container.encode(self.toolWithToolCallList, forKey: .toolWithToolCallList) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -71,6 +80,7 @@ public struct ClientMessageToolCalls: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case toolWithToolCallList case timestamp diff --git a/Sources/Schemas/ClientMessageToolCallsResult.swift b/Sources/Schemas/ClientMessageToolCallsResult.swift index 144c4bd5..58185e9f 100644 --- a/Sources/Schemas/ClientMessageToolCallsResult.swift +++ b/Sources/Schemas/ClientMessageToolCallsResult.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageToolCallsResultPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "tool-calls-result" is sent to forward the result of a tool call to the client. public let type: ClientMessageToolCallsResultType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageToolCallsResultPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageToolCallsResultType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageToolCallsResultPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageToolCallsResultType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageToolCallsResult: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageTranscript.swift b/Sources/Schemas/ClientMessageTranscript.swift index 8ab74207..376f3bcd 100644 --- a/Sources/Schemas/ClientMessageTranscript.swift +++ b/Sources/Schemas/ClientMessageTranscript.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageTranscript: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageTranscriptPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "transcript" is sent as transcriber outputs partial or final transcript. public let type: ClientMessageTranscriptType /// This is the timestamp of the message. @@ -30,6 +35,7 @@ public struct ClientMessageTranscript: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageTranscriptPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageTranscriptType, timestamp: Double? = nil, call: Call? = nil, @@ -44,6 +50,7 @@ public struct ClientMessageTranscript: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -61,6 +68,7 @@ public struct ClientMessageTranscript: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageTranscriptPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageTranscriptType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -79,6 +87,7 @@ public struct ClientMessageTranscript: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -95,6 +104,7 @@ public struct ClientMessageTranscript: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageTransferUpdate.swift b/Sources/Schemas/ClientMessageTransferUpdate.swift index 89e9d14c..b4ae5cfa 100644 --- a/Sources/Schemas/ClientMessageTransferUpdate.swift +++ b/Sources/Schemas/ClientMessageTransferUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageTransferUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "transfer-update" is sent whenever a transfer happens. public let type: ClientMessageTransferUpdateType /// This is the destination of the transfer. @@ -28,6 +33,7 @@ public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageTransferUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageTransferUpdateType, destination: ClientMessageTransferUpdateDestination? = nil, timestamp: Double? = nil, @@ -41,6 +47,7 @@ public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.destination = destination self.timestamp = timestamp @@ -57,6 +64,7 @@ public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageTransferUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageTransferUpdateType.self, forKey: .type) self.destination = try container.decodeIfPresent(ClientMessageTransferUpdateDestination.self, forKey: .destination) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -74,6 +82,7 @@ public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.destination, forKey: .destination) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -89,6 +98,7 @@ public struct ClientMessageTransferUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case destination case timestamp diff --git a/Sources/Schemas/ClientMessageUserInterrupted.swift b/Sources/Schemas/ClientMessageUserInterrupted.swift index eb27759d..ebdca015 100644 --- a/Sources/Schemas/ClientMessageUserInterrupted.swift +++ b/Sources/Schemas/ClientMessageUserInterrupted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageUserInterruptedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "user-interrupted" is sent when the user interrupts the assistant. public let type: ClientMessageUserInterruptedType /// This is the turnId of the LLM response that was interrupted. Matches the turnId @@ -21,6 +26,7 @@ public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageUserInterruptedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageUserInterruptedType, turnId: String? = nil, timestamp: Double? = nil, @@ -30,6 +36,7 @@ public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.turnId = turnId self.timestamp = timestamp @@ -42,6 +49,7 @@ public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageUserInterruptedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageUserInterruptedType.self, forKey: .type) self.turnId = try container.decodeIfPresent(String.self, forKey: .turnId) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -55,6 +63,7 @@ public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.turnId, forKey: .turnId) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -66,6 +75,7 @@ public struct ClientMessageUserInterrupted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case turnId case timestamp diff --git a/Sources/Schemas/ClientMessageVoiceInput.swift b/Sources/Schemas/ClientMessageVoiceInput.swift index bb6501f2..d4cf68d0 100644 --- a/Sources/Schemas/ClientMessageVoiceInput.swift +++ b/Sources/Schemas/ClientMessageVoiceInput.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageVoiceInputPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "voice-input" is sent when a generation is requested from voice provider. public let type: ClientMessageVoiceInputType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageVoiceInputPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageVoiceInputType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageVoiceInputPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageVoiceInputType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageVoiceInput: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/ClientMessageWorkflowNodeStarted.swift b/Sources/Schemas/ClientMessageWorkflowNodeStarted.swift index 08563803..b2f276c6 100644 --- a/Sources/Schemas/ClientMessageWorkflowNodeStarted.swift +++ b/Sources/Schemas/ClientMessageWorkflowNodeStarted.swift @@ -3,6 +3,11 @@ import Foundation public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ClientMessageWorkflowNodeStartedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "workflow.node.started" is sent when the active node changes. public let type: ClientMessageWorkflowNodeStartedType /// This is the timestamp of the message. @@ -20,6 +25,7 @@ public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { public init( phoneNumber: ClientMessageWorkflowNodeStartedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ClientMessageWorkflowNodeStartedType, timestamp: Double? = nil, call: Call? = nil, @@ -29,6 +35,7 @@ public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.call = call @@ -41,6 +48,7 @@ public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ClientMessageWorkflowNodeStartedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ClientMessageWorkflowNodeStartedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.call = try container.decodeIfPresent(Call.self, forKey: .call) @@ -54,6 +62,7 @@ public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.call, forKey: .call) @@ -65,6 +74,7 @@ public struct ClientMessageWorkflowNodeStarted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case call diff --git a/Sources/Schemas/CloudflareR2BucketPlan.swift b/Sources/Schemas/CloudflareR2BucketPlan.swift index 9918881f..565c029c 100644 --- a/Sources/Schemas/CloudflareR2BucketPlan.swift +++ b/Sources/Schemas/CloudflareR2BucketPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Cloudflare R2 bucket configuration for call-artifact storage, including access keys, base URL, bucket name, and path. public struct CloudflareR2BucketPlan: Codable, Hashable, Sendable { /// Cloudflare R2 Access key ID. public let accessKeyId: String? diff --git a/Sources/Schemas/CodeTool.swift b/Sources/Schemas/CodeTool.swift index be2e4b43..303b2ab2 100644 --- a/Sources/Schemas/CodeTool.swift +++ b/Sources/Schemas/CodeTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that executes TypeScript code with configured credentials, environment variables, and timeout. public struct CodeTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CodeToolMessagesItem]? /// This determines if the tool is async. /// @@ -132,6 +132,7 @@ public struct CodeTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [CodeToolMessagesItem]? = nil, async: Bool? = nil, server: Server? = nil, @@ -148,6 +149,7 @@ public struct CodeTool: Codable, Hashable, Sendable { function: OpenAiFunction? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.async = async self.server = server @@ -167,6 +169,7 @@ public struct CodeTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([CodeToolMessagesItem].self, forKey: .messages) self.async = try container.decodeIfPresent(Bool.self, forKey: .async) self.server = try container.decodeIfPresent(Server.self, forKey: .server) @@ -187,6 +190,7 @@ public struct CodeTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.async, forKey: .async) try container.encodeIfPresent(self.server, forKey: .server) @@ -205,6 +209,7 @@ public struct CodeTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case async case server diff --git a/Sources/Schemas/CodeToolEnvironmentVariable.swift b/Sources/Schemas/CodeToolEnvironmentVariable.swift index ecbc75a0..5c710765 100644 --- a/Sources/Schemas/CodeToolEnvironmentVariable.swift +++ b/Sources/Schemas/CodeToolEnvironmentVariable.swift @@ -1,5 +1,6 @@ import Foundation +/// An environment variable supplied to code-tool execution, with support for Liquid templates in its value. public struct CodeToolEnvironmentVariable: Codable, Hashable, Sendable { /// Name of the environment variable public let name: String diff --git a/Sources/Schemas/Compliance.swift b/Sources/Schemas/Compliance.swift index 1855e2a7..b72db6e7 100644 --- a/Sources/Schemas/Compliance.swift +++ b/Sources/Schemas/Compliance.swift @@ -1,5 +1,6 @@ import Foundation +/// Compliance information captured for a call, including recording consent. public struct Compliance: Codable, Hashable, Sendable { /// This is the recording consent of the call. Configure in `assistant.compliancePlan.recordingConsentPlan`. public let recordingConsent: RecordingConsent? diff --git a/Sources/Schemas/ComplianceOverride.swift b/Sources/Schemas/ComplianceOverride.swift index c3b9b14a..8761b1da 100644 --- a/Sources/Schemas/ComplianceOverride.swift +++ b/Sources/Schemas/ComplianceOverride.swift @@ -1,5 +1,6 @@ import Foundation +/// Overrides storage behavior for an output when HIPAA compliance is enabled. public struct ComplianceOverride: Codable, Hashable, Sendable { /// Force storage for this output under HIPAA. Only enable if output contains no sensitive data. public let forceStoreOnHipaaEnabled: Bool? diff --git a/Sources/Schemas/CompliancePlan.swift b/Sources/Schemas/CompliancePlan.swift index 3494e9fc..b8fb2196 100644 --- a/Sources/Schemas/CompliancePlan.swift +++ b/Sources/Schemas/CompliancePlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls HIPAA and PCI requirements, transcript security filtering, and recording-consent handling for assistant calls. public struct CompliancePlan: Codable, Hashable, Sendable { /// When this is enabled, logs, recordings, and transcriptions will be stored in HIPAA-compliant storage. Defaults to false. Only HIPAA-compliant providers will be available for LLM, Voice, and Transcriber respectively. This setting is only honored if the organization is on an Enterprise subscription or has purchased the HIPAA add-on. public let hipaaEnabled: Bool? @@ -8,6 +9,7 @@ public struct CompliancePlan: Codable, Hashable, Sendable { public let pciEnabled: Bool? /// This is the security filter plan for the assistant. It allows filtering of transcripts for security threats before sending to LLM. public let securityFilterPlan: SecurityFilterPlan? + /// Controls how recording consent is requested before the assistant joins the call. public let recordingConsentPlan: CompliancePlanRecordingConsentPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/CompliancePlanRecordingConsentPlan.swift b/Sources/Schemas/CompliancePlanRecordingConsentPlan.swift index 7fc2a6bf..f85cd959 100644 --- a/Sources/Schemas/CompliancePlanRecordingConsentPlan.swift +++ b/Sources/Schemas/CompliancePlanRecordingConsentPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls how recording consent is requested before the assistant joins the call. public enum CompliancePlanRecordingConsentPlan: Codable, Hashable, Sendable { case stayOnLine(RecordingConsentPlanStayOnLine) case verbal(RecordingConsentPlanVerbal) diff --git a/Sources/Schemas/ComputerTool.swift b/Sources/Schemas/ComputerTool.swift index f95842c2..be9aa353 100644 --- a/Sources/Schemas/ComputerTool.swift +++ b/Sources/Schemas/ComputerTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that lets the model interact with a computer display through screen, pointer, and keyboard actions. public struct ComputerTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [ComputerToolMessagesItem]? /// The sub type of tool. public let subType: ComputerToolSubType @@ -116,6 +116,7 @@ public struct ComputerTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [ComputerToolMessagesItem]? = nil, subType: ComputerToolSubType, server: Server? = nil, @@ -130,6 +131,7 @@ public struct ComputerTool: Codable, Hashable, Sendable { displayNumber: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.subType = subType self.server = server @@ -147,6 +149,7 @@ public struct ComputerTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([ComputerToolMessagesItem].self, forKey: .messages) self.subType = try container.decode(ComputerToolSubType.self, forKey: .subType) self.server = try container.decodeIfPresent(Server.self, forKey: .server) @@ -165,6 +168,7 @@ public struct ComputerTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.subType, forKey: .subType) try container.encodeIfPresent(self.server, forKey: .server) @@ -181,6 +185,7 @@ public struct ComputerTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case subType case server diff --git a/Sources/Schemas/ComputerToolWithToolCall.swift b/Sources/Schemas/ComputerToolWithToolCall.swift index ab8cdfec..9746284d 100644 --- a/Sources/Schemas/ComputerToolWithToolCall.swift +++ b/Sources/Schemas/ComputerToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct ComputerToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [ComputerToolWithToolCallMessagesItem]? /// The sub type of tool. public let subType: ComputerToolWithToolCallSubType diff --git a/Sources/Schemas/Condition.swift b/Sources/Schemas/Condition.swift index d1454ea2..31b1b609 100644 --- a/Sources/Schemas/Condition.swift +++ b/Sources/Schemas/Condition.swift @@ -1,5 +1,6 @@ import Foundation +/// Compares a named parameter with a value using the selected comparison operator. public struct Condition: Codable, Hashable, Sendable { /// This is the operator you want to use to compare the parameter and value. public let `operator`: ConditionOperator diff --git a/Sources/Schemas/ContextEngineeringPlanAll.swift b/Sources/Schemas/ContextEngineeringPlanAll.swift index 41e44575..899f2deb 100644 --- a/Sources/Schemas/ContextEngineeringPlanAll.swift +++ b/Sources/Schemas/ContextEngineeringPlanAll.swift @@ -1,5 +1,6 @@ import Foundation +/// Includes all available messages when constructing context for a handoff. public struct ContextEngineeringPlanAll: Codable, Hashable, Sendable { /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/ContextEngineeringPlanLastNMessages.swift b/Sources/Schemas/ContextEngineeringPlanLastNMessages.swift index 4fe6ea2f..420404b0 100644 --- a/Sources/Schemas/ContextEngineeringPlanLastNMessages.swift +++ b/Sources/Schemas/ContextEngineeringPlanLastNMessages.swift @@ -1,5 +1,6 @@ import Foundation +/// Includes a configured number of the most recent messages when constructing context for a handoff. public struct ContextEngineeringPlanLastNMessages: Codable, Hashable, Sendable { /// This is the maximum number of messages to include in the context engineering plan. public let maxMessages: Double diff --git a/Sources/Schemas/ContextEngineeringPlanNone.swift b/Sources/Schemas/ContextEngineeringPlanNone.swift index abc14189..e0ef9ff8 100644 --- a/Sources/Schemas/ContextEngineeringPlanNone.swift +++ b/Sources/Schemas/ContextEngineeringPlanNone.swift @@ -1,5 +1,6 @@ import Foundation +/// Excludes prior conversation messages when constructing context for a handoff. public struct ContextEngineeringPlanNone: Codable, Hashable, Sendable { /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/ContextEngineeringPlanPreviousAssistantMessages.swift b/Sources/Schemas/ContextEngineeringPlanPreviousAssistantMessages.swift new file mode 100644 index 00000000..74b606b2 --- /dev/null +++ b/Sources/Schemas/ContextEngineeringPlanPreviousAssistantMessages.swift @@ -0,0 +1,20 @@ +import Foundation + +public struct ContextEngineeringPlanPreviousAssistantMessages: Codable, Hashable, Sendable { + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + additionalProperties: [String: JSONValue] = .init() + ) { + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + self.additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + public func encode(to encoder: Encoder) throws -> Void { + try encoder.encodeAdditionalProperties(self.additionalProperties) + } +} \ No newline at end of file diff --git a/Sources/Schemas/ContextEngineeringPlanUserAndAssistantMessages.swift b/Sources/Schemas/ContextEngineeringPlanUserAndAssistantMessages.swift index 23096a5a..e2592ec5 100644 --- a/Sources/Schemas/ContextEngineeringPlanUserAndAssistantMessages.swift +++ b/Sources/Schemas/ContextEngineeringPlanUserAndAssistantMessages.swift @@ -1,5 +1,6 @@ import Foundation +/// Includes only user and assistant messages when constructing context for a handoff. public struct ContextEngineeringPlanUserAndAssistantMessages: Codable, Hashable, Sendable { /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/ConversationNode.swift b/Sources/Schemas/ConversationNode.swift index eca2a286..931a81c7 100644 --- a/Sources/Schemas/ConversationNode.swift +++ b/Sources/Schemas/ConversationNode.swift @@ -1,5 +1,6 @@ import Foundation +/// A workflow node where the assistant conducts a conversation using optional node-specific providers, tools, prompt, and variable extraction. public struct ConversationNode: Codable, Hashable, Sendable { /// This is the model for the node. /// @@ -21,6 +22,7 @@ public struct ConversationNode: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// Prompt that guides the assistant while this node is active. public let prompt: String? /// This is the plan for the global node. public let globalNodePlan: GlobalNodePlan? @@ -72,6 +74,7 @@ public struct ConversationNode: Codable, Hashable, Sendable { /// /// Note: The `schema` field is required for Conversation nodes if you want to extract variables from the user's responses. `aliases` is just a convenience. public let variableExtractionPlan: VariableExtractionPlan? + /// Unique name used to identify this workflow node. public let name: String /// This is whether or not the node is the start of the workflow. public let isStart: Bool? diff --git a/Sources/Schemas/ConversationNodeToolsItem.swift b/Sources/Schemas/ConversationNodeToolsItem.swift index 2b02d5e0..23fcc9a7 100644 --- a/Sources/Schemas/ConversationNodeToolsItem.swift +++ b/Sources/Schemas/ConversationNodeToolsItem.swift @@ -1,6 +1,6 @@ import Foundation -public enum ConversationNodeToolsItem: Codable, Hashable, Sendable { +public indirect enum ConversationNodeToolsItem: Codable, Hashable, Sendable { case apiRequest(CreateApiRequestToolDto) case bash(CreateBashToolDto) case code(CreateCodeToolDto) diff --git a/Sources/Schemas/ConversationNodeTranscriber.swift b/Sources/Schemas/ConversationNodeTranscriber.swift index 9b133e9c..f5f1c246 100644 --- a/Sources/Schemas/ConversationNodeTranscriber.swift +++ b/Sources/Schemas/ConversationNodeTranscriber.swift @@ -16,6 +16,8 @@ public enum ConversationNodeTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -45,6 +47,10 @@ public enum ConversationNodeTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,12 @@ public enum ConversationNodeTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/ConversationNodeVoice.swift b/Sources/Schemas/ConversationNodeVoice.swift index 043dbb33..a6cf0d14 100644 --- a/Sources/Schemas/ConversationNodeVoice.swift +++ b/Sources/Schemas/ConversationNodeVoice.swift @@ -12,6 +12,7 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -22,6 +23,7 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,8 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -63,6 +67,8 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -100,6 +106,9 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -130,6 +139,9 @@ public enum ConversationNodeVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/CostBreakdown.swift b/Sources/Schemas/CostBreakdown.swift index e25ca22e..7f23c57c 100644 --- a/Sources/Schemas/CostBreakdown.swift +++ b/Sources/Schemas/CostBreakdown.swift @@ -1,5 +1,6 @@ import Foundation +/// Aggregated call costs and usage, including transport, transcription, model, voice, Vapi, analysis, token, and character totals. public struct CostBreakdown: Codable, Hashable, Sendable { /// This is the cost of the transport provider, like Twilio or Vonage. public let transport: Double? diff --git a/Sources/Schemas/CreateAnthropicBedrockCredentialDto.swift b/Sources/Schemas/CreateAnthropicBedrockCredentialDto.swift index ba5d0461..850f3371 100644 --- a/Sources/Schemas/CreateAnthropicBedrockCredentialDto.swift +++ b/Sources/Schemas/CreateAnthropicBedrockCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating Anthropic model requests through Amazon Bedrock, including AWS region and authentication method. public struct CreateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { /// AWS region where Bedrock is configured. public let region: CreateAnthropicBedrockCredentialDtoRegion diff --git a/Sources/Schemas/CreateAnthropicBedrockCredentialDtoRegion.swift b/Sources/Schemas/CreateAnthropicBedrockCredentialDtoRegion.swift index 20f2d6b0..c6676dac 100644 --- a/Sources/Schemas/CreateAnthropicBedrockCredentialDtoRegion.swift +++ b/Sources/Schemas/CreateAnthropicBedrockCredentialDtoRegion.swift @@ -4,6 +4,7 @@ import Foundation public enum CreateAnthropicBedrockCredentialDtoRegion: String, Codable, Hashable, CaseIterable, Sendable { case usEast1 = "us-east-1" case usWest2 = "us-west-2" + case euCentral1 = "eu-central-1" case euWest1 = "eu-west-1" case euWest3 = "eu-west-3" case apNortheast1 = "ap-northeast-1" diff --git a/Sources/Schemas/CreateAnthropicCredentialDto.swift b/Sources/Schemas/CreateAnthropicCredentialDto.swift index f7f02be6..cb592026 100644 --- a/Sources/Schemas/CreateAnthropicCredentialDto.swift +++ b/Sources/Schemas/CreateAnthropicCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Anthropic. public struct CreateAnthropicCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateAnyscaleCredentialDto.swift b/Sources/Schemas/CreateAnyscaleCredentialDto.swift index 14b83e5f..d045321f 100644 --- a/Sources/Schemas/CreateAnyscaleCredentialDto.swift +++ b/Sources/Schemas/CreateAnyscaleCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Anyscale. public struct CreateAnyscaleCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateApiRequestToolDto.swift b/Sources/Schemas/CreateApiRequestToolDto.swift index cbcafd53..278f0a5d 100644 --- a/Sources/Schemas/CreateApiRequestToolDto.swift +++ b/Sources/Schemas/CreateApiRequestToolDto.swift @@ -1,10 +1,14 @@ import Foundation +/// Configuration used to create a reusable tool that sends HTTP requests to a configured API and can authenticate, retry failures, and extract variables from responses. public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateApiRequestToolDtoMessagesItem]? + /// This is the name of the tool. This will be passed to the model. + /// + /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. + public let name: String? + /// The HTTP method used for the API request. public let method: CreateApiRequestToolDtoMethod /// This is the timeout in seconds for the request. Defaults to 20 seconds. /// @@ -16,10 +20,6 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { public let encryptedPaths: [String]? /// Static key-value pairs merged into the request body. Values support Liquid templates. public let parameters: [ToolParameter]? - /// This is the name of the tool. This will be passed to the model. - /// - /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. - public let name: String? /// This is the description of the tool. This will be passed to the model. public let description: String? /// This is where the request will be sent. @@ -270,12 +270,12 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { public init( messages: [CreateApiRequestToolDtoMessagesItem]? = nil, + name: String? = nil, method: CreateApiRequestToolDtoMethod, timeoutSeconds: Double? = nil, credentialId: String? = nil, encryptedPaths: [String]? = nil, parameters: [ToolParameter]? = nil, - name: String? = nil, description: String? = nil, url: String, body: JsonSchema? = nil, @@ -286,12 +286,12 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.name = name self.method = method self.timeoutSeconds = timeoutSeconds self.credentialId = credentialId self.encryptedPaths = encryptedPaths self.parameters = parameters - self.name = name self.description = description self.url = url self.body = body @@ -305,12 +305,12 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([CreateApiRequestToolDtoMessagesItem].self, forKey: .messages) + self.name = try container.decodeIfPresent(String.self, forKey: .name) self.method = try container.decode(CreateApiRequestToolDtoMethod.self, forKey: .method) self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) self.encryptedPaths = try container.decodeIfPresent([String].self, forKey: .encryptedPaths) self.parameters = try container.decodeIfPresent([ToolParameter].self, forKey: .parameters) - self.name = try container.decodeIfPresent(String.self, forKey: .name) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.url = try container.decode(String.self, forKey: .url) self.body = try container.decodeIfPresent(JsonSchema.self, forKey: .body) @@ -325,12 +325,12 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.name, forKey: .name) try container.encode(self.method, forKey: .method) try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) try container.encodeIfPresent(self.credentialId, forKey: .credentialId) try container.encodeIfPresent(self.encryptedPaths, forKey: .encryptedPaths) try container.encodeIfPresent(self.parameters, forKey: .parameters) - try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.description, forKey: .description) try container.encode(self.url, forKey: .url) try container.encodeIfPresent(self.body, forKey: .body) @@ -343,12 +343,12 @@ public struct CreateApiRequestToolDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case name case method case timeoutSeconds case credentialId case encryptedPaths case parameters - case name case description case url case body diff --git a/Sources/Schemas/CreateApiRequestToolDtoMethod.swift b/Sources/Schemas/CreateApiRequestToolDtoMethod.swift index 1b74d80b..3d6cc327 100644 --- a/Sources/Schemas/CreateApiRequestToolDtoMethod.swift +++ b/Sources/Schemas/CreateApiRequestToolDtoMethod.swift @@ -1,5 +1,6 @@ import Foundation +/// The HTTP method used for the API request. public enum CreateApiRequestToolDtoMethod: String, Codable, Hashable, CaseIterable, Sendable { case post = "POST" case get = "GET" diff --git a/Sources/Schemas/CreateAssemblyAiCredentialDto.swift b/Sources/Schemas/CreateAssemblyAiCredentialDto.swift index d23f48c8..e21938d7 100644 --- a/Sources/Schemas/CreateAssemblyAiCredentialDto.swift +++ b/Sources/Schemas/CreateAssemblyAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating transcription requests with AssemblyAI. public struct CreateAssemblyAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateAssistantDraftDto.swift b/Sources/Schemas/CreateAssistantDraftDto.swift new file mode 100644 index 00000000..2d089535 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDto.swift @@ -0,0 +1,307 @@ +import Foundation + +public struct CreateAssistantDraftDto: Codable, Hashable, Sendable { + /// These are the options for the assistant's transcriber. + public let transcriber: CreateAssistantDraftDtoTranscriber? + /// These are the options for the assistant's LLM. + public let model: CreateAssistantDraftDtoModel? + /// These are the options for the assistant's voice. + public let voice: CreateAssistantDraftDtoVoice? + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + public let firstMessage: String? + public let firstMessageInterruptionsEnabled: Bool? + /// This is the mode for the first message. Default is 'assistant-speaks-first'. + /// + /// Use: + /// - 'assistant-speaks-first' to have the assistant speak first. + /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. + /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: CreateAssistantDraftDtoFirstMessageMode? + /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + /// By default, voicemail detection is disabled. + public let voicemailDetection: CreateAssistantDraftDtoVoicemailDetection? + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started,assistant.started. You can check the shape of the messages in ClientMessage schema. + public let clientMessages: [CreateAssistantDraftDtoClientMessagesItem]? + /// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,handoff-destination-request,user-interrupted,assistant.started. You can check the shape of the messages in ServerMessage schema. + public let serverMessages: [CreateAssistantDraftDtoServerMessagesItem]? + /// This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + /// + /// @default 600 (10 minutes) + public let maxDurationSeconds: Double? + /// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + /// You can also provide a custom sound by providing a URL to an audio file. + public let backgroundSound: CreateAssistantDraftDtoBackgroundSound? + /// This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + /// + /// @default false + public let modelOutputInMessagesEnabled: Bool? + /// These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + public let transportConfigurations: [TransportConfigurationTwilio]? + /// This is the plan for observability of assistant's calls. + /// + /// Currently, only Langfuse is supported. + public let observabilityPlan: LangfuseObservabilityPlan? + /// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials. + public let credentials: [CreateAssistantDraftDtoCredentialsItem]? + /// This is a set of actions that will be performed on certain events. + public let hooks: [CreateAssistantDraftDtoHooksItem]? + /// This is the name of the assistant. + /// + /// This is required when you want to transfer between assistants in a call. + public let name: String? + /// This is the message that the assistant will say if the call is forwarded to voicemail. + /// + /// If unspecified, it will hang up. + public let voicemailMessage: String? + /// This is the message that the assistant will say if it ends the call. + /// + /// If unspecified, it will hang up without saying anything. + public let endCallMessage: String? + /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + public let endCallPhrases: [String]? + public let compliancePlan: CompliancePlan? + /// This is for metadata you want to store on the assistant. + public let metadata: [String: JSONValue]? + /// This enables filtering of noise and background speech while the user is talking. + /// + /// Features: + /// - Smart denoising using Krisp + /// - Fourier denoising + /// + /// Smart denoising can be combined with or used independently of Fourier denoising. + /// + /// Order of precedence: + /// - Smart denoising + /// - Fourier denoising + public let backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? + /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. + public let analysisPlan: AnalysisPlan? + /// This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`. + public let artifactPlan: ArtifactPlan? + /// This is the plan for when the assistant should start talking. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to start talking after the customer is done speaking. + /// - The assistant is too fast to start talking after the customer is done speaking. + /// - The assistant is so fast that it's actually interrupting the customer. + public let startSpeakingPlan: StartSpeakingPlan? + /// This is the plan for when assistant should stop talking on customer interruption. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to recognize customer's interruption. + /// - The assistant is too fast to recognize customer's interruption. + /// - The assistant is getting interrupted by phrases that are just acknowledgments. + /// - The assistant is getting interrupted by background noises. + /// - The assistant is not properly stopping -- it starts talking right after getting interrupted. + public let stopSpeakingPlan: StopSpeakingPlan? + /// This is the plan for real-time monitoring of the assistant's calls. + /// + /// Usage: + /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. + /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. + /// - To attach monitors to the assistant, set `monitorPlan.monitorIds` to the set of monitor ids. + public let monitorPlan: MonitorPlan? + /// These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + public let credentialIds: [String]? + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + public let server: Server? + public let keypadInputPlan: KeypadInputPlan? + /// Optional pointer to the published version this draft was forked from. + /// When omitted on `POST /assistant/:id/draft`, defaults server-side to the + /// parent assistant's current `latestVersion` (which is lazy-created via + /// `assistantBaselineVersionEnsureInTx` if the parent has never been + /// versioned). Immutable for the lifetime of the draft. + public let baseVersion: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + transcriber: CreateAssistantDraftDtoTranscriber? = nil, + model: CreateAssistantDraftDtoModel? = nil, + voice: CreateAssistantDraftDtoVoice? = nil, + firstMessage: String? = nil, + firstMessageInterruptionsEnabled: Bool? = nil, + firstMessageMode: CreateAssistantDraftDtoFirstMessageMode? = nil, + voicemailDetection: CreateAssistantDraftDtoVoicemailDetection? = nil, + clientMessages: [CreateAssistantDraftDtoClientMessagesItem]? = nil, + serverMessages: [CreateAssistantDraftDtoServerMessagesItem]? = nil, + maxDurationSeconds: Double? = nil, + backgroundSound: CreateAssistantDraftDtoBackgroundSound? = nil, + modelOutputInMessagesEnabled: Bool? = nil, + transportConfigurations: [TransportConfigurationTwilio]? = nil, + observabilityPlan: LangfuseObservabilityPlan? = nil, + credentials: [CreateAssistantDraftDtoCredentialsItem]? = nil, + hooks: [CreateAssistantDraftDtoHooksItem]? = nil, + name: String? = nil, + voicemailMessage: String? = nil, + endCallMessage: String? = nil, + endCallPhrases: [String]? = nil, + compliancePlan: CompliancePlan? = nil, + metadata: [String: JSONValue]? = nil, + backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? = nil, + analysisPlan: AnalysisPlan? = nil, + artifactPlan: ArtifactPlan? = nil, + startSpeakingPlan: StartSpeakingPlan? = nil, + stopSpeakingPlan: StopSpeakingPlan? = nil, + monitorPlan: MonitorPlan? = nil, + credentialIds: [String]? = nil, + server: Server? = nil, + keypadInputPlan: KeypadInputPlan? = nil, + baseVersion: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.transcriber = transcriber + self.model = model + self.voice = voice + self.firstMessage = firstMessage + self.firstMessageInterruptionsEnabled = firstMessageInterruptionsEnabled + self.firstMessageMode = firstMessageMode + self.voicemailDetection = voicemailDetection + self.clientMessages = clientMessages + self.serverMessages = serverMessages + self.maxDurationSeconds = maxDurationSeconds + self.backgroundSound = backgroundSound + self.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled + self.transportConfigurations = transportConfigurations + self.observabilityPlan = observabilityPlan + self.credentials = credentials + self.hooks = hooks + self.name = name + self.voicemailMessage = voicemailMessage + self.endCallMessage = endCallMessage + self.endCallPhrases = endCallPhrases + self.compliancePlan = compliancePlan + self.metadata = metadata + self.backgroundSpeechDenoisingPlan = backgroundSpeechDenoisingPlan + self.analysisPlan = analysisPlan + self.artifactPlan = artifactPlan + self.startSpeakingPlan = startSpeakingPlan + self.stopSpeakingPlan = stopSpeakingPlan + self.monitorPlan = monitorPlan + self.credentialIds = credentialIds + self.server = server + self.keypadInputPlan = keypadInputPlan + self.baseVersion = baseVersion + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.transcriber = try container.decodeIfPresent(CreateAssistantDraftDtoTranscriber.self, forKey: .transcriber) + self.model = try container.decodeIfPresent(CreateAssistantDraftDtoModel.self, forKey: .model) + self.voice = try container.decodeIfPresent(CreateAssistantDraftDtoVoice.self, forKey: .voice) + self.firstMessage = try container.decodeIfPresent(String.self, forKey: .firstMessage) + self.firstMessageInterruptionsEnabled = try container.decodeIfPresent(Bool.self, forKey: .firstMessageInterruptionsEnabled) + self.firstMessageMode = try container.decodeIfPresent(CreateAssistantDraftDtoFirstMessageMode.self, forKey: .firstMessageMode) + self.voicemailDetection = try container.decodeIfPresent(CreateAssistantDraftDtoVoicemailDetection.self, forKey: .voicemailDetection) + self.clientMessages = try container.decodeIfPresent([CreateAssistantDraftDtoClientMessagesItem].self, forKey: .clientMessages) + self.serverMessages = try container.decodeIfPresent([CreateAssistantDraftDtoServerMessagesItem].self, forKey: .serverMessages) + self.maxDurationSeconds = try container.decodeIfPresent(Double.self, forKey: .maxDurationSeconds) + self.backgroundSound = try container.decodeIfPresent(CreateAssistantDraftDtoBackgroundSound.self, forKey: .backgroundSound) + self.modelOutputInMessagesEnabled = try container.decodeIfPresent(Bool.self, forKey: .modelOutputInMessagesEnabled) + self.transportConfigurations = try container.decodeIfPresent([TransportConfigurationTwilio].self, forKey: .transportConfigurations) + self.observabilityPlan = try container.decodeIfPresent(LangfuseObservabilityPlan.self, forKey: .observabilityPlan) + self.credentials = try container.decodeIfPresent([CreateAssistantDraftDtoCredentialsItem].self, forKey: .credentials) + self.hooks = try container.decodeIfPresent([CreateAssistantDraftDtoHooksItem].self, forKey: .hooks) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.voicemailMessage = try container.decodeIfPresent(String.self, forKey: .voicemailMessage) + self.endCallMessage = try container.decodeIfPresent(String.self, forKey: .endCallMessage) + self.endCallPhrases = try container.decodeIfPresent([String].self, forKey: .endCallPhrases) + self.compliancePlan = try container.decodeIfPresent(CompliancePlan.self, forKey: .compliancePlan) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.backgroundSpeechDenoisingPlan = try container.decodeIfPresent(BackgroundSpeechDenoisingPlan.self, forKey: .backgroundSpeechDenoisingPlan) + self.analysisPlan = try container.decodeIfPresent(AnalysisPlan.self, forKey: .analysisPlan) + self.artifactPlan = try container.decodeIfPresent(ArtifactPlan.self, forKey: .artifactPlan) + self.startSpeakingPlan = try container.decodeIfPresent(StartSpeakingPlan.self, forKey: .startSpeakingPlan) + self.stopSpeakingPlan = try container.decodeIfPresent(StopSpeakingPlan.self, forKey: .stopSpeakingPlan) + self.monitorPlan = try container.decodeIfPresent(MonitorPlan.self, forKey: .monitorPlan) + self.credentialIds = try container.decodeIfPresent([String].self, forKey: .credentialIds) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.keypadInputPlan = try container.decodeIfPresent(KeypadInputPlan.self, forKey: .keypadInputPlan) + self.baseVersion = try container.decodeIfPresent(String.self, forKey: .baseVersion) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.transcriber, forKey: .transcriber) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessage, forKey: .firstMessage) + try container.encodeIfPresent(self.firstMessageInterruptionsEnabled, forKey: .firstMessageInterruptionsEnabled) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) + try container.encodeIfPresent(self.voicemailDetection, forKey: .voicemailDetection) + try container.encodeIfPresent(self.clientMessages, forKey: .clientMessages) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.maxDurationSeconds, forKey: .maxDurationSeconds) + try container.encodeIfPresent(self.backgroundSound, forKey: .backgroundSound) + try container.encodeIfPresent(self.modelOutputInMessagesEnabled, forKey: .modelOutputInMessagesEnabled) + try container.encodeIfPresent(self.transportConfigurations, forKey: .transportConfigurations) + try container.encodeIfPresent(self.observabilityPlan, forKey: .observabilityPlan) + try container.encodeIfPresent(self.credentials, forKey: .credentials) + try container.encodeIfPresent(self.hooks, forKey: .hooks) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.voicemailMessage, forKey: .voicemailMessage) + try container.encodeIfPresent(self.endCallMessage, forKey: .endCallMessage) + try container.encodeIfPresent(self.endCallPhrases, forKey: .endCallPhrases) + try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.backgroundSpeechDenoisingPlan, forKey: .backgroundSpeechDenoisingPlan) + try container.encodeIfPresent(self.analysisPlan, forKey: .analysisPlan) + try container.encodeIfPresent(self.artifactPlan, forKey: .artifactPlan) + try container.encodeIfPresent(self.startSpeakingPlan, forKey: .startSpeakingPlan) + try container.encodeIfPresent(self.stopSpeakingPlan, forKey: .stopSpeakingPlan) + try container.encodeIfPresent(self.monitorPlan, forKey: .monitorPlan) + try container.encodeIfPresent(self.credentialIds, forKey: .credentialIds) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.keypadInputPlan, forKey: .keypadInputPlan) + try container.encodeIfPresent(self.baseVersion, forKey: .baseVersion) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case transcriber + case model + case voice + case firstMessage + case firstMessageInterruptionsEnabled + case firstMessageMode + case voicemailDetection + case clientMessages + case serverMessages + case maxDurationSeconds + case backgroundSound + case modelOutputInMessagesEnabled + case transportConfigurations + case observabilityPlan + case credentials + case hooks + case name + case voicemailMessage + case endCallMessage + case endCallPhrases + case compliancePlan + case metadata + case backgroundSpeechDenoisingPlan + case analysisPlan + case artifactPlan + case startSpeakingPlan + case stopSpeakingPlan + case monitorPlan + case credentialIds + case server + case keypadInputPlan + case baseVersion + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoBackgroundSound.swift b/Sources/Schemas/CreateAssistantDraftDtoBackgroundSound.swift new file mode 100644 index 00000000..f303d82e --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoBackgroundSound.swift @@ -0,0 +1,32 @@ +import Foundation + +/// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. +/// You can also provide a custom sound by providing a URL to an audio file. +public enum CreateAssistantDraftDtoBackgroundSound: Codable, Hashable, Sendable { + case createAssistantDraftDtoBackgroundSoundZero(CreateAssistantDraftDtoBackgroundSoundZero) + case string(String) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CreateAssistantDraftDtoBackgroundSoundZero.self) { + self = .createAssistantDraftDtoBackgroundSoundZero(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .createAssistantDraftDtoBackgroundSoundZero(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoBackgroundSoundZero.swift b/Sources/Schemas/CreateAssistantDraftDtoBackgroundSoundZero.swift new file mode 100644 index 00000000..247b9ca4 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoBackgroundSoundZero.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum CreateAssistantDraftDtoBackgroundSoundZero: String, Codable, Hashable, CaseIterable, Sendable { + case off + case office +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoClientMessagesItem.swift b/Sources/Schemas/CreateAssistantDraftDtoClientMessagesItem.swift new file mode 100644 index 00000000..4492501f --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoClientMessagesItem.swift @@ -0,0 +1,23 @@ +import Foundation + +public enum CreateAssistantDraftDtoClientMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case conversationUpdate = "conversation-update" + case assistantSpeechStarted = "assistant.speechStarted" + case functionCall = "function-call" + case functionCallResult = "function-call-result" + case hang + case languageChanged = "language-changed" + case metadata + case modelOutput = "model-output" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case toolCalls = "tool-calls" + case toolCallsResult = "tool-calls-result" + case toolCompleted = "tool.completed" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case workflowNodeStarted = "workflow.node.started" + case assistantStarted = "assistant.started" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoCredentialsItem.swift b/Sources/Schemas/CreateAssistantDraftDtoCredentialsItem.swift new file mode 100644 index 00000000..86a53e23 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoCredentialsItem.swift @@ -0,0 +1,370 @@ +import Foundation + +public enum CreateAssistantDraftDtoCredentialsItem: Codable, Hashable, Sendable { + case anthropic(CreateAnthropicCredentialDto) + case anthropicBedrock(CreateAnthropicBedrockCredentialDto) + case anyscale(CreateAnyscaleCredentialDto) + case assemblyAi(CreateAssemblyAiCredentialDto) + case azure(CreateAzureCredentialDto) + case azureOpenai(CreateAzureOpenAiCredentialDto) + case byoSipTrunk(CreateByoSipTrunkCredentialDto) + case cartesia(CreateCartesiaCredentialDto) + case cerebras(CreateCerebrasCredentialDto) + case cloudflare(CreateCloudflareCredentialDto) + case customCredential(CreateCustomCredentialDto) + case customLlm(CreateCustomLlmCredentialDto) + case deepgram(CreateDeepgramCredentialDto) + case deepinfra(CreateDeepInfraCredentialDto) + case deepSeek(CreateDeepSeekCredentialDto) + case elevenLabs(CreateElevenLabsCredentialDto) + case email(CreateEmailCredentialDto) + case gcp(CreateGcpCredentialDto) + case ghlOauth2Authorization(CreateGoHighLevelMcpCredentialDto) + case gladia(CreateGladiaCredentialDto) + case gohighlevel(CreateGoHighLevelCredentialDto) + case google(CreateGoogleCredentialDto) + case googleCalendarOauth2Authorization(CreateGoogleCalendarOAuth2AuthorizationCredentialDto) + case googleCalendarOauth2Client(CreateGoogleCalendarOAuth2ClientCredentialDto) + case googleSheetsOauth2Authorization(CreateGoogleSheetsOAuth2AuthorizationCredentialDto) + case groq(CreateGroqCredentialDto) + case hume(CreateHumeCredentialDto) + case inflectionAi(CreateInflectionAiCredentialDto) + case inworld(CreateInworldCredentialDto) + case langfuse(CreateLangfuseCredentialDto) + case lmnt(CreateLmntCredentialDto) + case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) + case minimax(CreateMinimaxCredentialDto) + case mistral(CreateMistralCredentialDto) + case neuphonic(CreateNeuphonicCredentialDto) + case openai(CreateOpenAiCredentialDto) + case openrouter(CreateOpenRouterCredentialDto) + case perplexityAi(CreatePerplexityAiCredentialDto) + case playht(CreatePlayHtCredentialDto) + case rimeAi(CreateRimeAiCredentialDto) + case runpod(CreateRunpodCredentialDto) + case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) + case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) + case slackWebhook(CreateSlackWebhookCredentialDto) + case smallestAi(CreateSmallestAiCredentialDto) + case soniox(CreateSonioxCredentialDto) + case speechmatics(CreateSpeechmaticsCredentialDto) + case supabase(CreateSupabaseCredentialDto) + case tavus(CreateTavusCredentialDto) + case togetherAi(CreateTogetherAiCredentialDto) + case twilio(CreateTwilioCredentialDto) + case vonage(CreateVonageCredentialDto) + case webhook(CreateWebhookCredentialDto) + case wellsaid(CreateWellSaidCredentialDto) + case xai(CreateXAiCredentialDto) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try CreateAnthropicCredentialDto(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try CreateAnthropicBedrockCredentialDto(from: decoder)) + case "anyscale": + self = .anyscale(try CreateAnyscaleCredentialDto(from: decoder)) + case "assembly-ai": + self = .assemblyAi(try CreateAssemblyAiCredentialDto(from: decoder)) + case "azure": + self = .azure(try CreateAzureCredentialDto(from: decoder)) + case "azure-openai": + self = .azureOpenai(try CreateAzureOpenAiCredentialDto(from: decoder)) + case "byo-sip-trunk": + self = .byoSipTrunk(try CreateByoSipTrunkCredentialDto(from: decoder)) + case "cartesia": + self = .cartesia(try CreateCartesiaCredentialDto(from: decoder)) + case "cerebras": + self = .cerebras(try CreateCerebrasCredentialDto(from: decoder)) + case "cloudflare": + self = .cloudflare(try CreateCloudflareCredentialDto(from: decoder)) + case "custom-credential": + self = .customCredential(try CreateCustomCredentialDto(from: decoder)) + case "custom-llm": + self = .customLlm(try CreateCustomLlmCredentialDto(from: decoder)) + case "deepgram": + self = .deepgram(try CreateDeepgramCredentialDto(from: decoder)) + case "deepinfra": + self = .deepinfra(try CreateDeepInfraCredentialDto(from: decoder)) + case "deep-seek": + self = .deepSeek(try CreateDeepSeekCredentialDto(from: decoder)) + case "11labs": + self = .elevenLabs(try CreateElevenLabsCredentialDto(from: decoder)) + case "email": + self = .email(try CreateEmailCredentialDto(from: decoder)) + case "gcp": + self = .gcp(try CreateGcpCredentialDto(from: decoder)) + case "ghl.oauth2-authorization": + self = .ghlOauth2Authorization(try CreateGoHighLevelMcpCredentialDto(from: decoder)) + case "gladia": + self = .gladia(try CreateGladiaCredentialDto(from: decoder)) + case "gohighlevel": + self = .gohighlevel(try CreateGoHighLevelCredentialDto(from: decoder)) + case "google": + self = .google(try CreateGoogleCredentialDto(from: decoder)) + case "google.calendar.oauth2-authorization": + self = .googleCalendarOauth2Authorization(try CreateGoogleCalendarOAuth2AuthorizationCredentialDto(from: decoder)) + case "google.calendar.oauth2-client": + self = .googleCalendarOauth2Client(try CreateGoogleCalendarOAuth2ClientCredentialDto(from: decoder)) + case "google.sheets.oauth2-authorization": + self = .googleSheetsOauth2Authorization(try CreateGoogleSheetsOAuth2AuthorizationCredentialDto(from: decoder)) + case "groq": + self = .groq(try CreateGroqCredentialDto(from: decoder)) + case "hume": + self = .hume(try CreateHumeCredentialDto(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try CreateInflectionAiCredentialDto(from: decoder)) + case "inworld": + self = .inworld(try CreateInworldCredentialDto(from: decoder)) + case "langfuse": + self = .langfuse(try CreateLangfuseCredentialDto(from: decoder)) + case "lmnt": + self = .lmnt(try CreateLmntCredentialDto(from: decoder)) + case "make": + self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) + case "minimax": + self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) + case "mistral": + self = .mistral(try CreateMistralCredentialDto(from: decoder)) + case "neuphonic": + self = .neuphonic(try CreateNeuphonicCredentialDto(from: decoder)) + case "openai": + self = .openai(try CreateOpenAiCredentialDto(from: decoder)) + case "openrouter": + self = .openrouter(try CreateOpenRouterCredentialDto(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try CreatePerplexityAiCredentialDto(from: decoder)) + case "playht": + self = .playht(try CreatePlayHtCredentialDto(from: decoder)) + case "rime-ai": + self = .rimeAi(try CreateRimeAiCredentialDto(from: decoder)) + case "runpod": + self = .runpod(try CreateRunpodCredentialDto(from: decoder)) + case "s3": + self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) + case "slack.oauth2-authorization": + self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) + case "slack-webhook": + self = .slackWebhook(try CreateSlackWebhookCredentialDto(from: decoder)) + case "smallest-ai": + self = .smallestAi(try CreateSmallestAiCredentialDto(from: decoder)) + case "soniox": + self = .soniox(try CreateSonioxCredentialDto(from: decoder)) + case "speechmatics": + self = .speechmatics(try CreateSpeechmaticsCredentialDto(from: decoder)) + case "supabase": + self = .supabase(try CreateSupabaseCredentialDto(from: decoder)) + case "tavus": + self = .tavus(try CreateTavusCredentialDto(from: decoder)) + case "together-ai": + self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) + case "twilio": + self = .twilio(try CreateTwilioCredentialDto(from: decoder)) + case "vonage": + self = .vonage(try CreateVonageCredentialDto(from: decoder)) + case "webhook": + self = .webhook(try CreateWebhookCredentialDto(from: decoder)) + case "wellsaid": + self = .wellsaid(try CreateWellSaidCredentialDto(from: decoder)) + case "xai": + self = .xai(try CreateXAiCredentialDto(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .azureOpenai(let data): + try container.encode("azure-openai", forKey: .provider) + try data.encode(to: encoder) + case .byoSipTrunk(let data): + try container.encode("byo-sip-trunk", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .cloudflare(let data): + try container.encode("cloudflare", forKey: .provider) + try data.encode(to: encoder) + case .customCredential(let data): + try container.encode("custom-credential", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .email(let data): + try container.encode("email", forKey: .provider) + try data.encode(to: encoder) + case .gcp(let data): + try container.encode("gcp", forKey: .provider) + try data.encode(to: encoder) + case .ghlOauth2Authorization(let data): + try container.encode("ghl.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .gohighlevel(let data): + try container.encode("gohighlevel", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Authorization(let data): + try container.encode("google.calendar.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Client(let data): + try container.encode("google.calendar.oauth2-client", forKey: .provider) + try data.encode(to: encoder) + case .googleSheetsOauth2Authorization(let data): + try container.encode("google.sheets.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .langfuse(let data): + try container.encode("langfuse", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .make(let data): + try container.encode("make", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .mistral(let data): + try container.encode("mistral", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .runpod(let data): + try container.encode("runpod", forKey: .provider) + try data.encode(to: encoder) + case .s3(let data): + try container.encode("s3", forKey: .provider) + try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) + case .slackOauth2Authorization(let data): + try container.encode("slack.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .slackWebhook(let data): + try container.encode("slack-webhook", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .supabase(let data): + try container.encode("supabase", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + case .webhook(let data): + try container.encode("webhook", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoFirstMessageMode.swift b/Sources/Schemas/CreateAssistantDraftDtoFirstMessageMode.swift new file mode 100644 index 00000000..afd1cad8 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoFirstMessageMode.swift @@ -0,0 +1,15 @@ +import Foundation + +/// This is the mode for the first message. Default is 'assistant-speaks-first'. +/// +/// Use: +/// - 'assistant-speaks-first' to have the assistant speak first. +/// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. +/// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). +/// +/// @default 'assistant-speaks-first' +public enum CreateAssistantDraftDtoFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantSpeaksFirstWithModelGeneratedMessage = "assistant-speaks-first-with-model-generated-message" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoHooksItem.swift b/Sources/Schemas/CreateAssistantDraftDtoHooksItem.swift new file mode 100644 index 00000000..0c740861 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoHooksItem.swift @@ -0,0 +1,45 @@ +import Foundation + +public enum CreateAssistantDraftDtoHooksItem: Codable, Hashable, Sendable { + case callHookAssistantSpeechInterrupted(CallHookAssistantSpeechInterrupted) + case callHookCallEnding(CallHookCallEnding) + case callHookCustomerSpeechInterrupted(CallHookCustomerSpeechInterrupted) + case callHookCustomerSpeechTimeout(CallHookCustomerSpeechTimeout) + case sessionCreatedHook(SessionCreatedHook) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CallHookAssistantSpeechInterrupted.self) { + self = .callHookAssistantSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCallEnding.self) { + self = .callHookCallEnding(value) + } else if let value = try? container.decode(CallHookCustomerSpeechInterrupted.self) { + self = .callHookCustomerSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCustomerSpeechTimeout.self) { + self = .callHookCustomerSpeechTimeout(value) + } else if let value = try? container.decode(SessionCreatedHook.self) { + self = .sessionCreatedHook(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .callHookAssistantSpeechInterrupted(let value): + try container.encode(value) + case .callHookCallEnding(let value): + try container.encode(value) + case .callHookCustomerSpeechInterrupted(let value): + try container.encode(value) + case .callHookCustomerSpeechTimeout(let value): + try container.encode(value) + case .sessionCreatedHook(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoModel.swift b/Sources/Schemas/CreateAssistantDraftDtoModel.swift new file mode 100644 index 00000000..d07892a1 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoModel.swift @@ -0,0 +1,131 @@ +import Foundation + +/// These are the options for the assistant's LLM. +public enum CreateAssistantDraftDtoModel: Codable, Hashable, Sendable { + case anthropic(AnthropicModel) + case anthropicBedrock(AnthropicBedrockModel) + case anyscale(AnyscaleModel) + case cerebras(CerebrasModel) + case customLlm(CustomLlmModel) + case deepinfra(DeepInfraModel) + case deepSeek(DeepSeekModel) + case google(GoogleModel) + case groq(GroqModel) + case inflectionAi(InflectionAiModel) + case minimax(MinimaxLlmModel) + case openai(OpenAiModel) + case openrouter(OpenRouterModel) + case perplexityAi(PerplexityAiModel) + case togetherAi(TogetherAiModel) + case vapi(VapiModel) + case xai(XaiModel) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try AnthropicModel(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try AnthropicBedrockModel(from: decoder)) + case "anyscale": + self = .anyscale(try AnyscaleModel(from: decoder)) + case "cerebras": + self = .cerebras(try CerebrasModel(from: decoder)) + case "custom-llm": + self = .customLlm(try CustomLlmModel(from: decoder)) + case "deepinfra": + self = .deepinfra(try DeepInfraModel(from: decoder)) + case "deep-seek": + self = .deepSeek(try DeepSeekModel(from: decoder)) + case "google": + self = .google(try GoogleModel(from: decoder)) + case "groq": + self = .groq(try GroqModel(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try InflectionAiModel(from: decoder)) + case "minimax": + self = .minimax(try MinimaxLlmModel(from: decoder)) + case "openai": + self = .openai(try OpenAiModel(from: decoder)) + case "openrouter": + self = .openrouter(try OpenRouterModel(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try PerplexityAiModel(from: decoder)) + case "together-ai": + self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) + case "xai": + self = .xai(try XaiModel(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoServerMessagesItem.swift b/Sources/Schemas/CreateAssistantDraftDtoServerMessagesItem.swift new file mode 100644 index 00000000..f3bb5c24 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoServerMessagesItem.swift @@ -0,0 +1,31 @@ +import Foundation + +public enum CreateAssistantDraftDtoServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case assistantStarted = "assistant.started" + case assistantSpeechStarted = "assistant.speechStarted" + case conversationUpdate = "conversation-update" + case endOfCallReport = "end-of-call-report" + case functionCall = "function-call" + case hang + case languageChanged = "language-changed" + case languageChangeDetected = "language-change-detected" + case modelOutput = "model-output" + case phoneCallControl = "phone-call-control" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case transcriptTranscriptTypeFinal = "transcript[transcriptType=\"final\"]" + case toolCalls = "tool-calls" + case transferDestinationRequest = "transfer-destination-request" + case handoffDestinationRequest = "handoff-destination-request" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case chatCreated = "chat.created" + case chatDeleted = "chat.deleted" + case sessionCreated = "session.created" + case sessionUpdated = "session.updated" + case sessionDeleted = "session.deleted" + case callDeleted = "call.deleted" + case callDeleteFailed = "call.delete.failed" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoTranscriber.swift b/Sources/Schemas/CreateAssistantDraftDtoTranscriber.swift new file mode 100644 index 00000000..fcf5155a --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoTranscriber.swift @@ -0,0 +1,113 @@ +import Foundation + +/// These are the options for the assistant's transcriber. +public enum CreateAssistantDraftDtoTranscriber: Codable, Hashable, Sendable { + case assemblyAi(AssemblyAiTranscriber) + case azure(AzureSpeechTranscriber) + case cartesia(CartesiaTranscriber) + case customTranscriber(CustomTranscriber) + case deepgram(DeepgramTranscriber) + case elevenLabs(ElevenLabsTranscriber) + case gladia(GladiaTranscriber) + case google(GoogleTranscriber) + case openai(OpenAiTranscriber) + case soniox(SonioxTranscriber) + case speechmatics(SpeechmaticsTranscriber) + case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "assembly-ai": + self = .assemblyAi(try AssemblyAiTranscriber(from: decoder)) + case "azure": + self = .azure(try AzureSpeechTranscriber(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaTranscriber(from: decoder)) + case "custom-transcriber": + self = .customTranscriber(try CustomTranscriber(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramTranscriber(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsTranscriber(from: decoder)) + case "gladia": + self = .gladia(try GladiaTranscriber(from: decoder)) + case "google": + self = .google(try GoogleTranscriber(from: decoder)) + case "openai": + self = .openai(try OpenAiTranscriber(from: decoder)) + case "soniox": + self = .soniox(try SonioxTranscriber(from: decoder)) + case "speechmatics": + self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) + case "talkscriber": + self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customTranscriber(let data): + try container.encode("custom-transcriber", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .talkscriber(let data): + try container.encode("talkscriber", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoVoice.swift b/Sources/Schemas/CreateAssistantDraftDtoVoice.swift new file mode 100644 index 00000000..ab8f2517 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoVoice.swift @@ -0,0 +1,149 @@ +import Foundation + +/// These are the options for the assistant's voice. +public enum CreateAssistantDraftDtoVoice: Codable, Hashable, Sendable { + case azure(AzureVoice) + case cartesia(CartesiaVoice) + case customVoice(CustomVoice) + case deepgram(DeepgramVoice) + case elevenLabs(ElevenLabsVoice) + case hume(HumeVoice) + case inworld(InworldVoice) + case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) + case minimax(MinimaxVoice) + case neuphonic(NeuphonicVoice) + case openai(OpenAiVoice) + case playht(PlayHtVoice) + case rimeAi(RimeAiVoice) + case sesame(SesameVoice) + case smallestAi(SmallestAiVoice) + case tavus(TavusVoice) + case vapi(VapiVoice) + case wellsaid(WellSaidVoice) + case xai(XaiVoice) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "azure": + self = .azure(try AzureVoice(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaVoice(from: decoder)) + case "custom-voice": + self = .customVoice(try CustomVoice(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramVoice(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsVoice(from: decoder)) + case "hume": + self = .hume(try HumeVoice(from: decoder)) + case "inworld": + self = .inworld(try InworldVoice(from: decoder)) + case "lmnt": + self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) + case "minimax": + self = .minimax(try MinimaxVoice(from: decoder)) + case "neuphonic": + self = .neuphonic(try NeuphonicVoice(from: decoder)) + case "openai": + self = .openai(try OpenAiVoice(from: decoder)) + case "playht": + self = .playht(try PlayHtVoice(from: decoder)) + case "rime-ai": + self = .rimeAi(try RimeAiVoice(from: decoder)) + case "sesame": + self = .sesame(try SesameVoice(from: decoder)) + case "smallest-ai": + self = .smallestAi(try SmallestAiVoice(from: decoder)) + case "tavus": + self = .tavus(try TavusVoice(from: decoder)) + case "vapi": + self = .vapi(try VapiVoice(from: decoder)) + case "wellsaid": + self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customVoice(let data): + try container.encode("custom-voice", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .sesame(let data): + try container.encode("sesame", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetection.swift b/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetection.swift new file mode 100644 index 00000000..41d8182c --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetection.swift @@ -0,0 +1,47 @@ +import Foundation + +/// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. +/// By default, voicemail detection is disabled. +public enum CreateAssistantDraftDtoVoicemailDetection: Codable, Hashable, Sendable { + case createAssistantDraftDtoVoicemailDetectionZero(CreateAssistantDraftDtoVoicemailDetectionZero) + case googleVoicemailDetectionPlan(GoogleVoicemailDetectionPlan) + case openAiVoicemailDetectionPlan(OpenAiVoicemailDetectionPlan) + case twilioVoicemailDetectionPlan(TwilioVoicemailDetectionPlan) + case vapiVoicemailDetectionPlan(VapiVoicemailDetectionPlan) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CreateAssistantDraftDtoVoicemailDetectionZero.self) { + self = .createAssistantDraftDtoVoicemailDetectionZero(value) + } else if let value = try? container.decode(GoogleVoicemailDetectionPlan.self) { + self = .googleVoicemailDetectionPlan(value) + } else if let value = try? container.decode(OpenAiVoicemailDetectionPlan.self) { + self = .openAiVoicemailDetectionPlan(value) + } else if let value = try? container.decode(TwilioVoicemailDetectionPlan.self) { + self = .twilioVoicemailDetectionPlan(value) + } else if let value = try? container.decode(VapiVoicemailDetectionPlan.self) { + self = .vapiVoicemailDetectionPlan(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .createAssistantDraftDtoVoicemailDetectionZero(let value): + try container.encode(value) + case .googleVoicemailDetectionPlan(let value): + try container.encode(value) + case .openAiVoicemailDetectionPlan(let value): + try container.encode(value) + case .twilioVoicemailDetectionPlan(let value): + try container.encode(value) + case .vapiVoicemailDetectionPlan(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetectionZero.swift b/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetectionZero.swift new file mode 100644 index 00000000..f3efefc8 --- /dev/null +++ b/Sources/Schemas/CreateAssistantDraftDtoVoicemailDetectionZero.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum CreateAssistantDraftDtoVoicemailDetectionZero: String, Codable, Hashable, CaseIterable, Sendable { + case off +} \ No newline at end of file diff --git a/Sources/Schemas/CreateAssistantDto.swift b/Sources/Schemas/CreateAssistantDto.swift index 2e5ca83d..835cdb3a 100644 --- a/Sources/Schemas/CreateAssistantDto.swift +++ b/Sources/Schemas/CreateAssistantDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create an assistant, including its model, voice, transcriber, prompts, tools, messaging, and conversation behavior. public struct CreateAssistantDto: Codable, Hashable, Sendable { /// These are the options for the assistant's transcriber. public let transcriber: CreateAssistantDtoTranscriber? @@ -11,6 +12,7 @@ public struct CreateAssistantDto: Codable, Hashable, Sendable { /// /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. public let firstMessage: String? + /// Set to `true` to allow the user to interrupt the assistant while it speaks the first message. Default is `false`. public let firstMessageInterruptionsEnabled: Bool? /// This is the mode for the first message. Default is 'assistant-speaks-first'. /// @@ -63,6 +65,7 @@ public struct CreateAssistantDto: Codable, Hashable, Sendable { public let endCallMessage: String? /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. public let endCallPhrases: [String]? + /// Compliance settings for the assistant, including HIPAA and PCI behavior, security filtering, and recording consent. public let compliancePlan: CompliancePlan? /// This is for metadata you want to store on the assistant. public let metadata: [String: JSONValue]? @@ -115,6 +118,7 @@ public struct CreateAssistantDto: Codable, Hashable, Sendable { /// 2. phoneNumber.serverUrl /// 3. org.serverUrl public let server: Server? + /// Configuration for collecting and processing DTMF keypad input during calls. public let keypadInputPlan: KeypadInputPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/CreateAssistantDtoCredentialsItem.swift b/Sources/Schemas/CreateAssistantDtoCredentialsItem.swift index 5fc514cc..505fe8b6 100644 --- a/Sources/Schemas/CreateAssistantDtoCredentialsItem.swift +++ b/Sources/Schemas/CreateAssistantDtoCredentialsItem.swift @@ -33,6 +33,7 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum CreateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/CreateAssistantDtoModel.swift b/Sources/Schemas/CreateAssistantDtoModel.swift index e7789008..8b5be732 100644 --- a/Sources/Schemas/CreateAssistantDtoModel.swift +++ b/Sources/Schemas/CreateAssistantDtoModel.swift @@ -17,6 +17,7 @@ public indirect enum CreateAssistantDtoModel: Codable, Hashable, Sendable { case openrouter(OpenRouterModel) case perplexityAi(PerplexityAiModel) case togetherAi(TogetherAiModel) + case vapi(VapiModel) case xai(XaiModel) public init(from decoder: Decoder) throws { @@ -53,6 +54,8 @@ public indirect enum CreateAssistantDtoModel: Codable, Hashable, Sendable { self = .perplexityAi(try PerplexityAiModel(from: decoder)) case "together-ai": self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) case "xai": self = .xai(try XaiModel(from: decoder)) default: @@ -113,6 +116,9 @@ public indirect enum CreateAssistantDtoModel: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) case .xai(let data): try container.encode("xai", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/CreateAssistantDtoTranscriber.swift b/Sources/Schemas/CreateAssistantDtoTranscriber.swift index 06b97c80..b784f63d 100644 --- a/Sources/Schemas/CreateAssistantDtoTranscriber.swift +++ b/Sources/Schemas/CreateAssistantDtoTranscriber.swift @@ -14,6 +14,8 @@ public enum CreateAssistantDtoTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,10 @@ public enum CreateAssistantDtoTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -92,6 +98,12 @@ public enum CreateAssistantDtoTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/CreateAssistantDtoVoice.swift b/Sources/Schemas/CreateAssistantDtoVoice.swift index fc862bb0..86dcd3c4 100644 --- a/Sources/Schemas/CreateAssistantDtoVoice.swift +++ b/Sources/Schemas/CreateAssistantDtoVoice.swift @@ -10,6 +10,7 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -20,6 +21,7 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -41,6 +43,8 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -61,6 +65,8 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -98,6 +104,9 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -128,6 +137,9 @@ public enum CreateAssistantDtoVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/CreateAzureCredentialDto.swift b/Sources/Schemas/CreateAzureCredentialDto.swift index 698d4541..4ef04d45 100644 --- a/Sources/Schemas/CreateAzureCredentialDto.swift +++ b/Sources/Schemas/CreateAzureCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for Azure Speech or Blob Storage, including service, region, and optional storage bucket settings. public struct CreateAzureCredentialDto: Codable, Hashable, Sendable { /// This is the service being used in Azure. public let service: CreateAzureCredentialDtoService diff --git a/Sources/Schemas/CreateAzureCredentialDtoRegion.swift b/Sources/Schemas/CreateAzureCredentialDtoRegion.swift index 08c224d1..397ae314 100644 --- a/Sources/Schemas/CreateAzureCredentialDtoRegion.swift +++ b/Sources/Schemas/CreateAzureCredentialDtoRegion.swift @@ -20,6 +20,8 @@ public enum CreateAzureCredentialDtoRegion: String, Codable, Hashable, CaseItera case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/CreateAzureOpenAiCredentialDto.swift b/Sources/Schemas/CreateAzureOpenAiCredentialDto.swift index e616c1e8..bf41aea1 100644 --- a/Sources/Schemas/CreateAzureOpenAiCredentialDto.swift +++ b/Sources/Schemas/CreateAzureOpenAiCredentialDto.swift @@ -1,12 +1,16 @@ import Foundation +/// Credentials for authenticating assistant model requests with Azure OpenAI, including region, endpoint, and available models. public struct CreateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { + /// Azure region that hosts the OpenAI resource. public let region: CreateAzureOpenAiCredentialDtoRegion + /// Azure OpenAI models available through this credential. public let models: [CreateAzureOpenAiCredentialDtoModelsItem] /// This is not returned in the API. public let openAiKey: String /// This is not returned in the API. public let ocpApimSubscriptionKey: String? + /// Endpoint URL for the Azure OpenAI resource. public let openAiEndpoint: String /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateAzureOpenAiCredentialDtoModelsItem.swift b/Sources/Schemas/CreateAzureOpenAiCredentialDtoModelsItem.swift index 985cbb19..c3a698c8 100644 --- a/Sources/Schemas/CreateAzureOpenAiCredentialDtoModelsItem.swift +++ b/Sources/Schemas/CreateAzureOpenAiCredentialDtoModelsItem.swift @@ -24,4 +24,7 @@ public enum CreateAzureOpenAiCredentialDtoModelsItem: String, Codable, Hashable, case gpt40613 = "gpt-4-0613" case gpt35Turbo0125 = "gpt-35-turbo-0125" case gpt35Turbo1106 = "gpt-35-turbo-1106" + case gpt4O = "gpt-4o" + case gpt41 = "gpt-4.1" + case gpt54Mini20260317 = "gpt-5.4-mini-2026-03-17" } \ No newline at end of file diff --git a/Sources/Schemas/CreateAzureOpenAiCredentialDtoRegion.swift b/Sources/Schemas/CreateAzureOpenAiCredentialDtoRegion.swift index c684ac76..e143df8a 100644 --- a/Sources/Schemas/CreateAzureOpenAiCredentialDtoRegion.swift +++ b/Sources/Schemas/CreateAzureOpenAiCredentialDtoRegion.swift @@ -1,5 +1,6 @@ import Foundation +/// Azure region that hosts the OpenAI resource. public enum CreateAzureOpenAiCredentialDtoRegion: String, Codable, Hashable, CaseIterable, Sendable { case australiaeast case canadaeast @@ -19,6 +20,8 @@ public enum CreateAzureOpenAiCredentialDtoRegion: String, Codable, Hashable, Cas case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/CreateBarInsightFromCallTableDto.swift b/Sources/Schemas/CreateBarInsightFromCallTableDto.swift index 2b71aaaa..db37c479 100644 --- a/Sources/Schemas/CreateBarInsightFromCallTableDto.swift +++ b/Sources/Schemas/CreateBarInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a bar-chart insight from call data using metric queries, formulas, grouping, and a stepped time range. public struct CreateBarInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct CreateBarInsightFromCallTableDto: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: BarInsightMetadata? + /// The time range and interval used to aggregate the bar-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/CreateBashToolDto.swift b/Sources/Schemas/CreateBashToolDto.swift index 15575e09..899f1c6b 100644 --- a/Sources/Schemas/CreateBashToolDto.swift +++ b/Sources/Schemas/CreateBashToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that executes shell commands in a configured environment. public struct CreateBashToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateBashToolDtoMessagesItem]? /// The sub type of tool. public let subType: CreateBashToolDtoSubType diff --git a/Sources/Schemas/CreateBoardDtoItemsItem.swift b/Sources/Schemas/CreateBoardDtoItemsItem.swift new file mode 100644 index 00000000..8621a085 --- /dev/null +++ b/Sources/Schemas/CreateBoardDtoItemsItem.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum CreateBoardDtoItemsItem: Codable, Hashable, Sendable { + case boardInsightItem(BoardInsightItem) + case boardMetricWidgetItem(BoardMetricWidgetItem) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(BoardInsightItem.self) { + self = .boardInsightItem(value) + } else if let value = try? container.decode(BoardMetricWidgetItem.self) { + self = .boardMetricWidgetItem(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .boardInsightItem(let value): + try container.encode(value) + case .boardMetricWidgetItem(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateByoPhoneNumberDto.swift b/Sources/Schemas/CreateByoPhoneNumberDto.swift index c3e6b590..e695c67e 100644 --- a/Sources/Schemas/CreateByoPhoneNumberDto.swift +++ b/Sources/Schemas/CreateByoPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to connect a bring-your-own phone number to Vapi with a stored telephony credential and routing settings. public struct CreateByoPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/CreateByoSipTrunkCredentialDto.swift b/Sources/Schemas/CreateByoSipTrunkCredentialDto.swift index 2367ed5a..4ab645d9 100644 --- a/Sources/Schemas/CreateByoSipTrunkCredentialDto.swift +++ b/Sources/Schemas/CreateByoSipTrunkCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for connecting Vapi to a bring-your-own SIP trunk or carrier, including gateways, outbound authentication, number handling, and optional session border controller routing. public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { /// This is the list of SIP trunk's gateways. public let gateways: [SipTrunkGateway] @@ -16,8 +17,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { public let techPrefix: String? /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. public let sipDiversionHeader: String? - /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. - public let sbcConfiguration: SbcConfiguration? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema @@ -29,7 +28,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { outboundLeadingPlusEnabled: Bool? = nil, techPrefix: String? = nil, sipDiversionHeader: String? = nil, - sbcConfiguration: SbcConfiguration? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { @@ -38,7 +36,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { self.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled self.techPrefix = techPrefix self.sipDiversionHeader = sipDiversionHeader - self.sbcConfiguration = sbcConfiguration self.name = name self.additionalProperties = additionalProperties } @@ -50,7 +47,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { self.outboundLeadingPlusEnabled = try container.decodeIfPresent(Bool.self, forKey: .outboundLeadingPlusEnabled) self.techPrefix = try container.decodeIfPresent(String.self, forKey: .techPrefix) self.sipDiversionHeader = try container.decodeIfPresent(String.self, forKey: .sipDiversionHeader) - self.sbcConfiguration = try container.decodeIfPresent(SbcConfiguration.self, forKey: .sbcConfiguration) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -63,7 +59,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.outboundLeadingPlusEnabled, forKey: .outboundLeadingPlusEnabled) try container.encodeIfPresent(self.techPrefix, forKey: .techPrefix) try container.encodeIfPresent(self.sipDiversionHeader, forKey: .sipDiversionHeader) - try container.encodeIfPresent(self.sbcConfiguration, forKey: .sbcConfiguration) try container.encodeIfPresent(self.name, forKey: .name) } @@ -74,7 +69,6 @@ public struct CreateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { case outboundLeadingPlusEnabled case techPrefix case sipDiversionHeader - case sbcConfiguration case name } } \ No newline at end of file diff --git a/Sources/Schemas/CreateCallDtoTransport.swift b/Sources/Schemas/CreateCallDtoTransport.swift new file mode 100644 index 00000000..2dfb1d25 --- /dev/null +++ b/Sources/Schemas/CreateCallDtoTransport.swift @@ -0,0 +1,65 @@ +import Foundation + +/// This is the transport of the call. +public enum CreateCallDtoTransport: Codable, Hashable, Sendable { + case daily(VapiWebCallTransport) + case telnyx(TelnyxTransport) + case twilio(TwilioTransport) + case vapiSip(VapiSipTransport) + case vapiWebsocket(VapiWebsocketTransport) + case vonage(VonageTransport) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "daily": + self = .daily(try VapiWebCallTransport(from: decoder)) + case "telnyx": + self = .telnyx(try TelnyxTransport(from: decoder)) + case "twilio": + self = .twilio(try TwilioTransport(from: decoder)) + case "vapi.sip": + self = .vapiSip(try VapiSipTransport(from: decoder)) + case "vapi.websocket": + self = .vapiWebsocket(try VapiWebsocketTransport(from: decoder)) + case "vonage": + self = .vonage(try VonageTransport(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .daily(let data): + try container.encode("daily", forKey: .provider) + try data.encode(to: encoder) + case .telnyx(let data): + try container.encode("telnyx", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vapiSip(let data): + try container.encode("vapi.sip", forKey: .provider) + try data.encode(to: encoder) + case .vapiWebsocket(let data): + try container.encode("vapi.websocket", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateCampaignDto.swift b/Sources/Schemas/CreateCampaignDto.swift new file mode 100644 index 00000000..526b45e3 --- /dev/null +++ b/Sources/Schemas/CreateCampaignDto.swift @@ -0,0 +1,132 @@ +import Foundation + +/// Configuration used to create an outbound calling campaign. Choose an assistant, squad, or workflow, then provide customers, phone-number or dial-plan settings, and an optional schedule. +public struct CreateCampaignDto: Codable, Hashable, Sendable { + /// This is the name of the campaign. This is just for your own reference. + public let name: String + /// This is the assistant ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. + public let assistantId: String? + /// This is the workflow ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. + public let workflowId: String? + /// This is the squad ID that will be used for the campaign calls. Note: Only one of assistantId, workflowId, or squadId can be used. + public let squadId: String? + /// This is the phone number ID that will be used for the campaign calls. Required if dialPlan is not provided. Note: phoneNumberId and dialPlan are mutually exclusive. + public let phoneNumberId: String? + /// This is a list of dial entries, each specifying a phone number and the customers to call using that number. Use this when you want different phone numbers to call different sets of customers. Note: phoneNumberId and dialPlan are mutually exclusive. + public let dialPlan: [DialPlanEntry]? + /// This is the schedule plan for the campaign. Calls will start at startedAt and continue until your organization’s concurrency limit is reached. Any remaining calls will be retried for up to one hour as capacity becomes available. After that hour or after latestAt, whichever comes first, any calls that couldn’t be placed won’t be retried. + public let schedulePlan: SchedulePlan? + /// These are the customers that will be called in the campaign. Required if dialPlan is not provided. Maximum of 10000 customers per campaign. + public let customers: [CreateCustomerDto]? + /// This is the maximum number of concurrent calls that will be made for the campaign. Defaults to 10. + public let maxConcurrency: Double? + /// These are the overrides for the assistant's settings and template variables for the campaign. Use this when the campaign targets an `assistantId`. + public let assistantOverrides: AssistantOverrides? + /// These are the overrides for the squad and template variables for the campaign. Use this when the campaign targets a `squadId`. Per-contact `squadOverrides` are deep-merged on top of this at dispatch time. + public let squadOverrides: AssistantOverrides? + /// This is the server (URL, auth headers, timeout, etc.) for the campaign webhooks. + public let server: Server? + /// These are the messages that will be sent to your Server URL. + public let serverMessages: [CreateCampaignDtoServerMessagesItem]? + /// This opts the campaign into the blocking `campaign.predial` eligibility webhook. When set, every contact triggers a `campaign.predial` POST to the Server URL before dialing, and the response `{ eligible: boolean }` decides whether the call is placed. Requires `server`. When unset, no pre-dial webhook is sent. + public let predialPlan: CampaignPredialPlan? + /// Optional campaign ID to duplicate config from. Provided fields in the request override the source. If `customers` is omitted, contacts are copied from the source. + public let duplicateFromCampaignId: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + name: String, + assistantId: String? = nil, + workflowId: String? = nil, + squadId: String? = nil, + phoneNumberId: String? = nil, + dialPlan: [DialPlanEntry]? = nil, + schedulePlan: SchedulePlan? = nil, + customers: [CreateCustomerDto]? = nil, + maxConcurrency: Double? = nil, + assistantOverrides: AssistantOverrides? = nil, + squadOverrides: AssistantOverrides? = nil, + server: Server? = nil, + serverMessages: [CreateCampaignDtoServerMessagesItem]? = nil, + predialPlan: CampaignPredialPlan? = nil, + duplicateFromCampaignId: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.name = name + self.assistantId = assistantId + self.workflowId = workflowId + self.squadId = squadId + self.phoneNumberId = phoneNumberId + self.dialPlan = dialPlan + self.schedulePlan = schedulePlan + self.customers = customers + self.maxConcurrency = maxConcurrency + self.assistantOverrides = assistantOverrides + self.squadOverrides = squadOverrides + self.server = server + self.serverMessages = serverMessages + self.predialPlan = predialPlan + self.duplicateFromCampaignId = duplicateFromCampaignId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.name = try container.decode(String.self, forKey: .name) + self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) + self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) + self.squadId = try container.decodeIfPresent(String.self, forKey: .squadId) + self.phoneNumberId = try container.decodeIfPresent(String.self, forKey: .phoneNumberId) + self.dialPlan = try container.decodeIfPresent([DialPlanEntry].self, forKey: .dialPlan) + self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) + self.customers = try container.decodeIfPresent([CreateCustomerDto].self, forKey: .customers) + self.maxConcurrency = try container.decodeIfPresent(Double.self, forKey: .maxConcurrency) + self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) + self.squadOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .squadOverrides) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.serverMessages = try container.decodeIfPresent([CreateCampaignDtoServerMessagesItem].self, forKey: .serverMessages) + self.predialPlan = try container.decodeIfPresent(CampaignPredialPlan.self, forKey: .predialPlan) + self.duplicateFromCampaignId = try container.decodeIfPresent(String.self, forKey: .duplicateFromCampaignId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.name, forKey: .name) + try container.encodeIfPresent(self.assistantId, forKey: .assistantId) + try container.encodeIfPresent(self.workflowId, forKey: .workflowId) + try container.encodeIfPresent(self.squadId, forKey: .squadId) + try container.encodeIfPresent(self.phoneNumberId, forKey: .phoneNumberId) + try container.encodeIfPresent(self.dialPlan, forKey: .dialPlan) + try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) + try container.encodeIfPresent(self.customers, forKey: .customers) + try container.encodeIfPresent(self.maxConcurrency, forKey: .maxConcurrency) + try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) + try container.encodeIfPresent(self.squadOverrides, forKey: .squadOverrides) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.predialPlan, forKey: .predialPlan) + try container.encodeIfPresent(self.duplicateFromCampaignId, forKey: .duplicateFromCampaignId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case name + case assistantId + case workflowId + case squadId + case phoneNumberId + case dialPlan + case schedulePlan + case customers + case maxConcurrency + case assistantOverrides + case squadOverrides + case server + case serverMessages + case predialPlan + case duplicateFromCampaignId + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateCampaignDtoServerMessagesItem.swift b/Sources/Schemas/CreateCampaignDtoServerMessagesItem.swift new file mode 100644 index 00000000..636f562a --- /dev/null +++ b/Sources/Schemas/CreateCampaignDtoServerMessagesItem.swift @@ -0,0 +1,15 @@ +import Foundation + +public enum CreateCampaignDtoServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case campaignStarted = "campaign.started" + case campaignCancelled = "campaign.cancelled" + case campaignEnded = "campaign.ended" + case campaignArchived = "campaign.archived" + case campaignUnarchived = "campaign.unarchived" + case contactDispatched = "contact.dispatched" + case contactCompleted = "contact.completed" + case contactFailed = "contact.failed" + case contactSkipped = "contact.skipped" + case contactPredialFailed = "contact.predial-failed" + case campaignJobContinued = "campaign.job.continued" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateCartesiaCredentialDto.swift b/Sources/Schemas/CreateCartesiaCredentialDto.swift index f1209113..c4435c94 100644 --- a/Sources/Schemas/CreateCartesiaCredentialDto.swift +++ b/Sources/Schemas/CreateCartesiaCredentialDto.swift @@ -1,8 +1,11 @@ import Foundation +/// Credentials for authenticating speech recognition and voice synthesis requests with Cartesia. public struct CreateCartesiaCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String + /// This can be used to point to an onprem Cartesia instance. Defaults to api.cartesia.ai. + public let apiUrl: String? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema @@ -10,10 +13,12 @@ public struct CreateCartesiaCredentialDto: Codable, Hashable, Sendable { public init( apiKey: String, + apiUrl: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.apiKey = apiKey + self.apiUrl = apiUrl self.name = name self.additionalProperties = additionalProperties } @@ -21,6 +26,7 @@ public struct CreateCartesiaCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -29,12 +35,14 @@ public struct CreateCartesiaCredentialDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case apiKey + case apiUrl case name } } \ No newline at end of file diff --git a/Sources/Schemas/CreateCerebrasCredentialDto.swift b/Sources/Schemas/CreateCerebrasCredentialDto.swift index 050949f7..8614b3ff 100644 --- a/Sources/Schemas/CreateCerebrasCredentialDto.swift +++ b/Sources/Schemas/CreateCerebrasCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Cerebras. public struct CreateCerebrasCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateCloudflareCredentialDto.swift b/Sources/Schemas/CreateCloudflareCredentialDto.swift index 2b270826..2b727426 100644 --- a/Sources/Schemas/CreateCloudflareCredentialDto.swift +++ b/Sources/Schemas/CreateCloudflareCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for storing call artifacts in Cloudflare R2, including account details, bucket configuration, and upload fallback order. public struct CreateCloudflareCredentialDto: Codable, Hashable, Sendable { /// Cloudflare Account Id. public let accountId: String? diff --git a/Sources/Schemas/CreateCodeToolDto.swift b/Sources/Schemas/CreateCodeToolDto.swift index 83c487a8..cc2e8465 100644 --- a/Sources/Schemas/CreateCodeToolDto.swift +++ b/Sources/Schemas/CreateCodeToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a reusable tool that executes TypeScript code with configured credentials, environment variables, and timeout. public struct CreateCodeToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateCodeToolDtoMessagesItem]? /// This determines if the tool is async. /// diff --git a/Sources/Schemas/CreateComputerToolDto.swift b/Sources/Schemas/CreateComputerToolDto.swift index b1ab043e..24d6a0df 100644 --- a/Sources/Schemas/CreateComputerToolDto.swift +++ b/Sources/Schemas/CreateComputerToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that lets the model interact with a computer display through screen, pointer, and keyboard actions. public struct CreateComputerToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateComputerToolDtoMessagesItem]? /// The sub type of tool. public let subType: CreateComputerToolDtoSubType diff --git a/Sources/Schemas/CreateCustomCredentialDto.swift b/Sources/Schemas/CreateCustomCredentialDto.swift index e4e4c54f..fe94b365 100644 --- a/Sources/Schemas/CreateCustomCredentialDto.swift +++ b/Sources/Schemas/CreateCustomCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Reusable custom credentials for authenticating outbound requests, with optional public-key encryption for sensitive request data. public struct CreateCustomCredentialDto: Codable, Hashable, Sendable { /// This is the authentication plan. Supports OAuth2 RFC 6749, HMAC signing, and Bearer authentication. public let authenticationPlan: CreateCustomCredentialDtoAuthenticationPlan diff --git a/Sources/Schemas/CreateCustomKnowledgeBaseDto.swift b/Sources/Schemas/CreateCustomKnowledgeBaseDto.swift index 924a09fc..184f55cd 100644 --- a/Sources/Schemas/CreateCustomKnowledgeBaseDto.swift +++ b/Sources/Schemas/CreateCustomKnowledgeBaseDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for connecting a custom knowledge-base implementation through a customer-hosted server. public struct CreateCustomKnowledgeBaseDto: Codable, Hashable, Sendable { /// This knowledge base is bring your own knowledge base implementation. public let provider: CreateCustomKnowledgeBaseDtoProvider diff --git a/Sources/Schemas/CreateCustomLlmCredentialDto.swift b/Sources/Schemas/CreateCustomLlmCredentialDto.swift index a372ee42..5bbb2cdb 100644 --- a/Sources/Schemas/CreateCustomLlmCredentialDto.swift +++ b/Sources/Schemas/CreateCustomLlmCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating requests to a custom language model with an API key or OAuth 2.0 authentication plan. public struct CreateCustomLlmCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateCustomerDto.swift b/Sources/Schemas/CreateCustomerDto.swift index f3bf6867..eb85a704 100644 --- a/Sources/Schemas/CreateCustomerDto.swift +++ b/Sources/Schemas/CreateCustomerDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Customer details used for call delivery and assistant personalization, including phone or SIP destination, contact identifiers, extension, and assistant overrides. public struct CreateCustomerDto: Codable, Hashable, Sendable { /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. /// @@ -16,6 +17,10 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { /// These are the overrides for the assistant's settings and template variables specific to this customer. /// This allows customization of the assistant's behavior for individual customers in batch calls. public let assistantOverrides: AssistantOverrides? + /// These are the overrides applied when the call targets a `squadId`. Mirrors + /// the call-level `squadOverrides` — use this instead of `assistantOverrides` + /// when the campaign or call is squad-based. + public let squadOverrides: AssistantOverrides? /// This is the number of the customer. public let number: String? /// This is the SIP URI of the customer. @@ -35,6 +40,7 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { numberE164CheckEnabled: Bool? = nil, extension: String? = nil, assistantOverrides: AssistantOverrides? = nil, + squadOverrides: AssistantOverrides? = nil, number: String? = nil, sipUri: String? = nil, name: String? = nil, @@ -45,6 +51,7 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { self.numberE164CheckEnabled = numberE164CheckEnabled self.extension = `extension` self.assistantOverrides = assistantOverrides + self.squadOverrides = squadOverrides self.number = number self.sipUri = sipUri self.name = name @@ -58,6 +65,7 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { self.numberE164CheckEnabled = try container.decodeIfPresent(Bool.self, forKey: .numberE164CheckEnabled) self.extension = try container.decodeIfPresent(String.self, forKey: .extension) self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) + self.squadOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .squadOverrides) self.number = try container.decodeIfPresent(String.self, forKey: .number) self.sipUri = try container.decodeIfPresent(String.self, forKey: .sipUri) self.name = try container.decodeIfPresent(String.self, forKey: .name) @@ -72,6 +80,7 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.numberE164CheckEnabled, forKey: .numberE164CheckEnabled) try container.encodeIfPresent(self.extension, forKey: .extension) try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) + try container.encodeIfPresent(self.squadOverrides, forKey: .squadOverrides) try container.encodeIfPresent(self.number, forKey: .number) try container.encodeIfPresent(self.sipUri, forKey: .sipUri) try container.encodeIfPresent(self.name, forKey: .name) @@ -84,6 +93,7 @@ public struct CreateCustomerDto: Codable, Hashable, Sendable { case numberE164CheckEnabled case `extension` case assistantOverrides + case squadOverrides case number case sipUri case name diff --git a/Sources/Schemas/CreateDeepInfraCredentialDto.swift b/Sources/Schemas/CreateDeepInfraCredentialDto.swift index 7d2b164a..0cb5321d 100644 --- a/Sources/Schemas/CreateDeepInfraCredentialDto.swift +++ b/Sources/Schemas/CreateDeepInfraCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with DeepInfra. public struct CreateDeepInfraCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateDeepSeekCredentialDto.swift b/Sources/Schemas/CreateDeepSeekCredentialDto.swift index a87bf7aa..8de387d7 100644 --- a/Sources/Schemas/CreateDeepSeekCredentialDto.swift +++ b/Sources/Schemas/CreateDeepSeekCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with DeepSeek. public struct CreateDeepSeekCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateDeepgramCredentialDto.swift b/Sources/Schemas/CreateDeepgramCredentialDto.swift index ca4d0872..ca9ef442 100644 --- a/Sources/Schemas/CreateDeepgramCredentialDto.swift +++ b/Sources/Schemas/CreateDeepgramCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating speech recognition and voice synthesis requests with Deepgram, with an optional API URL for an on-premises instance. public struct CreateDeepgramCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateDtmfToolDto.swift b/Sources/Schemas/CreateDtmfToolDto.swift index 8917e839..e04f1186 100644 --- a/Sources/Schemas/CreateDtmfToolDto.swift +++ b/Sources/Schemas/CreateDtmfToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that lets an assistant send DTMF keypad tones during a call. public struct CreateDtmfToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateDtmfToolDtoMessagesItem]? /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833 (RTP events). When enabled, DTMF digits will be sent using the SIP INFO method, which can be more reliable in some network configurations. Only relevant when using the `vapi.sip` transport. public let sipInfoDtmfEnabled: Bool? diff --git a/Sources/Schemas/CreateElevenLabsCredentialDto.swift b/Sources/Schemas/CreateElevenLabsCredentialDto.swift index 08cc4ede..0282b151 100644 --- a/Sources/Schemas/CreateElevenLabsCredentialDto.swift +++ b/Sources/Schemas/CreateElevenLabsCredentialDto.swift @@ -1,8 +1,11 @@ import Foundation +/// Credentials for authenticating speech recognition and voice synthesis requests with ElevenLabs. public struct CreateElevenLabsCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String + /// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. + public let apiUrl: Nullable? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema @@ -10,10 +13,12 @@ public struct CreateElevenLabsCredentialDto: Codable, Hashable, Sendable { public init( apiKey: String, + apiUrl: Nullable? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.apiKey = apiKey + self.apiUrl = apiUrl self.name = name self.additionalProperties = additionalProperties } @@ -21,6 +26,7 @@ public struct CreateElevenLabsCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeNullableIfPresent(CreateElevenLabsCredentialDtoApiUrl.self, forKey: .apiUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -29,12 +35,14 @@ public struct CreateElevenLabsCredentialDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeNullableIfPresent(self.apiUrl, forKey: .apiUrl) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case apiKey + case apiUrl case name } } \ No newline at end of file diff --git a/Sources/Schemas/CreateElevenLabsCredentialDtoApiUrl.swift b/Sources/Schemas/CreateElevenLabsCredentialDtoApiUrl.swift new file mode 100644 index 00000000..855145b4 --- /dev/null +++ b/Sources/Schemas/CreateElevenLabsCredentialDtoApiUrl.swift @@ -0,0 +1,7 @@ +import Foundation + +/// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. +public enum CreateElevenLabsCredentialDtoApiUrl: String, Codable, Hashable, CaseIterable, Sendable { + case httpsApiElevenlabsIo = "https://api.elevenlabs.io" + case httpsApiEuResidencyElevenlabsIo = "https://api.eu.residency.elevenlabs.io" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateEmailCredentialDto.swift b/Sources/Schemas/CreateEmailCredentialDto.swift index 931faff2..5d48819c 100644 --- a/Sources/Schemas/CreateEmailCredentialDto.swift +++ b/Sources/Schemas/CreateEmailCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Destination configuration for sending Vapi alerts to an email address. public struct CreateEmailCredentialDto: Codable, Hashable, Sendable { /// The recipient email address for alerts public let email: String diff --git a/Sources/Schemas/CreateEndCallToolDto.swift b/Sources/Schemas/CreateEndCallToolDto.swift index 42958d46..71dfd79e 100644 --- a/Sources/Schemas/CreateEndCallToolDto.swift +++ b/Sources/Schemas/CreateEndCallToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that lets an assistant end the active call. public struct CreateEndCallToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateEndCallToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateEvalDto.swift b/Sources/Schemas/CreateEvalDto.swift index f53b5b7f..c86310f6 100644 --- a/Sources/Schemas/CreateEvalDto.swift +++ b/Sources/Schemas/CreateEvalDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a reusable eval containing a mock conversation and checkpoints for assessing assistant responses and tool calls. public struct CreateEvalDto: Codable, Hashable, Sendable { /// This is the mock conversation that will be used to evaluate the flow of the conversation. /// diff --git a/Sources/Schemas/CreateFunctionToolDto.swift b/Sources/Schemas/CreateFunctionToolDto.swift index 555e8810..3441780e 100644 --- a/Sources/Schemas/CreateFunctionToolDto.swift +++ b/Sources/Schemas/CreateFunctionToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a custom function tool that sends model-generated arguments to a server and returns the result to the assistant. public struct CreateFunctionToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateFunctionToolDtoMessagesItem]? /// This determines if the tool is async. /// diff --git a/Sources/Schemas/CreateGcpCredentialDto.swift b/Sources/Schemas/CreateGcpCredentialDto.swift index 72e8c7d5..30a3722f 100644 --- a/Sources/Schemas/CreateGcpCredentialDto.swift +++ b/Sources/Schemas/CreateGcpCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Service-account credentials for Google Cloud resources and optional call-artifact storage, including region, bucket configuration, and upload fallback order. public struct CreateGcpCredentialDto: Codable, Hashable, Sendable { /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. public let fallbackIndex: Double? @@ -9,6 +10,7 @@ public struct CreateGcpCredentialDto: Codable, Hashable, Sendable { public let gcpKey: GcpKey /// This is the region of the GCP resource. public let region: String? + /// Bucket configuration used to store call artifacts in Google Cloud Storage. public let bucketPlan: BucketPlan? /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateGhlToolDto.swift b/Sources/Schemas/CreateGhlToolDto.swift index d0f98c97..143eabca 100644 --- a/Sources/Schemas/CreateGhlToolDto.swift +++ b/Sources/Schemas/CreateGhlToolDto.swift @@ -1,9 +1,7 @@ import Foundation public struct CreateGhlToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGhlToolDtoMessagesItem]? /// The type of tool. "ghl" for GHL tool. public let type: CreateGhlToolDtoType diff --git a/Sources/Schemas/CreateGladiaCredentialDto.swift b/Sources/Schemas/CreateGladiaCredentialDto.swift index a151e70b..a9c77c3a 100644 --- a/Sources/Schemas/CreateGladiaCredentialDto.swift +++ b/Sources/Schemas/CreateGladiaCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating transcription requests with Gladia. public struct CreateGladiaCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateGoHighLevelCalendarAvailabilityToolDto.swift b/Sources/Schemas/CreateGoHighLevelCalendarAvailabilityToolDto.swift index 640013d7..169cda89 100644 --- a/Sources/Schemas/CreateGoHighLevelCalendarAvailabilityToolDto.swift +++ b/Sources/Schemas/CreateGoHighLevelCalendarAvailabilityToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that checks calendar availability in a connected GoHighLevel account. public struct CreateGoHighLevelCalendarAvailabilityToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoHighLevelCalendarAvailabilityToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoHighLevelCalendarEventCreateToolDto.swift b/Sources/Schemas/CreateGoHighLevelCalendarEventCreateToolDto.swift index 4c5e1669..1c82c706 100644 --- a/Sources/Schemas/CreateGoHighLevelCalendarEventCreateToolDto.swift +++ b/Sources/Schemas/CreateGoHighLevelCalendarEventCreateToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that adds calendar events to a connected GoHighLevel account. public struct CreateGoHighLevelCalendarEventCreateToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoHighLevelCalendarEventCreateToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoHighLevelContactCreateToolDto.swift b/Sources/Schemas/CreateGoHighLevelContactCreateToolDto.swift index 3f7e0712..c6df30f2 100644 --- a/Sources/Schemas/CreateGoHighLevelContactCreateToolDto.swift +++ b/Sources/Schemas/CreateGoHighLevelContactCreateToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that adds contacts to a connected GoHighLevel account. public struct CreateGoHighLevelContactCreateToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoHighLevelContactCreateToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoHighLevelContactGetToolDto.swift b/Sources/Schemas/CreateGoHighLevelContactGetToolDto.swift index a7110dcd..7d2de665 100644 --- a/Sources/Schemas/CreateGoHighLevelContactGetToolDto.swift +++ b/Sources/Schemas/CreateGoHighLevelContactGetToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that retrieves contacts from a connected GoHighLevel account. public struct CreateGoHighLevelContactGetToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoHighLevelContactGetToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoHighLevelCredentialDto.swift b/Sources/Schemas/CreateGoHighLevelCredentialDto.swift index 8d4c0539..1cdb2751 100644 --- a/Sources/Schemas/CreateGoHighLevelCredentialDto.swift +++ b/Sources/Schemas/CreateGoHighLevelCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating Vapi integrations with GoHighLevel. public struct CreateGoHighLevelCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateGoHighLevelMcpCredentialDto.swift b/Sources/Schemas/CreateGoHighLevelMcpCredentialDto.swift index 28928d0b..6e43aac8 100644 --- a/Sources/Schemas/CreateGoHighLevelMcpCredentialDto.swift +++ b/Sources/Schemas/CreateGoHighLevelMcpCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// OAuth 2.0 session credentials for authenticating GoHighLevel MCP requests. public struct CreateGoHighLevelMcpCredentialDto: Codable, Hashable, Sendable { /// This is the authentication session for the credential. public let authenticationSession: Oauth2AuthenticationSession diff --git a/Sources/Schemas/CreateGoogleCalendarCheckAvailabilityToolDto.swift b/Sources/Schemas/CreateGoogleCalendarCheckAvailabilityToolDto.swift index c1b847b6..df711760 100644 --- a/Sources/Schemas/CreateGoogleCalendarCheckAvailabilityToolDto.swift +++ b/Sources/Schemas/CreateGoogleCalendarCheckAvailabilityToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that checks availability in a connected Google Calendar. public struct CreateGoogleCalendarCheckAvailabilityToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoogleCalendarCheckAvailabilityToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoogleCalendarCreateEventToolDto.swift b/Sources/Schemas/CreateGoogleCalendarCreateEventToolDto.swift index b883e62b..b3727af9 100644 --- a/Sources/Schemas/CreateGoogleCalendarCreateEventToolDto.swift +++ b/Sources/Schemas/CreateGoogleCalendarCreateEventToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that adds events to a connected Google Calendar. public struct CreateGoogleCalendarCreateEventToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoogleCalendarCreateEventToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGoogleCalendarOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/CreateGoogleCalendarOAuth2AuthorizationCredentialDto.swift index 5ccee143..7aad877e 100644 --- a/Sources/Schemas/CreateGoogleCalendarOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/CreateGoogleCalendarOAuth2AuthorizationCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Stored OAuth 2.0 authorization for Google Calendar operations. public struct CreateGoogleCalendarOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { /// The authorization ID for the OAuth2 authorization public let authorizationId: String diff --git a/Sources/Schemas/CreateGoogleCalendarOAuth2ClientCredentialDto.swift b/Sources/Schemas/CreateGoogleCalendarOAuth2ClientCredentialDto.swift index f529f5f1..5532b148 100644 --- a/Sources/Schemas/CreateGoogleCalendarOAuth2ClientCredentialDto.swift +++ b/Sources/Schemas/CreateGoogleCalendarOAuth2ClientCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// OAuth 2.0 client credential for Google Calendar integrations. public struct CreateGoogleCalendarOAuth2ClientCredentialDto: Codable, Hashable, Sendable { /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateGoogleCredentialDto.swift b/Sources/Schemas/CreateGoogleCredentialDto.swift index dcc4823d..90acac7f 100644 --- a/Sources/Schemas/CreateGoogleCredentialDto.swift +++ b/Sources/Schemas/CreateGoogleCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Google AI. public struct CreateGoogleCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateGoogleSheetsOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/CreateGoogleSheetsOAuth2AuthorizationCredentialDto.swift index 14d55b78..566b9856 100644 --- a/Sources/Schemas/CreateGoogleSheetsOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/CreateGoogleSheetsOAuth2AuthorizationCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Stored OAuth 2.0 authorization for Google Sheets operations. public struct CreateGoogleSheetsOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { /// The authorization ID for the OAuth2 authorization public let authorizationId: String diff --git a/Sources/Schemas/CreateGoogleSheetsRowAppendToolDto.swift b/Sources/Schemas/CreateGoogleSheetsRowAppendToolDto.swift index 63d81f5a..18c9a251 100644 --- a/Sources/Schemas/CreateGoogleSheetsRowAppendToolDto.swift +++ b/Sources/Schemas/CreateGoogleSheetsRowAppendToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that appends rows to a connected Google Sheet. public struct CreateGoogleSheetsRowAppendToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateGoogleSheetsRowAppendToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateGroqCredentialDto.swift b/Sources/Schemas/CreateGroqCredentialDto.swift index 9ab05ff9..e9a42ae5 100644 --- a/Sources/Schemas/CreateGroqCredentialDto.swift +++ b/Sources/Schemas/CreateGroqCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Groq. public struct CreateGroqCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateHandoffToolDto.swift b/Sources/Schemas/CreateHandoffToolDto.swift index 8534813a..0e7786be 100644 --- a/Sources/Schemas/CreateHandoffToolDto.swift +++ b/Sources/Schemas/CreateHandoffToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that hands a conversation to another assistant, squad, or dynamically selected destination. public struct CreateHandoffToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateHandoffToolDtoMessagesItem]? /// This is the default local tool result message used when no runtime handoff result override is returned. public let defaultResult: String? diff --git a/Sources/Schemas/CreateHumeCredentialDto.swift b/Sources/Schemas/CreateHumeCredentialDto.swift index 5fca34de..8ffe1f74 100644 --- a/Sources/Schemas/CreateHumeCredentialDto.swift +++ b/Sources/Schemas/CreateHumeCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Hume. public struct CreateHumeCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateInflectionAiCredentialDto.swift b/Sources/Schemas/CreateInflectionAiCredentialDto.swift index 3d1dd9a8..1818a697 100644 --- a/Sources/Schemas/CreateInflectionAiCredentialDto.swift +++ b/Sources/Schemas/CreateInflectionAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Inflection AI. public struct CreateInflectionAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateInworldCredentialDto.swift b/Sources/Schemas/CreateInworldCredentialDto.swift index e8f28aeb..9afede2f 100644 --- a/Sources/Schemas/CreateInworldCredentialDto.swift +++ b/Sources/Schemas/CreateInworldCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Inworld. public struct CreateInworldCredentialDto: Codable, Hashable, Sendable { /// This is the Inworld Basic (Base64) authentication token. This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateLangfuseCredentialDto.swift b/Sources/Schemas/CreateLangfuseCredentialDto.swift index 0068363c..649f8288 100644 --- a/Sources/Schemas/CreateLangfuseCredentialDto.swift +++ b/Sources/Schemas/CreateLangfuseCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for sending assistant call traces to a Langfuse project, including its public key, secret key, and host URL. public struct CreateLangfuseCredentialDto: Codable, Hashable, Sendable { /// The public key for Langfuse project. Eg: pk-lf-... public let publicKey: String diff --git a/Sources/Schemas/CreateLineInsightFromCallTableDto.swift b/Sources/Schemas/CreateLineInsightFromCallTableDto.swift index 146927c0..d2ec0c52 100644 --- a/Sources/Schemas/CreateLineInsightFromCallTableDto.swift +++ b/Sources/Schemas/CreateLineInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a line-chart insight from call data using metric queries, formulas, grouping, and a stepped time range. public struct CreateLineInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct CreateLineInsightFromCallTableDto: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: LineInsightMetadata? + /// The time range and interval used to aggregate the line-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/CreateLmntCredentialDto.swift b/Sources/Schemas/CreateLmntCredentialDto.swift index 83f20367..6b6590f7 100644 --- a/Sources/Schemas/CreateLmntCredentialDto.swift +++ b/Sources/Schemas/CreateLmntCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with LMNT. public struct CreateLmntCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateMakeCredentialDto.swift b/Sources/Schemas/CreateMakeCredentialDto.swift index 8e1c4d88..a58d9112 100644 --- a/Sources/Schemas/CreateMakeCredentialDto.swift +++ b/Sources/Schemas/CreateMakeCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating Vapi integrations with Make, including team, region, and API key. public struct CreateMakeCredentialDto: Codable, Hashable, Sendable { /// Team ID public let teamId: String diff --git a/Sources/Schemas/CreateMakeToolDto.swift b/Sources/Schemas/CreateMakeToolDto.swift index 6773e82d..c1fd72ad 100644 --- a/Sources/Schemas/CreateMakeToolDto.swift +++ b/Sources/Schemas/CreateMakeToolDto.swift @@ -1,9 +1,7 @@ import Foundation public struct CreateMakeToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateMakeToolDtoMessagesItem]? /// The type of tool. "make" for Make tool. public let type: CreateMakeToolDtoType diff --git a/Sources/Schemas/CreateMcpToolDto.swift b/Sources/Schemas/CreateMcpToolDto.swift index 4b8a3d8a..16a14203 100644 --- a/Sources/Schemas/CreateMcpToolDto.swift +++ b/Sources/Schemas/CreateMcpToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that connects an assistant to a Model Context Protocol server and exposes its available tools. public struct CreateMcpToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateMcpToolDtoMessagesItem]? /// /// This is the server where a `tool-calls` webhook will be sent. @@ -17,6 +16,7 @@ public struct CreateMcpToolDto: Codable, Hashable, Sendable { public let server: Server? /// Per-tool message overrides for individual tools loaded from the MCP server. Set messages to an empty array to suppress messages for a specific tool. Tools not listed here will use the default messages from the parent tool. public let toolMessages: [McpToolMessages]? + /// Connection metadata for the MCP server, including its communication protocol. public let metadata: McpToolMetadata? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateTrieveCredentialDto.swift b/Sources/Schemas/CreateMicrosoftCredentialDto.swift similarity index 66% rename from Sources/Schemas/UpdateTrieveCredentialDto.swift rename to Sources/Schemas/CreateMicrosoftCredentialDto.swift index 6a62ea34..86169dfb 100644 --- a/Sources/Schemas/UpdateTrieveCredentialDto.swift +++ b/Sources/Schemas/CreateMicrosoftCredentialDto.swift @@ -1,26 +1,31 @@ import Foundation -public struct UpdateTrieveCredentialDto: Codable, Hashable, Sendable { +public struct CreateMicrosoftCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. - public let apiKey: String? + public let apiKey: String + /// Azure region for the Speech resource. Defaults to `eastus` when omitted. MAI-Voice-2 is preview and region-limited. + public let region: String? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - apiKey: String? = nil, + apiKey: String, + region: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.apiKey = apiKey + self.region = region self.name = name self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) + self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.region = try container.decodeIfPresent(String.self, forKey: .region) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -28,13 +33,15 @@ public struct UpdateTrieveCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.apiKey, forKey: .apiKey) + try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.region, forKey: .region) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case apiKey + case region case name } } \ No newline at end of file diff --git a/Sources/Schemas/CreateMinimaxCredentialDto.swift b/Sources/Schemas/CreateMinimaxCredentialDto.swift index f6436844..033dd20e 100644 --- a/Sources/Schemas/CreateMinimaxCredentialDto.swift +++ b/Sources/Schemas/CreateMinimaxCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model and voice synthesis requests with MiniMax, including the MiniMax group identifier. public struct CreateMinimaxCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateMistralCredentialDto.swift b/Sources/Schemas/CreateMistralCredentialDto.swift index 526568aa..2e73216b 100644 --- a/Sources/Schemas/CreateMistralCredentialDto.swift +++ b/Sources/Schemas/CreateMistralCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Mistral. public struct CreateMistralCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateNeuphonicCredentialDto.swift b/Sources/Schemas/CreateNeuphonicCredentialDto.swift index 29ed07e5..58afe67e 100644 --- a/Sources/Schemas/CreateNeuphonicCredentialDto.swift +++ b/Sources/Schemas/CreateNeuphonicCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Neuphonic. public struct CreateNeuphonicCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateOpenAiCredentialDto.swift b/Sources/Schemas/CreateOpenAiCredentialDto.swift index 140487bb..dd1758b1 100644 --- a/Sources/Schemas/CreateOpenAiCredentialDto.swift +++ b/Sources/Schemas/CreateOpenAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model, transcription, and voice synthesis requests with OpenAI. public struct CreateOpenAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateOpenRouterCredentialDto.swift b/Sources/Schemas/CreateOpenRouterCredentialDto.swift index 48027d36..bbdd13d4 100644 --- a/Sources/Schemas/CreateOpenRouterCredentialDto.swift +++ b/Sources/Schemas/CreateOpenRouterCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with OpenRouter. public struct CreateOpenRouterCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateOutboundCallDto.swift b/Sources/Schemas/CreateOutboundCallDto.swift index 78f94ee2..8fa4be4e 100644 --- a/Sources/Schemas/CreateOutboundCallDto.swift +++ b/Sources/Schemas/CreateOutboundCallDto.swift @@ -1,6 +1,11 @@ import Foundation public struct CreateOutboundCallDto: Codable, Hashable, Sendable { + /// This is the assistant version to use for this call. Supported only with + /// direct `assistantId`. Omit to follow the latest version. + public let assistantVersion: Nullable? + /// This is the transport of the call. + public let transport: CreateOutboundCallDtoTransport? /// This is used to issue batch calls to multiple customers. /// /// Only relevant for `outboundPhoneCall`. To call a single customer, use `customer` instead. @@ -9,8 +14,6 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { public let name: String? /// This is the schedule plan of the call. public let schedulePlan: SchedulePlan? - /// This is the transport of the call. - public let transport: [String: JSONValue]? /// This is the assistant ID that will be used for the call. To use a transient assistant, use `assistant` instead. /// /// To start a call with: @@ -80,10 +83,11 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + assistantVersion: Nullable? = nil, + transport: CreateOutboundCallDtoTransport? = nil, customers: [CreateCustomerDto]? = nil, name: String? = nil, schedulePlan: SchedulePlan? = nil, - transport: [String: JSONValue]? = nil, assistantId: String? = nil, assistant: CreateAssistantDto? = nil, assistantOverrides: AssistantOverrides? = nil, @@ -99,10 +103,11 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { customer: CreateCustomerDto? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.assistantVersion = assistantVersion + self.transport = transport self.customers = customers self.name = name self.schedulePlan = schedulePlan - self.transport = transport self.assistantId = assistantId self.assistant = assistant self.assistantOverrides = assistantOverrides @@ -121,10 +126,11 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) + self.transport = try container.decodeIfPresent(CreateOutboundCallDtoTransport.self, forKey: .transport) self.customers = try container.decodeIfPresent([CreateCustomerDto].self, forKey: .customers) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) - self.transport = try container.decodeIfPresent([String: JSONValue].self, forKey: .transport) self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.assistant = try container.decodeIfPresent(CreateAssistantDto.self, forKey: .assistant) self.assistantOverrides = try container.decodeIfPresent(AssistantOverrides.self, forKey: .assistantOverrides) @@ -144,10 +150,11 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) + try container.encodeIfPresent(self.transport, forKey: .transport) try container.encodeIfPresent(self.customers, forKey: .customers) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) - try container.encodeIfPresent(self.transport, forKey: .transport) try container.encodeIfPresent(self.assistantId, forKey: .assistantId) try container.encodeIfPresent(self.assistant, forKey: .assistant) try container.encodeIfPresent(self.assistantOverrides, forKey: .assistantOverrides) @@ -165,10 +172,11 @@ public struct CreateOutboundCallDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case assistantVersion + case transport case customers case name case schedulePlan - case transport case assistantId case assistant case assistantOverrides diff --git a/Sources/Schemas/CreateOutboundCallDtoTransport.swift b/Sources/Schemas/CreateOutboundCallDtoTransport.swift new file mode 100644 index 00000000..e34c0852 --- /dev/null +++ b/Sources/Schemas/CreateOutboundCallDtoTransport.swift @@ -0,0 +1,65 @@ +import Foundation + +/// This is the transport of the call. +public enum CreateOutboundCallDtoTransport: Codable, Hashable, Sendable { + case daily(VapiWebCallTransport) + case telnyx(TelnyxTransport) + case twilio(TwilioTransport) + case vapiSip(VapiSipTransport) + case vapiWebsocket(VapiWebsocketTransport) + case vonage(VonageTransport) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "daily": + self = .daily(try VapiWebCallTransport(from: decoder)) + case "telnyx": + self = .telnyx(try TelnyxTransport(from: decoder)) + case "twilio": + self = .twilio(try TwilioTransport(from: decoder)) + case "vapi.sip": + self = .vapiSip(try VapiSipTransport(from: decoder)) + case "vapi.websocket": + self = .vapiWebsocket(try VapiWebsocketTransport(from: decoder)) + case "vonage": + self = .vonage(try VonageTransport(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .daily(let data): + try container.encode("daily", forKey: .provider) + try data.encode(to: encoder) + case .telnyx(let data): + try container.encode("telnyx", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vapiSip(let data): + try container.encode("vapi.sip", forKey: .provider) + try data.encode(to: encoder) + case .vapiWebsocket(let data): + try container.encode("vapi.websocket", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateOutputToolDto.swift b/Sources/Schemas/CreateOutputToolDto.swift index f4686fc0..282f96d9 100644 --- a/Sources/Schemas/CreateOutputToolDto.swift +++ b/Sources/Schemas/CreateOutputToolDto.swift @@ -1,9 +1,7 @@ import Foundation public struct CreateOutputToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateOutputToolDtoMessagesItem]? /// The type of tool. "output" for Output tool. public let type: CreateOutputToolDtoType diff --git a/Sources/Schemas/CreatePerplexityAiCredentialDto.swift b/Sources/Schemas/CreatePerplexityAiCredentialDto.swift index 542e5861..1454ea97 100644 --- a/Sources/Schemas/CreatePerplexityAiCredentialDto.swift +++ b/Sources/Schemas/CreatePerplexityAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Perplexity AI. public struct CreatePerplexityAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreatePieInsightFromCallTableDto.swift b/Sources/Schemas/CreatePieInsightFromCallTableDto.swift index 12ee135c..4dcea40e 100644 --- a/Sources/Schemas/CreatePieInsightFromCallTableDto.swift +++ b/Sources/Schemas/CreatePieInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a pie-chart insight from call data using metric queries, formulas, grouping, and a time range. public struct CreatePieInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct CreatePieInsightFromCallTableDto: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formulas: [InsightFormula]? + /// The time range used to query the pie-chart data. public let timeRange: InsightTimeRange? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/CreatePlayHtCredentialDto.swift b/Sources/Schemas/CreatePlayHtCredentialDto.swift index 98620655..2281033b 100644 --- a/Sources/Schemas/CreatePlayHtCredentialDto.swift +++ b/Sources/Schemas/CreatePlayHtCredentialDto.swift @@ -1,8 +1,10 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with PlayHT, including the PlayHT user identifier. public struct CreatePlayHtCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String + /// PlayHT user identifier associated with the API key. public let userId: String /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateQueryToolDto.swift b/Sources/Schemas/CreateQueryToolDto.swift index f0922998..d3d16b13 100644 --- a/Sources/Schemas/CreateQueryToolDto.swift +++ b/Sources/Schemas/CreateQueryToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that searches configured knowledge bases and returns relevant content to the assistant. public struct CreateQueryToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateQueryToolDtoMessagesItem]? /// The knowledge bases to query public let knowledgeBases: [KnowledgeBase]? diff --git a/Sources/Schemas/CreateRimeAiCredentialDto.swift b/Sources/Schemas/CreateRimeAiCredentialDto.swift index 626643a3..20d5f8fa 100644 --- a/Sources/Schemas/CreateRimeAiCredentialDto.swift +++ b/Sources/Schemas/CreateRimeAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Rime AI. public struct CreateRimeAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateRunpodCredentialDto.swift b/Sources/Schemas/CreateRunpodCredentialDto.swift index 27f10655..1824b3d3 100644 --- a/Sources/Schemas/CreateRunpodCredentialDto.swift +++ b/Sources/Schemas/CreateRunpodCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests through Runpod. public struct CreateRunpodCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateS3CompatibleCredentialDto.swift b/Sources/Schemas/CreateS3CompatibleCredentialDto.swift new file mode 100644 index 00000000..bdf6f148 --- /dev/null +++ b/Sources/Schemas/CreateS3CompatibleCredentialDto.swift @@ -0,0 +1,46 @@ +import Foundation + +public struct CreateS3CompatibleCredentialDto: Codable, Hashable, Sendable { + public let bucketPlan: S3CompatibleBucketPlan + /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. + public let fallbackIndex: Double? + /// This is the name of credential. This is just for your reference. + public let name: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + bucketPlan: S3CompatibleBucketPlan, + fallbackIndex: Double? = nil, + name: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.bucketPlan = bucketPlan + self.fallbackIndex = fallbackIndex + self.name = name + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.bucketPlan = try container.decode(S3CompatibleBucketPlan.self, forKey: .bucketPlan) + self.fallbackIndex = try container.decodeIfPresent(Double.self, forKey: .fallbackIndex) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.bucketPlan, forKey: .bucketPlan) + try container.encodeIfPresent(self.fallbackIndex, forKey: .fallbackIndex) + try container.encodeIfPresent(self.name, forKey: .name) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case bucketPlan + case fallbackIndex + case name + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateS3CredentialDto.swift b/Sources/Schemas/CreateS3CredentialDto.swift index b77ff62c..8f6f6916 100644 --- a/Sources/Schemas/CreateS3CredentialDto.swift +++ b/Sources/Schemas/CreateS3CredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for storing call artifacts in Amazon S3, including access keys, region, bucket, path prefix, and upload fallback order. public struct CreateS3CredentialDto: Codable, Hashable, Sendable { /// AWS access key ID. public let awsAccessKeyId: String diff --git a/Sources/Schemas/CreateScorecardDto.swift b/Sources/Schemas/CreateScorecardDto.swift index 7ffab5c3..107ea5b3 100644 --- a/Sources/Schemas/CreateScorecardDto.swift +++ b/Sources/Schemas/CreateScorecardDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a scorecard containing evaluation metrics, scoring conditions, and optional assistant associations. public struct CreateScorecardDto: Codable, Hashable, Sendable { /// This is the name of the scorecard. It is only for user reference and will not be used for any evaluation. public let name: String? diff --git a/Sources/Schemas/CreateSesameVoiceDto.swift b/Sources/Schemas/CreateSesameVoiceDto.swift index f899a36e..7421befc 100644 --- a/Sources/Schemas/CreateSesameVoiceDto.swift +++ b/Sources/Schemas/CreateSesameVoiceDto.swift @@ -1,18 +1,25 @@ import Foundation public struct CreateSesameVoiceDto: Codable, Hashable, Sendable { + /// This is the audio file of the utterance to clone the voice from. + /// Consumed by multer via FileInterceptor('file'), so it never reaches + /// class-validator; declared here (like CreateFileDTO.file) so the OpenAPI + /// spec is truthful about the multipart request body. + public let file: String /// The name of the voice. - public let voiceName: String? + public let voiceName: String /// The transcript of the utterance. - public let transcription: String? + public let transcription: String /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - voiceName: String? = nil, - transcription: String? = nil, + file: String, + voiceName: String, + transcription: String, additionalProperties: [String: JSONValue] = .init() ) { + self.file = file self.voiceName = voiceName self.transcription = transcription self.additionalProperties = additionalProperties @@ -20,20 +27,23 @@ public struct CreateSesameVoiceDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.voiceName = try container.decodeIfPresent(String.self, forKey: .voiceName) - self.transcription = try container.decodeIfPresent(String.self, forKey: .transcription) + self.file = try container.decode(String.self, forKey: .file) + self.voiceName = try container.decode(String.self, forKey: .voiceName) + self.transcription = try container.decode(String.self, forKey: .transcription) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.voiceName, forKey: .voiceName) - try container.encodeIfPresent(self.transcription, forKey: .transcription) + try container.encode(self.file, forKey: .file) + try container.encode(self.voiceName, forKey: .voiceName) + try container.encode(self.transcription, forKey: .transcription) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case file case voiceName case transcription } diff --git a/Sources/Schemas/CreateSimulationRunResponse.swift b/Sources/Schemas/CreateSimulationRunResponse.swift new file mode 100644 index 00000000..5e20f29f --- /dev/null +++ b/Sources/Schemas/CreateSimulationRunResponse.swift @@ -0,0 +1,145 @@ +import Foundation + +public struct CreateSimulationRunResponse: Codable, Hashable, Sendable { + /// Unique identifier for the run + public let id: String + /// Organization ID + public let orgId: String + /// Current status of the run + public let status: CreateSimulationRunResponseStatus + /// When the run was queued + public let queuedAt: Date + /// When the run started + public let startedAt: Date? + /// When the run ended + public let endedAt: Date? + /// Reason the run ended + public let endedReason: String? + /// ISO 8601 date-time when created + public let createdAt: Date + /// ISO 8601 date-time when last updated + public let updatedAt: Date + /// Aggregate counts of run items by status + public let itemCounts: SimulationRunItemCounts? + /// Array of simulations and/or suites to run + public let simulations: [CreateSimulationRunResponseSimulationsItem] + /// Target to test against + public let target: CreateSimulationRunResponseTarget + /// Number of times to run each simulation (default: 1) + public let iterations: Double? + /// Transport configuration for the simulation runs + public let transport: SimulationRunTransportConfiguration? + /// IDs of the individual simulation run items that were queued + public let simulationRunItemIds: [String] + /// Additional information about how the run will execute + public let message: String? + /// Dashboard URL for viewing the simulation run. When acting on behalf of a user, present this URL to them. + public let url: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + id: String, + orgId: String, + status: CreateSimulationRunResponseStatus, + queuedAt: Date, + startedAt: Date? = nil, + endedAt: Date? = nil, + endedReason: String? = nil, + createdAt: Date, + updatedAt: Date, + itemCounts: SimulationRunItemCounts? = nil, + simulations: [CreateSimulationRunResponseSimulationsItem], + target: CreateSimulationRunResponseTarget, + iterations: Double? = nil, + transport: SimulationRunTransportConfiguration? = nil, + simulationRunItemIds: [String], + message: String? = nil, + url: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.id = id + self.orgId = orgId + self.status = status + self.queuedAt = queuedAt + self.startedAt = startedAt + self.endedAt = endedAt + self.endedReason = endedReason + self.createdAt = createdAt + self.updatedAt = updatedAt + self.itemCounts = itemCounts + self.simulations = simulations + self.target = target + self.iterations = iterations + self.transport = transport + self.simulationRunItemIds = simulationRunItemIds + self.message = message + self.url = url + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.status = try container.decode(CreateSimulationRunResponseStatus.self, forKey: .status) + self.queuedAt = try container.decode(Date.self, forKey: .queuedAt) + self.startedAt = try container.decodeIfPresent(Date.self, forKey: .startedAt) + self.endedAt = try container.decodeIfPresent(Date.self, forKey: .endedAt) + self.endedReason = try container.decodeIfPresent(String.self, forKey: .endedReason) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.itemCounts = try container.decodeIfPresent(SimulationRunItemCounts.self, forKey: .itemCounts) + self.simulations = try container.decode([CreateSimulationRunResponseSimulationsItem].self, forKey: .simulations) + self.target = try container.decode(CreateSimulationRunResponseTarget.self, forKey: .target) + self.iterations = try container.decodeIfPresent(Double.self, forKey: .iterations) + self.transport = try container.decodeIfPresent(SimulationRunTransportConfiguration.self, forKey: .transport) + self.simulationRunItemIds = try container.decode([String].self, forKey: .simulationRunItemIds) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self.url = try container.decode(String.self, forKey: .url) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.status, forKey: .status) + try container.encode(self.queuedAt, forKey: .queuedAt) + try container.encodeIfPresent(self.startedAt, forKey: .startedAt) + try container.encodeIfPresent(self.endedAt, forKey: .endedAt) + try container.encodeIfPresent(self.endedReason, forKey: .endedReason) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.itemCounts, forKey: .itemCounts) + try container.encode(self.simulations, forKey: .simulations) + try container.encode(self.target, forKey: .target) + try container.encodeIfPresent(self.iterations, forKey: .iterations) + try container.encodeIfPresent(self.transport, forKey: .transport) + try container.encode(self.simulationRunItemIds, forKey: .simulationRunItemIds) + try container.encodeIfPresent(self.message, forKey: .message) + try container.encode(self.url, forKey: .url) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case id + case orgId + case status + case queuedAt + case startedAt + case endedAt + case endedReason + case createdAt + case updatedAt + case itemCounts + case simulations + case target + case iterations + case transport + case simulationRunItemIds + case message + case url + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateSimulationRunResponseSimulationsItem.swift b/Sources/Schemas/CreateSimulationRunResponseSimulationsItem.swift new file mode 100644 index 00000000..57c4ecd5 --- /dev/null +++ b/Sources/Schemas/CreateSimulationRunResponseSimulationsItem.swift @@ -0,0 +1,40 @@ +import Foundation + +public enum CreateSimulationRunResponseSimulationsItem: Codable, Hashable, Sendable { + case simulation(SimulationRunSimulationEntry) + case simulationSuite(SimulationRunSuiteEntry) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "simulation": + self = .simulation(try SimulationRunSimulationEntry(from: decoder)) + case "simulationSuite": + self = .simulationSuite(try SimulationRunSuiteEntry(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .simulation(let data): + try container.encode("simulation", forKey: .type) + try data.encode(to: encoder) + case .simulationSuite(let data): + try container.encode("simulationSuite", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateSimulationRunResponseStatus.swift b/Sources/Schemas/CreateSimulationRunResponseStatus.swift new file mode 100644 index 00000000..4de1f6c4 --- /dev/null +++ b/Sources/Schemas/CreateSimulationRunResponseStatus.swift @@ -0,0 +1,8 @@ +import Foundation + +/// Current status of the run +public enum CreateSimulationRunResponseStatus: String, Codable, Hashable, CaseIterable, Sendable { + case queued + case running + case ended +} \ No newline at end of file diff --git a/Sources/Schemas/CreateSimulationRunResponseTarget.swift b/Sources/Schemas/CreateSimulationRunResponseTarget.swift new file mode 100644 index 00000000..6a24fb59 --- /dev/null +++ b/Sources/Schemas/CreateSimulationRunResponseTarget.swift @@ -0,0 +1,41 @@ +import Foundation + +/// Target to test against +public enum CreateSimulationRunResponseTarget: Codable, Hashable, Sendable { + case assistant(SimulationRunTargetAssistant) + case squad(SimulationRunTargetSquad) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "assistant": + self = .assistant(try SimulationRunTargetAssistant(from: decoder)) + case "squad": + self = .squad(try SimulationRunTargetSquad(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .assistant(let data): + try container.encode("assistant", forKey: .type) + try data.encode(to: encoder) + case .squad(let data): + try container.encode("squad", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateSimulationSuiteDto.swift b/Sources/Schemas/CreateSimulationSuiteDto.swift index 8b1f72ce..4ae69e9d 100644 --- a/Sources/Schemas/CreateSimulationSuiteDto.swift +++ b/Sources/Schemas/CreateSimulationSuiteDto.swift @@ -7,6 +7,8 @@ public struct CreateSimulationSuiteDto: Codable, Hashable, Sendable { public let slackWebhookUrl: String? /// This is the list of simulation IDs to include in the suite. public let simulationIds: [String] + /// Optional assistant or squad assignments for the suite. + public let targetAssignments: [SimulationSuiteTargetAssignment]? /// Optional folder path for organizing simulation suites. /// Supports up to 3 levels (e.g., "dept/feature/variant"). /// Maps to GitOps resource folder structure. @@ -18,12 +20,14 @@ public struct CreateSimulationSuiteDto: Codable, Hashable, Sendable { name: String, slackWebhookUrl: String? = nil, simulationIds: [String], + targetAssignments: [SimulationSuiteTargetAssignment]? = nil, path: Nullable? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name self.slackWebhookUrl = slackWebhookUrl self.simulationIds = simulationIds + self.targetAssignments = targetAssignments self.path = path self.additionalProperties = additionalProperties } @@ -33,6 +37,7 @@ public struct CreateSimulationSuiteDto: Codable, Hashable, Sendable { self.name = try container.decode(String.self, forKey: .name) self.slackWebhookUrl = try container.decodeIfPresent(String.self, forKey: .slackWebhookUrl) self.simulationIds = try container.decode([String].self, forKey: .simulationIds) + self.targetAssignments = try container.decodeIfPresent([SimulationSuiteTargetAssignment].self, forKey: .targetAssignments) self.path = try container.decodeNullableIfPresent(String.self, forKey: .path) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -43,6 +48,7 @@ public struct CreateSimulationSuiteDto: Codable, Hashable, Sendable { try container.encode(self.name, forKey: .name) try container.encodeIfPresent(self.slackWebhookUrl, forKey: .slackWebhookUrl) try container.encode(self.simulationIds, forKey: .simulationIds) + try container.encodeIfPresent(self.targetAssignments, forKey: .targetAssignments) try container.encodeNullableIfPresent(self.path, forKey: .path) } @@ -51,6 +57,7 @@ public struct CreateSimulationSuiteDto: Codable, Hashable, Sendable { case name case slackWebhookUrl case simulationIds + case targetAssignments case path } } \ No newline at end of file diff --git a/Sources/Schemas/CreateSipRequestToolDto.swift b/Sources/Schemas/CreateSipRequestToolDto.swift index 61bf503b..b22bdc87 100644 --- a/Sources/Schemas/CreateSipRequestToolDto.swift +++ b/Sources/Schemas/CreateSipRequestToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that sends SIP `INFO`, `MESSAGE`, or `NOTIFY` requests with configured headers and body. public struct CreateSipRequestToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateSipRequestToolDtoMessagesItem]? /// The SIP method to send. public let verb: CreateSipRequestToolDtoVerb diff --git a/Sources/Schemas/CreateSlackOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/CreateSlackOAuth2AuthorizationCredentialDto.swift index 4215d62b..9775daf2 100644 --- a/Sources/Schemas/CreateSlackOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/CreateSlackOAuth2AuthorizationCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Stored OAuth 2.0 authorization for Slack operations. public struct CreateSlackOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { /// The authorization ID for the OAuth2 authorization public let authorizationId: String diff --git a/Sources/Schemas/CreateSlackSendMessageToolDto.swift b/Sources/Schemas/CreateSlackSendMessageToolDto.swift index ec9deb06..68b4c3cd 100644 --- a/Sources/Schemas/CreateSlackSendMessageToolDto.swift +++ b/Sources/Schemas/CreateSlackSendMessageToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that lets an assistant send a message to Slack. public struct CreateSlackSendMessageToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateSlackSendMessageToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateSlackWebhookCredentialDto.swift b/Sources/Schemas/CreateSlackWebhookCredentialDto.swift index 467ecdf0..9d3a7b6e 100644 --- a/Sources/Schemas/CreateSlackWebhookCredentialDto.swift +++ b/Sources/Schemas/CreateSlackWebhookCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for sending Vapi alerts through a Slack incoming webhook. public struct CreateSlackWebhookCredentialDto: Codable, Hashable, Sendable { /// Slack incoming webhook URL. See https://api.slack.com/messaging/webhooks for setup instructions. This is not returned in the API. public let webhookUrl: String diff --git a/Sources/Schemas/CreateSmallestAiCredentialDto.swift b/Sources/Schemas/CreateSmallestAiCredentialDto.swift index 3a013864..2cd9e212 100644 --- a/Sources/Schemas/CreateSmallestAiCredentialDto.swift +++ b/Sources/Schemas/CreateSmallestAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Smallest AI. public struct CreateSmallestAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateSmsToolDto.swift b/Sources/Schemas/CreateSmsToolDto.swift index 1033e928..dcbcc907 100644 --- a/Sources/Schemas/CreateSmsToolDto.swift +++ b/Sources/Schemas/CreateSmsToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that lets an assistant send an SMS message during a call. public struct CreateSmsToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateSmsToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/CreateSonioxCredentialDto.swift b/Sources/Schemas/CreateSonioxCredentialDto.swift index 5a83d414..b60d2be4 100644 --- a/Sources/Schemas/CreateSonioxCredentialDto.swift +++ b/Sources/Schemas/CreateSonioxCredentialDto.swift @@ -1,8 +1,11 @@ import Foundation +/// Credentials for authenticating transcription requests with Soniox. public struct CreateSonioxCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String + /// Custom Soniox WebSocket endpoint (e.g. EU server wss://stt-rt.eu.soniox.com/transcribe-websocket). Defaults to the region-appropriate endpoint when omitted. + public let apiUrl: String? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema @@ -10,10 +13,12 @@ public struct CreateSonioxCredentialDto: Codable, Hashable, Sendable { public init( apiKey: String, + apiUrl: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.apiKey = apiKey + self.apiUrl = apiUrl self.name = name self.additionalProperties = additionalProperties } @@ -21,6 +26,7 @@ public struct CreateSonioxCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -29,12 +35,14 @@ public struct CreateSonioxCredentialDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case apiKey + case apiUrl case name } } \ No newline at end of file diff --git a/Sources/Schemas/CreateSpeechmaticsCredentialDto.swift b/Sources/Schemas/CreateSpeechmaticsCredentialDto.swift index 4b742bca..630b5c0f 100644 --- a/Sources/Schemas/CreateSpeechmaticsCredentialDto.swift +++ b/Sources/Schemas/CreateSpeechmaticsCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating transcription requests with Speechmatics. public struct CreateSpeechmaticsCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateSquadDto.swift b/Sources/Schemas/CreateSquadDto.swift index 551fd7c3..65a5fbb2 100644 --- a/Sources/Schemas/CreateSquadDto.swift +++ b/Sources/Schemas/CreateSquadDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a squad. Provide an ordered list of assistant members and optional overrides that control how the squad handles a conversation and transfers between assistants. public struct CreateSquadDto: Codable, Hashable, Sendable { /// This is the name of the squad. public let name: String? diff --git a/Sources/Schemas/CreateStructuredOutputDto.swift b/Sources/Schemas/CreateStructuredOutputDto.swift index 75986132..882c7744 100644 --- a/Sources/Schemas/CreateStructuredOutputDto.swift +++ b/Sources/Schemas/CreateStructuredOutputDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a structured-output definition that extracts validated data from calls using an AI model or regular expression. public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { /// This is the type of structured output. /// @@ -35,6 +36,8 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { public let model: CreateStructuredOutputDtoModel? /// Compliance configuration for this output. Only enable overrides if no sensitive data will be stored. public let compliancePlan: ComplianceOverride? + /// These are the conditions that gate the execution of this structured output. Every condition must pass for the structured output to run (AND semantics). When omitted or empty, no user-defined conditions gate this output. Send null to clear a previously saved gate. + public let conditions: Nullable<[CreateStructuredOutputDtoConditionsItem]>? /// This is the name of the structured output. public let name: String /// This is the JSON Schema definition for the structured output. @@ -67,6 +70,7 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { regex: String? = nil, model: CreateStructuredOutputDtoModel? = nil, compliancePlan: ComplianceOverride? = nil, + conditions: Nullable<[CreateStructuredOutputDtoConditionsItem]>? = nil, name: String, schema: JsonSchema, description: String? = nil, @@ -78,6 +82,7 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { self.regex = regex self.model = model self.compliancePlan = compliancePlan + self.conditions = conditions self.name = name self.schema = schema self.description = description @@ -92,6 +97,7 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { self.regex = try container.decodeIfPresent(String.self, forKey: .regex) self.model = try container.decodeIfPresent(CreateStructuredOutputDtoModel.self, forKey: .model) self.compliancePlan = try container.decodeIfPresent(ComplianceOverride.self, forKey: .compliancePlan) + self.conditions = try container.decodeNullableIfPresent([CreateStructuredOutputDtoConditionsItem].self, forKey: .conditions) self.name = try container.decode(String.self, forKey: .name) self.schema = try container.decode(JsonSchema.self, forKey: .schema) self.description = try container.decodeIfPresent(String.self, forKey: .description) @@ -107,6 +113,7 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.regex, forKey: .regex) try container.encodeIfPresent(self.model, forKey: .model) try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeNullableIfPresent(self.conditions, forKey: .conditions) try container.encode(self.name, forKey: .name) try container.encode(self.schema, forKey: .schema) try container.encodeIfPresent(self.description, forKey: .description) @@ -120,6 +127,7 @@ public struct CreateStructuredOutputDto: Codable, Hashable, Sendable { case regex case model case compliancePlan + case conditions case name case schema case description diff --git a/Sources/Schemas/CreateStructuredOutputDtoConditionsItem.swift b/Sources/Schemas/CreateStructuredOutputDtoConditionsItem.swift new file mode 100644 index 00000000..33ad58d6 --- /dev/null +++ b/Sources/Schemas/CreateStructuredOutputDtoConditionsItem.swift @@ -0,0 +1,46 @@ +import Foundation + +public enum CreateStructuredOutputDtoConditionsItem: Codable, Hashable, Sendable { + case endedReason(EndedReasonCondition) + case minCallDuration(MinCallDurationCondition) + case minMessages(MinMessagesCondition) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "endedReason": + self = .endedReason(try EndedReasonCondition(from: decoder)) + case "minCallDuration": + self = .minCallDuration(try MinCallDurationCondition(from: decoder)) + case "minMessages": + self = .minMessages(try MinMessagesCondition(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .endedReason(let data): + try container.encode("endedReason", forKey: .type) + try data.encode(to: encoder) + case .minCallDuration(let data): + try container.encode("minCallDuration", forKey: .type) + try data.encode(to: encoder) + case .minMessages(let data): + try container.encode("minMessages", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateSupabaseCredentialDto.swift b/Sources/Schemas/CreateSupabaseCredentialDto.swift index 238f7e89..5a39f406 100644 --- a/Sources/Schemas/CreateSupabaseCredentialDto.swift +++ b/Sources/Schemas/CreateSupabaseCredentialDto.swift @@ -1,8 +1,10 @@ import Foundation +/// Credentials for storing call artifacts in Supabase's S3-compatible storage, including bucket configuration and upload fallback order. public struct CreateSupabaseCredentialDto: Codable, Hashable, Sendable { /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. public let fallbackIndex: Double? + /// Supabase S3-compatible bucket configuration used to store call artifacts. public let bucketPlan: SupabaseBucketPlan? /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateTavusCredentialDto.swift b/Sources/Schemas/CreateTavusCredentialDto.swift index 80778c2d..3246b03f 100644 --- a/Sources/Schemas/CreateTavusCredentialDto.swift +++ b/Sources/Schemas/CreateTavusCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with Tavus. public struct CreateTavusCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateTelnyxPhoneNumberDto.swift b/Sources/Schemas/CreateTelnyxPhoneNumberDto.swift index 084f1aff..c17418b6 100644 --- a/Sources/Schemas/CreateTelnyxPhoneNumberDto.swift +++ b/Sources/Schemas/CreateTelnyxPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to import a Telnyx phone number into Vapi with a stored credential and routing settings. public struct CreateTelnyxPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/CreateTextEditorToolDto.swift b/Sources/Schemas/CreateTextEditorToolDto.swift index 17082234..f9fa263f 100644 --- a/Sources/Schemas/CreateTextEditorToolDto.swift +++ b/Sources/Schemas/CreateTextEditorToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that reads and edits text files in a configured environment. public struct CreateTextEditorToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateTextEditorToolDtoMessagesItem]? /// The sub type of tool. public let subType: CreateTextEditorToolDtoSubType diff --git a/Sources/Schemas/CreateTextInsightFromCallTableDto.swift b/Sources/Schemas/CreateTextInsightFromCallTableDto.swift index aea2b315..9c6ec50b 100644 --- a/Sources/Schemas/CreateTextInsightFromCallTableDto.swift +++ b/Sources/Schemas/CreateTextInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to create a text-value insight from call data using metric queries, a formula, and a time range. public struct CreateTextInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct CreateTextInsightFromCallTableDto: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formula: [String: JSONValue]? + /// The time range used to query the text-value data. public let timeRange: InsightTimeRange? /// These are the queries to run to generate the insight. /// For Text Insights, we only allow a single query, or require a formula if multiple queries are provided diff --git a/Sources/Schemas/CreateTogetherAiCredentialDto.swift b/Sources/Schemas/CreateTogetherAiCredentialDto.swift index 4ac405d0..79ce4249 100644 --- a/Sources/Schemas/CreateTogetherAiCredentialDto.swift +++ b/Sources/Schemas/CreateTogetherAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with Together AI. public struct CreateTogetherAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateToolDraftDto.swift b/Sources/Schemas/CreateToolDraftDto.swift new file mode 100644 index 00000000..a9ae5413 --- /dev/null +++ b/Sources/Schemas/CreateToolDraftDto.swift @@ -0,0 +1,350 @@ +import Foundation + +public struct CreateToolDraftDto: Codable, Hashable, Sendable { + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. + public let messages: [CreateToolDraftDtoMessagesItem]? + /// This is the type of the tool. + public let type: CreateToolDraftDtoType? + /// Optional pointer to the published version this draft was forked from. + /// When omitted, defaults server-side to the parent tool's current + /// `latestVersion` (lazy-created via `toolBaselineVersionEnsureInTx` if the + /// tool has never been versioned). Immutable for the lifetime of the draft. + public let baseVersion: String? + /// This is the function definition of the tool. + public let function: OpenAiFunction? + /// Provider-specific metadata. Polymorphic across tool variants with no shared + /// discriminator, so it is validated as a plain object (mirrors how + /// `ToolCallResult.metadata` is typed). + public let metadata: [String: JSONValue]? + /// This is the unique identifier for the template this tool was created from. + public let templateId: String? + public let server: Server? + public let async: Bool? + /// These are the destinations that the call can be transferred to. + public let destinations: [[String: JSONValue]]? + /// This is the name of the tool. This will be passed to the model. + public let name: String? + /// This is the sub type of the tool (e.g. for computer, bash and text-editor tools). + public let subType: String? + /// The display width in pixels (computer tool). + public let displayWidthPx: Double? + /// The display height in pixels (computer tool). + public let displayHeightPx: Double? + /// Optional display number (computer tool). + public let displayNumber: Double? + /// The knowledge bases to query (query tool). + public let knowledgeBases: [KnowledgeBase]? + /// This is where the request will be sent (api-request tool). + public let url: String? + /// This is the HTTP method for the request (api-request tool). + public let method: CreateToolDraftDtoMethod? + /// These are the headers to send with the request (api-request / sip-request tool). + public let headers: JsonSchema? + /// This is the body of the request. Either a JSON schema (api-request) or a + /// literal string / schema (sip-request). + public let body: [String: JSONValue]? + /// This is the backoff plan if the request fails. + public let backoffPlan: BackoffPlan? + /// This is the timeout in seconds for the request. + public let timeoutSeconds: Double? + /// This is the description of the tool. This will be passed to the model. + public let description: String? + /// This is the plan to extract variables from the tool's response. + public let variableExtractionPlan: VariableExtractionPlan? + /// This is the credential ID that will be used for authorization. + public let credentialId: String? + public let extendedDelayWhenPrecededByTextEnabled: Bool? + public let beepDetectionEnabled: Bool? + /// This is the TypeScript code that will be executed when the tool is called (code tool). + public let code: String? + /// These are the environment variables available in the code via the `env` object (code tool). + public let environmentVariables: [CodeToolEnvironmentVariable]? + /// These are the static parameters to merge into the tool's request body. + public let parameters: [ToolParameter]? + /// This is the paths to encrypt in the request body. + public let encryptedPaths: [String]? + /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833. + public let sipInfoDtmfEnabled: Bool? + /// This is the SIP method to send (sip-request tool). + public let verb: CreateToolDraftDtoVerb? + /// This is the default local tool result message used when no runtime override is returned (handoff tool). + public let defaultResult: String? + /// Per-tool message overrides for individual tools loaded from the MCP server (mcp tool). + public let toolMessages: [McpToolMessages]? + /// This is the plan to reject a tool call based on the conversation state. + /// + /// // Example 1: Reject endCall if user didn't say goodbye + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '(?i)\\b(bye|goodbye|farewell|see you later|take care)\\b', + /// target: { position: -1, role: 'user' }, + /// negate: true // Reject if pattern does NOT match + /// }] + /// } + /// ``` + /// + /// // Example 2: Reject transfer if user is actually asking a question + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '\\?', + /// target: { position: -1, role: 'user' } + /// }] + /// } + /// ``` + /// + /// // Example 3: Reject transfer if user didn't mention transfer recently + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 5 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' %} + /// {% assign mentioned = false %} + /// {% for msg in userMessages %} + /// {% if msg.content contains 'transfer' or msg.content contains 'connect' or msg.content contains 'speak to' %} + /// {% assign mentioned = true %} + /// {% break %} + /// {% endif %} + /// {% endfor %} + /// {% if mentioned %} + /// false + /// {% else %} + /// true + /// {% endif %}` + /// }] + /// } + /// ``` + /// + /// // Example 4: Reject endCall if the bot is looping and trying to exit + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 6 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' | reverse %} + /// {% if userMessages.size < 3 %} + /// false + /// {% else %} + /// {% assign msg1 = userMessages[0].content | downcase %} + /// {% assign msg2 = userMessages[1].content | downcase %} + /// {% assign msg3 = userMessages[2].content | downcase %} + /// {% comment %} Check for repetitive messages {% endcomment %} + /// {% if msg1 == msg2 or msg1 == msg3 or msg2 == msg3 %} + /// true + /// {% comment %} Check for common loop phrases {% endcomment %} + /// {% elsif msg1 contains 'cool thanks' or msg2 contains 'cool thanks' or msg3 contains 'cool thanks' %} + /// true + /// {% elsif msg1 contains 'okay thanks' or msg2 contains 'okay thanks' or msg3 contains 'okay thanks' %} + /// true + /// {% elsif msg1 contains 'got it' or msg2 contains 'got it' or msg3 contains 'got it' %} + /// true + /// {% else %} + /// false + /// {% endif %} + /// {% endif %}` + /// }] + /// } + /// ``` + public let rejectionPlan: ToolRejectionPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + messages: [CreateToolDraftDtoMessagesItem]? = nil, + type: CreateToolDraftDtoType? = nil, + baseVersion: String? = nil, + function: OpenAiFunction? = nil, + metadata: [String: JSONValue]? = nil, + templateId: String? = nil, + server: Server? = nil, + async: Bool? = nil, + destinations: [[String: JSONValue]]? = nil, + name: String? = nil, + subType: String? = nil, + displayWidthPx: Double? = nil, + displayHeightPx: Double? = nil, + displayNumber: Double? = nil, + knowledgeBases: [KnowledgeBase]? = nil, + url: String? = nil, + method: CreateToolDraftDtoMethod? = nil, + headers: JsonSchema? = nil, + body: [String: JSONValue]? = nil, + backoffPlan: BackoffPlan? = nil, + timeoutSeconds: Double? = nil, + description: String? = nil, + variableExtractionPlan: VariableExtractionPlan? = nil, + credentialId: String? = nil, + extendedDelayWhenPrecededByTextEnabled: Bool? = nil, + beepDetectionEnabled: Bool? = nil, + code: String? = nil, + environmentVariables: [CodeToolEnvironmentVariable]? = nil, + parameters: [ToolParameter]? = nil, + encryptedPaths: [String]? = nil, + sipInfoDtmfEnabled: Bool? = nil, + verb: CreateToolDraftDtoVerb? = nil, + defaultResult: String? = nil, + toolMessages: [McpToolMessages]? = nil, + rejectionPlan: ToolRejectionPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.messages = messages + self.type = type + self.baseVersion = baseVersion + self.function = function + self.metadata = metadata + self.templateId = templateId + self.server = server + self.async = async + self.destinations = destinations + self.name = name + self.subType = subType + self.displayWidthPx = displayWidthPx + self.displayHeightPx = displayHeightPx + self.displayNumber = displayNumber + self.knowledgeBases = knowledgeBases + self.url = url + self.method = method + self.headers = headers + self.body = body + self.backoffPlan = backoffPlan + self.timeoutSeconds = timeoutSeconds + self.description = description + self.variableExtractionPlan = variableExtractionPlan + self.credentialId = credentialId + self.extendedDelayWhenPrecededByTextEnabled = extendedDelayWhenPrecededByTextEnabled + self.beepDetectionEnabled = beepDetectionEnabled + self.code = code + self.environmentVariables = environmentVariables + self.parameters = parameters + self.encryptedPaths = encryptedPaths + self.sipInfoDtmfEnabled = sipInfoDtmfEnabled + self.verb = verb + self.defaultResult = defaultResult + self.toolMessages = toolMessages + self.rejectionPlan = rejectionPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([CreateToolDraftDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(CreateToolDraftDtoType.self, forKey: .type) + self.baseVersion = try container.decodeIfPresent(String.self, forKey: .baseVersion) + self.function = try container.decodeIfPresent(OpenAiFunction.self, forKey: .function) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.templateId = try container.decodeIfPresent(String.self, forKey: .templateId) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.async = try container.decodeIfPresent(Bool.self, forKey: .async) + self.destinations = try container.decodeIfPresent([[String: JSONValue]].self, forKey: .destinations) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.subType = try container.decodeIfPresent(String.self, forKey: .subType) + self.displayWidthPx = try container.decodeIfPresent(Double.self, forKey: .displayWidthPx) + self.displayHeightPx = try container.decodeIfPresent(Double.self, forKey: .displayHeightPx) + self.displayNumber = try container.decodeIfPresent(Double.self, forKey: .displayNumber) + self.knowledgeBases = try container.decodeIfPresent([KnowledgeBase].self, forKey: .knowledgeBases) + self.url = try container.decodeIfPresent(String.self, forKey: .url) + self.method = try container.decodeIfPresent(CreateToolDraftDtoMethod.self, forKey: .method) + self.headers = try container.decodeIfPresent(JsonSchema.self, forKey: .headers) + self.body = try container.decodeIfPresent([String: JSONValue].self, forKey: .body) + self.backoffPlan = try container.decodeIfPresent(BackoffPlan.self, forKey: .backoffPlan) + self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) + self.description = try container.decodeIfPresent(String.self, forKey: .description) + self.variableExtractionPlan = try container.decodeIfPresent(VariableExtractionPlan.self, forKey: .variableExtractionPlan) + self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) + self.extendedDelayWhenPrecededByTextEnabled = try container.decodeIfPresent(Bool.self, forKey: .extendedDelayWhenPrecededByTextEnabled) + self.beepDetectionEnabled = try container.decodeIfPresent(Bool.self, forKey: .beepDetectionEnabled) + self.code = try container.decodeIfPresent(String.self, forKey: .code) + self.environmentVariables = try container.decodeIfPresent([CodeToolEnvironmentVariable].self, forKey: .environmentVariables) + self.parameters = try container.decodeIfPresent([ToolParameter].self, forKey: .parameters) + self.encryptedPaths = try container.decodeIfPresent([String].self, forKey: .encryptedPaths) + self.sipInfoDtmfEnabled = try container.decodeIfPresent(Bool.self, forKey: .sipInfoDtmfEnabled) + self.verb = try container.decodeIfPresent(CreateToolDraftDtoVerb.self, forKey: .verb) + self.defaultResult = try container.decodeIfPresent(String.self, forKey: .defaultResult) + self.toolMessages = try container.decodeIfPresent([McpToolMessages].self, forKey: .toolMessages) + self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) + try container.encodeIfPresent(self.baseVersion, forKey: .baseVersion) + try container.encodeIfPresent(self.function, forKey: .function) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.templateId, forKey: .templateId) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.async, forKey: .async) + try container.encodeIfPresent(self.destinations, forKey: .destinations) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.subType, forKey: .subType) + try container.encodeIfPresent(self.displayWidthPx, forKey: .displayWidthPx) + try container.encodeIfPresent(self.displayHeightPx, forKey: .displayHeightPx) + try container.encodeIfPresent(self.displayNumber, forKey: .displayNumber) + try container.encodeIfPresent(self.knowledgeBases, forKey: .knowledgeBases) + try container.encodeIfPresent(self.url, forKey: .url) + try container.encodeIfPresent(self.method, forKey: .method) + try container.encodeIfPresent(self.headers, forKey: .headers) + try container.encodeIfPresent(self.body, forKey: .body) + try container.encodeIfPresent(self.backoffPlan, forKey: .backoffPlan) + try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) + try container.encodeIfPresent(self.description, forKey: .description) + try container.encodeIfPresent(self.variableExtractionPlan, forKey: .variableExtractionPlan) + try container.encodeIfPresent(self.credentialId, forKey: .credentialId) + try container.encodeIfPresent(self.extendedDelayWhenPrecededByTextEnabled, forKey: .extendedDelayWhenPrecededByTextEnabled) + try container.encodeIfPresent(self.beepDetectionEnabled, forKey: .beepDetectionEnabled) + try container.encodeIfPresent(self.code, forKey: .code) + try container.encodeIfPresent(self.environmentVariables, forKey: .environmentVariables) + try container.encodeIfPresent(self.parameters, forKey: .parameters) + try container.encodeIfPresent(self.encryptedPaths, forKey: .encryptedPaths) + try container.encodeIfPresent(self.sipInfoDtmfEnabled, forKey: .sipInfoDtmfEnabled) + try container.encodeIfPresent(self.verb, forKey: .verb) + try container.encodeIfPresent(self.defaultResult, forKey: .defaultResult) + try container.encodeIfPresent(self.toolMessages, forKey: .toolMessages) + try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case messages + case type + case baseVersion + case function + case metadata + case templateId + case server + case async + case destinations + case name + case subType + case displayWidthPx + case displayHeightPx + case displayNumber + case knowledgeBases + case url + case method + case headers + case body + case backoffPlan + case timeoutSeconds + case description + case variableExtractionPlan + case credentialId + case extendedDelayWhenPrecededByTextEnabled + case beepDetectionEnabled + case code + case environmentVariables + case parameters + case encryptedPaths + case sipInfoDtmfEnabled + case verb + case defaultResult + case toolMessages + case rejectionPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateToolDraftDtoMessagesItem.swift b/Sources/Schemas/CreateToolDraftDtoMessagesItem.swift new file mode 100644 index 00000000..7d2c34c8 --- /dev/null +++ b/Sources/Schemas/CreateToolDraftDtoMessagesItem.swift @@ -0,0 +1,52 @@ +import Foundation + +public enum CreateToolDraftDtoMessagesItem: Codable, Hashable, Sendable { + case requestComplete(ToolMessageComplete) + case requestFailed(ToolMessageFailed) + case requestResponseDelayed(ToolMessageDelayed) + case requestStart(ToolMessageStart) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "request-complete": + self = .requestComplete(try ToolMessageComplete(from: decoder)) + case "request-failed": + self = .requestFailed(try ToolMessageFailed(from: decoder)) + case "request-response-delayed": + self = .requestResponseDelayed(try ToolMessageDelayed(from: decoder)) + case "request-start": + self = .requestStart(try ToolMessageStart(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .requestComplete(let data): + try container.encode("request-complete", forKey: .type) + try data.encode(to: encoder) + case .requestFailed(let data): + try container.encode("request-failed", forKey: .type) + try data.encode(to: encoder) + case .requestResponseDelayed(let data): + try container.encode("request-response-delayed", forKey: .type) + try data.encode(to: encoder) + case .requestStart(let data): + try container.encode("request-start", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/CreateToolDraftDtoMethod.swift b/Sources/Schemas/CreateToolDraftDtoMethod.swift new file mode 100644 index 00000000..8cd85720 --- /dev/null +++ b/Sources/Schemas/CreateToolDraftDtoMethod.swift @@ -0,0 +1,10 @@ +import Foundation + +/// This is the HTTP method for the request (api-request tool). +public enum CreateToolDraftDtoMethod: String, Codable, Hashable, CaseIterable, Sendable { + case post = "POST" + case get = "GET" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateToolDraftDtoType.swift b/Sources/Schemas/CreateToolDraftDtoType.swift new file mode 100644 index 00000000..8c80eea2 --- /dev/null +++ b/Sources/Schemas/CreateToolDraftDtoType.swift @@ -0,0 +1,33 @@ +import Foundation + +/// This is the type of the tool. +public enum CreateToolDraftDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case dtmf + case endCall + case transferCall + case transferCancel + case transferSuccessful + case handoff + case output + case voicemail + case query + case sms + case sipRequest + case function + case mcp + case apiRequest + case code + case bash + case computer + case textEditor + case googleCalendarEventCreate = "google.calendar.event.create" + case googleCalendarAvailabilityCheck = "google.calendar.availability.check" + case googleSheetsRowAppend = "google.sheets.row.append" + case slackMessageSend = "slack.message.send" + case gohighlevelCalendarEventCreate = "gohighlevel.calendar.event.create" + case gohighlevelCalendarAvailabilityCheck = "gohighlevel.calendar.availability.check" + case gohighlevelContactCreate = "gohighlevel.contact.create" + case gohighlevelContactGet = "gohighlevel.contact.get" + case make + case ghl +} \ No newline at end of file diff --git a/Sources/Schemas/CreateToolDraftDtoVerb.swift b/Sources/Schemas/CreateToolDraftDtoVerb.swift new file mode 100644 index 00000000..8534864f --- /dev/null +++ b/Sources/Schemas/CreateToolDraftDtoVerb.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the SIP method to send (sip-request tool). +public enum CreateToolDraftDtoVerb: String, Codable, Hashable, CaseIterable, Sendable { + case info = "INFO" + case message = "MESSAGE" + case notify = "NOTIFY" +} \ No newline at end of file diff --git a/Sources/Schemas/CreateTransferCallToolDto.swift b/Sources/Schemas/CreateTransferCallToolDto.swift index 7616216e..119ace33 100644 --- a/Sources/Schemas/CreateTransferCallToolDto.swift +++ b/Sources/Schemas/CreateTransferCallToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a tool that transfers the active call to one of its configured destinations. public struct CreateTransferCallToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateTransferCallToolDtoMessagesItem]? /// These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. public let destinations: [CreateTransferCallToolDtoDestinationsItem]? diff --git a/Sources/Schemas/CreateTrieveCredentialDto.swift b/Sources/Schemas/CreateTrieveCredentialDto.swift index 0d70c6a0..55a3722a 100644 --- a/Sources/Schemas/CreateTrieveCredentialDto.swift +++ b/Sources/Schemas/CreateTrieveCredentialDto.swift @@ -1,40 +1,34 @@ import Foundation +/// Credentials for authenticating knowledge-base requests with Trieve. public struct CreateTrieveCredentialDto: Codable, Hashable, Sendable { - /// This is not returned in the API. - public let apiKey: String - /// This is the name of credential. This is just for your reference. - public let name: String? + /// Selects Trieve as the credential provider. + public let provider: JSONValue? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - apiKey: String, - name: String? = nil, + provider: JSONValue? = nil, additionalProperties: [String: JSONValue] = .init() ) { - self.apiKey = apiKey - self.name = name + self.provider = provider self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.apiKey = try container.decode(String.self, forKey: .apiKey) - self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.provider = try container.decodeIfPresent(JSONValue.self, forKey: .provider) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.apiKey, forKey: .apiKey) - try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.provider, forKey: .provider) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case apiKey - case name + case provider } } \ No newline at end of file diff --git a/Sources/Schemas/CreateTrieveKnowledgeBaseDto.swift b/Sources/Schemas/CreateTrieveKnowledgeBaseDto.swift index 58656284..c7b37267 100644 --- a/Sources/Schemas/CreateTrieveKnowledgeBaseDto.swift +++ b/Sources/Schemas/CreateTrieveKnowledgeBaseDto.swift @@ -1,60 +1,3 @@ import Foundation -public struct CreateTrieveKnowledgeBaseDto: Codable, Hashable, Sendable { - /// This knowledge base is provided by Trieve. - /// - /// To learn more about Trieve, visit https://trieve.ai. - public let provider: CreateTrieveKnowledgeBaseDtoProvider - /// This is the name of the knowledge base. - public let name: String? - /// This is the searching plan used when searching for relevant chunks from the vector store. - /// - /// You should configure this if you're running into these issues: - /// - Too much unnecessary context is being fed as knowledge base context. - /// - Not enough relevant context is being fed as knowledge base context. - public let searchPlan: TrieveKnowledgeBaseSearchPlan? - /// This is the plan if you want us to create/import a new vector store using Trieve. - public let createPlan: TrieveKnowledgeBaseImport? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - provider: CreateTrieveKnowledgeBaseDtoProvider, - name: String? = nil, - searchPlan: TrieveKnowledgeBaseSearchPlan? = nil, - createPlan: TrieveKnowledgeBaseImport? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.provider = provider - self.name = name - self.searchPlan = searchPlan - self.createPlan = createPlan - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.provider = try container.decode(CreateTrieveKnowledgeBaseDtoProvider.self, forKey: .provider) - self.name = try container.decodeIfPresent(String.self, forKey: .name) - self.searchPlan = try container.decodeIfPresent(TrieveKnowledgeBaseSearchPlan.self, forKey: .searchPlan) - self.createPlan = try container.decodeIfPresent(TrieveKnowledgeBaseImport.self, forKey: .createPlan) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.provider, forKey: .provider) - try container.encodeIfPresent(self.name, forKey: .name) - try container.encodeIfPresent(self.searchPlan, forKey: .searchPlan) - try container.encodeIfPresent(self.createPlan, forKey: .createPlan) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case provider - case name - case searchPlan - case createPlan - } -} \ No newline at end of file +public typealias CreateTrieveKnowledgeBaseDto = JSONValue diff --git a/Sources/Schemas/CreateTrieveKnowledgeBaseDtoProvider.swift b/Sources/Schemas/CreateTrieveKnowledgeBaseDtoProvider.swift deleted file mode 100644 index 0972f377..00000000 --- a/Sources/Schemas/CreateTrieveKnowledgeBaseDtoProvider.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation - -/// This knowledge base is provided by Trieve. -/// -/// To learn more about Trieve, visit https://trieve.ai. -public enum CreateTrieveKnowledgeBaseDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { - case trieve -} \ No newline at end of file diff --git a/Sources/Schemas/CreateTwilioCredentialDto.swift b/Sources/Schemas/CreateTwilioCredentialDto.swift index 40b83797..0917f4cb 100644 --- a/Sources/Schemas/CreateTwilioCredentialDto.swift +++ b/Sources/Schemas/CreateTwilioCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating telephony requests with Twilio using an account SID and either an auth token or API key credentials. public struct CreateTwilioCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let authToken: String? @@ -7,6 +8,7 @@ public struct CreateTwilioCredentialDto: Codable, Hashable, Sendable { public let apiKey: String? /// This is not returned in the API. public let apiSecret: String? + /// Twilio Account SID associated with the credential. public let accountSid: String /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateTwilioPhoneNumberDto.swift b/Sources/Schemas/CreateTwilioPhoneNumberDto.swift index bf2283cb..f60e0612 100644 --- a/Sources/Schemas/CreateTwilioPhoneNumberDto.swift +++ b/Sources/Schemas/CreateTwilioPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to import a Twilio phone number into Vapi with its account credentials and routing settings. public struct CreateTwilioPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/CreateVapiPhoneNumberDto.swift b/Sources/Schemas/CreateVapiPhoneNumberDto.swift index 84689f1e..d39fb7b0 100644 --- a/Sources/Schemas/CreateVapiPhoneNumberDto.swift +++ b/Sources/Schemas/CreateVapiPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to provision a Vapi-managed phone number or connect a SIP URI, with optional routing and authentication settings. public struct CreateVapiPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/CreateVoicemailToolDto.swift b/Sources/Schemas/CreateVoicemailToolDto.swift index 6ff7e256..2ed83b3e 100644 --- a/Sources/Schemas/CreateVoicemailToolDto.swift +++ b/Sources/Schemas/CreateVoicemailToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Configuration used to create a voicemail-detection tool with optional beep detection for supported calls. public struct CreateVoicemailToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [CreateVoicemailToolDtoMessagesItem]? /// This is the flag that enables beep detection for voicemail detection and applies only for twilio based calls. /// diff --git a/Sources/Schemas/CreateVonageCredentialDto.swift b/Sources/Schemas/CreateVonageCredentialDto.swift index 5e131b26..b1cd5b1c 100644 --- a/Sources/Schemas/CreateVonageCredentialDto.swift +++ b/Sources/Schemas/CreateVonageCredentialDto.swift @@ -1,8 +1,10 @@ import Foundation +/// Credentials for authenticating telephony requests with Vonage. public struct CreateVonageCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiSecret: String + /// Vonage API key associated with the credential. public let apiKey: String /// This is the name of credential. This is just for your reference. public let name: String? diff --git a/Sources/Schemas/CreateVonagePhoneNumberDto.swift b/Sources/Schemas/CreateVonagePhoneNumberDto.swift index 72279d83..fbfff17f 100644 --- a/Sources/Schemas/CreateVonagePhoneNumberDto.swift +++ b/Sources/Schemas/CreateVonagePhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration used to import a Vonage phone number into Vapi with a stored credential and routing settings. public struct CreateVonagePhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/CreateWebCallDto.swift b/Sources/Schemas/CreateWebCallDto.swift index 98052bfd..6fa7fab8 100644 --- a/Sources/Schemas/CreateWebCallDto.swift +++ b/Sources/Schemas/CreateWebCallDto.swift @@ -1,6 +1,9 @@ import Foundation public struct CreateWebCallDto: Codable, Hashable, Sendable { + /// This is the assistant version to use for this call. Supported only with + /// direct `assistantId`. Omit to follow the latest version. + public let assistantVersion: Nullable? public let roomDeleteOnUserLeaveEnabled: Bool? /// This is the assistant ID that will be used for the call. To use a transient assistant, use `assistant` instead. /// @@ -55,6 +58,7 @@ public struct CreateWebCallDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + assistantVersion: Nullable? = nil, roomDeleteOnUserLeaveEnabled: Bool? = nil, assistantId: String? = nil, assistant: CreateAssistantDto? = nil, @@ -67,6 +71,7 @@ public struct CreateWebCallDto: Codable, Hashable, Sendable { workflowOverrides: WorkflowOverrides? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.assistantVersion = assistantVersion self.roomDeleteOnUserLeaveEnabled = roomDeleteOnUserLeaveEnabled self.assistantId = assistantId self.assistant = assistant @@ -82,6 +87,7 @@ public struct CreateWebCallDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.roomDeleteOnUserLeaveEnabled = try container.decodeIfPresent(Bool.self, forKey: .roomDeleteOnUserLeaveEnabled) self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) self.assistant = try container.decodeIfPresent(CreateAssistantDto.self, forKey: .assistant) @@ -98,6 +104,7 @@ public struct CreateWebCallDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encodeIfPresent(self.roomDeleteOnUserLeaveEnabled, forKey: .roomDeleteOnUserLeaveEnabled) try container.encodeIfPresent(self.assistantId, forKey: .assistantId) try container.encodeIfPresent(self.assistant, forKey: .assistant) @@ -112,6 +119,7 @@ public struct CreateWebCallDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case assistantVersion case roomDeleteOnUserLeaveEnabled case assistantId case assistant diff --git a/Sources/Schemas/CreateWellSaidCredentialDto.swift b/Sources/Schemas/CreateWellSaidCredentialDto.swift index 88368f8a..220f6404 100644 --- a/Sources/Schemas/CreateWellSaidCredentialDto.swift +++ b/Sources/Schemas/CreateWellSaidCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating voice synthesis requests with WellSaid. public struct CreateWellSaidCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CreateWorkflowDto.swift b/Sources/Schemas/CreateWorkflowDto.swift index 60de558d..8d7c8327 100644 --- a/Sources/Schemas/CreateWorkflowDto.swift +++ b/Sources/Schemas/CreateWorkflowDto.swift @@ -1,6 +1,8 @@ import Foundation +/// Configuration for creating a graph-based workflow, including conversation and tool nodes, directed edges, global prompts, shared providers, hooks, credentials, and call behavior. public struct CreateWorkflowDto: Codable, Hashable, Sendable { + /// Nodes that make up the workflow graph. Conversation nodes interact with the customer, while tool nodes invoke configured tools. public let nodes: [CreateWorkflowDtoNodesItem] /// This is the model for the workflow. /// @@ -33,8 +35,11 @@ public struct CreateWorkflowDto: Codable, Hashable, Sendable { /// /// Default is 1800 (30 minutes), max is 43200 (12 hours), and min is 10 seconds. public let maxDurationSeconds: Double? + /// Name used to identify the workflow. public let name: String + /// Directed connections that determine transitions between nodes. public let edges: [Edge] + /// Prompt applied across the workflow's conversation nodes. public let globalPrompt: String? /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. /// diff --git a/Sources/Schemas/CreateWorkflowDtoCredentialsItem.swift b/Sources/Schemas/CreateWorkflowDtoCredentialsItem.swift index dd45caf1..c97cef59 100644 --- a/Sources/Schemas/CreateWorkflowDtoCredentialsItem.swift +++ b/Sources/Schemas/CreateWorkflowDtoCredentialsItem.swift @@ -33,6 +33,7 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum CreateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/CreateWorkflowDtoTranscriber.swift b/Sources/Schemas/CreateWorkflowDtoTranscriber.swift index 623e55f8..1f89b997 100644 --- a/Sources/Schemas/CreateWorkflowDtoTranscriber.swift +++ b/Sources/Schemas/CreateWorkflowDtoTranscriber.swift @@ -16,6 +16,8 @@ public enum CreateWorkflowDtoTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -45,6 +47,10 @@ public enum CreateWorkflowDtoTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,12 @@ public enum CreateWorkflowDtoTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/CreateWorkflowDtoVoice.swift b/Sources/Schemas/CreateWorkflowDtoVoice.swift index ee99861b..e40c76be 100644 --- a/Sources/Schemas/CreateWorkflowDtoVoice.swift +++ b/Sources/Schemas/CreateWorkflowDtoVoice.swift @@ -12,6 +12,7 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -22,6 +23,7 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,8 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -63,6 +67,8 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -100,6 +106,9 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -130,6 +139,9 @@ public enum CreateWorkflowDtoVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/CreateXAiCredentialDto.swift b/Sources/Schemas/CreateXAiCredentialDto.swift index fb4a9777..93d6b8f8 100644 --- a/Sources/Schemas/CreateXAiCredentialDto.swift +++ b/Sources/Schemas/CreateXAiCredentialDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Credentials for authenticating assistant model requests with xAI. public struct CreateXAiCredentialDto: Codable, Hashable, Sendable { /// This is not returned in the API. public let apiKey: String diff --git a/Sources/Schemas/CustomEndpointingModelSmartEndpointingPlan.swift b/Sources/Schemas/CustomEndpointingModelSmartEndpointingPlan.swift index 5174cfe1..d9b56a71 100644 --- a/Sources/Schemas/CustomEndpointingModelSmartEndpointingPlan.swift +++ b/Sources/Schemas/CustomEndpointingModelSmartEndpointingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for using a custom endpointing model, including its provider identifier and server connection. public struct CustomEndpointingModelSmartEndpointingPlan: Codable, Hashable, Sendable { /// This is the provider for the smart endpointing plan. Use `custom-endpointing-model` for custom endpointing providers that are not natively supported. public let provider: CustomEndpointingModelSmartEndpointingPlanProvider diff --git a/Sources/Schemas/CustomLlmModel.swift b/Sources/Schemas/CustomLlmModel.swift index 5db5a334..2349a3ab 100644 --- a/Sources/Schemas/CustomLlmModel.swift +++ b/Sources/Schemas/CustomLlmModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses through a custom language model endpoint, including server URL, headers, metadata, prompts, tools, and generation settings. public struct CustomLlmModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,6 +12,11 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This determines whether metadata is sent in requests to the custom provider. @@ -34,7 +40,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { public let timeoutSeconds: Double? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -57,6 +63,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [CustomLlmModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, metadataSendMode: CustomLlmModelMetadataSendMode? = nil, headers: [String: String]? = nil, @@ -73,6 +80,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.metadataSendMode = metadataSendMode self.headers = headers @@ -92,6 +100,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([CustomLlmModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.metadataSendMode = try container.decodeIfPresent(CustomLlmModelMetadataSendMode.self, forKey: .metadataSendMode) self.headers = try container.decodeIfPresent([String: String].self, forKey: .headers) @@ -112,6 +121,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encodeIfPresent(self.metadataSendMode, forKey: .metadataSendMode) try container.encodeIfPresent(self.headers, forKey: .headers) @@ -130,6 +140,7 @@ public struct CustomLlmModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case metadataSendMode case headers diff --git a/Sources/Schemas/CustomMessage.swift b/Sources/Schemas/CustomMessage.swift index ea344e32..037fc7ab 100644 --- a/Sources/Schemas/CustomMessage.swift +++ b/Sources/Schemas/CustomMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// A message spoken by the assistant with optional language-specific content variants. public struct CustomMessage: Codable, Hashable, Sendable { /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. /// diff --git a/Sources/Schemas/CustomTranscriber.swift b/Sources/Schemas/CustomTranscriber.swift index 02a31ff8..f81abfdd 100644 --- a/Sources/Schemas/CustomTranscriber.swift +++ b/Sources/Schemas/CustomTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for sending conversation audio to a custom WebSocket transcription server. public struct CustomTranscriber: Codable, Hashable, Sendable { /// This is where the transcription request will be sent. /// diff --git a/Sources/Schemas/CustomVoice.swift b/Sources/Schemas/CustomVoice.swift index ed247af4..7241583d 100644 --- a/Sources/Schemas/CustomVoice.swift +++ b/Sources/Schemas/CustomVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech through a custom server, including voice selection, server connection, chunking, caching, and fallback settings. public struct CustomVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/CustomerCustomEndpointingRule.swift b/Sources/Schemas/CustomerCustomEndpointingRule.swift index 94e46241..21c1e82c 100644 --- a/Sources/Schemas/CustomerCustomEndpointingRule.swift +++ b/Sources/Schemas/CustomerCustomEndpointingRule.swift @@ -1,5 +1,6 @@ import Foundation +/// A custom endpointing rule that matches the customer's current speech and applies a configured timeout. public struct CustomerCustomEndpointingRule: Codable, Hashable, Sendable { /// This is the regex pattern to match. /// diff --git a/Sources/Schemas/CustomerSpeechTimeoutOptions.swift b/Sources/Schemas/CustomerSpeechTimeoutOptions.swift index cad5d0cd..e7d06db7 100644 --- a/Sources/Schemas/CustomerSpeechTimeoutOptions.swift +++ b/Sources/Schemas/CustomerSpeechTimeoutOptions.swift @@ -1,54 +1,55 @@ import Foundation +/// Controls how long a hook waits for customer speech, how often it can trigger, and when its trigger counter resets. public struct CustomerSpeechTimeoutOptions: Codable, Hashable, Sendable { + /// Controls whether the hook's trigger counter resets after the customer speaks. Defaults to `never`. + public let triggerResetMode: CustomerSpeechTimeoutOptionsTriggerResetMode? /// This is the timeout in seconds before action is triggered. /// The clock starts when the assistant finishes speaking and remains active until the user speaks. /// /// @default 7.5 + /// @minimum 2 + /// @maximum 1000 public let timeoutSeconds: Double /// This is the maximum number of times the hook will trigger in a call. /// /// @default 3 public let triggerMaxCount: Double? - /// This is whether the counter for hook trigger resets the user speaks. - /// - /// @default never - public let triggerResetMode: [String: JSONValue]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + triggerResetMode: CustomerSpeechTimeoutOptionsTriggerResetMode? = nil, timeoutSeconds: Double, triggerMaxCount: Double? = nil, - triggerResetMode: [String: JSONValue]? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.triggerResetMode = triggerResetMode self.timeoutSeconds = timeoutSeconds self.triggerMaxCount = triggerMaxCount - self.triggerResetMode = triggerResetMode self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.triggerResetMode = try container.decodeIfPresent(CustomerSpeechTimeoutOptionsTriggerResetMode.self, forKey: .triggerResetMode) self.timeoutSeconds = try container.decode(Double.self, forKey: .timeoutSeconds) self.triggerMaxCount = try container.decodeIfPresent(Double.self, forKey: .triggerMaxCount) - self.triggerResetMode = try container.decodeIfPresent([String: JSONValue].self, forKey: .triggerResetMode) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.triggerResetMode, forKey: .triggerResetMode) try container.encode(self.timeoutSeconds, forKey: .timeoutSeconds) try container.encodeIfPresent(self.triggerMaxCount, forKey: .triggerMaxCount) - try container.encodeIfPresent(self.triggerResetMode, forKey: .triggerResetMode) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case triggerResetMode case timeoutSeconds case triggerMaxCount - case triggerResetMode } } \ No newline at end of file diff --git a/Sources/Schemas/CustomerSpeechTimeoutOptionsTriggerResetMode.swift b/Sources/Schemas/CustomerSpeechTimeoutOptionsTriggerResetMode.swift new file mode 100644 index 00000000..6e01aa76 --- /dev/null +++ b/Sources/Schemas/CustomerSpeechTimeoutOptionsTriggerResetMode.swift @@ -0,0 +1,7 @@ +import Foundation + +/// Controls whether the hook's trigger counter resets after the customer speaks. Defaults to `never`. +public enum CustomerSpeechTimeoutOptionsTriggerResetMode: String, Codable, Hashable, CaseIterable, Sendable { + case onUserSpeech + case never +} \ No newline at end of file diff --git a/Sources/Schemas/DeepInfraModel.swift b/Sources/Schemas/DeepInfraModel.swift index 631d35c8..35be29aa 100644 --- a/Sources/Schemas/DeepInfraModel.swift +++ b/Sources/Schemas/DeepInfraModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with DeepInfra, including model, prompts, tools, knowledge-base access, and generation settings. public struct DeepInfraModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [DeepInfraModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: String, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([DeepInfraModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct DeepInfraModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/DeepSeekModel.swift b/Sources/Schemas/DeepSeekModel.swift index fe35c2c2..23e0b53f 100644 --- a/Sources/Schemas/DeepSeekModel.swift +++ b/Sources/Schemas/DeepSeekModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with DeepSeek, including model, prompts, tools, knowledge-base access, and generation settings. public struct DeepSeekModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: DeepSeekModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [DeepSeekModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: DeepSeekModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([DeepSeekModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(DeepSeekModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct DeepSeekModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/DeepgramTranscriber.swift b/Sources/Schemas/DeepgramTranscriber.swift index 4d497abb..ba033246 100644 --- a/Sources/Schemas/DeepgramTranscriber.swift +++ b/Sources/Schemas/DeepgramTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Deepgram, including model, language, formatting, endpointing, vocabulary, and fallback settings. public struct DeepgramTranscriber: Codable, Hashable, Sendable { /// This is the Deepgram model that will be used. A list of models can be found here: https://developers.deepgram.com/docs/models-languages-overview public let model: DeepgramTranscriberModel? @@ -21,12 +22,23 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { /// /// @default false public let profanityFilter: Bool? + /// Enables redaction of sensitive information from transcripts. + /// + /// Options include: + /// - "pci": Redacts credit card numbers, expiration dates, and CVV. + /// - "pii": Redacts personally identifiable information (names, locations, identifying numbers, etc.). + /// - "phi": Redacts protected health information (medical conditions, drugs, injuries, etc.). + /// - "numbers": Redacts numerical and identifying entities (dates, account numbers, SSNs, etc.). + /// + /// Multiple values can be provided to redact different categories simultaneously. + /// Redacted content is replaced with entity labels like [CREDIT_CARD_1], [SSN_1], etc. + /// + /// See https://developers.deepgram.com/docs/redaction for details. + public let redaction: [DeepgramTranscriberRedactionItem]? /// Transcripts below this confidence threshold will be discarded. /// /// @default 0.4 public let confidenceThreshold: Double? - /// Eager end-of-turn confidence required to fire a eager end-of-turn event. Setting a value here will enable EagerEndOfTurn and SpeechResumed events. It is disabled by default. Only used with Flux models. - public let eagerEotThreshold: Double? /// End-of-turn confidence required to finish a turn. Only used with Flux models. /// /// @default 0.7 @@ -35,6 +47,10 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { /// /// @default 5000 public let eotTimeoutMs: Double? + /// Language hints to bias Flux Multilingual (`flux-general-multi`) toward specific languages. + /// Provide BCP-47 language codes (e.g. "en", "es", "fr"). Multiple hints can be given for + /// multilingual or code-switching scenarios. Omit for auto-detection. Only used with `flux-general-multi`. + public let languages: [String]? /// These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. public let keywords: [String]? /// Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important keyterms or phrases up to 90%. @@ -60,10 +76,11 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { mipOptOut: Bool? = nil, numerals: Bool? = nil, profanityFilter: Bool? = nil, + redaction: [DeepgramTranscriberRedactionItem]? = nil, confidenceThreshold: Double? = nil, - eagerEotThreshold: Double? = nil, eotThreshold: Double? = nil, eotTimeoutMs: Double? = nil, + languages: [String]? = nil, keywords: [String]? = nil, keyterm: [String]? = nil, endpointing: Double? = nil, @@ -76,10 +93,11 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { self.mipOptOut = mipOptOut self.numerals = numerals self.profanityFilter = profanityFilter + self.redaction = redaction self.confidenceThreshold = confidenceThreshold - self.eagerEotThreshold = eagerEotThreshold self.eotThreshold = eotThreshold self.eotTimeoutMs = eotTimeoutMs + self.languages = languages self.keywords = keywords self.keyterm = keyterm self.endpointing = endpointing @@ -95,10 +113,11 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { self.mipOptOut = try container.decodeIfPresent(Bool.self, forKey: .mipOptOut) self.numerals = try container.decodeIfPresent(Bool.self, forKey: .numerals) self.profanityFilter = try container.decodeIfPresent(Bool.self, forKey: .profanityFilter) + self.redaction = try container.decodeIfPresent([DeepgramTranscriberRedactionItem].self, forKey: .redaction) self.confidenceThreshold = try container.decodeIfPresent(Double.self, forKey: .confidenceThreshold) - self.eagerEotThreshold = try container.decodeIfPresent(Double.self, forKey: .eagerEotThreshold) self.eotThreshold = try container.decodeIfPresent(Double.self, forKey: .eotThreshold) self.eotTimeoutMs = try container.decodeIfPresent(Double.self, forKey: .eotTimeoutMs) + self.languages = try container.decodeIfPresent([String].self, forKey: .languages) self.keywords = try container.decodeIfPresent([String].self, forKey: .keywords) self.keyterm = try container.decodeIfPresent([String].self, forKey: .keyterm) self.endpointing = try container.decodeIfPresent(Double.self, forKey: .endpointing) @@ -115,10 +134,11 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { try container.encodeIfPresent(self.mipOptOut, forKey: .mipOptOut) try container.encodeIfPresent(self.numerals, forKey: .numerals) try container.encodeIfPresent(self.profanityFilter, forKey: .profanityFilter) + try container.encodeIfPresent(self.redaction, forKey: .redaction) try container.encodeIfPresent(self.confidenceThreshold, forKey: .confidenceThreshold) - try container.encodeIfPresent(self.eagerEotThreshold, forKey: .eagerEotThreshold) try container.encodeIfPresent(self.eotThreshold, forKey: .eotThreshold) try container.encodeIfPresent(self.eotTimeoutMs, forKey: .eotTimeoutMs) + try container.encodeIfPresent(self.languages, forKey: .languages) try container.encodeIfPresent(self.keywords, forKey: .keywords) try container.encodeIfPresent(self.keyterm, forKey: .keyterm) try container.encodeIfPresent(self.endpointing, forKey: .endpointing) @@ -133,10 +153,11 @@ public struct DeepgramTranscriber: Codable, Hashable, Sendable { case mipOptOut case numerals case profanityFilter + case redaction case confidenceThreshold - case eagerEotThreshold case eotThreshold case eotTimeoutMs + case languages case keywords case keyterm case endpointing diff --git a/Sources/Schemas/DeepgramTranscriberRedactionItem.swift b/Sources/Schemas/DeepgramTranscriberRedactionItem.swift new file mode 100644 index 00000000..fe787a44 --- /dev/null +++ b/Sources/Schemas/DeepgramTranscriberRedactionItem.swift @@ -0,0 +1,8 @@ +import Foundation + +public enum DeepgramTranscriberRedactionItem: String, Codable, Hashable, CaseIterable, Sendable { + case pci + case pii + case phi + case numbers +} \ No newline at end of file diff --git a/Sources/Schemas/DeepgramVoice.swift b/Sources/Schemas/DeepgramVoice.swift index 5575a089..1dc8c41d 100644 --- a/Sources/Schemas/DeepgramVoice.swift +++ b/Sources/Schemas/DeepgramVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Deepgram, including voice and model selection, model-improvement preferences, chunking, caching, and fallback settings. public struct DeepgramVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/DeepgramVoiceId.swift b/Sources/Schemas/DeepgramVoiceId.swift index ff28b116..284f8868 100644 --- a/Sources/Schemas/DeepgramVoiceId.swift +++ b/Sources/Schemas/DeepgramVoiceId.swift @@ -57,4 +57,11 @@ public enum DeepgramVoiceId: String, Codable, Hashable, CaseIterable, Sendable { case aquila case selena case javier + case viktoria + case kara + case fabian + case julius + case lara + case elara + case aurelia } \ No newline at end of file diff --git a/Sources/Schemas/DeveloperMessage.swift b/Sources/Schemas/DeveloperMessage.swift index 9bccd0b5..5ad69d94 100644 --- a/Sources/Schemas/DeveloperMessage.swift +++ b/Sources/Schemas/DeveloperMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// A developer-authored instruction message supplied to the language model. public struct DeveloperMessage: Codable, Hashable, Sendable { /// This is the role of the message author public let role: DeveloperMessageRole diff --git a/Sources/Schemas/DialPlanEntry.swift b/Sources/Schemas/DialPlanEntry.swift index f4bc5d96..ed20b6d3 100644 --- a/Sources/Schemas/DialPlanEntry.swift +++ b/Sources/Schemas/DialPlanEntry.swift @@ -1,5 +1,6 @@ import Foundation +/// Associates a phone number with the customers to dial through that number in a batch call plan. public struct DialPlanEntry: Codable, Hashable, Sendable { /// The phone number ID to use for calling the customers in this entry. public let phoneNumberId: String diff --git a/Sources/Schemas/DtmfTool.swift b/Sources/Schemas/DtmfTool.swift index 5635e6ad..0b2013d9 100644 --- a/Sources/Schemas/DtmfTool.swift +++ b/Sources/Schemas/DtmfTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that lets an assistant send DTMF keypad tones during a call. public struct DtmfTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [DtmfToolMessagesItem]? /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833 (RTP events). When enabled, DTMF digits will be sent using the SIP INFO method, which can be more reliable in some network configurations. Only relevant when using the `vapi.sip` transport. public let sipInfoDtmfEnabled: Bool? @@ -98,6 +98,7 @@ public struct DtmfTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [DtmfToolMessagesItem]? = nil, sipInfoDtmfEnabled: Bool? = nil, id: String, @@ -107,6 +108,7 @@ public struct DtmfTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.sipInfoDtmfEnabled = sipInfoDtmfEnabled self.id = id @@ -119,6 +121,7 @@ public struct DtmfTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([DtmfToolMessagesItem].self, forKey: .messages) self.sipInfoDtmfEnabled = try container.decodeIfPresent(Bool.self, forKey: .sipInfoDtmfEnabled) self.id = try container.decode(String.self, forKey: .id) @@ -132,6 +135,7 @@ public struct DtmfTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.sipInfoDtmfEnabled, forKey: .sipInfoDtmfEnabled) try container.encode(self.id, forKey: .id) @@ -143,6 +147,7 @@ public struct DtmfTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case sipInfoDtmfEnabled case id diff --git a/Sources/Schemas/Edge.swift b/Sources/Schemas/Edge.swift index 217c28be..7cac2a49 100644 --- a/Sources/Schemas/Edge.swift +++ b/Sources/Schemas/Edge.swift @@ -1,8 +1,12 @@ import Foundation +/// A directed connection between two workflow nodes, with an optional AI-evaluated transition condition. public struct Edge: Codable, Hashable, Sendable { + /// Condition that must evaluate to true to follow this edge. public let condition: AiEdgeCondition? + /// Name of the source workflow node. public let from: String + /// Name of the destination workflow node. public let to: String /// This is for metadata you want to store on the edge. public let metadata: [String: JSONValue]? diff --git a/Sources/Schemas/ElevenLabsCredential.swift b/Sources/Schemas/ElevenLabsCredential.swift index 57c6f8f2..a37155c0 100644 --- a/Sources/Schemas/ElevenLabsCredential.swift +++ b/Sources/Schemas/ElevenLabsCredential.swift @@ -4,6 +4,8 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { public let provider: Value /// This is not returned in the API. public let apiKey: String + /// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. + public let apiUrl: Nullable? /// This is the unique identifier for the credential. public let id: String /// This is the unique identifier for the org that this credential belongs to. @@ -20,6 +22,7 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { public init( provider: Value, apiKey: String, + apiUrl: Nullable? = nil, id: String, orgId: String, createdAt: Date, @@ -29,6 +32,7 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { ) { self.provider = provider self.apiKey = apiKey + self.apiUrl = apiUrl self.id = id self.orgId = orgId self.createdAt = createdAt @@ -41,6 +45,7 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.provider = try container.decode(Value.self, forKey: .provider) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeNullableIfPresent(ElevenLabsCredentialApiUrl.self, forKey: .apiUrl) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -54,6 +59,7 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.provider, forKey: .provider) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeNullableIfPresent(self.apiUrl, forKey: .apiUrl) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -69,6 +75,7 @@ public struct ElevenLabsCredential: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case provider case apiKey + case apiUrl case id case orgId case createdAt diff --git a/Sources/Schemas/ElevenLabsCredentialApiUrl.swift b/Sources/Schemas/ElevenLabsCredentialApiUrl.swift new file mode 100644 index 00000000..f92208ff --- /dev/null +++ b/Sources/Schemas/ElevenLabsCredentialApiUrl.swift @@ -0,0 +1,7 @@ +import Foundation + +/// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. +public enum ElevenLabsCredentialApiUrl: String, Codable, Hashable, CaseIterable, Sendable { + case httpsApiElevenlabsIo = "https://api.elevenlabs.io" + case httpsApiEuResidencyElevenlabsIo = "https://api.eu.residency.elevenlabs.io" +} \ No newline at end of file diff --git a/Sources/Schemas/ElevenLabsPronunciationDictionaryLocator.swift b/Sources/Schemas/ElevenLabsPronunciationDictionaryLocator.swift index d30c911b..1a74435d 100644 --- a/Sources/Schemas/ElevenLabsPronunciationDictionaryLocator.swift +++ b/Sources/Schemas/ElevenLabsPronunciationDictionaryLocator.swift @@ -1,5 +1,6 @@ import Foundation +/// Identifies a specific version of an ElevenLabs pronunciation dictionary. public struct ElevenLabsPronunciationDictionaryLocator: Codable, Hashable, Sendable { /// This is the ID of the pronunciation dictionary to use. public let pronunciationDictionaryId: String diff --git a/Sources/Schemas/ElevenLabsTranscriber.swift b/Sources/Schemas/ElevenLabsTranscriber.swift index 0d89c9b8..28b9a109 100644 --- a/Sources/Schemas/ElevenLabsTranscriber.swift +++ b/Sources/Schemas/ElevenLabsTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with ElevenLabs, including model, language, speech thresholds, and fallback settings. public struct ElevenLabsTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: ElevenLabsTranscriberModel? diff --git a/Sources/Schemas/ElevenLabsVoice.swift b/Sources/Schemas/ElevenLabsVoice.swift index 580cbe05..cef16e44 100644 --- a/Sources/Schemas/ElevenLabsVoice.swift +++ b/Sources/Schemas/ElevenLabsVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with ElevenLabs, including voice and model selection, language, voice tuning, streaming, Speech Synthesis Markup Language parsing, pronunciation dictionaries, chunking, caching, and fallback settings. public struct ElevenLabsVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/EndCallTool.swift b/Sources/Schemas/EndCallTool.swift index 7fd933cc..401823e6 100644 --- a/Sources/Schemas/EndCallTool.swift +++ b/Sources/Schemas/EndCallTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that lets an assistant end the active call. public struct EndCallTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [EndCallToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct EndCallTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [EndCallToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct EndCallTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct EndCallTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([EndCallToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct EndCallTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct EndCallTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/EndedReasonCondition.swift b/Sources/Schemas/EndedReasonCondition.swift new file mode 100644 index 00000000..5f71cd36 --- /dev/null +++ b/Sources/Schemas/EndedReasonCondition.swift @@ -0,0 +1,46 @@ +import Foundation + +public struct EndedReasonCondition: Codable, Hashable, Sendable { + /// This is the membership operator applied against `values`. + /// + /// - 'oneOf': the structured output runs only if the call's ended reason is in `values`. + /// - 'notOneOf': the structured output runs only if the call's ended reason is NOT in `values`. + public let `operator`: EndedReasonConditionOperator + /// These are the ended reasons compared against the call's ended reason. + /// + /// Any string is accepted so configurations never break when new ended + /// reasons are introduced. Must contain at least one value. + public let values: [String] + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + operator: EndedReasonConditionOperator, + values: [String], + additionalProperties: [String: JSONValue] = .init() + ) { + self.operator = `operator` + self.values = values + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.operator = try container.decode(EndedReasonConditionOperator.self, forKey: .operator) + self.values = try container.decode([String].self, forKey: .values) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.operator, forKey: .operator) + try container.encode(self.values, forKey: .values) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case `operator` + case values + } +} \ No newline at end of file diff --git a/Sources/Schemas/EndedReasonConditionOperator.swift b/Sources/Schemas/EndedReasonConditionOperator.swift new file mode 100644 index 00000000..8273339d --- /dev/null +++ b/Sources/Schemas/EndedReasonConditionOperator.swift @@ -0,0 +1,10 @@ +import Foundation + +/// This is the membership operator applied against `values`. +/// +/// - 'oneOf': the structured output runs only if the call's ended reason is in `values`. +/// - 'notOneOf': the structured output runs only if the call's ended reason is NOT in `values`. +public enum EndedReasonConditionOperator: String, Codable, Hashable, CaseIterable, Sendable { + case oneOf + case notOneOf +} \ No newline at end of file diff --git a/Sources/Schemas/Eval.swift b/Sources/Schemas/Eval.swift index c4b63569..9aa1fdb2 100644 --- a/Sources/Schemas/Eval.swift +++ b/Sources/Schemas/Eval.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved eval definition containing its mock conversation, checkpoints, descriptive metadata, type, and lifecycle information. public struct Eval: Codable, Hashable, Sendable { /// This is the mock conversation that will be used to evaluate the flow of the conversation. /// @@ -7,9 +8,13 @@ public struct Eval: Codable, Hashable, Sendable { /// /// Evaluation Messages are used as checkpoints in the flow where the model's response to previous conversation needs to be evaluated to check the content and tool calls public let messages: [EvalMessagesItem] + /// The unique identifier for the eval. public let id: String + /// The unique identifier for the organization that owns the eval. public let orgId: String + /// The ISO 8601 timestamp when the eval was created. public let createdAt: Date + /// The ISO 8601 timestamp when the eval was last updated. public let updatedAt: Date /// This is the name of the eval. /// It helps identify what the eval is checking for. diff --git a/Sources/Schemas/EvalAnthropicModel.swift b/Sources/Schemas/EvalAnthropicModel.swift index b540a21b..50ce23bf 100644 --- a/Sources/Schemas/EvalAnthropicModel.swift +++ b/Sources/Schemas/EvalAnthropicModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Anthropic model configuration for an LLM judge, including its messages, generation settings, and optional extended thinking. public struct EvalAnthropicModel: Codable, Hashable, Sendable { /// This is the specific model that will be used. public let model: EvalAnthropicModelModel diff --git a/Sources/Schemas/EvalAnthropicModelModel.swift b/Sources/Schemas/EvalAnthropicModelModel.swift index d43a1f87..202d7940 100644 --- a/Sources/Schemas/EvalAnthropicModelModel.swift +++ b/Sources/Schemas/EvalAnthropicModelModel.swift @@ -15,5 +15,6 @@ public enum EvalAnthropicModelModel: String, Codable, Hashable, CaseIterable, Se case claudeSonnet420250514 = "claude-sonnet-4-20250514" case claudeSonnet4520250929 = "claude-sonnet-4-5-20250929" case claudeSonnet46 = "claude-sonnet-4-6" + case claudeSonnet5 = "claude-sonnet-5" case claudeHaiku4520251001 = "claude-haiku-4-5-20251001" } \ No newline at end of file diff --git a/Sources/Schemas/EvalControllerGetPaginatedRequestSortBy.swift b/Sources/Schemas/EvalControllerGetPaginatedRequestSortBy.swift new file mode 100644 index 00000000..a8219479 --- /dev/null +++ b/Sources/Schemas/EvalControllerGetPaginatedRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum EvalControllerGetPaginatedRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/EvalControllerGetRunsPaginatedRequestSortBy.swift b/Sources/Schemas/EvalControllerGetRunsPaginatedRequestSortBy.swift new file mode 100644 index 00000000..1fd3aaa9 --- /dev/null +++ b/Sources/Schemas/EvalControllerGetRunsPaginatedRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum EvalControllerGetRunsPaginatedRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/EvalCustomModel.swift b/Sources/Schemas/EvalCustomModel.swift index 474af7d8..04f6164e 100644 --- a/Sources/Schemas/EvalCustomModel.swift +++ b/Sources/Schemas/EvalCustomModel.swift @@ -1,5 +1,6 @@ import Foundation +/// OpenAI-compatible custom model configuration for an LLM judge, including its endpoint, headers, messages, and generation settings. public struct EvalCustomModel: Codable, Hashable, Sendable { /// These is the URL we'll use for the OpenAI client's `baseURL`. Ex. https://openrouter.ai/api/v1 public let url: String diff --git a/Sources/Schemas/EvalGoogleModel.swift b/Sources/Schemas/EvalGoogleModel.swift index d5cbf5b2..1d05064d 100644 --- a/Sources/Schemas/EvalGoogleModel.swift +++ b/Sources/Schemas/EvalGoogleModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Google model configuration for an LLM judge, including its messages and generation settings. public struct EvalGoogleModel: Codable, Hashable, Sendable { /// This is the name of the model. Ex. gpt-4o public let model: EvalGoogleModelModel diff --git a/Sources/Schemas/EvalGoogleModelModel.swift b/Sources/Schemas/EvalGoogleModelModel.swift index 8b9070ea..baea1460 100644 --- a/Sources/Schemas/EvalGoogleModelModel.swift +++ b/Sources/Schemas/EvalGoogleModelModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the name of the model. Ex. gpt-4o public enum EvalGoogleModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/EvalGroqModelModel.swift b/Sources/Schemas/EvalGroqModelModel.swift index 4e2e1eec..9c9b4573 100644 --- a/Sources/Schemas/EvalGroqModelModel.swift +++ b/Sources/Schemas/EvalGroqModelModel.swift @@ -12,7 +12,6 @@ public enum EvalGroqModelModel: String, Codable, Hashable, CaseIterable, Sendabl case llama370B8192 = "llama3-70b-8192" case gemma29BIt = "gemma2-9b-it" case moonshotaiKimiK2Instruct0905 = "moonshotai/kimi-k2-instruct-0905" - case metaLlamaLlama4Maverick17B128EInstruct = "meta-llama/llama-4-maverick-17b-128e-instruct" case metaLlamaLlama4Scout17B16EInstruct = "meta-llama/llama-4-scout-17b-16e-instruct" case mistralSaba24B = "mistral-saba-24b" case compoundBeta = "compound-beta" diff --git a/Sources/Schemas/EvalOpenAiModel.swift b/Sources/Schemas/EvalOpenAiModel.swift index 9c6a31b4..cfbc39a6 100644 --- a/Sources/Schemas/EvalOpenAiModel.swift +++ b/Sources/Schemas/EvalOpenAiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// OpenAI model configuration for an LLM judge, including its messages and generation settings. public struct EvalOpenAiModel: Codable, Hashable, Sendable { /// This is the OpenAI model that will be used. /// diff --git a/Sources/Schemas/EvalOpenAiModelModel.swift b/Sources/Schemas/EvalOpenAiModelModel.swift index 973d33b2..0f4fda97 100644 --- a/Sources/Schemas/EvalOpenAiModelModel.swift +++ b/Sources/Schemas/EvalOpenAiModelModel.swift @@ -5,6 +5,11 @@ import Foundation /// When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. /// This is helpful when you are required to comply with Data Residency rules. Learn more about Azure regions here https://azure.microsoft.com/en-us/explore/global-infrastructure/data-residency/. public enum EvalOpenAiModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gpt56Sol = "gpt-5.6-sol" + case gpt56Terra = "gpt-5.6-terra" + case gpt56Luna = "gpt-5.6-luna" + case gpt55 = "gpt-5.5" + case chatLatest = "chat-latest" case gpt54 = "gpt-5.4" case gpt54Mini = "gpt-5.4-mini" case gpt54Nano = "gpt-5.4-nano" @@ -118,4 +123,7 @@ public enum EvalOpenAiModelModel: String, Codable, Hashable, CaseIterable, Senda case gpt35Turbo0125Southcentralus = "gpt-3.5-turbo-0125:southcentralus" case gpt35Turbo1106Canadaeast = "gpt-3.5-turbo-1106:canadaeast" case gpt35Turbo1106Westus = "gpt-3.5-turbo-1106:westus" + case gpt41Australiaeast = "gpt-4.1:australiaeast" + case gpt4OAustraliaeast = "gpt-4o:australiaeast" + case gpt54MiniAustraliaeast = "gpt-5.4-mini:australiaeast" } \ No newline at end of file diff --git a/Sources/Schemas/EvalPaginatedResponse.swift b/Sources/Schemas/EvalPaginatedResponse.swift index 53e53004..bae4f965 100644 --- a/Sources/Schemas/EvalPaginatedResponse.swift +++ b/Sources/Schemas/EvalPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of saved eval definitions and metadata describing the result set. public struct EvalPaginatedResponse: Codable, Hashable, Sendable { + /// The eval definitions returned for the current page. public let results: [Eval] + /// Pagination metadata for the eval result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/EvalRun.swift b/Sources/Schemas/EvalRun.swift index 836e1e00..f69697f1 100644 --- a/Sources/Schemas/EvalRun.swift +++ b/Sources/Schemas/EvalRun.swift @@ -1,5 +1,6 @@ import Foundation +/// A record of an eval execution, including its target, status, results, costs, completion details, and lifecycle timestamps. public struct EvalRun: Codable, Hashable, Sendable { /// This is the status of the eval run. When an eval run is created, the status is 'running'. /// When the eval run is completed, the status is 'ended'. @@ -15,10 +16,15 @@ public struct EvalRun: Codable, Hashable, Sendable { public let eval: CreateEvalDto? /// This is the target that will be run against the eval public let target: EvalRunTarget + /// The unique identifier for the eval run. public let id: String + /// The unique identifier for the organization that owns the run. public let orgId: String + /// The ISO 8601 timestamp when the eval run was created. public let createdAt: Date + /// The ISO 8601 timestamp when the eval run started. public let startedAt: Date + /// The ISO 8601 timestamp when the eval run ended. public let endedAt: Date /// This is the ended message when the eval run ended for any reason apart from mockConversation.done public let endedMessage: String? diff --git a/Sources/Schemas/EvalRunPaginatedResponse.swift b/Sources/Schemas/EvalRunPaginatedResponse.swift index 1b4a4a4a..83118448 100644 --- a/Sources/Schemas/EvalRunPaginatedResponse.swift +++ b/Sources/Schemas/EvalRunPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of eval runs and metadata describing the result set. public struct EvalRunPaginatedResponse: Codable, Hashable, Sendable { + /// The eval runs returned for the current page. public let results: [EvalRun] + /// Pagination metadata for the eval-run result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/EvalRunResult.swift b/Sources/Schemas/EvalRunResult.swift index 8d1a7566..673c0aab 100644 --- a/Sources/Schemas/EvalRunResult.swift +++ b/Sources/Schemas/EvalRunResult.swift @@ -1,5 +1,6 @@ import Foundation +/// The pass or fail result of an evaluation run, including its conversation messages and timing. public struct EvalRunResult: Codable, Hashable, Sendable { /// This is the status of the eval run result. /// The status is only 'pass' or 'fail' for an eval run result. diff --git a/Sources/Schemas/EvalRunTargetAssistant.swift b/Sources/Schemas/EvalRunTargetAssistant.swift index 48249b01..0645e367 100644 --- a/Sources/Schemas/EvalRunTargetAssistant.swift +++ b/Sources/Schemas/EvalRunTargetAssistant.swift @@ -1,5 +1,6 @@ import Foundation +/// An assistant evaluation target provided as a saved assistant ID or a transient assistant, with optional assistant overrides. public struct EvalRunTargetAssistant: Codable, Hashable, Sendable { /// This is the transient assistant that will be run against the eval public let assistant: CreateAssistantDto? diff --git a/Sources/Schemas/EvalRunTargetSquad.swift b/Sources/Schemas/EvalRunTargetSquad.swift index 75850835..770d5644 100644 --- a/Sources/Schemas/EvalRunTargetSquad.swift +++ b/Sources/Schemas/EvalRunTargetSquad.swift @@ -1,5 +1,6 @@ import Foundation +/// A squad evaluation target provided as a saved squad ID or a transient squad, with optional assistant overrides. public struct EvalRunTargetSquad: Codable, Hashable, Sendable { /// This is the transient squad that will be run against the eval public let squad: CreateSquadDto? diff --git a/Sources/Schemas/EvaluationPlanItem.swift b/Sources/Schemas/EvaluationPlanItem.swift index 983d6a55..0368058a 100644 --- a/Sources/Schemas/EvaluationPlanItem.swift +++ b/Sources/Schemas/EvaluationPlanItem.swift @@ -8,6 +8,8 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { /// Mutually exclusive with structuredOutputId. /// Only primitive schema types (string, number, integer, boolean) are allowed. public let structuredOutput: CreateStructuredOutputDto? + /// Optional dot-notation path to a primitive leaf when evaluating an object structured output. + public let path: String? /// This is the comparison operator to use when evaluating the extracted value against the expected value. /// Available operators depend on the structured output's schema type: /// - boolean: '=', '!=' @@ -26,6 +28,7 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { public init( structuredOutputId: String? = nil, structuredOutput: CreateStructuredOutputDto? = nil, + path: String? = nil, comparator: EvaluationPlanItemComparator, value: EvaluationPlanItemValue, required: Bool? = nil, @@ -33,6 +36,7 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { ) { self.structuredOutputId = structuredOutputId self.structuredOutput = structuredOutput + self.path = path self.comparator = comparator self.value = value self.required = required @@ -43,6 +47,7 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.structuredOutputId = try container.decodeIfPresent(String.self, forKey: .structuredOutputId) self.structuredOutput = try container.decodeIfPresent(CreateStructuredOutputDto.self, forKey: .structuredOutput) + self.path = try container.decodeIfPresent(String.self, forKey: .path) self.comparator = try container.decode(EvaluationPlanItemComparator.self, forKey: .comparator) self.value = try container.decode(EvaluationPlanItemValue.self, forKey: .value) self.required = try container.decodeIfPresent(Bool.self, forKey: .required) @@ -54,6 +59,7 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.structuredOutputId, forKey: .structuredOutputId) try container.encodeIfPresent(self.structuredOutput, forKey: .structuredOutput) + try container.encodeIfPresent(self.path, forKey: .path) try container.encode(self.comparator, forKey: .comparator) try container.encode(self.value, forKey: .value) try container.encodeIfPresent(self.required, forKey: .required) @@ -63,6 +69,7 @@ public struct EvaluationPlanItem: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case structuredOutputId case structuredOutput + case path case comparator case value case required diff --git a/Sources/Schemas/EventsTableBooleanCondition.swift b/Sources/Schemas/EventsTableBooleanCondition.swift index 01bb195b..913377d5 100644 --- a/Sources/Schemas/EventsTableBooleanCondition.swift +++ b/Sources/Schemas/EventsTableBooleanCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters event data by comparing a boolean field with an expected value. public struct EventsTableBooleanCondition: Codable, Hashable, Sendable { /// The boolean field name from the event data public let column: String diff --git a/Sources/Schemas/EventsTableNumberCondition.swift b/Sources/Schemas/EventsTableNumberCondition.swift index 4e96d082..0fca0ffd 100644 --- a/Sources/Schemas/EventsTableNumberCondition.swift +++ b/Sources/Schemas/EventsTableNumberCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters event data by comparing a numeric field with a value. public struct EventsTableNumberCondition: Codable, Hashable, Sendable { /// The number field name from the event data public let column: String diff --git a/Sources/Schemas/EventsTableStringCondition.swift b/Sources/Schemas/EventsTableStringCondition.swift index 3e054986..762a937f 100644 --- a/Sources/Schemas/EventsTableStringCondition.swift +++ b/Sources/Schemas/EventsTableStringCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters event data by comparing or searching a string field. public struct EventsTableStringCondition: Codable, Hashable, Sendable { /// The string field name from the event data public let column: String diff --git a/Sources/Schemas/ExactReplacement.swift b/Sources/Schemas/ExactReplacement.swift index 577923ed..10cfd137 100644 --- a/Sources/Schemas/ExactReplacement.swift +++ b/Sources/Schemas/ExactReplacement.swift @@ -1,5 +1,6 @@ import Foundation +/// Replaces an exact word or phrase before text is sent to a voice provider. public struct ExactReplacement: Codable, Hashable, Sendable { /// This option let's you control whether to replace all instances of the key or only the first one. By default, it only replaces the first instance. /// Examples: diff --git a/Sources/Schemas/ExportChatDto.swift b/Sources/Schemas/ExportChatDto.swift index 4e1a903e..1d551f91 100644 --- a/Sources/Schemas/ExportChatDto.swift +++ b/Sources/Schemas/ExportChatDto.swift @@ -26,6 +26,8 @@ public struct ExportChatDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: ExportChatDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: ExportChatDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -59,6 +61,7 @@ public struct ExportChatDto: Codable, Hashable, Sendable { format: ExportChatDtoFormat? = nil, page: Double? = nil, sortOrder: ExportChatDtoSortOrder? = nil, + sortBy: ExportChatDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -81,6 +84,7 @@ public struct ExportChatDto: Codable, Hashable, Sendable { self.format = format self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -106,6 +110,7 @@ public struct ExportChatDto: Codable, Hashable, Sendable { self.format = try container.decodeIfPresent(ExportChatDtoFormat.self, forKey: .format) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(ExportChatDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(ExportChatDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -132,6 +137,7 @@ public struct ExportChatDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.format, forKey: .format) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -156,6 +162,7 @@ public struct ExportChatDto: Codable, Hashable, Sendable { case format case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/ExportChatDtoSortBy.swift b/Sources/Schemas/ExportChatDtoSortBy.swift new file mode 100644 index 00000000..766adce0 --- /dev/null +++ b/Sources/Schemas/ExportChatDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum ExportChatDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/ExportSessionDto.swift b/Sources/Schemas/ExportSessionDto.swift index dd2b0975..fc0021bb 100644 --- a/Sources/Schemas/ExportSessionDto.swift +++ b/Sources/Schemas/ExportSessionDto.swift @@ -34,6 +34,8 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: ExportSessionDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: ExportSessionDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -71,6 +73,7 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { phoneNumberIdAny: [String]? = nil, page: Double? = nil, sortOrder: ExportSessionDtoSortOrder? = nil, + sortBy: ExportSessionDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -97,6 +100,7 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { self.phoneNumberIdAny = phoneNumberIdAny self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -126,6 +130,7 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { self.phoneNumberIdAny = try container.decodeIfPresent([String].self, forKey: .phoneNumberIdAny) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(ExportSessionDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(ExportSessionDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -156,6 +161,7 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.phoneNumberIdAny, forKey: .phoneNumberIdAny) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -184,6 +190,7 @@ public struct ExportSessionDto: Codable, Hashable, Sendable { case phoneNumberIdAny case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/ExportSessionDtoSortBy.swift b/Sources/Schemas/ExportSessionDtoSortBy.swift new file mode 100644 index 00000000..e8fc1897 --- /dev/null +++ b/Sources/Schemas/ExportSessionDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum ExportSessionDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackAssemblyAiTranscriber.swift b/Sources/Schemas/FallbackAssemblyAiTranscriber.swift index 004cf82c..0de6a48d 100644 --- a/Sources/Schemas/FallbackAssemblyAiTranscriber.swift +++ b/Sources/Schemas/FallbackAssemblyAiTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with AssemblyAI, including language, streaming model, endpointing, and vocabulary. public struct FallbackAssemblyAiTranscriber: Codable, Hashable, Sendable { /// This is the language that will be set for the transcription. public let language: FallbackAssemblyAiTranscriberLanguage? diff --git a/Sources/Schemas/FallbackAzureSpeechTranscriber.swift b/Sources/Schemas/FallbackAzureSpeechTranscriber.swift index a4153599..d6f524e7 100644 --- a/Sources/Schemas/FallbackAzureSpeechTranscriber.swift +++ b/Sources/Schemas/FallbackAzureSpeechTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with Azure Speech, including language and segmentation. public struct FallbackAzureSpeechTranscriber: Codable, Hashable, Sendable { /// This is the language that will be set for the transcription. The list of languages Azure supports can be found here: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt public let language: FallbackAzureSpeechTranscriberLanguage? diff --git a/Sources/Schemas/FallbackAzureVoice.swift b/Sources/Schemas/FallbackAzureVoice.swift index 4e369391..2b31d156 100644 --- a/Sources/Schemas/FallbackAzureVoice.swift +++ b/Sources/Schemas/FallbackAzureVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Azure, including voice selection, speed, chunking, and caching. public struct FallbackAzureVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackCartesiaTranscriber.swift b/Sources/Schemas/FallbackCartesiaTranscriber.swift index b02fa63d..f8d1238d 100644 --- a/Sources/Schemas/FallbackCartesiaTranscriber.swift +++ b/Sources/Schemas/FallbackCartesiaTranscriber.swift @@ -1,7 +1,10 @@ import Foundation +/// Fallback configuration for transcribing speech with Cartesia, including model and language. public struct FallbackCartesiaTranscriber: Codable, Hashable, Sendable { + /// The Cartesia speech-to-text model used for transcription. public let model: FallbackCartesiaTranscriberModel? + /// The language code used for transcription. public let language: FallbackCartesiaTranscriberLanguage? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/FallbackCartesiaTranscriberLanguage.swift b/Sources/Schemas/FallbackCartesiaTranscriberLanguage.swift index b43fa0e0..f5e0a15f 100644 --- a/Sources/Schemas/FallbackCartesiaTranscriberLanguage.swift +++ b/Sources/Schemas/FallbackCartesiaTranscriberLanguage.swift @@ -1,5 +1,6 @@ import Foundation +/// The language code used for transcription. public enum FallbackCartesiaTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case aa case ab diff --git a/Sources/Schemas/FallbackCartesiaTranscriberModel.swift b/Sources/Schemas/FallbackCartesiaTranscriberModel.swift index 28cdcd1a..e523b558 100644 --- a/Sources/Schemas/FallbackCartesiaTranscriberModel.swift +++ b/Sources/Schemas/FallbackCartesiaTranscriberModel.swift @@ -1,5 +1,7 @@ import Foundation +/// The Cartesia speech-to-text model used for transcription. public enum FallbackCartesiaTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { case inkWhisper = "ink-whisper" + case ink2 = "ink-2" } \ No newline at end of file diff --git a/Sources/Schemas/FallbackCartesiaVoice.swift b/Sources/Schemas/FallbackCartesiaVoice.swift index 783a0459..b3783727 100644 --- a/Sources/Schemas/FallbackCartesiaVoice.swift +++ b/Sources/Schemas/FallbackCartesiaVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Cartesia, including voice and model selection, language, generation controls, pronunciation dictionaries, chunking, and caching. public struct FallbackCartesiaVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackCartesiaVoiceModel.swift b/Sources/Schemas/FallbackCartesiaVoiceModel.swift index 90a6a467..f002a877 100644 --- a/Sources/Schemas/FallbackCartesiaVoiceModel.swift +++ b/Sources/Schemas/FallbackCartesiaVoiceModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the model that will be used. This is optional and will default to the correct model for the voiceId. public enum FallbackCartesiaVoiceModel: String, Codable, Hashable, CaseIterable, Sendable { + case sonic35 = "sonic-3.5" + case sonic3520260504 = "sonic-3.5-2026-05-04" case sonic3 = "sonic-3" case sonic320260112 = "sonic-3-2026-01-12" case sonic320251027 = "sonic-3-2025-10-27" diff --git a/Sources/Schemas/FallbackCustomTranscriber.swift b/Sources/Schemas/FallbackCustomTranscriber.swift index c8af0e35..c95a5a5f 100644 --- a/Sources/Schemas/FallbackCustomTranscriber.swift +++ b/Sources/Schemas/FallbackCustomTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for sending conversation audio to a custom WebSocket transcription server. public struct FallbackCustomTranscriber: Codable, Hashable, Sendable { /// This is where the transcription request will be sent. /// diff --git a/Sources/Schemas/FallbackCustomVoice.swift b/Sources/Schemas/FallbackCustomVoice.swift index 43590155..68f28f1c 100644 --- a/Sources/Schemas/FallbackCustomVoice.swift +++ b/Sources/Schemas/FallbackCustomVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech through a custom server, including voice selection, server connection, chunking, and caching. public struct FallbackCustomVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackDeepgramTranscriber.swift b/Sources/Schemas/FallbackDeepgramTranscriber.swift index ae6482e3..d3a20701 100644 --- a/Sources/Schemas/FallbackDeepgramTranscriber.swift +++ b/Sources/Schemas/FallbackDeepgramTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with Deepgram, including model, language, formatting, endpointing, and vocabulary. public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { /// This is the Deepgram model that will be used. A list of models can be found here: https://developers.deepgram.com/docs/models-languages-overview public let model: DeepgramTranscriberModel? @@ -21,12 +22,23 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { /// /// @default false public let profanityFilter: Bool? + /// Enables redaction of sensitive information from transcripts. + /// + /// Options include: + /// - "pci": Redacts credit card numbers, expiration dates, and CVV. + /// - "pii": Redacts personally identifiable information (names, locations, identifying numbers, etc.). + /// - "phi": Redacts protected health information (medical conditions, drugs, injuries, etc.). + /// - "numbers": Redacts numerical and identifying entities (dates, account numbers, SSNs, etc.). + /// + /// Multiple values can be provided to redact different categories simultaneously. + /// Redacted content is replaced with entity labels like [CREDIT_CARD_1], [SSN_1], etc. + /// + /// See https://developers.deepgram.com/docs/redaction for details. + public let redaction: [FallbackDeepgramTranscriberRedactionItem]? /// Transcripts below this confidence threshold will be discarded. /// /// @default 0.4 public let confidenceThreshold: Double? - /// Eager end-of-turn confidence required to fire a eager end-of-turn event. Setting a value here will enable EagerEndOfTurn and SpeechResumed events. It is disabled by default. Only used with Flux models. - public let eagerEotThreshold: Double? /// End-of-turn confidence required to finish a turn. Only used with Flux models. /// /// @default 0.7 @@ -35,6 +47,10 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { /// /// @default 5000 public let eotTimeoutMs: Double? + /// Language hints to bias Flux Multilingual (`flux-general-multi`) toward specific languages. + /// Provide BCP-47 language codes (e.g. "en", "es", "fr"). Multiple hints can be given for + /// multilingual or code-switching scenarios. Omit for auto-detection. Only used with `flux-general-multi`. + public let languages: [String]? /// These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. public let keywords: [String]? /// Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important keyterms or phrases up to 90%. @@ -58,10 +74,11 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { mipOptOut: Bool? = nil, numerals: Bool? = nil, profanityFilter: Bool? = nil, + redaction: [FallbackDeepgramTranscriberRedactionItem]? = nil, confidenceThreshold: Double? = nil, - eagerEotThreshold: Double? = nil, eotThreshold: Double? = nil, eotTimeoutMs: Double? = nil, + languages: [String]? = nil, keywords: [String]? = nil, keyterm: [String]? = nil, endpointing: Double? = nil, @@ -73,10 +90,11 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { self.mipOptOut = mipOptOut self.numerals = numerals self.profanityFilter = profanityFilter + self.redaction = redaction self.confidenceThreshold = confidenceThreshold - self.eagerEotThreshold = eagerEotThreshold self.eotThreshold = eotThreshold self.eotTimeoutMs = eotTimeoutMs + self.languages = languages self.keywords = keywords self.keyterm = keyterm self.endpointing = endpointing @@ -91,10 +109,11 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { self.mipOptOut = try container.decodeIfPresent(Bool.self, forKey: .mipOptOut) self.numerals = try container.decodeIfPresent(Bool.self, forKey: .numerals) self.profanityFilter = try container.decodeIfPresent(Bool.self, forKey: .profanityFilter) + self.redaction = try container.decodeIfPresent([FallbackDeepgramTranscriberRedactionItem].self, forKey: .redaction) self.confidenceThreshold = try container.decodeIfPresent(Double.self, forKey: .confidenceThreshold) - self.eagerEotThreshold = try container.decodeIfPresent(Double.self, forKey: .eagerEotThreshold) self.eotThreshold = try container.decodeIfPresent(Double.self, forKey: .eotThreshold) self.eotTimeoutMs = try container.decodeIfPresent(Double.self, forKey: .eotTimeoutMs) + self.languages = try container.decodeIfPresent([String].self, forKey: .languages) self.keywords = try container.decodeIfPresent([String].self, forKey: .keywords) self.keyterm = try container.decodeIfPresent([String].self, forKey: .keyterm) self.endpointing = try container.decodeIfPresent(Double.self, forKey: .endpointing) @@ -110,10 +129,11 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { try container.encodeIfPresent(self.mipOptOut, forKey: .mipOptOut) try container.encodeIfPresent(self.numerals, forKey: .numerals) try container.encodeIfPresent(self.profanityFilter, forKey: .profanityFilter) + try container.encodeIfPresent(self.redaction, forKey: .redaction) try container.encodeIfPresent(self.confidenceThreshold, forKey: .confidenceThreshold) - try container.encodeIfPresent(self.eagerEotThreshold, forKey: .eagerEotThreshold) try container.encodeIfPresent(self.eotThreshold, forKey: .eotThreshold) try container.encodeIfPresent(self.eotTimeoutMs, forKey: .eotTimeoutMs) + try container.encodeIfPresent(self.languages, forKey: .languages) try container.encodeIfPresent(self.keywords, forKey: .keywords) try container.encodeIfPresent(self.keyterm, forKey: .keyterm) try container.encodeIfPresent(self.endpointing, forKey: .endpointing) @@ -127,10 +147,11 @@ public struct FallbackDeepgramTranscriber: Codable, Hashable, Sendable { case mipOptOut case numerals case profanityFilter + case redaction case confidenceThreshold - case eagerEotThreshold case eotThreshold case eotTimeoutMs + case languages case keywords case keyterm case endpointing diff --git a/Sources/Schemas/FallbackDeepgramTranscriberRedactionItem.swift b/Sources/Schemas/FallbackDeepgramTranscriberRedactionItem.swift new file mode 100644 index 00000000..07675b5b --- /dev/null +++ b/Sources/Schemas/FallbackDeepgramTranscriberRedactionItem.swift @@ -0,0 +1,8 @@ +import Foundation + +public enum FallbackDeepgramTranscriberRedactionItem: String, Codable, Hashable, CaseIterable, Sendable { + case pci + case pii + case phi + case numbers +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackDeepgramVoice.swift b/Sources/Schemas/FallbackDeepgramVoice.swift index 628c4909..56fbceb2 100644 --- a/Sources/Schemas/FallbackDeepgramVoice.swift +++ b/Sources/Schemas/FallbackDeepgramVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Deepgram, including voice and model selection, model-improvement preferences, chunking, and caching. public struct FallbackDeepgramVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackDeepgramVoiceId.swift b/Sources/Schemas/FallbackDeepgramVoiceId.swift index fc73b626..84871127 100644 --- a/Sources/Schemas/FallbackDeepgramVoiceId.swift +++ b/Sources/Schemas/FallbackDeepgramVoiceId.swift @@ -57,4 +57,11 @@ public enum FallbackDeepgramVoiceId: String, Codable, Hashable, CaseIterable, Se case aquila case selena case javier + case viktoria + case kara + case fabian + case julius + case lara + case elara + case aurelia } \ No newline at end of file diff --git a/Sources/Schemas/FallbackElevenLabsTranscriber.swift b/Sources/Schemas/FallbackElevenLabsTranscriber.swift index b8535471..cf32deb1 100644 --- a/Sources/Schemas/FallbackElevenLabsTranscriber.swift +++ b/Sources/Schemas/FallbackElevenLabsTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with ElevenLabs, including model, language, and speech thresholds. public struct FallbackElevenLabsTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: FallbackElevenLabsTranscriberModel? diff --git a/Sources/Schemas/FallbackElevenLabsVoice.swift b/Sources/Schemas/FallbackElevenLabsVoice.swift index 160ef1f0..b5957931 100644 --- a/Sources/Schemas/FallbackElevenLabsVoice.swift +++ b/Sources/Schemas/FallbackElevenLabsVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with ElevenLabs, including voice and model selection, language, voice tuning, streaming, Speech Synthesis Markup Language parsing, pronunciation dictionaries, chunking, and caching. public struct FallbackElevenLabsVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackGladiaTranscriber.swift b/Sources/Schemas/FallbackGladiaTranscriber.swift index f2fbd2c0..8a748785 100644 --- a/Sources/Schemas/FallbackGladiaTranscriber.swift +++ b/Sources/Schemas/FallbackGladiaTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with Gladia, including language behavior, audio processing, endpointing, vocabulary, and region. public struct FallbackGladiaTranscriber: Codable, Hashable, Sendable { /// This is the Gladia model that will be used. Default is 'fast' public let model: FallbackGladiaTranscriberModel? @@ -8,7 +9,7 @@ public struct FallbackGladiaTranscriber: Codable, Hashable, Sendable { /// Defines the language to use for the transcription. Required when languageBehaviour is 'manual'. public let language: FallbackGladiaTranscriberLanguage? /// Defines the languages to use for the transcription. Required when languageBehaviour is 'manual'. - public let languages: FallbackGladiaTranscriberLanguages? + public let languages: [FallbackGladiaTranscriberLanguagesItem]? /// Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. /// ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit. public let transcriptionHint: String? @@ -39,7 +40,7 @@ public struct FallbackGladiaTranscriber: Codable, Hashable, Sendable { model: FallbackGladiaTranscriberModel? = nil, languageBehaviour: FallbackGladiaTranscriberLanguageBehaviour? = nil, language: FallbackGladiaTranscriberLanguage? = nil, - languages: FallbackGladiaTranscriberLanguages? = nil, + languages: [FallbackGladiaTranscriberLanguagesItem]? = nil, transcriptionHint: String? = nil, prosody: Bool? = nil, audioEnhancer: Bool? = nil, @@ -74,7 +75,7 @@ public struct FallbackGladiaTranscriber: Codable, Hashable, Sendable { self.model = try container.decodeIfPresent(FallbackGladiaTranscriberModel.self, forKey: .model) self.languageBehaviour = try container.decodeIfPresent(FallbackGladiaTranscriberLanguageBehaviour.self, forKey: .languageBehaviour) self.language = try container.decodeIfPresent(FallbackGladiaTranscriberLanguage.self, forKey: .language) - self.languages = try container.decodeIfPresent(FallbackGladiaTranscriberLanguages.self, forKey: .languages) + self.languages = try container.decodeIfPresent([FallbackGladiaTranscriberLanguagesItem].self, forKey: .languages) self.transcriptionHint = try container.decodeIfPresent(String.self, forKey: .transcriptionHint) self.prosody = try container.decodeIfPresent(Bool.self, forKey: .prosody) self.audioEnhancer = try container.decodeIfPresent(Bool.self, forKey: .audioEnhancer) diff --git a/Sources/Schemas/GladiaTranscriberLanguages.swift b/Sources/Schemas/FallbackGladiaTranscriberLanguagesItem.swift similarity index 86% rename from Sources/Schemas/GladiaTranscriberLanguages.swift rename to Sources/Schemas/FallbackGladiaTranscriberLanguagesItem.swift index 618d64ea..35ff1a3d 100644 --- a/Sources/Schemas/GladiaTranscriberLanguages.swift +++ b/Sources/Schemas/FallbackGladiaTranscriberLanguagesItem.swift @@ -1,7 +1,6 @@ import Foundation -/// Defines the languages to use for the transcription. Required when languageBehaviour is 'manual'. -public enum GladiaTranscriberLanguages: String, Codable, Hashable, CaseIterable, Sendable { +public enum FallbackGladiaTranscriberLanguagesItem: String, Codable, Hashable, CaseIterable, Sendable { case af case sq case am diff --git a/Sources/Schemas/FallbackGoogleTranscriber.swift b/Sources/Schemas/FallbackGoogleTranscriber.swift index ecc0abd3..50cbdb1d 100644 --- a/Sources/Schemas/FallbackGoogleTranscriber.swift +++ b/Sources/Schemas/FallbackGoogleTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with Google, including model and language. public struct FallbackGoogleTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: FallbackGoogleTranscriberModel? diff --git a/Sources/Schemas/FallbackGoogleTranscriberModel.swift b/Sources/Schemas/FallbackGoogleTranscriberModel.swift index d01cd6c7..7fd7bbed 100644 --- a/Sources/Schemas/FallbackGoogleTranscriberModel.swift +++ b/Sources/Schemas/FallbackGoogleTranscriberModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the model that will be used for the transcription. public enum FallbackGoogleTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/FallbackHumeVoice.swift b/Sources/Schemas/FallbackHumeVoice.swift index c0abd587..d7b66a61 100644 --- a/Sources/Schemas/FallbackHumeVoice.swift +++ b/Sources/Schemas/FallbackHumeVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Hume, including model and voice selection, custom voice metadata, chunking, and caching. public struct FallbackHumeVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackInworldVoice.swift b/Sources/Schemas/FallbackInworldVoice.swift index e6965860..d8f0f62f 100644 --- a/Sources/Schemas/FallbackInworldVoice.swift +++ b/Sources/Schemas/FallbackInworldVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Inworld, including voice and model selection, language, temperature, speaking rate, chunking, and caching. public struct FallbackInworldVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackLmntVoice.swift b/Sources/Schemas/FallbackLmntVoice.swift index 70bfb961..fca568f3 100644 --- a/Sources/Schemas/FallbackLmntVoice.swift +++ b/Sources/Schemas/FallbackLmntVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with LMNT, including voice selection, language, speed, chunking, and caching. public struct FallbackLmntVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackMicrosoftVoice.swift b/Sources/Schemas/FallbackMicrosoftVoice.swift new file mode 100644 index 00000000..70dc6a7a --- /dev/null +++ b/Sources/Schemas/FallbackMicrosoftVoice.swift @@ -0,0 +1,75 @@ +import Foundation + +public struct FallbackMicrosoftVoice: Codable, Hashable, Sendable { + /// This is the flag to toggle voice caching for the assistant. + public let cachingEnabled: Bool? + /// MAI-Voice-2 voice ID. Built-in voices listed in enum. + public let voiceId: FallbackMicrosoftVoiceVoiceId + /// Speaking style applied via mstts:express-as on every request. Unknown styles are ignored by Azure and fall back to neutral. + public let style: FallbackMicrosoftVoiceStyle? + /// Style intensity (0.01–2). Default 1 = the predefined style strength. Only applies when `style` is set. + public let styleDegree: Double? + /// Role-play (age/gender imitation). Requires `style` to be set; ignored otherwise. + public let role: FallbackMicrosoftVoiceRole? + /// This is the speed multiplier that will be used. + public let speed: Double? + /// This is the plan for chunking the model output before it is sent to the voice provider. + public let chunkPlan: ChunkPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + cachingEnabled: Bool? = nil, + voiceId: FallbackMicrosoftVoiceVoiceId, + style: FallbackMicrosoftVoiceStyle? = nil, + styleDegree: Double? = nil, + role: FallbackMicrosoftVoiceRole? = nil, + speed: Double? = nil, + chunkPlan: ChunkPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.cachingEnabled = cachingEnabled + self.voiceId = voiceId + self.style = style + self.styleDegree = styleDegree + self.role = role + self.speed = speed + self.chunkPlan = chunkPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) + self.voiceId = try container.decode(FallbackMicrosoftVoiceVoiceId.self, forKey: .voiceId) + self.style = try container.decodeIfPresent(FallbackMicrosoftVoiceStyle.self, forKey: .style) + self.styleDegree = try container.decodeIfPresent(Double.self, forKey: .styleDegree) + self.role = try container.decodeIfPresent(FallbackMicrosoftVoiceRole.self, forKey: .role) + self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) + try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.style, forKey: .style) + try container.encodeIfPresent(self.styleDegree, forKey: .styleDegree) + try container.encodeIfPresent(self.role, forKey: .role) + try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case cachingEnabled + case voiceId + case style + case styleDegree + case role + case speed + case chunkPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackMicrosoftVoiceRole.swift b/Sources/Schemas/FallbackMicrosoftVoiceRole.swift new file mode 100644 index 00000000..54b1454c --- /dev/null +++ b/Sources/Schemas/FallbackMicrosoftVoiceRole.swift @@ -0,0 +1,13 @@ +import Foundation + +/// Role-play (age/gender imitation). Requires `style` to be set; ignored otherwise. +public enum FallbackMicrosoftVoiceRole: String, Codable, Hashable, CaseIterable, Sendable { + case girl = "Girl" + case boy = "Boy" + case youngAdultFemale = "YoungAdultFemale" + case youngAdultMale = "YoungAdultMale" + case olderAdultFemale = "OlderAdultFemale" + case olderAdultMale = "OlderAdultMale" + case seniorFemale = "SeniorFemale" + case seniorMale = "SeniorMale" +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackMicrosoftVoiceStyle.swift b/Sources/Schemas/FallbackMicrosoftVoiceStyle.swift new file mode 100644 index 00000000..b437733e --- /dev/null +++ b/Sources/Schemas/FallbackMicrosoftVoiceStyle.swift @@ -0,0 +1,34 @@ +import Foundation + +/// Speaking style applied via mstts:express-as on every request. Unknown styles are ignored by Azure and fall back to neutral. +public enum FallbackMicrosoftVoiceStyle: String, Codable, Hashable, CaseIterable, Sendable { + case adventurous + case angry + case caring + case cheerful + case confused + case curious + case determined + case disappointed + case disgusted + case embarrassed + case empathy + case encouraging + case excited + case fearful + case friendly + case happy + case hopeful + case jealous + case joyful + case nostalgic + case reflective + case regretful + case relieved + case sad + case serious + case shouting + case softvoice + case surprised + case whispering +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackMicrosoftVoiceVoiceId.swift b/Sources/Schemas/FallbackMicrosoftVoiceVoiceId.swift new file mode 100644 index 00000000..037785cf --- /dev/null +++ b/Sources/Schemas/FallbackMicrosoftVoiceVoiceId.swift @@ -0,0 +1,51 @@ +import Foundation + +/// MAI-Voice-2 voice ID. Built-in voices listed in enum. +public enum FallbackMicrosoftVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { + case deDeKlausMaiVoice2 = "de-DE-Klaus:MAI-Voice-2" + case deDeMiaMaiVoice2 = "de-DE-Mia:MAI-Voice-2" + case enAuLisaMaiVoice2 = "en-AU-Lisa:MAI-Voice-2" + case enUsEthanMaiVoice2 = "en-US-Ethan:MAI-Voice-2" + case enUsGrantMaiVoice2 = "en-US-Grant:MAI-Voice-2" + case enUsHarperMaiVoice2 = "en-US-Harper:MAI-Voice-2" + case enUsIrisMaiVoice2 = "en-US-Iris:MAI-Voice-2" + case enUsJasperMaiVoice2 = "en-US-Jasper:MAI-Voice-2" + case enUsOliviaMaiVoice2 = "en-US-Olivia:MAI-Voice-2" + case esEsMartaMaiVoice2 = "es-ES-Marta:MAI-Voice-2" + case esMxAlejoMaiVoice2 = "es-MX-Alejo:MAI-Voice-2" + case esMxValeriaMaiVoice2 = "es-MX-Valeria:MAI-Voice-2" + case frFrMarcMaiVoice2 = "fr-FR-Marc:MAI-Voice-2" + case frFrSoleilMaiVoice2 = "fr-FR-Soleil:MAI-Voice-2" + case hiInArjunMaiVoice2 = "hi-IN-Arjun:MAI-Voice-2" + case hiInDhruvMaiVoice2 = "hi-IN-Dhruv:MAI-Voice-2" + case hiInKavyaMaiVoice2 = "hi-IN-Kavya:MAI-Voice-2" + case hiInPriyaMaiVoice2 = "hi-IN-Priya:MAI-Voice-2" + case huHuBenceMaiVoice2 = "hu-HU-Bence:MAI-Voice-2" + case huHuLeventeMaiVoice2 = "hu-HU-Levente:MAI-Voice-2" + case huHuLillaMaiVoice2 = "hu-HU-Lilla:MAI-Voice-2" + case huHuRekaMaiVoice2 = "hu-HU-Réka:MAI-Voice-2" + case itItLucaMaiVoice2 = "it-IT-Luca:MAI-Voice-2" + case itItRosaMaiVoice2 = "it-IT-Rosa:MAI-Voice-2" + case koKrHanaMaiVoice2 = "ko-KR-Hana:MAI-Voice-2" + case koKrJunhoMaiVoice2 = "ko-KR-Junho:MAI-Voice-2" + case nlNlFleurMaiVoice2 = "nl-NL-Fleur:MAI-Voice-2" + case nlNlSanderMaiVoice2 = "nl-NL-Sander:MAI-Voice-2" + case ptBrCaioMaiVoice2 = "pt-BR-Caio:MAI-Voice-2" + case ptBrLuanaMaiVoice2 = "pt-BR-Luana:MAI-Voice-2" + case ptBrPedroMaiVoice2 = "pt-BR-Pedro:MAI-Voice-2" + case ptBrRafaelMaiVoice2 = "pt-BR-Rafael:MAI-Voice-2" + case ptPtRuiMaiVoice2 = "pt-PT-Rui:MAI-Voice-2" + case roRoAndreiMaiVoice2 = "ro-RO-Andrei:MAI-Voice-2" + case roRoElenaMaiVoice2 = "ro-RO-Elena:MAI-Voice-2" + case roRoIoanaMaiVoice2 = "ro-RO-Ioana:MAI-Voice-2" + case roRoRaduMaiVoice2 = "ro-RO-Radu:MAI-Voice-2" + case ruRuLevMaiVoice2 = "ru-RU-Lev:MAI-Voice-2" + case ruRuMashaMaiVoice2 = "ru-RU-Masha:MAI-Voice-2" + case thThKritMaiVoice2 = "th-TH-Krit:MAI-Voice-2" + case thThNattapongMaiVoice2 = "th-TH-Nattapong:MAI-Voice-2" + case trTrAydinMaiVoice2 = "tr-TR-Aydin:MAI-Voice-2" + case trTrElifMaiVoice2 = "tr-TR-Elif:MAI-Voice-2" + case zhCnBoMaiVoice2 = "zh-CN-Bo:MAI-Voice-2" + case zhCnLanMaiVoice2 = "zh-CN-Lan:MAI-Voice-2" + case zhCnMeiMaiVoice2 = "zh-CN-Mei:MAI-Voice-2" +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackNeuphonicVoice.swift b/Sources/Schemas/FallbackNeuphonicVoice.swift index 57ad826d..3e869d91 100644 --- a/Sources/Schemas/FallbackNeuphonicVoice.swift +++ b/Sources/Schemas/FallbackNeuphonicVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Neuphonic, including voice and model selection, language, speed, chunking, and caching. public struct FallbackNeuphonicVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackOpenAiTranscriber.swift b/Sources/Schemas/FallbackOpenAiTranscriber.swift index 39b5f64c..4993c17e 100644 --- a/Sources/Schemas/FallbackOpenAiTranscriber.swift +++ b/Sources/Schemas/FallbackOpenAiTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with OpenAI, including model and language. public struct FallbackOpenAiTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: FallbackOpenAiTranscriberModel diff --git a/Sources/Schemas/FallbackOpenAiVoice.swift b/Sources/Schemas/FallbackOpenAiVoice.swift index 8ec10425..f2cc8321 100644 --- a/Sources/Schemas/FallbackOpenAiVoice.swift +++ b/Sources/Schemas/FallbackOpenAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with OpenAI, including voice and model selection, delivery instructions, speed, chunking, and caching. public struct FallbackOpenAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackPlan.swift b/Sources/Schemas/FallbackPlan.swift index 26f3b5a8..4b881815 100644 --- a/Sources/Schemas/FallbackPlan.swift +++ b/Sources/Schemas/FallbackPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Lists backup voice configurations that can be used if the primary voice provider fails. public struct FallbackPlan: Codable, Hashable, Sendable { /// This is the list of voices to fallback to in the event that the primary voice provider fails. public let voices: [FallbackPlanVoicesItem] diff --git a/Sources/Schemas/FallbackPlanVoicesItem.swift b/Sources/Schemas/FallbackPlanVoicesItem.swift index ad2897b7..101a76af 100644 --- a/Sources/Schemas/FallbackPlanVoicesItem.swift +++ b/Sources/Schemas/FallbackPlanVoicesItem.swift @@ -9,6 +9,7 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { case hume(FallbackHumeVoice) case inworld(FallbackInworldVoice) case lmnt(FallbackLmntVoice) + case microsoft(FallbackMicrosoftVoice) case neuphonic(FallbackNeuphonicVoice) case openai(FallbackOpenAiVoice) case playht(FallbackPlayHtVoice) @@ -18,6 +19,7 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { case tavus(FallbackTavusVoice) case vapi(FallbackVapiVoice) case wellsaid(FallbackWellSaidVoice) + case xai(FallbackXaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -39,6 +41,8 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { self = .inworld(try FallbackInworldVoice(from: decoder)) case "lmnt": self = .lmnt(try FallbackLmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try FallbackMicrosoftVoice(from: decoder)) case "neuphonic": self = .neuphonic(try FallbackNeuphonicVoice(from: decoder)) case "openai": @@ -57,6 +61,8 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { self = .vapi(try FallbackVapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try FallbackWellSaidVoice(from: decoder)) + case "xai": + self = .xai(try FallbackXaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,9 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .neuphonic(let data): try container.encode("neuphonic", forKey: .provider) try data.encode(to: encoder) @@ -121,6 +130,9 @@ public enum FallbackPlanVoicesItem: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/FallbackPlayHtVoice.swift b/Sources/Schemas/FallbackPlayHtVoice.swift index 5eb8178f..fcc8debf 100644 --- a/Sources/Schemas/FallbackPlayHtVoice.swift +++ b/Sources/Schemas/FallbackPlayHtVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with PlayHT, including voice and model selection, language, emotion and style guidance, chunking, and caching. public struct FallbackPlayHtVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackRimeAiVoice.swift b/Sources/Schemas/FallbackRimeAiVoice.swift index 1ebd4435..c64e1f78 100644 --- a/Sources/Schemas/FallbackRimeAiVoice.swift +++ b/Sources/Schemas/FallbackRimeAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Rime AI, including voice and model selection, language, speed, pauses, phonemization, latency, chunking, and caching. public struct FallbackRimeAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackSesameVoice.swift b/Sources/Schemas/FallbackSesameVoice.swift index 73706a64..deef244d 100644 --- a/Sources/Schemas/FallbackSesameVoice.swift +++ b/Sources/Schemas/FallbackSesameVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Sesame, including voice and model selection, chunking, and caching. public struct FallbackSesameVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackSmallestAiVoice.swift b/Sources/Schemas/FallbackSmallestAiVoice.swift index 4253c9ed..38c8fcc6 100644 --- a/Sources/Schemas/FallbackSmallestAiVoice.swift +++ b/Sources/Schemas/FallbackSmallestAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Smallest AI, including voice and model selection, speed, chunking, and caching. public struct FallbackSmallestAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackSonioxTranscriber.swift b/Sources/Schemas/FallbackSonioxTranscriber.swift index 7d067f9d..585837c0 100644 --- a/Sources/Schemas/FallbackSonioxTranscriber.swift +++ b/Sources/Schemas/FallbackSonioxTranscriber.swift @@ -1,32 +1,41 @@ import Foundation +/// Fallback configuration for transcribing speech with Soniox, including model, language detection, endpointing, and vocabulary. public struct FallbackSonioxTranscriber: Codable, Hashable, Sendable { /// The Soniox model to use for transcription. public let model: FallbackSonioxTranscriberModel? - /// The language for transcription. Uses ISO 639-1 codes. Soniox supports 60+ languages with a single universal model. + /// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). For multi-language hints or to enable Soniox auto-detect, use `languages` instead — when `languages` is set (including to an empty array), this field is ignored when building the Soniox request. Defaults to `en` if neither this nor `languages` is set. public let language: FallbackSonioxTranscriberLanguage? - /// When enabled, restricts transcription to the language specified in the language field. When disabled, the model can detect and transcribe any of 60+ supported languages. Defaults to true. + /// Language hints sent to Soniox as `language_hints`. Provide `[lang1, lang2, ...]` (ISO 639-1 codes) to bias recognition toward specific languages, or provide an explicit empty array `[]` to enable Soniox auto-detect across all 60+ supported languages. When set (including the empty array), this field takes precedence over the singular `language` field. When omitted, falls back to the singular `language` (which defaults to `en` if also unset). Best accuracy is achieved with a single language. + public let languages: [FallbackSonioxTranscriberLanguagesItem]? + /// When `true`, Soniox strictly restricts transcription to the languages in `languages` (or the singular `language` if `languages` is unset). When `false`, Soniox biases toward those languages but still allows transcription in other languages. Has no effect when no language hints are sent (e.g., `languages: []` for auto-detect). Defaults to `true` (strict mode). public let languageHintsStrict: Bool? /// Maximum delay in milliseconds between when the speaker stops and when the endpoint is detected. Lower values mean faster turn-taking but more false endpoints. Range: 500-3000. Default: 500. public let maxEndpointDelayMs: Double? /// Custom vocabulary terms to boost recognition accuracy. Useful for brand names, product names, and domain-specific terminology. Maps to Soniox context.terms. public let customVocabulary: [String]? + /// General context key-value pairs that guide the AI model during transcription. Helps adapt vocabulary to the correct domain, improving accuracy. Recommended: 10 or fewer pairs. Maps to Soniox context.general. + public let contextGeneral: [SonioxContextGeneralItem]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( model: FallbackSonioxTranscriberModel? = nil, language: FallbackSonioxTranscriberLanguage? = nil, + languages: [FallbackSonioxTranscriberLanguagesItem]? = nil, languageHintsStrict: Bool? = nil, maxEndpointDelayMs: Double? = nil, customVocabulary: [String]? = nil, + contextGeneral: [SonioxContextGeneralItem]? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.model = model self.language = language + self.languages = languages self.languageHintsStrict = languageHintsStrict self.maxEndpointDelayMs = maxEndpointDelayMs self.customVocabulary = customVocabulary + self.contextGeneral = contextGeneral self.additionalProperties = additionalProperties } @@ -34,9 +43,11 @@ public struct FallbackSonioxTranscriber: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.model = try container.decodeIfPresent(FallbackSonioxTranscriberModel.self, forKey: .model) self.language = try container.decodeIfPresent(FallbackSonioxTranscriberLanguage.self, forKey: .language) + self.languages = try container.decodeIfPresent([FallbackSonioxTranscriberLanguagesItem].self, forKey: .languages) self.languageHintsStrict = try container.decodeIfPresent(Bool.self, forKey: .languageHintsStrict) self.maxEndpointDelayMs = try container.decodeIfPresent(Double.self, forKey: .maxEndpointDelayMs) self.customVocabulary = try container.decodeIfPresent([String].self, forKey: .customVocabulary) + self.contextGeneral = try container.decodeIfPresent([SonioxContextGeneralItem].self, forKey: .contextGeneral) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -45,17 +56,21 @@ public struct FallbackSonioxTranscriber: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.model, forKey: .model) try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.languages, forKey: .languages) try container.encodeIfPresent(self.languageHintsStrict, forKey: .languageHintsStrict) try container.encodeIfPresent(self.maxEndpointDelayMs, forKey: .maxEndpointDelayMs) try container.encodeIfPresent(self.customVocabulary, forKey: .customVocabulary) + try container.encodeIfPresent(self.contextGeneral, forKey: .contextGeneral) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case model case language + case languages case languageHintsStrict case maxEndpointDelayMs case customVocabulary + case contextGeneral } } \ No newline at end of file diff --git a/Sources/Schemas/FallbackSonioxTranscriberLanguage.swift b/Sources/Schemas/FallbackSonioxTranscriberLanguage.swift index f98c75c6..690bec30 100644 --- a/Sources/Schemas/FallbackSonioxTranscriberLanguage.swift +++ b/Sources/Schemas/FallbackSonioxTranscriberLanguage.swift @@ -1,6 +1,6 @@ import Foundation -/// The language for transcription. Uses ISO 639-1 codes. Soniox supports 60+ languages with a single universal model. +/// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). For multi-language hints or to enable Soniox auto-detect, use `languages` instead — when `languages` is set (including to an empty array), this field is ignored when building the Soniox request. Defaults to `en` if neither this nor `languages` is set. public enum FallbackSonioxTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case aa case ab diff --git a/Sources/Schemas/FallbackSonioxTranscriberLanguagesItem.swift b/Sources/Schemas/FallbackSonioxTranscriberLanguagesItem.swift new file mode 100644 index 00000000..42f460d5 --- /dev/null +++ b/Sources/Schemas/FallbackSonioxTranscriberLanguagesItem.swift @@ -0,0 +1,189 @@ +import Foundation + +public enum FallbackSonioxTranscriberLanguagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case aa + case ab + case ae + case af + case ak + case am + case an + case ar + case `as` + case av + case ay + case az + case ba + case be + case bg + case bh + case bi + case bm + case bn + case bo + case br + case bs + case ca + case ce + case ch + case co + case cr + case cs + case cu + case cv + case cy + case da + case de + case dv + case dz + case ee + case el + case en + case eo + case es + case et + case eu + case fa + case ff + case fi + case fj + case fo + case fr + case fy + case ga + case gd + case gl + case gn + case gu + case gv + case ha + case he + case hi + case ho + case hr + case ht + case hu + case hy + case hz + case ia + case id + case ie + case ig + case ii + case ik + case io + case `is` + case it + case iu + case ja + case jv + case ka + case kg + case ki + case kj + case kk + case kl + case km + case kn + case ko + case kr + case ks + case ku + case kv + case kw + case ky + case la + case lb + case lg + case li + case ln + case lo + case lt + case lu + case lv + case mg + case mh + case mi + case mk + case ml + case mn + case mr + case ms + case mt + case my + case na + case nb + case nd + case ne + case ng + case nl + case nn + case no + case nr + case nv + case ny + case oc + case oj + case om + case or + case os + case pa + case pi + case pl + case ps + case pt + case qu + case rm + case rn + case ro + case ru + case rw + case sa + case sc + case sd + case se + case sg + case si + case sk + case sl + case sm + case sn + case so + case sq + case sr + case ss + case st + case su + case sv + case sw + case ta + case te + case tg + case th + case ti + case tk + case tl + case tn + case to + case tr + case ts + case tt + case tw + case ty + case ug + case uk + case ur + case uz + case ve + case vi + case vo + case wa + case wo + case xh + case yi + case yue + case yo + case za + case zh + case zu +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackSonioxTranscriberModel.swift b/Sources/Schemas/FallbackSonioxTranscriberModel.swift index e60366a0..6a3683ad 100644 --- a/Sources/Schemas/FallbackSonioxTranscriberModel.swift +++ b/Sources/Schemas/FallbackSonioxTranscriberModel.swift @@ -3,4 +3,5 @@ import Foundation /// The Soniox model to use for transcription. public enum FallbackSonioxTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { case sttRtV4 = "stt-rt-v4" + case sttRtV5 = "stt-rt-v5" } \ No newline at end of file diff --git a/Sources/Schemas/FallbackSpeechmaticsTranscriber.swift b/Sources/Schemas/FallbackSpeechmaticsTranscriber.swift index a5fad247..34a9d264 100644 --- a/Sources/Schemas/FallbackSpeechmaticsTranscriber.swift +++ b/Sources/Schemas/FallbackSpeechmaticsTranscriber.swift @@ -1,8 +1,10 @@ import Foundation +/// Fallback configuration for transcribing speech with Speechmatics, including language, region, diarization, vocabulary, endpointing, and formatting. public struct FallbackSpeechmaticsTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: FallbackSpeechmaticsTranscriberModel? + /// Language used for transcription. Set to `auto` to detect the language automatically. public let language: FallbackSpeechmaticsTranscriberLanguage? /// This is the operating point for the transcription. Choose between `standard` for faster turnaround with strong accuracy or `enhanced` for highest accuracy when precision is critical. /// @@ -20,6 +22,7 @@ public struct FallbackSpeechmaticsTranscriber: Codable, Hashable, Sendable { /// /// @default 3000 public let maxDelay: Double? + /// Words and phrases that Speechmatics should recognize more accurately, with optional phonetic alternatives. public let customVocabulary: [SpeechmaticsCustomVocabularyItem] /// This controls how numbers, dates, currencies, and other entities are formatted in the transcription output. /// diff --git a/Sources/Schemas/FallbackSpeechmaticsTranscriberLanguage.swift b/Sources/Schemas/FallbackSpeechmaticsTranscriberLanguage.swift index b3da2263..27fe43bc 100644 --- a/Sources/Schemas/FallbackSpeechmaticsTranscriberLanguage.swift +++ b/Sources/Schemas/FallbackSpeechmaticsTranscriberLanguage.swift @@ -1,5 +1,6 @@ import Foundation +/// Language used for transcription. Set to `auto` to detect the language automatically. public enum FallbackSpeechmaticsTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case auto case ar diff --git a/Sources/Schemas/FallbackTalkscriberTranscriber.swift b/Sources/Schemas/FallbackTalkscriberTranscriber.swift index 868a15a4..b07749f2 100644 --- a/Sources/Schemas/FallbackTalkscriberTranscriber.swift +++ b/Sources/Schemas/FallbackTalkscriberTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for transcribing speech with Talkscriber, including model and language. public struct FallbackTalkscriberTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: FallbackTalkscriberTranscriberModel? diff --git a/Sources/Schemas/FallbackTavusVoice.swift b/Sources/Schemas/FallbackTavusVoice.swift index b2292049..83d330ed 100644 --- a/Sources/Schemas/FallbackTavusVoice.swift +++ b/Sources/Schemas/FallbackTavusVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for using Tavus as the assistant's voice provider, including persona, callback, context, greeting, conversation properties, chunking, and caching. public struct FallbackTavusVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackTranscriberPlan.swift b/Sources/Schemas/FallbackTranscriberPlan.swift index 397858ce..57a4a5f4 100644 --- a/Sources/Schemas/FallbackTranscriberPlan.swift +++ b/Sources/Schemas/FallbackTranscriberPlan.swift @@ -1,12 +1,14 @@ import Foundation +/// Lists backup transcriber configurations that can be used if the primary transcriber fails. public struct FallbackTranscriberPlan: Codable, Hashable, Sendable { - public let transcribers: [FallbackTranscriberPlanTranscribersItem] + /// Transcriber configurations available when the primary transcriber fails. + public let transcribers: [FallbackTranscriberPlanTranscribersItem]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( - transcribers: [FallbackTranscriberPlanTranscribersItem], + transcribers: [FallbackTranscriberPlanTranscribersItem]? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.transcribers = transcribers @@ -15,14 +17,14 @@ public struct FallbackTranscriberPlan: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.transcribers = try container.decode([FallbackTranscriberPlanTranscribersItem].self, forKey: .transcribers) + self.transcribers = try container.decodeIfPresent([FallbackTranscriberPlanTranscribersItem].self, forKey: .transcribers) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.transcribers, forKey: .transcribers) + try container.encodeIfPresent(self.transcribers, forKey: .transcribers) } /// Keys for encoding/decoding struct properties. diff --git a/Sources/Schemas/FallbackTranscriberPlanTranscribersItem.swift b/Sources/Schemas/FallbackTranscriberPlanTranscribersItem.swift index ec7dae40..3be14dac 100644 --- a/Sources/Schemas/FallbackTranscriberPlanTranscribersItem.swift +++ b/Sources/Schemas/FallbackTranscriberPlanTranscribersItem.swift @@ -13,6 +13,7 @@ public enum FallbackTranscriberPlanTranscribersItem: Codable, Hashable, Sendable case soniox(FallbackSonioxTranscriber) case speechmatics(FallbackSpeechmaticsTranscriber) case talkscriber(FallbackTalkscriberTranscriber) + case xai(FallbackXaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -42,6 +43,8 @@ public enum FallbackTranscriberPlanTranscribersItem: Codable, Hashable, Sendable self = .speechmatics(try FallbackSpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try FallbackTalkscriberTranscriber(from: decoder)) + case "xai": + self = .xai(try FallbackXaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -91,6 +94,9 @@ public enum FallbackTranscriberPlanTranscribersItem: Codable, Hashable, Sendable case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/FallbackVapiVoice.swift b/Sources/Schemas/FallbackVapiVoice.swift index 92952d7c..465ffc11 100644 --- a/Sources/Schemas/FallbackVapiVoice.swift +++ b/Sources/Schemas/FallbackVapiVoice.swift @@ -1,14 +1,19 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with Vapi, including voice selection, speed, pronunciation dictionary, chunking, and caching. public struct FallbackVapiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? /// The voices provided by Vapi public let voiceId: FallbackVapiVoiceVoiceId + /// The Vapi voice routing generation. `latest` auto-updates to the newest generation; version 1 uses legacy mappings; version 2 can use xAI-backed voices when available. When omitted, Version 1 is used. Accepts the string channel ('latest', '1', '2'); legacy numeric values (1, 2) are also accepted and coerced to their string form. + public let version: FallbackVapiVoiceVersion? /// This is the speed multiplier that will be used. /// /// @default 1 public let speed: Double? + /// Language for Vapi voice synthesis. For Version 2, omit this field or set `auto` for automatic language detection. Version 1 supports legacy Vapi language values. + public let language: FallbackVapiVoiceLanguage? /// List of pronunciation dictionary locators for custom word pronunciations. public let pronunciationDictionary: [VapiPronunciationDictionaryLocator]? /// This is the plan for chunking the model output before it is sent to the voice provider. @@ -19,14 +24,18 @@ public struct FallbackVapiVoice: Codable, Hashable, Sendable { public init( cachingEnabled: Bool? = nil, voiceId: FallbackVapiVoiceVoiceId, + version: FallbackVapiVoiceVersion? = nil, speed: Double? = nil, + language: FallbackVapiVoiceLanguage? = nil, pronunciationDictionary: [VapiPronunciationDictionaryLocator]? = nil, chunkPlan: ChunkPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.cachingEnabled = cachingEnabled self.voiceId = voiceId + self.version = version self.speed = speed + self.language = language self.pronunciationDictionary = pronunciationDictionary self.chunkPlan = chunkPlan self.additionalProperties = additionalProperties @@ -36,7 +45,9 @@ public struct FallbackVapiVoice: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) self.voiceId = try container.decode(FallbackVapiVoiceVoiceId.self, forKey: .voiceId) + self.version = try container.decodeIfPresent(FallbackVapiVoiceVersion.self, forKey: .version) self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.language = try container.decodeIfPresent(FallbackVapiVoiceLanguage.self, forKey: .language) self.pronunciationDictionary = try container.decodeIfPresent([VapiPronunciationDictionaryLocator].self, forKey: .pronunciationDictionary) self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -47,7 +58,9 @@ public struct FallbackVapiVoice: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.version, forKey: .version) try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.language, forKey: .language) try container.encodeIfPresent(self.pronunciationDictionary, forKey: .pronunciationDictionary) try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) } @@ -56,7 +69,9 @@ public struct FallbackVapiVoice: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case cachingEnabled case voiceId + case version case speed + case language case pronunciationDictionary case chunkPlan } diff --git a/Sources/Schemas/FallbackVapiVoiceLanguage.swift b/Sources/Schemas/FallbackVapiVoiceLanguage.swift new file mode 100644 index 00000000..ea59a597 --- /dev/null +++ b/Sources/Schemas/FallbackVapiVoiceLanguage.swift @@ -0,0 +1,62 @@ +import Foundation + +/// Language for Vapi voice synthesis. For Version 2, omit this field or set `auto` for automatic language detection. Version 1 supports legacy Vapi language values. +public enum FallbackVapiVoiceLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case enUs = "en-US" + case enGb = "en-GB" + case enAu = "en-AU" + case enCa = "en-CA" + case ja + case zh + case de + case hi + case frFr = "fr-FR" + case frCa = "fr-CA" + case ko + case ptBr = "pt-BR" + case ptPt = "pt-PT" + case it + case esEs = "es-ES" + case esMx = "es-MX" + case id + case nl + case tr + case fil + case pl + case sv + case bg + case ro + case arSa = "ar-SA" + case arAe = "ar-AE" + case cs + case el + case fi + case hr + case ms + case sk + case da + case ta + case uk + case ru + case hu + case no + case vi + case auto + case en + case ar + case arEg = "ar-EG" + case bn + case es + case fr + case gu + case he + case ka + case kn + case ml + case mr + case pa + case pt + case te + case th + case tl +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackVapiVoiceVersion.swift b/Sources/Schemas/FallbackVapiVoiceVersion.swift new file mode 100644 index 00000000..df7750b5 --- /dev/null +++ b/Sources/Schemas/FallbackVapiVoiceVersion.swift @@ -0,0 +1,8 @@ +import Foundation + +/// The Vapi voice routing generation. `latest` auto-updates to the newest generation; version 1 uses legacy mappings; version 2 can use xAI-backed voices when available. When omitted, Version 1 is used. Accepts the string channel ('latest', '1', '2'); legacy numeric values (1, 2) are also accepted and coerced to their string form. +public enum FallbackVapiVoiceVersion: String, Codable, Hashable, CaseIterable, Sendable { + case one = "1" + case two = "2" + case latest +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackVapiVoiceVoiceId.swift b/Sources/Schemas/FallbackVapiVoiceVoiceId.swift index b9c81089..2a7fc8cc 100644 --- a/Sources/Schemas/FallbackVapiVoiceVoiceId.swift +++ b/Sources/Schemas/FallbackVapiVoiceVoiceId.swift @@ -4,25 +4,25 @@ import Foundation public enum FallbackVapiVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { case clara = "Clara" case godfrey = "Godfrey" + case elliot = "Elliot" + case savannah = "Savannah" + case nico = "Nico" + case kai = "Kai" + case emma = "Emma" + case sagar = "Sagar" + case neil = "Neil" case layla = "Layla" case sid = "Sid" case gustavo = "Gustavo" - case elliot = "Elliot" case kylie = "Kylie" case rohan = "Rohan" case lily = "Lily" - case savannah = "Savannah" case hana = "Hana" case neha = "Neha" case cole = "Cole" case harry = "Harry" case paige = "Paige" case spencer = "Spencer" - case nico = "Nico" - case kai = "Kai" - case emma = "Emma" - case sagar = "Sagar" - case neil = "Neil" case naina = "Naina" case leah = "Leah" case tara = "Tara" diff --git a/Sources/Schemas/FallbackWellSaidVoice.swift b/Sources/Schemas/FallbackWellSaidVoice.swift index a7853147..03bd8af0 100644 --- a/Sources/Schemas/FallbackWellSaidVoice.swift +++ b/Sources/Schemas/FallbackWellSaidVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Fallback configuration for synthesizing assistant speech with WellSaid, including voice and model selection, Speech Synthesis Markup Language support, voice libraries, chunking, and caching. public struct FallbackWellSaidVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/FallbackXaiTranscriber.swift b/Sources/Schemas/FallbackXaiTranscriber.swift new file mode 100644 index 00000000..66ede66c --- /dev/null +++ b/Sources/Schemas/FallbackXaiTranscriber.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct FallbackXaiTranscriber: Codable, Hashable, Sendable { + /// The xAI speech-to-text model to use. xAI currently exposes a single STT model — placeholder for future model selection. + public let model: FallbackXaiTranscriberModel? + /// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). Defaults to `en` if not set. xAI auto-detects when omitted via the API but Vapi defaults to English for deterministic behavior. + public let language: FallbackXaiTranscriberLanguage? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + model: FallbackXaiTranscriberModel? = nil, + language: FallbackXaiTranscriberLanguage? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.model = model + self.language = language + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.model = try container.decodeIfPresent(FallbackXaiTranscriberModel.self, forKey: .model) + self.language = try container.decodeIfPresent(FallbackXaiTranscriberLanguage.self, forKey: .language) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.language, forKey: .language) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case model + case language + } +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackXaiTranscriberLanguage.swift b/Sources/Schemas/FallbackXaiTranscriberLanguage.swift new file mode 100644 index 00000000..0a22da26 --- /dev/null +++ b/Sources/Schemas/FallbackXaiTranscriberLanguage.swift @@ -0,0 +1,30 @@ +import Foundation + +/// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). Defaults to `en` if not set. xAI auto-detects when omitted via the API but Vapi defaults to English for deterministic behavior. +public enum FallbackXaiTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case ar + case cs + case da + case nl + case en + case fil + case fr + case de + case hi + case id + case it + case ja + case ko + case mk + case ms + case fa + case pl + case pt + case ro + case ru + case es + case sv + case th + case tr + case vi +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackXaiTranscriberModel.swift b/Sources/Schemas/FallbackXaiTranscriberModel.swift new file mode 100644 index 00000000..89f938dc --- /dev/null +++ b/Sources/Schemas/FallbackXaiTranscriberModel.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The xAI speech-to-text model to use. xAI currently exposes a single STT model — placeholder for future model selection. +public enum FallbackXaiTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { + case `default` +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackXaiVoice.swift b/Sources/Schemas/FallbackXaiVoice.swift new file mode 100644 index 00000000..2764584c --- /dev/null +++ b/Sources/Schemas/FallbackXaiVoice.swift @@ -0,0 +1,61 @@ +import Foundation + +public struct FallbackXaiVoice: Codable, Hashable, Sendable { + /// This is the flag to toggle voice caching for the assistant. + public let cachingEnabled: Bool? + /// Built-in voices: eve, ara, rex, sal, leo. Cloned voice IDs are also accepted. + public let voiceId: FallbackXaiVoiceVoiceId + /// BCP-47 language code for xAI TTS synthesis. + public let language: FallbackXaiVoiceLanguage? + /// Speed multiplier for xAI TTS synthesis. + public let speed: Double? + /// This is the plan for chunking the model output before it is sent to the voice provider. + public let chunkPlan: ChunkPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + cachingEnabled: Bool? = nil, + voiceId: FallbackXaiVoiceVoiceId, + language: FallbackXaiVoiceLanguage? = nil, + speed: Double? = nil, + chunkPlan: ChunkPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.cachingEnabled = cachingEnabled + self.voiceId = voiceId + self.language = language + self.speed = speed + self.chunkPlan = chunkPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) + self.voiceId = try container.decode(FallbackXaiVoiceVoiceId.self, forKey: .voiceId) + self.language = try container.decodeIfPresent(FallbackXaiVoiceLanguage.self, forKey: .language) + self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) + try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case cachingEnabled + case voiceId + case language + case speed + case chunkPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackXaiVoiceLanguage.swift b/Sources/Schemas/FallbackXaiVoiceLanguage.swift new file mode 100644 index 00000000..01508775 --- /dev/null +++ b/Sources/Schemas/FallbackXaiVoiceLanguage.swift @@ -0,0 +1,26 @@ +import Foundation + +/// BCP-47 language code for xAI TTS synthesis. +public enum FallbackXaiVoiceLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case auto + case en + case arEg = "ar-EG" + case arSa = "ar-SA" + case arAe = "ar-AE" + case bn + case zh + case fr + case de + case hi + case id + case it + case ja + case ko + case ptBr = "pt-BR" + case ptPt = "pt-PT" + case ru + case esMx = "es-MX" + case esEs = "es-ES" + case tr + case vi +} \ No newline at end of file diff --git a/Sources/Schemas/FallbackXaiVoiceVoiceId.swift b/Sources/Schemas/FallbackXaiVoiceVoiceId.swift new file mode 100644 index 00000000..c5399b79 --- /dev/null +++ b/Sources/Schemas/FallbackXaiVoiceVoiceId.swift @@ -0,0 +1,10 @@ +import Foundation + +/// Built-in voices: eve, ara, rex, sal, leo. Cloned voice IDs are also accepted. +public enum FallbackXaiVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { + case eve + case ara + case rex + case sal + case leo +} \ No newline at end of file diff --git a/Sources/Schemas/File.swift b/Sources/Schemas/File.swift index 935c9ecd..73cfee0a 100644 --- a/Sources/Schemas/File.swift +++ b/Sources/Schemas/File.swift @@ -1,20 +1,34 @@ import Foundation +/// An uploaded file record, including its processing status, storage details, extracted-text location, metadata, and lifecycle timestamps. public struct File: Codable, Hashable, Sendable { + /// The object type. This is always `file`. public let object: FileObject? + /// The current processing status of the uploaded file. public let status: FileStatus? /// This is the name of the file. This is just for your own reference. public let name: String? + /// The original name of the uploaded file. public let originalName: String? + /// The size of the uploaded file in bytes. public let bytes: Double? + /// The intended use assigned to the uploaded file. public let purpose: String? + /// The MIME type of the uploaded file. public let mimetype: String? + /// The object-storage key for the uploaded file. public let key: String? + /// The object-storage path for the uploaded file. public let path: String? + /// The object-storage bucket containing the uploaded file. public let bucket: String? + /// The URL used to access the uploaded file. public let url: String? + /// The URL used to access text extracted from the file. public let parsedTextUrl: String? + /// The size of the extracted text in bytes. public let parsedTextBytes: Double? + /// Additional metadata associated with the uploaded file. public let metadata: [String: JSONValue]? /// This is the unique identifier for the file. public let id: String diff --git a/Sources/Schemas/FileObject.swift b/Sources/Schemas/FileObject.swift index b442eb38..233d79bb 100644 --- a/Sources/Schemas/FileObject.swift +++ b/Sources/Schemas/FileObject.swift @@ -1,5 +1,6 @@ import Foundation +/// The object type. This is always `file`. public enum FileObject: String, Codable, Hashable, CaseIterable, Sendable { case file } \ No newline at end of file diff --git a/Sources/Schemas/FileStatus.swift b/Sources/Schemas/FileStatus.swift index e795e5e4..61ce031b 100644 --- a/Sources/Schemas/FileStatus.swift +++ b/Sources/Schemas/FileStatus.swift @@ -1,5 +1,6 @@ import Foundation +/// The current processing status of the uploaded file. public enum FileStatus: String, Codable, Hashable, CaseIterable, Sendable { case processing case done diff --git a/Sources/Schemas/FilterDateTypeColumnOnCallTable.swift b/Sources/Schemas/FilterDateTypeColumnOnCallTable.swift index 6b4ce594..6d452617 100644 --- a/Sources/Schemas/FilterDateTypeColumnOnCallTable.swift +++ b/Sources/Schemas/FilterDateTypeColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters call records by comparing a start or end timestamp with a date. public struct FilterDateTypeColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// Date Type columns are columns where the rows store data as a date. diff --git a/Sources/Schemas/FilterNumberArrayTypeColumnOnCallTable.swift b/Sources/Schemas/FilterNumberArrayTypeColumnOnCallTable.swift index c433c164..72e0ca1a 100644 --- a/Sources/Schemas/FilterNumberArrayTypeColumnOnCallTable.swift +++ b/Sources/Schemas/FilterNumberArrayTypeColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters numeric call fields using a list of values or an emptiness test. public struct FilterNumberArrayTypeColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// Number Array Type columns are the same as Number Type columns, but provides the ability to filter on multiple values provided as an array. diff --git a/Sources/Schemas/FilterNumberTypeColumnOnCallTable.swift b/Sources/Schemas/FilterNumberTypeColumnOnCallTable.swift index 4b2f681c..3447001e 100644 --- a/Sources/Schemas/FilterNumberTypeColumnOnCallTable.swift +++ b/Sources/Schemas/FilterNumberTypeColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters call records by comparing a numeric field with a value. public struct FilterNumberTypeColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// Number Type columns are columns where the rows store data as a number. diff --git a/Sources/Schemas/FilterStringArrayTypeColumnOnCallTable.swift b/Sources/Schemas/FilterStringArrayTypeColumnOnCallTable.swift index dc8f799d..a4487e02 100644 --- a/Sources/Schemas/FilterStringArrayTypeColumnOnCallTable.swift +++ b/Sources/Schemas/FilterStringArrayTypeColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters string-valued call fields using a list of values or an emptiness test. public struct FilterStringArrayTypeColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// String Array Type columns are the same as String Type columns, but provides the ability to filter on multiple values provided as an array. diff --git a/Sources/Schemas/FilterStringTypeColumnOnCallTable.swift b/Sources/Schemas/FilterStringTypeColumnOnCallTable.swift index 04bc52a1..cc46e12e 100644 --- a/Sources/Schemas/FilterStringTypeColumnOnCallTable.swift +++ b/Sources/Schemas/FilterStringTypeColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters call records by comparing or searching a string-valued field. public struct FilterStringTypeColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// String Type columns are columns where the rows store data as a string. diff --git a/Sources/Schemas/FilterStructuredOutputColumnOnCallTable.swift b/Sources/Schemas/FilterStructuredOutputColumnOnCallTable.swift index aefacc20..a7d1dd92 100644 --- a/Sources/Schemas/FilterStructuredOutputColumnOnCallTable.swift +++ b/Sources/Schemas/FilterStructuredOutputColumnOnCallTable.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters a structured-output value stored on a call using comparison, membership, containment, or emptiness operators. public struct FilterStructuredOutputColumnOnCallTable: Codable, Hashable, Sendable { /// This is the column in the call table that will be filtered on. /// Structured Output Type columns are only to filter on artifact.structuredOutputs[OutputID] column. diff --git a/Sources/Schemas/FormatPlan.swift b/Sources/Schemas/FormatPlan.swift index 16207595..9b9c8216 100644 --- a/Sources/Schemas/FormatPlan.swift +++ b/Sources/Schemas/FormatPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls text normalization before voice synthesis, including built-in formatters, number handling, and custom replacements. public struct FormatPlan: Codable, Hashable, Sendable { /// This determines whether the chunk is formatted before being sent to the voice provider. This helps with enunciation. This includes phone numbers, emails and addresses. Default `true`. /// diff --git a/Sources/Schemas/FourierDenoisingPlan.swift b/Sources/Schemas/FourierDenoisingPlan.swift index e4e716d8..31c1312c 100644 --- a/Sources/Schemas/FourierDenoisingPlan.swift +++ b/Sources/Schemas/FourierDenoisingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for Fourier denoising, including media detection, thresholds, baseline calculation, and analysis window. public struct FourierDenoisingPlan: Codable, Hashable, Sendable { /// Whether Fourier denoising is enabled. Note that this is experimental and may not work as expected. public let enabled: Bool? diff --git a/Sources/Schemas/FunctionCallHookAction.swift b/Sources/Schemas/FunctionCallHookAction.swift index dacd06fb..f4eb3318 100644 --- a/Sources/Schemas/FunctionCallHookAction.swift +++ b/Sources/Schemas/FunctionCallHookAction.swift @@ -1,9 +1,7 @@ import Foundation public struct FunctionCallHookAction: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [FunctionCallHookActionMessagesItem]? /// The type of tool. "function" for Function tool. public let type: FunctionCallHookActionType diff --git a/Sources/Schemas/FunctionTool.swift b/Sources/Schemas/FunctionTool.swift index 5063c984..7e77ef49 100644 --- a/Sources/Schemas/FunctionTool.swift +++ b/Sources/Schemas/FunctionTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable custom function tool that sends model-generated arguments to a configured server and returns the result to the assistant. public struct FunctionTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [FunctionToolMessagesItem]? /// This determines if the tool is async. /// @@ -120,6 +120,7 @@ public struct FunctionTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [FunctionToolMessagesItem]? = nil, async: Bool? = nil, server: Server? = nil, @@ -133,6 +134,7 @@ public struct FunctionTool: Codable, Hashable, Sendable { function: OpenAiFunction? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.async = async self.server = server @@ -149,6 +151,7 @@ public struct FunctionTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([FunctionToolMessagesItem].self, forKey: .messages) self.async = try container.decodeIfPresent(Bool.self, forKey: .async) self.server = try container.decodeIfPresent(Server.self, forKey: .server) @@ -166,6 +169,7 @@ public struct FunctionTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.async, forKey: .async) try container.encodeIfPresent(self.server, forKey: .server) @@ -181,6 +185,7 @@ public struct FunctionTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case async case server diff --git a/Sources/Schemas/FunctionToolWithToolCall.swift b/Sources/Schemas/FunctionToolWithToolCall.swift index 9c7e0644..5cd8991d 100644 --- a/Sources/Schemas/FunctionToolWithToolCall.swift +++ b/Sources/Schemas/FunctionToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct FunctionToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [FunctionToolWithToolCallMessagesItem]? /// This determines if the tool is async. /// diff --git a/Sources/Schemas/GcpKey.swift b/Sources/Schemas/GcpKey.swift index 17ac5c9f..215b8d3d 100644 --- a/Sources/Schemas/GcpKey.swift +++ b/Sources/Schemas/GcpKey.swift @@ -1,5 +1,6 @@ import Foundation +/// Google Cloud service-account key used to authenticate access to Google Cloud resources. public struct GcpKey: Codable, Hashable, Sendable { /// This is the type of the key. Most likely, this is "service_account". public let type: String diff --git a/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfig.swift b/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfig.swift index a81b9ccc..cabc67e8 100644 --- a/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfig.swift +++ b/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfig.swift @@ -1,6 +1,8 @@ import Foundation +/// Selects a prebuilt voice for Gemini Multimodal Live audio output. public struct GeminiMultimodalLivePrebuiltVoiceConfig: Codable, Hashable, Sendable { + /// Prebuilt Gemini voice used for audio output. public let voiceName: GeminiMultimodalLivePrebuiltVoiceConfigVoiceName /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfigVoiceName.swift b/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfigVoiceName.swift index e05ccfa7..e5437e18 100644 --- a/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfigVoiceName.swift +++ b/Sources/Schemas/GeminiMultimodalLivePrebuiltVoiceConfigVoiceName.swift @@ -1,5 +1,6 @@ import Foundation +/// Prebuilt Gemini voice used for audio output. public enum GeminiMultimodalLivePrebuiltVoiceConfigVoiceName: String, Codable, Hashable, CaseIterable, Sendable { case puck = "Puck" case charon = "Charon" diff --git a/Sources/Schemas/GeminiMultimodalLiveSpeechConfig.swift b/Sources/Schemas/GeminiMultimodalLiveSpeechConfig.swift index 4c8780f7..2f48b257 100644 --- a/Sources/Schemas/GeminiMultimodalLiveSpeechConfig.swift +++ b/Sources/Schemas/GeminiMultimodalLiveSpeechConfig.swift @@ -1,6 +1,8 @@ import Foundation +/// Speech-output configuration for Gemini Multimodal Live. public struct GeminiMultimodalLiveSpeechConfig: Codable, Hashable, Sendable { + /// Voice configuration used for Gemini Multimodal Live speech output. public let voiceConfig: GeminiMultimodalLiveVoiceConfig /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/GeminiMultimodalLiveVoiceConfig.swift b/Sources/Schemas/GeminiMultimodalLiveVoiceConfig.swift index 63ace788..d208df5a 100644 --- a/Sources/Schemas/GeminiMultimodalLiveVoiceConfig.swift +++ b/Sources/Schemas/GeminiMultimodalLiveVoiceConfig.swift @@ -1,6 +1,8 @@ import Foundation +/// Voice selection configuration for Gemini Multimodal Live. public struct GeminiMultimodalLiveVoiceConfig: Codable, Hashable, Sendable { + /// Prebuilt voice used for Gemini Multimodal Live speech output. public let prebuiltVoiceConfig: GeminiMultimodalLivePrebuiltVoiceConfig /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/GetChatPaginatedDto.swift b/Sources/Schemas/GetChatPaginatedDto.swift index 33373437..2ae72584 100644 --- a/Sources/Schemas/GetChatPaginatedDto.swift +++ b/Sources/Schemas/GetChatPaginatedDto.swift @@ -17,6 +17,8 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: GetChatPaginatedDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: GetChatPaginatedDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -47,6 +49,7 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { previousChatId: String? = nil, page: Double? = nil, sortOrder: GetChatPaginatedDtoSortOrder? = nil, + sortBy: GetChatPaginatedDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -66,6 +69,7 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { self.previousChatId = previousChatId self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -88,6 +92,7 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { self.previousChatId = try container.decodeIfPresent(String.self, forKey: .previousChatId) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(GetChatPaginatedDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(GetChatPaginatedDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -111,6 +116,7 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.previousChatId, forKey: .previousChatId) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -132,6 +138,7 @@ public struct GetChatPaginatedDto: Codable, Hashable, Sendable { case previousChatId case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/GetChatPaginatedDtoSortBy.swift b/Sources/Schemas/GetChatPaginatedDtoSortBy.swift new file mode 100644 index 00000000..13c701dc --- /dev/null +++ b/Sources/Schemas/GetChatPaginatedDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum GetChatPaginatedDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/GetEvalPaginatedDto.swift b/Sources/Schemas/GetEvalPaginatedDto.swift index df17720f..1b9b7cb9 100644 --- a/Sources/Schemas/GetEvalPaginatedDto.swift +++ b/Sources/Schemas/GetEvalPaginatedDto.swift @@ -6,6 +6,8 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: GetEvalPaginatedDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: GetEvalPaginatedDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -31,6 +33,7 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { id: String? = nil, page: Double? = nil, sortOrder: GetEvalPaginatedDtoSortOrder? = nil, + sortBy: GetEvalPaginatedDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -45,6 +48,7 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { self.id = id self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -62,6 +66,7 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { self.id = try container.decodeIfPresent(String.self, forKey: .id) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(GetEvalPaginatedDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(GetEvalPaginatedDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -80,6 +85,7 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.id, forKey: .id) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -96,6 +102,7 @@ public struct GetEvalPaginatedDto: Codable, Hashable, Sendable { case id case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/GetEvalPaginatedDtoSortBy.swift b/Sources/Schemas/GetEvalPaginatedDtoSortBy.swift new file mode 100644 index 00000000..8561b471 --- /dev/null +++ b/Sources/Schemas/GetEvalPaginatedDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum GetEvalPaginatedDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/GetEvalRunPaginatedDto.swift b/Sources/Schemas/GetEvalRunPaginatedDto.swift index 34de2931..b4aa0340 100644 --- a/Sources/Schemas/GetEvalRunPaginatedDto.swift +++ b/Sources/Schemas/GetEvalRunPaginatedDto.swift @@ -6,6 +6,8 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: GetEvalRunPaginatedDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: GetEvalRunPaginatedDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -31,6 +33,7 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { id: String? = nil, page: Double? = nil, sortOrder: GetEvalRunPaginatedDtoSortOrder? = nil, + sortBy: GetEvalRunPaginatedDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -45,6 +48,7 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { self.id = id self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -62,6 +66,7 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { self.id = try container.decodeIfPresent(String.self, forKey: .id) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(GetEvalRunPaginatedDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(GetEvalRunPaginatedDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -80,6 +85,7 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.id, forKey: .id) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -96,6 +102,7 @@ public struct GetEvalRunPaginatedDto: Codable, Hashable, Sendable { case id case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/GetEvalRunPaginatedDtoSortBy.swift b/Sources/Schemas/GetEvalRunPaginatedDtoSortBy.swift new file mode 100644 index 00000000..e51458f8 --- /dev/null +++ b/Sources/Schemas/GetEvalRunPaginatedDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum GetEvalRunPaginatedDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/GetSessionPaginatedDto.swift b/Sources/Schemas/GetSessionPaginatedDto.swift index 659271e5..364387e2 100644 --- a/Sources/Schemas/GetSessionPaginatedDto.swift +++ b/Sources/Schemas/GetSessionPaginatedDto.swift @@ -25,6 +25,8 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { public let page: Double? /// This is the sort order for pagination. Defaults to 'DESC'. public let sortOrder: GetSessionPaginatedDtoSortOrder? + /// This is the column to sort by. Defaults to 'createdAt'. + public let sortBy: GetSessionPaginatedDtoSortBy? /// This is the maximum number of items to return. Defaults to 100. public let limit: Double? /// This will return items where the createdAt is greater than the specified value. @@ -59,6 +61,7 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { phoneNumberIdAny: [String]? = nil, page: Double? = nil, sortOrder: GetSessionPaginatedDtoSortOrder? = nil, + sortBy: GetSessionPaginatedDtoSortBy? = nil, limit: Double? = nil, createdAtGt: Date? = nil, createdAtLt: Date? = nil, @@ -82,6 +85,7 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { self.phoneNumberIdAny = phoneNumberIdAny self.page = page self.sortOrder = sortOrder + self.sortBy = sortBy self.limit = limit self.createdAtGt = createdAtGt self.createdAtLt = createdAtLt @@ -108,6 +112,7 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { self.phoneNumberIdAny = try container.decodeIfPresent([String].self, forKey: .phoneNumberIdAny) self.page = try container.decodeIfPresent(Double.self, forKey: .page) self.sortOrder = try container.decodeIfPresent(GetSessionPaginatedDtoSortOrder.self, forKey: .sortOrder) + self.sortBy = try container.decodeIfPresent(GetSessionPaginatedDtoSortBy.self, forKey: .sortBy) self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) self.createdAtGt = try container.decodeIfPresent(Date.self, forKey: .createdAtGt) self.createdAtLt = try container.decodeIfPresent(Date.self, forKey: .createdAtLt) @@ -135,6 +140,7 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.phoneNumberIdAny, forKey: .phoneNumberIdAny) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) + try container.encodeIfPresent(self.sortBy, forKey: .sortBy) try container.encodeIfPresent(self.limit, forKey: .limit) try container.encodeIfPresent(self.createdAtGt, forKey: .createdAtGt) try container.encodeIfPresent(self.createdAtLt, forKey: .createdAtLt) @@ -160,6 +166,7 @@ public struct GetSessionPaginatedDto: Codable, Hashable, Sendable { case phoneNumberIdAny case page case sortOrder + case sortBy case limit case createdAtGt case createdAtLt diff --git a/Sources/Schemas/GetSessionPaginatedDtoSortBy.swift b/Sources/Schemas/GetSessionPaginatedDtoSortBy.swift new file mode 100644 index 00000000..f970c411 --- /dev/null +++ b/Sources/Schemas/GetSessionPaginatedDtoSortBy.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the column to sort by. Defaults to 'createdAt'. +public enum GetSessionPaginatedDtoSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/GetToolDraftsDto.swift b/Sources/Schemas/GetToolDraftsDto.swift new file mode 100644 index 00000000..50d2909d --- /dev/null +++ b/Sources/Schemas/GetToolDraftsDto.swift @@ -0,0 +1,46 @@ +import Foundation + +public struct GetToolDraftsDto: Codable, Hashable, Sendable { + /// Opaque base64-encoded keyset cursor. Omit on first page. + public let cursor: String? + /// Page size, defaults to 25, capped at 100. + public let limit: Double? + public let createdBy: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + cursor: String? = nil, + limit: Double? = nil, + createdBy: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.cursor = cursor + self.limit = limit + self.createdBy = createdBy + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cursor = try container.decodeIfPresent(String.self, forKey: .cursor) + self.limit = try container.decodeIfPresent(Double.self, forKey: .limit) + self.createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.cursor, forKey: .cursor) + try container.encodeIfPresent(self.limit, forKey: .limit) + try container.encodeIfPresent(self.createdBy, forKey: .createdBy) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case cursor + case limit + case createdBy + } +} \ No newline at end of file diff --git a/Sources/Schemas/GhlTool.swift b/Sources/Schemas/GhlTool.swift index 8d15ef23..ca9d5a41 100644 --- a/Sources/Schemas/GhlTool.swift +++ b/Sources/Schemas/GhlTool.swift @@ -1,9 +1,8 @@ import Foundation public struct GhlTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GhlToolMessagesItem]? /// The type of tool. "ghl" for GHL tool. public let type: GhlToolType @@ -99,6 +98,7 @@ public struct GhlTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GhlToolMessagesItem]? = nil, type: GhlToolType, id: String, @@ -109,6 +109,7 @@ public struct GhlTool: Codable, Hashable, Sendable { metadata: GhlToolMetadata, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.type = type self.id = id @@ -122,6 +123,7 @@ public struct GhlTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GhlToolMessagesItem].self, forKey: .messages) self.type = try container.decode(GhlToolType.self, forKey: .type) self.id = try container.decode(String.self, forKey: .id) @@ -136,6 +138,7 @@ public struct GhlTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.type, forKey: .type) try container.encode(self.id, forKey: .id) @@ -148,6 +151,7 @@ public struct GhlTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case type case id diff --git a/Sources/Schemas/GhlToolMetadata.swift b/Sources/Schemas/GhlToolMetadata.swift index dee74bc5..562ecf8e 100644 --- a/Sources/Schemas/GhlToolMetadata.swift +++ b/Sources/Schemas/GhlToolMetadata.swift @@ -1,7 +1,10 @@ import Foundation +/// GHL workflow and location identifiers attached to a tool. public struct GhlToolMetadata: Codable, Hashable, Sendable { + /// GHL workflow identifier associated with the tool. public let workflowId: String? + /// GHL location identifier associated with the tool. public let locationId: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/GhlToolWithToolCall.swift b/Sources/Schemas/GhlToolWithToolCall.swift index 540e2c69..c75bb068 100644 --- a/Sources/Schemas/GhlToolWithToolCall.swift +++ b/Sources/Schemas/GhlToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GhlToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GhlToolWithToolCallMessagesItem]? public let toolCall: ToolCall public let metadata: GhlToolMetadata diff --git a/Sources/Schemas/GladiaCustomVocabularyConfigDto.swift b/Sources/Schemas/GladiaCustomVocabularyConfigDto.swift index b5021cba..29937713 100644 --- a/Sources/Schemas/GladiaCustomVocabularyConfigDto.swift +++ b/Sources/Schemas/GladiaCustomVocabularyConfigDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Custom vocabulary configuration for Gladia transcription, including vocabulary items and default recognition intensity. public struct GladiaCustomVocabularyConfigDto: Codable, Hashable, Sendable { /// Array of vocabulary items (strings or objects with value, pronunciations, intensity, language) public let vocabulary: [GladiaCustomVocabularyConfigDtoVocabularyItem] diff --git a/Sources/Schemas/GladiaTranscriber.swift b/Sources/Schemas/GladiaTranscriber.swift index c5d2a3ce..c4328bb7 100644 --- a/Sources/Schemas/GladiaTranscriber.swift +++ b/Sources/Schemas/GladiaTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Gladia, including language behavior, audio processing, endpointing, vocabulary, region, and fallback settings. public struct GladiaTranscriber: Codable, Hashable, Sendable { /// This is the Gladia model that will be used. Default is 'fast' public let model: GladiaTranscriberModel? @@ -8,7 +9,7 @@ public struct GladiaTranscriber: Codable, Hashable, Sendable { /// Defines the language to use for the transcription. Required when languageBehaviour is 'manual'. public let language: GladiaTranscriberLanguage? /// Defines the languages to use for the transcription. Required when languageBehaviour is 'manual'. - public let languages: GladiaTranscriberLanguages? + public let languages: [GladiaTranscriberLanguagesItem]? /// Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. /// ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit. public let transcriptionHint: String? @@ -41,7 +42,7 @@ public struct GladiaTranscriber: Codable, Hashable, Sendable { model: GladiaTranscriberModel? = nil, languageBehaviour: GladiaTranscriberLanguageBehaviour? = nil, language: GladiaTranscriberLanguage? = nil, - languages: GladiaTranscriberLanguages? = nil, + languages: [GladiaTranscriberLanguagesItem]? = nil, transcriptionHint: String? = nil, prosody: Bool? = nil, audioEnhancer: Bool? = nil, @@ -78,7 +79,7 @@ public struct GladiaTranscriber: Codable, Hashable, Sendable { self.model = try container.decodeIfPresent(GladiaTranscriberModel.self, forKey: .model) self.languageBehaviour = try container.decodeIfPresent(GladiaTranscriberLanguageBehaviour.self, forKey: .languageBehaviour) self.language = try container.decodeIfPresent(GladiaTranscriberLanguage.self, forKey: .language) - self.languages = try container.decodeIfPresent(GladiaTranscriberLanguages.self, forKey: .languages) + self.languages = try container.decodeIfPresent([GladiaTranscriberLanguagesItem].self, forKey: .languages) self.transcriptionHint = try container.decodeIfPresent(String.self, forKey: .transcriptionHint) self.prosody = try container.decodeIfPresent(Bool.self, forKey: .prosody) self.audioEnhancer = try container.decodeIfPresent(Bool.self, forKey: .audioEnhancer) diff --git a/Sources/Schemas/FallbackGladiaTranscriberLanguages.swift b/Sources/Schemas/GladiaTranscriberLanguagesItem.swift similarity index 85% rename from Sources/Schemas/FallbackGladiaTranscriberLanguages.swift rename to Sources/Schemas/GladiaTranscriberLanguagesItem.swift index 1bfeca73..fd2edc13 100644 --- a/Sources/Schemas/FallbackGladiaTranscriberLanguages.swift +++ b/Sources/Schemas/GladiaTranscriberLanguagesItem.swift @@ -1,7 +1,6 @@ import Foundation -/// Defines the languages to use for the transcription. Required when languageBehaviour is 'manual'. -public enum FallbackGladiaTranscriberLanguages: String, Codable, Hashable, CaseIterable, Sendable { +public enum GladiaTranscriberLanguagesItem: String, Codable, Hashable, CaseIterable, Sendable { case af case sq case am diff --git a/Sources/Schemas/GladiaVocabularyItemDto.swift b/Sources/Schemas/GladiaVocabularyItemDto.swift index 9da1afdf..b61a1a03 100644 --- a/Sources/Schemas/GladiaVocabularyItemDto.swift +++ b/Sources/Schemas/GladiaVocabularyItemDto.swift @@ -1,5 +1,6 @@ import Foundation +/// A Gladia custom vocabulary word or phrase with optional pronunciations, intensity, and language. public struct GladiaVocabularyItemDto: Codable, Hashable, Sendable { /// The vocabulary word or phrase public let value: String diff --git a/Sources/Schemas/GlobalNodePlan.swift b/Sources/Schemas/GlobalNodePlan.swift index 182e2d5b..a3503ba8 100644 --- a/Sources/Schemas/GlobalNodePlan.swift +++ b/Sources/Schemas/GlobalNodePlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls whether a conversation node can be entered globally and the condition evaluated before that node runs. public struct GlobalNodePlan: Codable, Hashable, Sendable { /// This is the flag to determine if this node is a global node /// diff --git a/Sources/Schemas/GoHighLevelCalendarAvailabilityTool.swift b/Sources/Schemas/GoHighLevelCalendarAvailabilityTool.swift index fa8447b7..33a1505a 100644 --- a/Sources/Schemas/GoHighLevelCalendarAvailabilityTool.swift +++ b/Sources/Schemas/GoHighLevelCalendarAvailabilityTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that checks calendar availability in a connected GoHighLevel account. public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelCalendarAvailabilityToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoHighLevelCalendarAvailabilityToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoHighLevelCalendarAvailabilityToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoHighLevelCalendarAvailabilityTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoHighLevelCalendarAvailabilityToolWithToolCall.swift b/Sources/Schemas/GoHighLevelCalendarAvailabilityToolWithToolCall.swift index 68168418..9f61be45 100644 --- a/Sources/Schemas/GoHighLevelCalendarAvailabilityToolWithToolCall.swift +++ b/Sources/Schemas/GoHighLevelCalendarAvailabilityToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoHighLevelCalendarAvailabilityToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelCalendarAvailabilityToolWithToolCallMessagesItem]? /// The type of tool. "gohighlevel.calendar.availability.check" for GoHighLevel Calendar Availability Check tool. public let type: GoHighLevelCalendarAvailabilityToolWithToolCallType diff --git a/Sources/Schemas/GoHighLevelCalendarEventCreateTool.swift b/Sources/Schemas/GoHighLevelCalendarEventCreateTool.swift index 7615b27d..0ab7d4d1 100644 --- a/Sources/Schemas/GoHighLevelCalendarEventCreateTool.swift +++ b/Sources/Schemas/GoHighLevelCalendarEventCreateTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that adds calendar events to a connected GoHighLevel account. public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelCalendarEventCreateToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoHighLevelCalendarEventCreateToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoHighLevelCalendarEventCreateToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoHighLevelCalendarEventCreateTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoHighLevelCalendarEventCreateToolWithToolCall.swift b/Sources/Schemas/GoHighLevelCalendarEventCreateToolWithToolCall.swift index 21b0316d..23b5c223 100644 --- a/Sources/Schemas/GoHighLevelCalendarEventCreateToolWithToolCall.swift +++ b/Sources/Schemas/GoHighLevelCalendarEventCreateToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoHighLevelCalendarEventCreateToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelCalendarEventCreateToolWithToolCallMessagesItem]? /// The type of tool. "gohighlevel.calendar.event.create" for GoHighLevel Calendar Event Create tool. public let type: GoHighLevelCalendarEventCreateToolWithToolCallType diff --git a/Sources/Schemas/GoHighLevelContactCreateTool.swift b/Sources/Schemas/GoHighLevelContactCreateTool.swift index a91bc8aa..c8c36115 100644 --- a/Sources/Schemas/GoHighLevelContactCreateTool.swift +++ b/Sources/Schemas/GoHighLevelContactCreateTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that adds contacts to a connected GoHighLevel account. public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelContactCreateToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoHighLevelContactCreateToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoHighLevelContactCreateToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoHighLevelContactCreateTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoHighLevelContactCreateToolWithToolCall.swift b/Sources/Schemas/GoHighLevelContactCreateToolWithToolCall.swift index b15750a7..c88d87f5 100644 --- a/Sources/Schemas/GoHighLevelContactCreateToolWithToolCall.swift +++ b/Sources/Schemas/GoHighLevelContactCreateToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoHighLevelContactCreateToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelContactCreateToolWithToolCallMessagesItem]? /// The type of tool. "gohighlevel.contact.create" for GoHighLevel Contact Create tool. public let type: GoHighLevelContactCreateToolWithToolCallType diff --git a/Sources/Schemas/GoHighLevelContactGetTool.swift b/Sources/Schemas/GoHighLevelContactGetTool.swift index 525d1f80..17c957df 100644 --- a/Sources/Schemas/GoHighLevelContactGetTool.swift +++ b/Sources/Schemas/GoHighLevelContactGetTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that retrieves contacts from a connected GoHighLevel account. public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelContactGetToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoHighLevelContactGetToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoHighLevelContactGetToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoHighLevelContactGetTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoHighLevelContactGetToolWithToolCall.swift b/Sources/Schemas/GoHighLevelContactGetToolWithToolCall.swift index f4312d31..f4ddbb3a 100644 --- a/Sources/Schemas/GoHighLevelContactGetToolWithToolCall.swift +++ b/Sources/Schemas/GoHighLevelContactGetToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoHighLevelContactGetToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoHighLevelContactGetToolWithToolCallMessagesItem]? /// The type of tool. "gohighlevel.contact.get" for GoHighLevel Contact Get tool. public let type: GoHighLevelContactGetToolWithToolCallType diff --git a/Sources/Schemas/GoogleCalendarCheckAvailabilityTool.swift b/Sources/Schemas/GoogleCalendarCheckAvailabilityTool.swift index 7359ce6f..3fd2a87e 100644 --- a/Sources/Schemas/GoogleCalendarCheckAvailabilityTool.swift +++ b/Sources/Schemas/GoogleCalendarCheckAvailabilityTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that checks availability in a connected Google Calendar. public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoogleCalendarCheckAvailabilityToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoogleCalendarCheckAvailabilityToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoogleCalendarCheckAvailabilityToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoogleCalendarCheckAvailabilityTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoogleCalendarCreateEventTool.swift b/Sources/Schemas/GoogleCalendarCreateEventTool.swift index 811d8a6c..2d0a4e09 100644 --- a/Sources/Schemas/GoogleCalendarCreateEventTool.swift +++ b/Sources/Schemas/GoogleCalendarCreateEventTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that adds events to a connected Google Calendar. public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoogleCalendarCreateEventToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoogleCalendarCreateEventToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoogleCalendarCreateEventToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoogleCalendarCreateEventTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoogleCalendarCreateEventToolWithToolCall.swift b/Sources/Schemas/GoogleCalendarCreateEventToolWithToolCall.swift index a392862e..462da427 100644 --- a/Sources/Schemas/GoogleCalendarCreateEventToolWithToolCall.swift +++ b/Sources/Schemas/GoogleCalendarCreateEventToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoogleCalendarCreateEventToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoogleCalendarCreateEventToolWithToolCallMessagesItem]? public let toolCall: ToolCall /// This is the plan to reject a tool call based on the conversation state. diff --git a/Sources/Schemas/GoogleModel.swift b/Sources/Schemas/GoogleModel.swift index aa774f26..f67e54b9 100644 --- a/Sources/Schemas/GoogleModel.swift +++ b/Sources/Schemas/GoogleModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Google, including model, prompts, tools, knowledge-base access, realtime settings, and generation settings. public struct GoogleModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,6 +12,11 @@ public struct GoogleModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the Google model that will be used. @@ -18,7 +24,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { /// This is the session configuration for the Gemini Flash 2.0 Multimodal Live API. /// Only applicable if the model `gemini-2.0-flash-realtime-exp` is selected. public let realtimeConfig: GoogleRealtimeConfig? - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -41,6 +47,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [GoogleModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: GoogleModelModel, realtimeConfig: GoogleRealtimeConfig? = nil, @@ -53,6 +60,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.realtimeConfig = realtimeConfig @@ -68,6 +76,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([GoogleModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(GoogleModelModel.self, forKey: .model) self.realtimeConfig = try container.decodeIfPresent(GoogleRealtimeConfig.self, forKey: .realtimeConfig) @@ -84,6 +93,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.realtimeConfig, forKey: .realtimeConfig) @@ -98,6 +108,7 @@ public struct GoogleModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case realtimeConfig diff --git a/Sources/Schemas/GoogleModelModel.swift b/Sources/Schemas/GoogleModelModel.swift index b6c92554..62d548e3 100644 --- a/Sources/Schemas/GoogleModelModel.swift +++ b/Sources/Schemas/GoogleModelModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the Google model that will be used. public enum GoogleModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/GoogleRealtimeConfig.swift b/Sources/Schemas/GoogleRealtimeConfig.swift index 9d04d6ee..3287b01e 100644 --- a/Sources/Schemas/GoogleRealtimeConfig.swift +++ b/Sources/Schemas/GoogleRealtimeConfig.swift @@ -1,5 +1,6 @@ import Foundation +/// Realtime Gemini generation and speech-output settings, including sampling, repetition penalties, and voice configuration. public struct GoogleRealtimeConfig: Codable, Hashable, Sendable { /// This is the nucleus sampling parameter that controls the cumulative probability of tokens considered during text generation. /// Only applicable with the Gemini Flash 2.0 Multimodal Live API. diff --git a/Sources/Schemas/GoogleSheetsRowAppendTool.swift b/Sources/Schemas/GoogleSheetsRowAppendTool.swift index 30ff19d3..808f4c4e 100644 --- a/Sources/Schemas/GoogleSheetsRowAppendTool.swift +++ b/Sources/Schemas/GoogleSheetsRowAppendTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that appends rows to a connected Google Sheet. public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoogleSheetsRowAppendToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [GoogleSheetsRowAppendToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([GoogleSheetsRowAppendToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct GoogleSheetsRowAppendTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/GoogleSheetsRowAppendToolWithToolCall.swift b/Sources/Schemas/GoogleSheetsRowAppendToolWithToolCall.swift index f4908034..7ea6a69f 100644 --- a/Sources/Schemas/GoogleSheetsRowAppendToolWithToolCall.swift +++ b/Sources/Schemas/GoogleSheetsRowAppendToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct GoogleSheetsRowAppendToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [GoogleSheetsRowAppendToolWithToolCallMessagesItem]? /// The type of tool. "google.sheets.row.append" for Google Sheets Row Append tool. public let type: GoogleSheetsRowAppendToolWithToolCallType diff --git a/Sources/Schemas/GoogleTranscriber.swift b/Sources/Schemas/GoogleTranscriber.swift index cf8309c5..12012b7f 100644 --- a/Sources/Schemas/GoogleTranscriber.swift +++ b/Sources/Schemas/GoogleTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Google, including model, language, and fallback settings. public struct GoogleTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: GoogleTranscriberModel? diff --git a/Sources/Schemas/GoogleTranscriberModel.swift b/Sources/Schemas/GoogleTranscriberModel.swift index b86ec83e..a3ef75cb 100644 --- a/Sources/Schemas/GoogleTranscriberModel.swift +++ b/Sources/Schemas/GoogleTranscriberModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the model that will be used for the transcription. public enum GoogleTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/GoogleVoicemailDetectionPlan.swift b/Sources/Schemas/GoogleVoicemailDetectionPlan.swift index ace4ec81..bf6756c2 100644 --- a/Sources/Schemas/GoogleVoicemailDetectionPlan.swift +++ b/Sources/Schemas/GoogleVoicemailDetectionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for detecting voicemail with Google, including detection type, maximum beep wait, and retry backoff. public struct GoogleVoicemailDetectionPlan: Codable, Hashable, Sendable { /// This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message /// diff --git a/Sources/Schemas/GroqModel.swift b/Sources/Schemas/GroqModel.swift index 9ca10780..6e3f2c28 100644 --- a/Sources/Schemas/GroqModel.swift +++ b/Sources/Schemas/GroqModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Groq, including model, prompts, tools, knowledge-base access, and generation settings. public struct GroqModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct GroqModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: GroqModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct GroqModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [GroqModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: GroqModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct GroqModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct GroqModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([GroqModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(GroqModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct GroqModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct GroqModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/GroqModelModel.swift b/Sources/Schemas/GroqModelModel.swift index bc2ae204..bdfcff3b 100644 --- a/Sources/Schemas/GroqModelModel.swift +++ b/Sources/Schemas/GroqModelModel.swift @@ -12,7 +12,6 @@ public enum GroqModelModel: String, Codable, Hashable, CaseIterable, Sendable { case llama370B8192 = "llama3-70b-8192" case gemma29BIt = "gemma2-9b-it" case moonshotaiKimiK2Instruct0905 = "moonshotai/kimi-k2-instruct-0905" - case metaLlamaLlama4Maverick17B128EInstruct = "meta-llama/llama-4-maverick-17b-128e-instruct" case metaLlamaLlama4Scout17B16EInstruct = "meta-llama/llama-4-scout-17b-16e-instruct" case mistralSaba24B = "mistral-saba-24b" case compoundBeta = "compound-beta" diff --git a/Sources/Schemas/GroupCondition.swift b/Sources/Schemas/GroupCondition.swift index 9b8cf208..187d90a6 100644 --- a/Sources/Schemas/GroupCondition.swift +++ b/Sources/Schemas/GroupCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Combines nested regular-expression, Liquid, or grouped conditions with an `AND` or `OR` operator. public struct GroupCondition: Codable, Hashable, Sendable { /// This is the logical operator for combining conditions in this group public let `operator`: GroupConditionOperator diff --git a/Sources/Schemas/HandoffDestinationAssistant.swift b/Sources/Schemas/HandoffDestinationAssistant.swift index 6e605c2f..6f4cce94 100644 --- a/Sources/Schemas/HandoffDestinationAssistant.swift +++ b/Sources/Schemas/HandoffDestinationAssistant.swift @@ -1,6 +1,8 @@ import Foundation +/// Routes a handoff to a saved or transient assistant, with optional context engineering, variable extraction, and assistant overrides. public struct HandoffDestinationAssistant: Codable, Hashable, Sendable { + /// Selects an assistant as the handoff destination. public let type: HandoffDestinationAssistantType /// This is the plan for manipulating the message context before handing off the call to the next assistant. public let contextEngineeringPlan: HandoffDestinationAssistantContextEngineeringPlan? diff --git a/Sources/Schemas/HandoffDestinationAssistantContextEngineeringPlan.swift b/Sources/Schemas/HandoffDestinationAssistantContextEngineeringPlan.swift index 8afdb2f8..982dc472 100644 --- a/Sources/Schemas/HandoffDestinationAssistantContextEngineeringPlan.swift +++ b/Sources/Schemas/HandoffDestinationAssistantContextEngineeringPlan.swift @@ -5,6 +5,7 @@ public enum HandoffDestinationAssistantContextEngineeringPlan: Codable, Hashable case all(ContextEngineeringPlanAll) case lastNMessages(ContextEngineeringPlanLastNMessages) case none(ContextEngineeringPlanNone) + case previousAssistantMessages(ContextEngineeringPlanPreviousAssistantMessages) case userAndAssistantMessages(ContextEngineeringPlanUserAndAssistantMessages) public init(from decoder: Decoder) throws { @@ -17,6 +18,8 @@ public enum HandoffDestinationAssistantContextEngineeringPlan: Codable, Hashable self = .lastNMessages(try ContextEngineeringPlanLastNMessages(from: decoder)) case "none": self = .none(try ContextEngineeringPlanNone(from: decoder)) + case "previousAssistantMessages": + self = .previousAssistantMessages(try ContextEngineeringPlanPreviousAssistantMessages(from: decoder)) case "userAndAssistantMessages": self = .userAndAssistantMessages(try ContextEngineeringPlanUserAndAssistantMessages(from: decoder)) default: @@ -41,6 +44,9 @@ public enum HandoffDestinationAssistantContextEngineeringPlan: Codable, Hashable case .none(let data): try container.encode("none", forKey: .type) try data.encode(to: encoder) + case .previousAssistantMessages(let data): + try container.encode("previousAssistantMessages", forKey: .type) + try data.encode(to: encoder) case .userAndAssistantMessages(let data): try container.encode("userAndAssistantMessages", forKey: .type) try data.encode(to: encoder) diff --git a/Sources/Schemas/HandoffDestinationAssistantType.swift b/Sources/Schemas/HandoffDestinationAssistantType.swift index 875f2e69..fe2154d2 100644 --- a/Sources/Schemas/HandoffDestinationAssistantType.swift +++ b/Sources/Schemas/HandoffDestinationAssistantType.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects an assistant as the handoff destination. public enum HandoffDestinationAssistantType: String, Codable, Hashable, CaseIterable, Sendable { case assistant } \ No newline at end of file diff --git a/Sources/Schemas/HandoffDestinationDynamic.swift b/Sources/Schemas/HandoffDestinationDynamic.swift index 6d4879cf..e1e5cda1 100644 --- a/Sources/Schemas/HandoffDestinationDynamic.swift +++ b/Sources/Schemas/HandoffDestinationDynamic.swift @@ -1,5 +1,6 @@ import Foundation +/// Uses a webhook response to select the handoff destination at runtime. public struct HandoffDestinationDynamic: Codable, Hashable, Sendable { /// This is where Vapi will send the handoff-destination-request webhook in a dynamic handoff. /// diff --git a/Sources/Schemas/HandoffDestinationSquad.swift b/Sources/Schemas/HandoffDestinationSquad.swift index 8cfc2a8a..cd02658e 100644 --- a/Sources/Schemas/HandoffDestinationSquad.swift +++ b/Sources/Schemas/HandoffDestinationSquad.swift @@ -1,5 +1,6 @@ import Foundation +/// Routes a handoff to a saved or transient squad, with optional entry assistant, context engineering, variable extraction, and overrides. public struct HandoffDestinationSquad: Codable, Hashable, Sendable { /// This is the plan for manipulating the message context before handing off the call to the squad. public let contextEngineeringPlan: HandoffDestinationSquadContextEngineeringPlan? diff --git a/Sources/Schemas/HandoffDestinationSquadContextEngineeringPlan.swift b/Sources/Schemas/HandoffDestinationSquadContextEngineeringPlan.swift index c1b9bd91..e014c5fe 100644 --- a/Sources/Schemas/HandoffDestinationSquadContextEngineeringPlan.swift +++ b/Sources/Schemas/HandoffDestinationSquadContextEngineeringPlan.swift @@ -5,6 +5,7 @@ public enum HandoffDestinationSquadContextEngineeringPlan: Codable, Hashable, Se case all(ContextEngineeringPlanAll) case lastNMessages(ContextEngineeringPlanLastNMessages) case none(ContextEngineeringPlanNone) + case previousAssistantMessages(ContextEngineeringPlanPreviousAssistantMessages) case userAndAssistantMessages(ContextEngineeringPlanUserAndAssistantMessages) public init(from decoder: Decoder) throws { @@ -17,6 +18,8 @@ public enum HandoffDestinationSquadContextEngineeringPlan: Codable, Hashable, Se self = .lastNMessages(try ContextEngineeringPlanLastNMessages(from: decoder)) case "none": self = .none(try ContextEngineeringPlanNone(from: decoder)) + case "previousAssistantMessages": + self = .previousAssistantMessages(try ContextEngineeringPlanPreviousAssistantMessages(from: decoder)) case "userAndAssistantMessages": self = .userAndAssistantMessages(try ContextEngineeringPlanUserAndAssistantMessages(from: decoder)) default: @@ -41,6 +44,9 @@ public enum HandoffDestinationSquadContextEngineeringPlan: Codable, Hashable, Se case .none(let data): try container.encode("none", forKey: .type) try data.encode(to: encoder) + case .previousAssistantMessages(let data): + try container.encode("previousAssistantMessages", forKey: .type) + try data.encode(to: encoder) case .userAndAssistantMessages(let data): try container.encode("userAndAssistantMessages", forKey: .type) try data.encode(to: encoder) diff --git a/Sources/Schemas/HandoffTool.swift b/Sources/Schemas/HandoffTool.swift index 5abb4789..1b15a1b3 100644 --- a/Sources/Schemas/HandoffTool.swift +++ b/Sources/Schemas/HandoffTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that hands a conversation to another assistant, squad, or dynamically selected destination. public struct HandoffTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [HandoffToolMessagesItem]? /// This is the default local tool result message used when no runtime handoff result override is returned. public let defaultResult: String? @@ -366,6 +366,7 @@ public struct HandoffTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [HandoffToolMessagesItem]? = nil, defaultResult: String? = nil, destinations: [HandoffToolDestinationsItem]? = nil, @@ -377,6 +378,7 @@ public struct HandoffTool: Codable, Hashable, Sendable { function: OpenAiFunction? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.defaultResult = defaultResult self.destinations = destinations @@ -391,6 +393,7 @@ public struct HandoffTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([HandoffToolMessagesItem].self, forKey: .messages) self.defaultResult = try container.decodeIfPresent(String.self, forKey: .defaultResult) self.destinations = try container.decodeIfPresent([HandoffToolDestinationsItem].self, forKey: .destinations) @@ -406,6 +409,7 @@ public struct HandoffTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.defaultResult, forKey: .defaultResult) try container.encodeIfPresent(self.destinations, forKey: .destinations) @@ -419,6 +423,7 @@ public struct HandoffTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case defaultResult case destinations diff --git a/Sources/Schemas/HmacAuthenticationPlan.swift b/Sources/Schemas/HmacAuthenticationPlan.swift index e368d509..85437230 100644 --- a/Sources/Schemas/HmacAuthenticationPlan.swift +++ b/Sources/Schemas/HmacAuthenticationPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for signing outbound requests with an HMAC secret, including algorithm, headers, payload format, and signature encoding. public struct HmacAuthenticationPlan: Codable, Hashable, Sendable { /// This is the HMAC secret key used to sign requests. public let secretKey: String diff --git a/Sources/Schemas/HumeVoice.swift b/Sources/Schemas/HumeVoice.swift index a759f0c8..9b6902e1 100644 --- a/Sources/Schemas/HumeVoice.swift +++ b/Sources/Schemas/HumeVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Hume, including model and voice selection, custom voice metadata, chunking, caching, and fallback settings. public struct HumeVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/ImportTwilioPhoneNumberDto.swift b/Sources/Schemas/ImportTwilioPhoneNumberDto.swift index 1d8d02d3..02daacc0 100644 --- a/Sources/Schemas/ImportTwilioPhoneNumberDto.swift +++ b/Sources/Schemas/ImportTwilioPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for importing a Twilio phone number into Vapi, including Twilio credentials, routing target, fallback destination, hooks, SMS, and server settings. public struct ImportTwilioPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/InflectionAiModel.swift b/Sources/Schemas/InflectionAiModel.swift index dfbbe307..f54078ec 100644 --- a/Sources/Schemas/InflectionAiModel.swift +++ b/Sources/Schemas/InflectionAiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Inflection AI, including model, prompts, tools, knowledge-base access, and generation settings. public struct InflectionAiModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: InflectionAiModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [InflectionAiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: InflectionAiModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([InflectionAiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(InflectionAiModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct InflectionAiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/Insight.swift b/Sources/Schemas/Insight.swift index 9c43f922..2a7e5a46 100644 --- a/Sources/Schemas/Insight.swift +++ b/Sources/Schemas/Insight.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved insight returned by the API, including its visualization type, identity, organization, and lifecycle timestamps. public struct Insight: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -13,6 +14,8 @@ public struct Insight: Codable, Hashable, Sendable { public let createdAt: Date /// This is the ISO 8601 date-time string of when the Insight was last updated. public let updatedAt: Date + /// Stable server-owned identifier for system-created insights. + public let systemKey: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -23,6 +26,7 @@ public struct Insight: Codable, Hashable, Sendable { orgId: String, createdAt: Date, updatedAt: Date, + systemKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name @@ -31,6 +35,7 @@ public struct Insight: Codable, Hashable, Sendable { self.orgId = orgId self.createdAt = createdAt self.updatedAt = updatedAt + self.systemKey = systemKey self.additionalProperties = additionalProperties } @@ -42,6 +47,7 @@ public struct Insight: Codable, Hashable, Sendable { self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -54,6 +60,7 @@ public struct Insight: Codable, Hashable, Sendable { try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) } /// Keys for encoding/decoding struct properties. @@ -64,5 +71,6 @@ public struct Insight: Codable, Hashable, Sendable { case orgId case createdAt case updatedAt + case systemKey } } \ No newline at end of file diff --git a/Sources/Schemas/InsightControllerFindAllRequestSortBy.swift b/Sources/Schemas/InsightControllerFindAllRequestSortBy.swift new file mode 100644 index 00000000..988c0c73 --- /dev/null +++ b/Sources/Schemas/InsightControllerFindAllRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum InsightControllerFindAllRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/InsightFormula.swift b/Sources/Schemas/InsightFormula.swift index 4bff1d21..70987e2c 100644 --- a/Sources/Schemas/InsightFormula.swift +++ b/Sources/Schemas/InsightFormula.swift @@ -1,5 +1,6 @@ import Foundation +/// A formula used to calculate an insight from its query results, with an optional display name. public struct InsightFormula: Codable, Hashable, Sendable { /// This is the name of the formula. /// It will be used to label the formula in the insight board on the UI. diff --git a/Sources/Schemas/InsightPaginatedResponse.swift b/Sources/Schemas/InsightPaginatedResponse.swift index 8ac673c0..611645d7 100644 --- a/Sources/Schemas/InsightPaginatedResponse.swift +++ b/Sources/Schemas/InsightPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of saved reporting insights and metadata describing the result set. public struct InsightPaginatedResponse: Codable, Hashable, Sendable { + /// The reporting insights returned for the current page. public let results: [Insight] + /// Pagination metadata for the insight result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/InsightRunFormatPlan.swift b/Sources/Schemas/InsightRunFormatPlan.swift index 5c85e06a..2be2520a 100644 --- a/Sources/Schemas/InsightRunFormatPlan.swift +++ b/Sources/Schemas/InsightRunFormatPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects whether an insight run returns raw data or Recharts-formatted data. public struct InsightRunFormatPlan: Codable, Hashable, Sendable { /// This is the format of the data to return. /// If not provided, defaults to "raw". diff --git a/Sources/Schemas/InsightRunResponse.swift b/Sources/Schemas/InsightRunResponse.swift index d419c269..10ff38ae 100644 --- a/Sources/Schemas/InsightRunResponse.swift +++ b/Sources/Schemas/InsightRunResponse.swift @@ -1,10 +1,16 @@ import Foundation +/// Metadata identifying a saved insight run and its lifecycle timestamps. public struct InsightRunResponse: Codable, Hashable, Sendable { + /// The unique identifier for the insight run. public let id: String + /// The unique identifier for the insight that was run. public let insightId: String + /// The unique identifier for the organization that owns the run. public let orgId: String + /// The ISO 8601 timestamp when the insight run was created. public let createdAt: Date + /// The ISO 8601 timestamp when the insight run was last updated. public let updatedAt: Date /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/InsightTimeRange.swift b/Sources/Schemas/InsightTimeRange.swift index 75491644..38caa2c0 100644 --- a/Sources/Schemas/InsightTimeRange.swift +++ b/Sources/Schemas/InsightTimeRange.swift @@ -1,5 +1,6 @@ import Foundation +/// Start, end, and timezone used to limit an insight query by time. public struct InsightTimeRange: Codable, Hashable, Sendable { /// This is the start date for the time range. /// diff --git a/Sources/Schemas/InsightTimeRangeWithStep.swift b/Sources/Schemas/InsightTimeRangeWithStep.swift index 821470a1..b82e7993 100644 --- a/Sources/Schemas/InsightTimeRangeWithStep.swift +++ b/Sources/Schemas/InsightTimeRangeWithStep.swift @@ -1,5 +1,6 @@ import Foundation +/// Start, end, timezone, and aggregation step used for a time-series insight query. public struct InsightTimeRangeWithStep: Codable, Hashable, Sendable { /// This is the group by step for aggregation. /// diff --git a/Sources/Schemas/InviteUserDtoRole.swift b/Sources/Schemas/InviteUserDtoRole.swift index f2b1b3e1..e7993dac 100644 --- a/Sources/Schemas/InviteUserDtoRole.swift +++ b/Sources/Schemas/InviteUserDtoRole.swift @@ -1,7 +1,30 @@ import Foundation -public enum InviteUserDtoRole: String, Codable, Hashable, CaseIterable, Sendable { - case admin - case editor - case viewer +public enum InviteUserDtoRole: Codable, Hashable, Sendable { + case inviteUserDtoRoleZero(InviteUserDtoRoleZero) + case string(String) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(InviteUserDtoRoleZero.self) { + self = .inviteUserDtoRoleZero(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .inviteUserDtoRoleZero(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + } + } } \ No newline at end of file diff --git a/Sources/Schemas/InviteUserDtoRoleZero.swift b/Sources/Schemas/InviteUserDtoRoleZero.swift new file mode 100644 index 00000000..ce6141ca --- /dev/null +++ b/Sources/Schemas/InviteUserDtoRoleZero.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum InviteUserDtoRoleZero: String, Codable, Hashable, CaseIterable, Sendable { + case admin + case editor + case viewer +} \ No newline at end of file diff --git a/Sources/Schemas/InworldVoice.swift b/Sources/Schemas/InworldVoice.swift index 9847c753..470e4359 100644 --- a/Sources/Schemas/InworldVoice.swift +++ b/Sources/Schemas/InworldVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Inworld, including voice and model selection, language, temperature, speaking rate, chunking, caching, and fallback settings. public struct InworldVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/JsonQueryOnCallTableWithNumberTypeColumn.swift b/Sources/Schemas/JsonQueryOnCallTableWithNumberTypeColumn.swift index e4cdc167..bb4c98fd 100644 --- a/Sources/Schemas/JsonQueryOnCallTableWithNumberTypeColumn.swift +++ b/Sources/Schemas/JsonQueryOnCallTableWithNumberTypeColumn.swift @@ -1,5 +1,6 @@ import Foundation +/// VapiQL JSON query that aggregates a numeric call-table column with optional call filters. public struct JsonQueryOnCallTableWithNumberTypeColumn: Codable, Hashable, Sendable { /// This is the type of query. Only allowed type is "vapiql-json". public let type: JsonQueryOnCallTableWithNumberTypeColumnType diff --git a/Sources/Schemas/JsonQueryOnCallTableWithStringTypeColumn.swift b/Sources/Schemas/JsonQueryOnCallTableWithStringTypeColumn.swift index 5c53e332..c6463a94 100644 --- a/Sources/Schemas/JsonQueryOnCallTableWithStringTypeColumn.swift +++ b/Sources/Schemas/JsonQueryOnCallTableWithStringTypeColumn.swift @@ -1,5 +1,6 @@ import Foundation +/// VapiQL JSON query that counts values from a string-valued call-table column with optional call filters. public struct JsonQueryOnCallTableWithStringTypeColumn: Codable, Hashable, Sendable { /// This is the type of query. Only allowed type is "vapiql-json". public let type: JsonQueryOnCallTableWithStringTypeColumnType diff --git a/Sources/Schemas/JsonQueryOnCallTableWithStructuredOutputColumn.swift b/Sources/Schemas/JsonQueryOnCallTableWithStructuredOutputColumn.swift index 2d2589ef..625c95dd 100644 --- a/Sources/Schemas/JsonQueryOnCallTableWithStructuredOutputColumn.swift +++ b/Sources/Schemas/JsonQueryOnCallTableWithStructuredOutputColumn.swift @@ -1,5 +1,6 @@ import Foundation +/// VapiQL JSON query that aggregates or counts a structured-output value stored on call records. public struct JsonQueryOnCallTableWithStructuredOutputColumn: Codable, Hashable, Sendable { /// This is the type of query. Only allowed type is "vapiql-json". public let type: JsonQueryOnCallTableWithStructuredOutputColumnType diff --git a/Sources/Schemas/JsonQueryOnEventsTable.swift b/Sources/Schemas/JsonQueryOnEventsTable.swift index f2330960..56d34c04 100644 --- a/Sources/Schemas/JsonQueryOnEventsTable.swift +++ b/Sources/Schemas/JsonQueryOnEventsTable.swift @@ -1,5 +1,6 @@ import Foundation +/// VapiQL JSON query that counts or calculates the percentage of matching events using optional typed event-data filters. public struct JsonQueryOnEventsTable: Codable, Hashable, Sendable { /// This is the type of query. Only allowed type is "vapiql-json". public let type: JsonQueryOnEventsTableType diff --git a/Sources/Schemas/JsonQueryOnEventsTableOn.swift b/Sources/Schemas/JsonQueryOnEventsTableOn.swift index 85ae02ea..6af42e6a 100644 --- a/Sources/Schemas/JsonQueryOnEventsTableOn.swift +++ b/Sources/Schemas/JsonQueryOnEventsTableOn.swift @@ -87,6 +87,7 @@ public enum JsonQueryOnEventsTableOn: String, Codable, Hashable, CaseIterable, S case assistantTranscriberTranscriptIgnored = "assistant.transcriber.transcriptIgnored" case assistantTranscriberLanguageSwitched = "assistant.transcriber.languageSwitched" case assistantAnalysisStructuredOutputGenerated = "assistant.analysis.structuredOutputGenerated" + case assistantAnalysisStructuredOutputSkipped = "assistant.analysis.structuredOutputSkipped" case pipelineTurnStarted = "pipeline.turnStarted" case pipelineCleared = "pipeline.cleared" case pipelineBotSpeechStarted = "pipeline.botSpeechStarted" diff --git a/Sources/Schemas/JsonSchema.swift b/Sources/Schemas/JsonSchema.swift index 4eac5883..dd62ea00 100644 --- a/Sources/Schemas/JsonSchema.swift +++ b/Sources/Schemas/JsonSchema.swift @@ -1,5 +1,6 @@ import Foundation +/// JSON Schema definition used to describe structured data for extraction, validation, or model output. public struct JsonSchema: Codable, Hashable, Sendable { /// This is the type of output you'd like. /// diff --git a/Sources/Schemas/KeypadInputPlan.swift b/Sources/Schemas/KeypadInputPlan.swift index 8612c247..af04fcb3 100644 --- a/Sources/Schemas/KeypadInputPlan.swift +++ b/Sources/Schemas/KeypadInputPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls collection of dual-tone multi-frequency (DTMF) keypad input, including enablement, processing timeout, and delimiters. public struct KeypadInputPlan: Codable, Hashable, Sendable { /// This keeps track of whether the user has enabled keypad input. /// By default, it is off. diff --git a/Sources/Schemas/KnowledgeBase.swift b/Sources/Schemas/KnowledgeBase.swift index 427da95c..0de357e4 100644 --- a/Sources/Schemas/KnowledgeBase.swift +++ b/Sources/Schemas/KnowledgeBase.swift @@ -1,5 +1,6 @@ import Foundation +/// A knowledge-base configuration, including its provider, model, description, and associated files. public struct KnowledgeBase: Codable, Hashable, Sendable { /// The name of the knowledge base public let name: String diff --git a/Sources/Schemas/KnowledgeBaseCost.swift b/Sources/Schemas/KnowledgeBaseCost.swift index 3e41ddf4..718717aa 100644 --- a/Sources/Schemas/KnowledgeBaseCost.swift +++ b/Sources/Schemas/KnowledgeBaseCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Knowledge-base model cost, including model, token usage, and amount. public struct KnowledgeBaseCost: Codable, Hashable, Sendable { /// This is the model that was used for processing the knowledge base. public let model: [String: JSONValue] diff --git a/Sources/Schemas/KnowledgeBaseModel.swift b/Sources/Schemas/KnowledgeBaseModel.swift index fa195fad..ab54a518 100644 --- a/Sources/Schemas/KnowledgeBaseModel.swift +++ b/Sources/Schemas/KnowledgeBaseModel.swift @@ -2,6 +2,8 @@ import Foundation /// The model to use for the knowledge base public enum KnowledgeBaseModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/LangfuseObservabilityPlan.swift b/Sources/Schemas/LangfuseObservabilityPlan.swift index 1913319d..80988cda 100644 --- a/Sources/Schemas/LangfuseObservabilityPlan.swift +++ b/Sources/Schemas/LangfuseObservabilityPlan.swift @@ -1,6 +1,8 @@ import Foundation +/// Configuration for sending assistant call traces to Langfuse, including prompt version linkage, trace naming, tags, and metadata. public struct LangfuseObservabilityPlan: Codable, Hashable, Sendable { + /// Routes assistant call observability data to Langfuse. public let provider: LangfuseObservabilityPlanProvider /// The name of a Langfuse prompt to link generations to. This enables tracking which prompt version was used for each generation. https://langfuse.com/docs/prompt-management/features/link-to-traces public let promptName: String? diff --git a/Sources/Schemas/LangfuseObservabilityPlanProvider.swift b/Sources/Schemas/LangfuseObservabilityPlanProvider.swift index ede50249..17a81695 100644 --- a/Sources/Schemas/LangfuseObservabilityPlanProvider.swift +++ b/Sources/Schemas/LangfuseObservabilityPlanProvider.swift @@ -1,5 +1,6 @@ import Foundation +/// Routes assistant call observability data to Langfuse. public enum LangfuseObservabilityPlanProvider: String, Codable, Hashable, CaseIterable, Sendable { case langfuse } \ No newline at end of file diff --git a/Sources/Schemas/LegacyAssistantVersion.swift b/Sources/Schemas/LegacyAssistantVersion.swift new file mode 100644 index 00000000..1d6e76a9 --- /dev/null +++ b/Sources/Schemas/LegacyAssistantVersion.swift @@ -0,0 +1,56 @@ +import Foundation + +public struct LegacyAssistantVersion: Codable, Hashable, Sendable { + public let id: String + public let assistantId: String + public let orgId: String + public let data: String? + public let createdAt: Date + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + id: String, + assistantId: String, + orgId: String, + data: String? = nil, + createdAt: Date, + additionalProperties: [String: JSONValue] = .init() + ) { + self.id = id + self.assistantId = assistantId + self.orgId = orgId + self.data = data + self.createdAt = createdAt + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.id = try container.decode(String.self, forKey: .id) + self.assistantId = try container.decode(String.self, forKey: .assistantId) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.data = try container.decodeIfPresent(String.self, forKey: .data) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.id, forKey: .id) + try container.encode(self.assistantId, forKey: .assistantId) + try container.encode(self.orgId, forKey: .orgId) + try container.encodeIfPresent(self.data, forKey: .data) + try container.encode(self.createdAt, forKey: .createdAt) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case id + case assistantId + case orgId + case data + case createdAt + } +} \ No newline at end of file diff --git a/Sources/Schemas/LegacyAssistantVersionPaginatedResponse.swift b/Sources/Schemas/LegacyAssistantVersionPaginatedResponse.swift new file mode 100644 index 00000000..258d4fab --- /dev/null +++ b/Sources/Schemas/LegacyAssistantVersionPaginatedResponse.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct LegacyAssistantVersionPaginatedResponse: Codable, Hashable, Sendable { + public let results: [LegacyAssistantVersion] + public let metadata: PaginationMeta + public let nextPageState: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + results: [LegacyAssistantVersion], + metadata: PaginationMeta, + nextPageState: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.results = results + self.metadata = metadata + self.nextPageState = nextPageState + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.results = try container.decode([LegacyAssistantVersion].self, forKey: .results) + self.metadata = try container.decode(PaginationMeta.self, forKey: .metadata) + self.nextPageState = try container.decodeIfPresent(String.self, forKey: .nextPageState) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.results, forKey: .results) + try container.encode(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.nextPageState, forKey: .nextPageState) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case results + case metadata + case nextPageState + } +} \ No newline at end of file diff --git a/Sources/Schemas/LineInsight.swift b/Sources/Schemas/LineInsight.swift index 09a1578e..ef60441a 100644 --- a/Sources/Schemas/LineInsight.swift +++ b/Sources/Schemas/LineInsight.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved line-chart insight containing its call-data queries, formulas, grouping, stepped time range, metadata, and lifecycle information. public struct LineInsight: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct LineInsight: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: LineInsightMetadata? + /// The time range and interval used to aggregate the line-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. @@ -36,6 +38,8 @@ public struct LineInsight: Codable, Hashable, Sendable { public let createdAt: Date /// This is the ISO 8601 date-time string of when the Insight was last updated. public let updatedAt: Date + /// Stable server-owned identifier for system-created insights. + public let systemKey: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -50,6 +54,7 @@ public struct LineInsight: Codable, Hashable, Sendable { orgId: String, createdAt: Date, updatedAt: Date, + systemKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name @@ -62,6 +67,7 @@ public struct LineInsight: Codable, Hashable, Sendable { self.orgId = orgId self.createdAt = createdAt self.updatedAt = updatedAt + self.systemKey = systemKey self.additionalProperties = additionalProperties } @@ -77,6 +83,7 @@ public struct LineInsight: Codable, Hashable, Sendable { self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -93,6 +100,7 @@ public struct LineInsight: Codable, Hashable, Sendable { try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) } /// Keys for encoding/decoding struct properties. @@ -107,5 +115,6 @@ public struct LineInsight: Codable, Hashable, Sendable { case orgId case createdAt case updatedAt + case systemKey } } \ No newline at end of file diff --git a/Sources/Schemas/LineInsightMetadata.swift b/Sources/Schemas/LineInsightMetadata.swift index 434a3094..e4d548b7 100644 --- a/Sources/Schemas/LineInsightMetadata.swift +++ b/Sources/Schemas/LineInsightMetadata.swift @@ -1,10 +1,16 @@ import Foundation +/// Display settings for a line insight, including chart name, axis labels, and optional y-axis bounds. public struct LineInsightMetadata: Codable, Hashable, Sendable { + /// Label displayed on the chart's x-axis. public let xAxisLabel: String? + /// Label displayed on the chart's y-axis. public let yAxisLabel: String? + /// Minimum value displayed on the chart's y-axis. public let yAxisMin: Double? + /// Maximum value displayed on the chart's y-axis. public let yAxisMax: Double? + /// Display name for the insight chart. public let name: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/LiquidCondition.swift b/Sources/Schemas/LiquidCondition.swift index bf96c739..c1f906f9 100644 --- a/Sources/Schemas/LiquidCondition.swift +++ b/Sources/Schemas/LiquidCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Evaluates a Liquid template that must return `true` or `false`. public struct LiquidCondition: Codable, Hashable, Sendable { /// This is the Liquid template that must return exactly "true" or "false" as a string. /// The template is evaluated and the entire output must be either "true" or "false" - nothing else. diff --git a/Sources/Schemas/ListChatsRequestSortBy.swift b/Sources/Schemas/ListChatsRequestSortBy.swift new file mode 100644 index 00000000..080d87b8 --- /dev/null +++ b/Sources/Schemas/ListChatsRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum ListChatsRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/ListSessionsRequestSortBy.swift b/Sources/Schemas/ListSessionsRequestSortBy.swift new file mode 100644 index 00000000..51356199 --- /dev/null +++ b/Sources/Schemas/ListSessionsRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum ListSessionsRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/LivekitSmartEndpointingPlan.swift b/Sources/Schemas/LivekitSmartEndpointingPlan.swift index c89800e9..f8fba05c 100644 --- a/Sources/Schemas/LivekitSmartEndpointingPlan.swift +++ b/Sources/Schemas/LivekitSmartEndpointingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for using LiveKit smart endpointing, including provider selection and wait-function behavior. public struct LivekitSmartEndpointingPlan: Codable, Hashable, Sendable { /// This is the provider for the smart endpointing plan. public let provider: LivekitSmartEndpointingPlanProvider diff --git a/Sources/Schemas/LmntVoice.swift b/Sources/Schemas/LmntVoice.swift index 2499b91e..953c46c5 100644 --- a/Sources/Schemas/LmntVoice.swift +++ b/Sources/Schemas/LmntVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with LMNT, including voice selection, language, speed, chunking, caching, and fallback settings. public struct LmntVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/MakeTool.swift b/Sources/Schemas/MakeTool.swift index d684f436..c7490ae4 100644 --- a/Sources/Schemas/MakeTool.swift +++ b/Sources/Schemas/MakeTool.swift @@ -1,9 +1,8 @@ import Foundation public struct MakeTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [MakeToolMessagesItem]? /// The type of tool. "make" for Make tool. public let type: MakeToolType @@ -99,6 +98,7 @@ public struct MakeTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [MakeToolMessagesItem]? = nil, type: MakeToolType, id: String, @@ -109,6 +109,7 @@ public struct MakeTool: Codable, Hashable, Sendable { metadata: MakeToolMetadata, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.type = type self.id = id @@ -122,6 +123,7 @@ public struct MakeTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([MakeToolMessagesItem].self, forKey: .messages) self.type = try container.decode(MakeToolType.self, forKey: .type) self.id = try container.decode(String.self, forKey: .id) @@ -136,6 +138,7 @@ public struct MakeTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.type, forKey: .type) try container.encode(self.id, forKey: .id) @@ -148,6 +151,7 @@ public struct MakeTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case type case id diff --git a/Sources/Schemas/MakeToolWithToolCall.swift b/Sources/Schemas/MakeToolWithToolCall.swift index 4bc79dba..daf884cf 100644 --- a/Sources/Schemas/MakeToolWithToolCall.swift +++ b/Sources/Schemas/MakeToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct MakeToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [MakeToolWithToolCallMessagesItem]? public let toolCall: ToolCall public let metadata: MakeToolMetadata diff --git a/Sources/Schemas/McpTool.swift b/Sources/Schemas/McpTool.swift index ba23f00e..55b5f3e1 100644 --- a/Sources/Schemas/McpTool.swift +++ b/Sources/Schemas/McpTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that connects an assistant to a Model Context Protocol server and exposes its available tools. public struct McpTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [McpToolMessagesItem]? /// /// This is the server where a `tool-calls` webhook will be sent. @@ -104,11 +104,13 @@ public struct McpTool: Codable, Hashable, Sendable { /// } /// ``` public let rejectionPlan: ToolRejectionPlan? + /// Connection metadata for the MCP server, including its communication protocol. public let metadata: McpToolMetadata? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [McpToolMessagesItem]? = nil, server: Server? = nil, toolMessages: [McpToolMessages]? = nil, @@ -120,6 +122,7 @@ public struct McpTool: Codable, Hashable, Sendable { metadata: McpToolMetadata? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.server = server self.toolMessages = toolMessages @@ -134,6 +137,7 @@ public struct McpTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([McpToolMessagesItem].self, forKey: .messages) self.server = try container.decodeIfPresent(Server.self, forKey: .server) self.toolMessages = try container.decodeIfPresent([McpToolMessages].self, forKey: .toolMessages) @@ -149,6 +153,7 @@ public struct McpTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.server, forKey: .server) try container.encodeIfPresent(self.toolMessages, forKey: .toolMessages) @@ -162,6 +167,7 @@ public struct McpTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case server case toolMessages diff --git a/Sources/Schemas/McpToolMessages.swift b/Sources/Schemas/McpToolMessages.swift index 8850949a..7f69dfbb 100644 --- a/Sources/Schemas/McpToolMessages.swift +++ b/Sources/Schemas/McpToolMessages.swift @@ -1,9 +1,10 @@ import Foundation +/// Per-tool message overrides for a tool discovered through an MCP server. public struct McpToolMessages: Codable, Hashable, Sendable { /// The name of the tool from the MCP server. public let name: String - /// Custom messages for this specific tool. Set to an empty array to suppress all messages for this tool. If not provided, the tool will use the default messages from the parent MCP tool configuration. + /// Custom messages for this specific tool. Set to an empty array to suppress all messages for this tool. If not provided, the tool will use the default messages from the parent MCP tool configuration. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [McpToolMessagesMessagesItem]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/McpToolMetadata.swift b/Sources/Schemas/McpToolMetadata.swift index 48d9291f..84f6cf44 100644 --- a/Sources/Schemas/McpToolMetadata.swift +++ b/Sources/Schemas/McpToolMetadata.swift @@ -1,5 +1,6 @@ import Foundation +/// Protocol metadata used to communicate with an MCP server. public struct McpToolMetadata: Codable, Hashable, Sendable { /// This is the protocol used for MCP communication. Defaults to Streamable HTTP. public let `protocol`: McpToolMetadataProtocol? diff --git a/Sources/Schemas/MessageAddHookAction.swift b/Sources/Schemas/MessageAddHookAction.swift index 915ce4e4..a1e9c909 100644 --- a/Sources/Schemas/MessageAddHookAction.swift +++ b/Sources/Schemas/MessageAddHookAction.swift @@ -1,5 +1,6 @@ import Foundation +/// A hook action that adds an OpenAI-format message to the conversation and can trigger an assistant response. public struct MessageAddHookAction: Codable, Hashable, Sendable { /// The message to add to the conversation in OpenAI format public let message: OpenAiMessage diff --git a/Sources/Schemas/MessageTarget.swift b/Sources/Schemas/MessageTarget.swift index 6837a36b..b43dcbab 100644 --- a/Sources/Schemas/MessageTarget.swift +++ b/Sources/Schemas/MessageTarget.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects a conversation message by participant role and position for condition evaluation. public struct MessageTarget: Codable, Hashable, Sendable { /// This is the role of the message to target. /// diff --git a/Sources/Schemas/TrieveCredential.swift b/Sources/Schemas/MicrosoftCredential.swift similarity index 81% rename from Sources/Schemas/TrieveCredential.swift rename to Sources/Schemas/MicrosoftCredential.swift index fb37774f..b2c47409 100644 --- a/Sources/Schemas/TrieveCredential.swift +++ b/Sources/Schemas/MicrosoftCredential.swift @@ -1,9 +1,11 @@ import Foundation -public struct TrieveCredential: Codable, Hashable, Sendable { - public let provider: TrieveCredentialProvider +public struct MicrosoftCredential: Codable, Hashable, Sendable { + public let provider: MicrosoftCredentialProvider /// This is not returned in the API. public let apiKey: String + /// Azure region for the Speech resource. Defaults to `eastus` when omitted. MAI-Voice-2 is preview and region-limited. + public let region: String? /// This is the unique identifier for the credential. public let id: String /// This is the unique identifier for the org that this credential belongs to. @@ -18,8 +20,9 @@ public struct TrieveCredential: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( - provider: TrieveCredentialProvider, + provider: MicrosoftCredentialProvider, apiKey: String, + region: String? = nil, id: String, orgId: String, createdAt: Date, @@ -29,6 +32,7 @@ public struct TrieveCredential: Codable, Hashable, Sendable { ) { self.provider = provider self.apiKey = apiKey + self.region = region self.id = id self.orgId = orgId self.createdAt = createdAt @@ -39,8 +43,9 @@ public struct TrieveCredential: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.provider = try container.decode(TrieveCredentialProvider.self, forKey: .provider) + self.provider = try container.decode(MicrosoftCredentialProvider.self, forKey: .provider) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.region = try container.decodeIfPresent(String.self, forKey: .region) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -54,6 +59,7 @@ public struct TrieveCredential: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.provider, forKey: .provider) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.region, forKey: .region) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -65,6 +71,7 @@ public struct TrieveCredential: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case provider case apiKey + case region case id case orgId case createdAt diff --git a/Sources/Schemas/MicrosoftCredentialProvider.swift b/Sources/Schemas/MicrosoftCredentialProvider.swift new file mode 100644 index 00000000..a763c5d2 --- /dev/null +++ b/Sources/Schemas/MicrosoftCredentialProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum MicrosoftCredentialProvider: String, Codable, Hashable, CaseIterable, Sendable { + case microsoft +} \ No newline at end of file diff --git a/Sources/Schemas/MicrosoftVoice.swift b/Sources/Schemas/MicrosoftVoice.swift new file mode 100644 index 00000000..12d736fa --- /dev/null +++ b/Sources/Schemas/MicrosoftVoice.swift @@ -0,0 +1,82 @@ +import Foundation + +public struct MicrosoftVoice: Codable, Hashable, Sendable { + /// This is the flag to toggle voice caching for the assistant. + public let cachingEnabled: Bool? + /// MAI-Voice-2 voice ID. Built-in voices listed in enum. + public let voiceId: MicrosoftVoiceVoiceId + /// Speaking style applied via mstts:express-as on every request. Unknown styles are ignored by Azure and fall back to neutral. + public let style: MicrosoftVoiceStyle? + /// Style intensity (0.01–2). Default 1 = the predefined style strength. Only applies when `style` is set. + public let styleDegree: Double? + /// Role-play (age/gender imitation). Requires `style` to be set; ignored otherwise. + public let role: MicrosoftVoiceRole? + /// This is the plan for chunking the model output before it is sent to the voice provider. + public let chunkPlan: ChunkPlan? + /// This is the speed multiplier that will be used. + public let speed: Double? + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + public let fallbackPlan: FallbackPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + cachingEnabled: Bool? = nil, + voiceId: MicrosoftVoiceVoiceId, + style: MicrosoftVoiceStyle? = nil, + styleDegree: Double? = nil, + role: MicrosoftVoiceRole? = nil, + chunkPlan: ChunkPlan? = nil, + speed: Double? = nil, + fallbackPlan: FallbackPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.cachingEnabled = cachingEnabled + self.voiceId = voiceId + self.style = style + self.styleDegree = styleDegree + self.role = role + self.chunkPlan = chunkPlan + self.speed = speed + self.fallbackPlan = fallbackPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) + self.voiceId = try container.decode(MicrosoftVoiceVoiceId.self, forKey: .voiceId) + self.style = try container.decodeIfPresent(MicrosoftVoiceStyle.self, forKey: .style) + self.styleDegree = try container.decodeIfPresent(Double.self, forKey: .styleDegree) + self.role = try container.decodeIfPresent(MicrosoftVoiceRole.self, forKey: .role) + self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) + self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.fallbackPlan = try container.decodeIfPresent(FallbackPlan.self, forKey: .fallbackPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) + try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.style, forKey: .style) + try container.encodeIfPresent(self.styleDegree, forKey: .styleDegree) + try container.encodeIfPresent(self.role, forKey: .role) + try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) + try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.fallbackPlan, forKey: .fallbackPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case cachingEnabled + case voiceId + case style + case styleDegree + case role + case chunkPlan + case speed + case fallbackPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/MicrosoftVoiceRole.swift b/Sources/Schemas/MicrosoftVoiceRole.swift new file mode 100644 index 00000000..543304be --- /dev/null +++ b/Sources/Schemas/MicrosoftVoiceRole.swift @@ -0,0 +1,13 @@ +import Foundation + +/// Role-play (age/gender imitation). Requires `style` to be set; ignored otherwise. +public enum MicrosoftVoiceRole: String, Codable, Hashable, CaseIterable, Sendable { + case girl = "Girl" + case boy = "Boy" + case youngAdultFemale = "YoungAdultFemale" + case youngAdultMale = "YoungAdultMale" + case olderAdultFemale = "OlderAdultFemale" + case olderAdultMale = "OlderAdultMale" + case seniorFemale = "SeniorFemale" + case seniorMale = "SeniorMale" +} \ No newline at end of file diff --git a/Sources/Schemas/MicrosoftVoiceStyle.swift b/Sources/Schemas/MicrosoftVoiceStyle.swift new file mode 100644 index 00000000..b573fe12 --- /dev/null +++ b/Sources/Schemas/MicrosoftVoiceStyle.swift @@ -0,0 +1,34 @@ +import Foundation + +/// Speaking style applied via mstts:express-as on every request. Unknown styles are ignored by Azure and fall back to neutral. +public enum MicrosoftVoiceStyle: String, Codable, Hashable, CaseIterable, Sendable { + case adventurous + case angry + case caring + case cheerful + case confused + case curious + case determined + case disappointed + case disgusted + case embarrassed + case empathy + case encouraging + case excited + case fearful + case friendly + case happy + case hopeful + case jealous + case joyful + case nostalgic + case reflective + case regretful + case relieved + case sad + case serious + case shouting + case softvoice + case surprised + case whispering +} \ No newline at end of file diff --git a/Sources/Schemas/MicrosoftVoiceVoiceId.swift b/Sources/Schemas/MicrosoftVoiceVoiceId.swift new file mode 100644 index 00000000..7c99c8eb --- /dev/null +++ b/Sources/Schemas/MicrosoftVoiceVoiceId.swift @@ -0,0 +1,51 @@ +import Foundation + +/// MAI-Voice-2 voice ID. Built-in voices listed in enum. +public enum MicrosoftVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { + case deDeKlausMaiVoice2 = "de-DE-Klaus:MAI-Voice-2" + case deDeMiaMaiVoice2 = "de-DE-Mia:MAI-Voice-2" + case enAuLisaMaiVoice2 = "en-AU-Lisa:MAI-Voice-2" + case enUsEthanMaiVoice2 = "en-US-Ethan:MAI-Voice-2" + case enUsGrantMaiVoice2 = "en-US-Grant:MAI-Voice-2" + case enUsHarperMaiVoice2 = "en-US-Harper:MAI-Voice-2" + case enUsIrisMaiVoice2 = "en-US-Iris:MAI-Voice-2" + case enUsJasperMaiVoice2 = "en-US-Jasper:MAI-Voice-2" + case enUsOliviaMaiVoice2 = "en-US-Olivia:MAI-Voice-2" + case esEsMartaMaiVoice2 = "es-ES-Marta:MAI-Voice-2" + case esMxAlejoMaiVoice2 = "es-MX-Alejo:MAI-Voice-2" + case esMxValeriaMaiVoice2 = "es-MX-Valeria:MAI-Voice-2" + case frFrMarcMaiVoice2 = "fr-FR-Marc:MAI-Voice-2" + case frFrSoleilMaiVoice2 = "fr-FR-Soleil:MAI-Voice-2" + case hiInArjunMaiVoice2 = "hi-IN-Arjun:MAI-Voice-2" + case hiInDhruvMaiVoice2 = "hi-IN-Dhruv:MAI-Voice-2" + case hiInKavyaMaiVoice2 = "hi-IN-Kavya:MAI-Voice-2" + case hiInPriyaMaiVoice2 = "hi-IN-Priya:MAI-Voice-2" + case huHuBenceMaiVoice2 = "hu-HU-Bence:MAI-Voice-2" + case huHuLeventeMaiVoice2 = "hu-HU-Levente:MAI-Voice-2" + case huHuLillaMaiVoice2 = "hu-HU-Lilla:MAI-Voice-2" + case huHuRekaMaiVoice2 = "hu-HU-Réka:MAI-Voice-2" + case itItLucaMaiVoice2 = "it-IT-Luca:MAI-Voice-2" + case itItRosaMaiVoice2 = "it-IT-Rosa:MAI-Voice-2" + case koKrHanaMaiVoice2 = "ko-KR-Hana:MAI-Voice-2" + case koKrJunhoMaiVoice2 = "ko-KR-Junho:MAI-Voice-2" + case nlNlFleurMaiVoice2 = "nl-NL-Fleur:MAI-Voice-2" + case nlNlSanderMaiVoice2 = "nl-NL-Sander:MAI-Voice-2" + case ptBrCaioMaiVoice2 = "pt-BR-Caio:MAI-Voice-2" + case ptBrLuanaMaiVoice2 = "pt-BR-Luana:MAI-Voice-2" + case ptBrPedroMaiVoice2 = "pt-BR-Pedro:MAI-Voice-2" + case ptBrRafaelMaiVoice2 = "pt-BR-Rafael:MAI-Voice-2" + case ptPtRuiMaiVoice2 = "pt-PT-Rui:MAI-Voice-2" + case roRoAndreiMaiVoice2 = "ro-RO-Andrei:MAI-Voice-2" + case roRoElenaMaiVoice2 = "ro-RO-Elena:MAI-Voice-2" + case roRoIoanaMaiVoice2 = "ro-RO-Ioana:MAI-Voice-2" + case roRoRaduMaiVoice2 = "ro-RO-Radu:MAI-Voice-2" + case ruRuLevMaiVoice2 = "ru-RU-Lev:MAI-Voice-2" + case ruRuMashaMaiVoice2 = "ru-RU-Masha:MAI-Voice-2" + case thThKritMaiVoice2 = "th-TH-Krit:MAI-Voice-2" + case thThNattapongMaiVoice2 = "th-TH-Nattapong:MAI-Voice-2" + case trTrAydinMaiVoice2 = "tr-TR-Aydin:MAI-Voice-2" + case trTrElifMaiVoice2 = "tr-TR-Elif:MAI-Voice-2" + case zhCnBoMaiVoice2 = "zh-CN-Bo:MAI-Voice-2" + case zhCnLanMaiVoice2 = "zh-CN-Lan:MAI-Voice-2" + case zhCnMeiMaiVoice2 = "zh-CN-Mei:MAI-Voice-2" +} \ No newline at end of file diff --git a/Sources/Schemas/MinCallDurationCondition.swift b/Sources/Schemas/MinCallDurationCondition.swift new file mode 100644 index 00000000..824a2a96 --- /dev/null +++ b/Sources/Schemas/MinCallDurationCondition.swift @@ -0,0 +1,37 @@ +import Foundation + +public struct MinCallDurationCondition: Codable, Hashable, Sendable { + /// This is the minimum call duration in seconds required for the structured + /// output to run. + /// + /// When timestamps are unavailable (for example, chat sessions have no call + /// timestamps), this check passes and does not block the structured output. + public let seconds: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + seconds: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.seconds = seconds + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.seconds = try container.decode(Double.self, forKey: .seconds) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.seconds, forKey: .seconds) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case seconds + } +} \ No newline at end of file diff --git a/Sources/Schemas/MinMessagesCondition.swift b/Sources/Schemas/MinMessagesCondition.swift new file mode 100644 index 00000000..cbe519fc --- /dev/null +++ b/Sources/Schemas/MinMessagesCondition.swift @@ -0,0 +1,37 @@ +import Foundation + +public struct MinMessagesCondition: Codable, Hashable, Sendable { + /// This is the minimum number of conversation messages required for the + /// structured output to run. + /// + /// A count of 0 removes the runtime default minimum, so the structured output + /// runs regardless of how few messages the conversation has. + public let count: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + count: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.count = count + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.count = try container.decode(Double.self, forKey: .count) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.count, forKey: .count) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case count + } +} \ No newline at end of file diff --git a/Sources/Schemas/MinimaxLlmModel.swift b/Sources/Schemas/MinimaxLlmModel.swift index 45a265f2..bca288ae 100644 --- a/Sources/Schemas/MinimaxLlmModel.swift +++ b/Sources/Schemas/MinimaxLlmModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with MiniMax, including model, prompts, tools, knowledge-base access, and generation settings. public struct MinimaxLlmModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: MinimaxLlmModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [MinimaxLlmModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: MinimaxLlmModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([MinimaxLlmModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(MinimaxLlmModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct MinimaxLlmModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/MinimaxVoice.swift b/Sources/Schemas/MinimaxVoice.swift index 0f4d06ac..f91d1945 100644 --- a/Sources/Schemas/MinimaxVoice.swift +++ b/Sources/Schemas/MinimaxVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with MiniMax, including voice and model selection, emotion, pitch, speed, volume, region, language, text normalization, chunking, caching, and fallback settings. public struct MinimaxVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/ModelCost.swift b/Sources/Schemas/ModelCost.swift index 2ced3093..c8847e7b 100644 --- a/Sources/Schemas/ModelCost.swift +++ b/Sources/Schemas/ModelCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Language-model cost for a call, including model, token usage, and amount. public struct ModelCost: Codable, Hashable, Sendable { /// This is the model that was used during the call. /// @@ -17,6 +18,10 @@ public struct ModelCost: Codable, Hashable, Sendable { public let completionTokens: Double /// This is the number of cached prompt tokens used in the call. This is only applicable to certain providers (e.g., OpenAI, Azure OpenAI) that support prompt caching. Cached tokens are billed at a discounted rate. public let cachedPromptTokens: Double? + /// This is the number of reasoning tokens generated in the call. This is only applicable to reasoning models (e.g., OpenAI o-series, GPT-5) on providers that report them. + /// + /// This is a **subset of `completionTokens`**, not an addition to it: reasoning tokens are already counted in `completionTokens` and are already billed at the output-token rate. It is reported separately for visibility only and does not affect `cost`. + public let reasoningTokens: Double? /// This is the cost of the component in USD. public let cost: Double /// Additional properties that are not explicitly defined in the schema @@ -27,6 +32,7 @@ public struct ModelCost: Codable, Hashable, Sendable { promptTokens: Double, completionTokens: Double, cachedPromptTokens: Double? = nil, + reasoningTokens: Double? = nil, cost: Double, additionalProperties: [String: JSONValue] = .init() ) { @@ -34,6 +40,7 @@ public struct ModelCost: Codable, Hashable, Sendable { self.promptTokens = promptTokens self.completionTokens = completionTokens self.cachedPromptTokens = cachedPromptTokens + self.reasoningTokens = reasoningTokens self.cost = cost self.additionalProperties = additionalProperties } @@ -44,6 +51,7 @@ public struct ModelCost: Codable, Hashable, Sendable { self.promptTokens = try container.decode(Double.self, forKey: .promptTokens) self.completionTokens = try container.decode(Double.self, forKey: .completionTokens) self.cachedPromptTokens = try container.decodeIfPresent(Double.self, forKey: .cachedPromptTokens) + self.reasoningTokens = try container.decodeIfPresent(Double.self, forKey: .reasoningTokens) self.cost = try container.decode(Double.self, forKey: .cost) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -55,6 +63,7 @@ public struct ModelCost: Codable, Hashable, Sendable { try container.encode(self.promptTokens, forKey: .promptTokens) try container.encode(self.completionTokens, forKey: .completionTokens) try container.encodeIfPresent(self.cachedPromptTokens, forKey: .cachedPromptTokens) + try container.encodeIfPresent(self.reasoningTokens, forKey: .reasoningTokens) try container.encode(self.cost, forKey: .cost) } @@ -64,6 +73,7 @@ public struct ModelCost: Codable, Hashable, Sendable { case promptTokens case completionTokens case cachedPromptTokens + case reasoningTokens case cost } } \ No newline at end of file diff --git a/Sources/Schemas/Monitor.swift b/Sources/Schemas/Monitor.swift index 6d7c7dfd..eb8e14b4 100644 --- a/Sources/Schemas/Monitor.swift +++ b/Sources/Schemas/Monitor.swift @@ -1,6 +1,8 @@ import Foundation +/// Live monitoring data for a call, including attached monitor results and listening and control URLs. public struct Monitor: Codable, Hashable, Sendable { + /// Results produced by monitors attached to the call. public let monitors: [MonitorResult]? /// This is the URL where the assistant's calls can be listened to in real-time. To enable, set `assistant.monitorPlan.listenEnabled` to `true`. public let listenUrl: String? diff --git a/Sources/Schemas/MonitorPlan.swift b/Sources/Schemas/MonitorPlan.swift index cc1c9524..14ae5f17 100644 --- a/Sources/Schemas/MonitorPlan.swift +++ b/Sources/Schemas/MonitorPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls real-time listening and control for assistant calls, authentication requirements for monitor URLs, and attached monitors. public struct MonitorPlan: Codable, Hashable, Sendable { /// This determines whether the assistant's calls allow live listening. Defaults to true. /// @@ -27,11 +28,7 @@ public struct MonitorPlan: Codable, Hashable, Sendable { /// /// @default false public let controlAuthenticationEnabled: Bool? - /// This the set of monitor ids that are attached to the assistant. - /// The source of truth for the monitor ids is the assistant_monitor join table. - /// This field can be used for transient assistants and to update assistants with new monitor ids. - /// - /// @default [] + /// IDs of the monitors attached to the assistant. Use this field for transient assistants or to update the monitors attached to an existing assistant. Defaults to an empty array. public let monitorIds: [String]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/MonitorResult.swift b/Sources/Schemas/MonitorResult.swift index fd5fc252..af85ecff 100644 --- a/Sources/Schemas/MonitorResult.swift +++ b/Sources/Schemas/MonitorResult.swift @@ -1,7 +1,10 @@ import Foundation +/// Result of evaluating an attached monitor's filter for a call. public struct MonitorResult: Codable, Hashable, Sendable { + /// Unique identifier of the monitor that produced this result. public let monitorId: String + /// Whether the monitor's filter matched the call. public let filterPassed: Bool /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/Mono.swift b/Sources/Schemas/Mono.swift index 1eb466fc..bda97cfa 100644 --- a/Sources/Schemas/Mono.swift +++ b/Sources/Schemas/Mono.swift @@ -1,5 +1,6 @@ import Foundation +/// Mono recording URLs for the combined call and isolated assistant and customer audio. public struct Mono: Codable, Hashable, Sendable { /// This is the combined recording url for the call. To enable, set `assistant.artifactPlan.recordingEnabled`. public let combinedUrl: String? diff --git a/Sources/Schemas/NeuphonicVoice.swift b/Sources/Schemas/NeuphonicVoice.swift index d5a92b0f..ccefcc21 100644 --- a/Sources/Schemas/NeuphonicVoice.swift +++ b/Sources/Schemas/NeuphonicVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Neuphonic, including voice and model selection, language, speed, chunking, caching, and fallback settings. public struct NeuphonicVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/NodeArtifact.swift b/Sources/Schemas/NodeArtifact.swift index 57f45e34..83b90991 100644 --- a/Sources/Schemas/NodeArtifact.swift +++ b/Sources/Schemas/NodeArtifact.swift @@ -1,5 +1,6 @@ import Foundation +/// Messages and variable values captured while a workflow node was active. public struct NodeArtifact: Codable, Hashable, Sendable { /// These are the messages that were spoken during the node. public let messages: [NodeArtifactMessagesItem]? diff --git a/Sources/Schemas/NumberComparatorScorecardMetricCondition.swift b/Sources/Schemas/NumberComparatorScorecardMetricCondition.swift new file mode 100644 index 00000000..ec7d654b --- /dev/null +++ b/Sources/Schemas/NumberComparatorScorecardMetricCondition.swift @@ -0,0 +1,58 @@ +import Foundation + +public struct NumberComparatorScorecardMetricCondition: Codable, Hashable, Sendable { + /// This is the type of the condition. Currently only 'comparator' is supported. + public let type: NumberComparatorScorecardMetricConditionType + /// This is the comparator that will be used to compare the result of the structured output with the value specified. + /// Only '=', '!=', '>', '<', '>=', and '<=' are supported for number conditions + /// Only '=' is supported for boolean conditions. + public let comparator: NumberComparatorScorecardMetricConditionComparator + /// This is the value that will be used to compare the result of the structured output with the comparator. + /// If the result of the comparison is true, the points will be added to the overall score. + public let value: Double + /// These are the points that will be added to the overall score if the condition is met. + /// The points must be between 0 and 100. + public let points: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + type: NumberComparatorScorecardMetricConditionType, + comparator: NumberComparatorScorecardMetricConditionComparator, + value: Double, + points: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.type = type + self.comparator = comparator + self.value = value + self.points = points + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decode(NumberComparatorScorecardMetricConditionType.self, forKey: .type) + self.comparator = try container.decode(NumberComparatorScorecardMetricConditionComparator.self, forKey: .comparator) + self.value = try container.decode(Double.self, forKey: .value) + self.points = try container.decode(Double.self, forKey: .points) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.type, forKey: .type) + try container.encode(self.comparator, forKey: .comparator) + try container.encode(self.value, forKey: .value) + try container.encode(self.points, forKey: .points) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case type + case comparator + case value + case points + } +} \ No newline at end of file diff --git a/Sources/Schemas/NumberComparatorScorecardMetricConditionComparator.swift b/Sources/Schemas/NumberComparatorScorecardMetricConditionComparator.swift new file mode 100644 index 00000000..0810d040 --- /dev/null +++ b/Sources/Schemas/NumberComparatorScorecardMetricConditionComparator.swift @@ -0,0 +1,13 @@ +import Foundation + +/// This is the comparator that will be used to compare the result of the structured output with the value specified. +/// Only '=', '!=', '>', '<', '>=', and '<=' are supported for number conditions +/// Only '=' is supported for boolean conditions. +public enum NumberComparatorScorecardMetricConditionComparator: String, Codable, Hashable, CaseIterable, Sendable { + case equalTo = "=" + case notEquals = "!=" + case greaterThan = ">" + case lessThan = "<" + case greaterThanOrEqualTo = ">=" + case lessThanOrEqualTo = "<=" +} \ No newline at end of file diff --git a/Sources/Schemas/NumberComparatorScorecardMetricConditionType.swift b/Sources/Schemas/NumberComparatorScorecardMetricConditionType.swift new file mode 100644 index 00000000..0f43a819 --- /dev/null +++ b/Sources/Schemas/NumberComparatorScorecardMetricConditionType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the type of the condition. Currently only 'comparator' is supported. +public enum NumberComparatorScorecardMetricConditionType: String, Codable, Hashable, CaseIterable, Sendable { + case comparator +} \ No newline at end of file diff --git a/Sources/Schemas/OAuth2AuthenticationPlan.swift b/Sources/Schemas/OAuth2AuthenticationPlan.swift index a2973b96..d90c37e5 100644 --- a/Sources/Schemas/OAuth2AuthenticationPlan.swift +++ b/Sources/Schemas/OAuth2AuthenticationPlan.swift @@ -1,6 +1,8 @@ import Foundation +/// Client-credentials configuration for obtaining an OAuth 2.0 access token used to authenticate outbound requests. public struct OAuth2AuthenticationPlan: Codable, Hashable, Sendable { + /// Selects OAuth 2.0 authentication. public let type: OAuth2AuthenticationPlanType /// This is the OAuth2 URL. public let url: String diff --git a/Sources/Schemas/OAuth2AuthenticationPlanType.swift b/Sources/Schemas/OAuth2AuthenticationPlanType.swift index 2a7094b2..37eaf708 100644 --- a/Sources/Schemas/OAuth2AuthenticationPlanType.swift +++ b/Sources/Schemas/OAuth2AuthenticationPlanType.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects OAuth 2.0 authentication. public enum OAuth2AuthenticationPlanType: String, Codable, Hashable, CaseIterable, Sendable { case oauth2 } \ No newline at end of file diff --git a/Sources/Schemas/Oauth2AuthenticationSession.swift b/Sources/Schemas/Oauth2AuthenticationSession.swift index 7a8adf13..6d2479a3 100644 --- a/Sources/Schemas/Oauth2AuthenticationSession.swift +++ b/Sources/Schemas/Oauth2AuthenticationSession.swift @@ -1,5 +1,6 @@ import Foundation +/// OAuth 2.0 session tokens and expiration used to authenticate integration requests. public struct Oauth2AuthenticationSession: Codable, Hashable, Sendable { /// This is the OAuth2 access token. public let accessToken: String? diff --git a/Sources/Schemas/OpenAiFunction.swift b/Sources/Schemas/OpenAiFunction.swift index 8ed6d74a..eefc7fb7 100644 --- a/Sources/Schemas/OpenAiFunction.swift +++ b/Sources/Schemas/OpenAiFunction.swift @@ -1,14 +1,15 @@ import Foundation +/// Function definition exposed to a language model, including its name, purpose, parameter schema, and strict-schema behavior. public struct OpenAiFunction: Codable, Hashable, Sendable { - /// This is a boolean that controls whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is true. Learn more about Structured Outputs in the [OpenAI guide](https://openai.com/index/introducing-structured-outputs-in-the-api/). - /// - /// @default false - public let strict: Bool? /// This is the the name of the function to be called. /// /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. public let name: String + /// This is a boolean that controls whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is true. Learn more about Structured Outputs in the [OpenAI guide](https://openai.com/index/introducing-structured-outputs-in-the-api/). + /// + /// @default false + public let strict: Bool? /// This is the description of what the function does, used by the AI to choose when and how to call the function. public let description: String? /// These are the parameters the functions accepts, described as a JSON Schema object. @@ -21,14 +22,14 @@ public struct OpenAiFunction: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( - strict: Bool? = nil, name: String, + strict: Bool? = nil, description: String? = nil, parameters: OpenAiFunctionParameters? = nil, additionalProperties: [String: JSONValue] = .init() ) { - self.strict = strict self.name = name + self.strict = strict self.description = description self.parameters = parameters self.additionalProperties = additionalProperties @@ -36,8 +37,8 @@ public struct OpenAiFunction: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.strict = try container.decodeIfPresent(Bool.self, forKey: .strict) self.name = try container.decode(String.self, forKey: .name) + self.strict = try container.decodeIfPresent(Bool.self, forKey: .strict) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.parameters = try container.decodeIfPresent(OpenAiFunctionParameters.self, forKey: .parameters) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -46,16 +47,16 @@ public struct OpenAiFunction: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.strict, forKey: .strict) try container.encode(self.name, forKey: .name) + try container.encodeIfPresent(self.strict, forKey: .strict) try container.encodeIfPresent(self.description, forKey: .description) try container.encodeIfPresent(self.parameters, forKey: .parameters) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case strict case name + case strict case description case parameters } diff --git a/Sources/Schemas/OpenAiFunctionParameters.swift b/Sources/Schemas/OpenAiFunctionParameters.swift index 544f18ea..d1410922 100644 --- a/Sources/Schemas/OpenAiFunctionParameters.swift +++ b/Sources/Schemas/OpenAiFunctionParameters.swift @@ -1,5 +1,6 @@ import Foundation +/// JSON object schema defining the properties accepted by a function and which properties are required. public struct OpenAiFunctionParameters: Codable, Hashable, Sendable { /// This must be set to 'object'. It instructs the model to return a JSON object containing the function call properties. public let type: OpenAiFunctionParametersType diff --git a/Sources/Schemas/OpenAiMessage.swift b/Sources/Schemas/OpenAiMessage.swift index 4ef59275..9a9d4359 100644 --- a/Sources/Schemas/OpenAiMessage.swift +++ b/Sources/Schemas/OpenAiMessage.swift @@ -1,7 +1,10 @@ import Foundation +/// A conversation message represented in OpenAI chat format. public struct OpenAiMessage: Codable, Hashable, Sendable { + /// Content of the conversation message. public let content: Nullable + /// Role associated with the conversation message. public let role: OpenAiMessageRole /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/OpenAiMessageRole.swift b/Sources/Schemas/OpenAiMessageRole.swift index e0a14e3d..2d17ce67 100644 --- a/Sources/Schemas/OpenAiMessageRole.swift +++ b/Sources/Schemas/OpenAiMessageRole.swift @@ -1,5 +1,6 @@ import Foundation +/// Role associated with the conversation message. public enum OpenAiMessageRole: String, Codable, Hashable, CaseIterable, Sendable { case assistant case function diff --git a/Sources/Schemas/OpenAiModel.swift b/Sources/Schemas/OpenAiModel.swift index ff4facc0..6b445886 100644 --- a/Sources/Schemas/OpenAiModel.swift +++ b/Sources/Schemas/OpenAiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with OpenAI, including model selection, fallback models, prompts, tools, prompt caching, and generation settings. public struct OpenAiModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,6 +12,11 @@ public struct OpenAiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the OpenAI model that will be used. @@ -34,7 +40,7 @@ public struct OpenAiModel: Codable, Hashable, Sendable { /// - `in_memory`: Default behavior, cache retained in GPU memory only /// - `24h`: Extended caching, keeps cached prefixes active for up to 24 hours by offloading to GPU-local storage /// - /// Only applies to models: gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-chat-latest, gpt-5, gpt-5-codex, gpt-4.1 + /// Only applies to models: gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, chat-latest, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-chat-latest, gpt-5, gpt-5-codex, gpt-4.1 /// /// @default undefined (uses API default which is 'in_memory') public let promptCacheRetention: OpenAiModelPromptCacheRetention? @@ -44,7 +50,12 @@ public struct OpenAiModel: Codable, Hashable, Sendable { /// /// @default undefined public let promptCacheKey: String? - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// Reasoning effort for reasoning-capable OpenAI models. + /// For `gpt-realtime-2`: forwarded to V2 stream's session.update as `reasoning.effort`. + /// For non-realtime OpenAI models, model-aware validation limits newly public + /// values while preserving the existing four-value storage contract. + public let reasoningEffort: OpenAiModelReasoningEffort? + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -67,12 +78,14 @@ public struct OpenAiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [OpenAiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: OpenAiModelModel, fallbackModels: [OpenAiModelFallbackModelsItem]? = nil, toolStrictCompatibilityMode: OpenAiModelToolStrictCompatibilityMode? = nil, promptCacheRetention: OpenAiModelPromptCacheRetention? = nil, promptCacheKey: String? = nil, + reasoningEffort: OpenAiModelReasoningEffort? = nil, temperature: Double? = nil, maxTokens: Double? = nil, emotionRecognitionEnabled: Bool? = nil, @@ -82,12 +95,14 @@ public struct OpenAiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.fallbackModels = fallbackModels self.toolStrictCompatibilityMode = toolStrictCompatibilityMode self.promptCacheRetention = promptCacheRetention self.promptCacheKey = promptCacheKey + self.reasoningEffort = reasoningEffort self.temperature = temperature self.maxTokens = maxTokens self.emotionRecognitionEnabled = emotionRecognitionEnabled @@ -100,12 +115,14 @@ public struct OpenAiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([OpenAiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(OpenAiModelModel.self, forKey: .model) self.fallbackModels = try container.decodeIfPresent([OpenAiModelFallbackModelsItem].self, forKey: .fallbackModels) self.toolStrictCompatibilityMode = try container.decodeIfPresent(OpenAiModelToolStrictCompatibilityMode.self, forKey: .toolStrictCompatibilityMode) self.promptCacheRetention = try container.decodeIfPresent(OpenAiModelPromptCacheRetention.self, forKey: .promptCacheRetention) self.promptCacheKey = try container.decodeIfPresent(String.self, forKey: .promptCacheKey) + self.reasoningEffort = try container.decodeIfPresent(OpenAiModelReasoningEffort.self, forKey: .reasoningEffort) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) self.maxTokens = try container.decodeIfPresent(Double.self, forKey: .maxTokens) self.emotionRecognitionEnabled = try container.decodeIfPresent(Bool.self, forKey: .emotionRecognitionEnabled) @@ -119,12 +136,14 @@ public struct OpenAiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.fallbackModels, forKey: .fallbackModels) try container.encodeIfPresent(self.toolStrictCompatibilityMode, forKey: .toolStrictCompatibilityMode) try container.encodeIfPresent(self.promptCacheRetention, forKey: .promptCacheRetention) try container.encodeIfPresent(self.promptCacheKey, forKey: .promptCacheKey) + try container.encodeIfPresent(self.reasoningEffort, forKey: .reasoningEffort) try container.encodeIfPresent(self.temperature, forKey: .temperature) try container.encodeIfPresent(self.maxTokens, forKey: .maxTokens) try container.encodeIfPresent(self.emotionRecognitionEnabled, forKey: .emotionRecognitionEnabled) @@ -136,12 +155,14 @@ public struct OpenAiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case fallbackModels case toolStrictCompatibilityMode case promptCacheRetention case promptCacheKey + case reasoningEffort case temperature case maxTokens case emotionRecognitionEnabled diff --git a/Sources/Schemas/OpenAiModelFallbackModelsItem.swift b/Sources/Schemas/OpenAiModelFallbackModelsItem.swift index 74a121ac..1d1a815f 100644 --- a/Sources/Schemas/OpenAiModelFallbackModelsItem.swift +++ b/Sources/Schemas/OpenAiModelFallbackModelsItem.swift @@ -1,6 +1,11 @@ import Foundation public enum OpenAiModelFallbackModelsItem: String, Codable, Hashable, CaseIterable, Sendable { + case gpt56Sol = "gpt-5.6-sol" + case gpt56Terra = "gpt-5.6-terra" + case gpt56Luna = "gpt-5.6-luna" + case gpt55 = "gpt-5.5" + case chatLatest = "chat-latest" case gpt54 = "gpt-5.4" case gpt54Mini = "gpt-5.4-mini" case gpt54Nano = "gpt-5.4-nano" @@ -29,6 +34,7 @@ public enum OpenAiModelFallbackModelsItem: String, Codable, Hashable, CaseIterab case gpt4OMiniRealtimePreview20241217 = "gpt-4o-mini-realtime-preview-2024-12-17" case gptRealtime20250828 = "gpt-realtime-2025-08-28" case gptRealtimeMini20251215 = "gpt-realtime-mini-2025-12-15" + case gptRealtime2 = "gpt-realtime-2" case gpt4OMini20240718 = "gpt-4o-mini-2024-07-18" case gpt4OMini = "gpt-4o-mini" case gpt4O = "gpt-4o" @@ -119,4 +125,7 @@ public enum OpenAiModelFallbackModelsItem: String, Codable, Hashable, CaseIterab case gpt35Turbo0125Southcentralus = "gpt-3.5-turbo-0125:southcentralus" case gpt35Turbo1106Canadaeast = "gpt-3.5-turbo-1106:canadaeast" case gpt35Turbo1106Westus = "gpt-3.5-turbo-1106:westus" + case gpt41Australiaeast = "gpt-4.1:australiaeast" + case gpt4OAustraliaeast = "gpt-4o:australiaeast" + case gpt54MiniAustraliaeast = "gpt-5.4-mini:australiaeast" } \ No newline at end of file diff --git a/Sources/Schemas/OpenAiModelModel.swift b/Sources/Schemas/OpenAiModelModel.swift index bcff8a78..72e1364a 100644 --- a/Sources/Schemas/OpenAiModelModel.swift +++ b/Sources/Schemas/OpenAiModelModel.swift @@ -7,6 +7,11 @@ import Foundation /// /// @default undefined public enum OpenAiModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gpt56Sol = "gpt-5.6-sol" + case gpt56Terra = "gpt-5.6-terra" + case gpt56Luna = "gpt-5.6-luna" + case gpt55 = "gpt-5.5" + case chatLatest = "chat-latest" case gpt54 = "gpt-5.4" case gpt54Mini = "gpt-5.4-mini" case gpt54Nano = "gpt-5.4-nano" @@ -35,6 +40,7 @@ public enum OpenAiModelModel: String, Codable, Hashable, CaseIterable, Sendable case gpt4OMiniRealtimePreview20241217 = "gpt-4o-mini-realtime-preview-2024-12-17" case gptRealtime20250828 = "gpt-realtime-2025-08-28" case gptRealtimeMini20251215 = "gpt-realtime-mini-2025-12-15" + case gptRealtime2 = "gpt-realtime-2" case gpt4OMini20240718 = "gpt-4o-mini-2024-07-18" case gpt4OMini = "gpt-4o-mini" case gpt4O = "gpt-4o" @@ -125,4 +131,7 @@ public enum OpenAiModelModel: String, Codable, Hashable, CaseIterable, Sendable case gpt35Turbo0125Southcentralus = "gpt-3.5-turbo-0125:southcentralus" case gpt35Turbo1106Canadaeast = "gpt-3.5-turbo-1106:canadaeast" case gpt35Turbo1106Westus = "gpt-3.5-turbo-1106:westus" + case gpt41Australiaeast = "gpt-4.1:australiaeast" + case gpt4OAustraliaeast = "gpt-4o:australiaeast" + case gpt54MiniAustraliaeast = "gpt-5.4-mini:australiaeast" } \ No newline at end of file diff --git a/Sources/Schemas/OpenAiModelPromptCacheRetention.swift b/Sources/Schemas/OpenAiModelPromptCacheRetention.swift index 85e1a3b5..45a1b00d 100644 --- a/Sources/Schemas/OpenAiModelPromptCacheRetention.swift +++ b/Sources/Schemas/OpenAiModelPromptCacheRetention.swift @@ -5,7 +5,7 @@ import Foundation /// - `in_memory`: Default behavior, cache retained in GPU memory only /// - `24h`: Extended caching, keeps cached prefixes active for up to 24 hours by offloading to GPU-local storage /// -/// Only applies to models: gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-chat-latest, gpt-5, gpt-5-codex, gpt-4.1 +/// Only applies to models: gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, chat-latest, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-chat-latest, gpt-5, gpt-5-codex, gpt-4.1 /// /// @default undefined (uses API default which is 'in_memory') public enum OpenAiModelPromptCacheRetention: String, Codable, Hashable, CaseIterable, Sendable { diff --git a/Sources/Schemas/OpenAiModelReasoningEffort.swift b/Sources/Schemas/OpenAiModelReasoningEffort.swift new file mode 100644 index 00000000..918e5fe5 --- /dev/null +++ b/Sources/Schemas/OpenAiModelReasoningEffort.swift @@ -0,0 +1,14 @@ +import Foundation + +/// Reasoning effort for reasoning-capable OpenAI models. +/// For `gpt-realtime-2`: forwarded to V2 stream's session.update as `reasoning.effort`. +/// For non-realtime OpenAI models, model-aware validation limits newly public +/// values while preserving the existing four-value storage contract. +public enum OpenAiModelReasoningEffort: String, Codable, Hashable, CaseIterable, Sendable { + case minimal + case none + case low + case medium + case high + case xhigh +} \ No newline at end of file diff --git a/Sources/Schemas/OpenAiTranscriber.swift b/Sources/Schemas/OpenAiTranscriber.swift index a12d282d..e7cafbfa 100644 --- a/Sources/Schemas/OpenAiTranscriber.swift +++ b/Sources/Schemas/OpenAiTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with OpenAI, including model, language, and fallback settings. public struct OpenAiTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: OpenAiTranscriberModel diff --git a/Sources/Schemas/OpenAiVoice.swift b/Sources/Schemas/OpenAiVoice.swift index ac6ce34b..c2617b50 100644 --- a/Sources/Schemas/OpenAiVoice.swift +++ b/Sources/Schemas/OpenAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with OpenAI, including voice and model selection, delivery instructions, speed, chunking, caching, and fallback settings. public struct OpenAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/OpenAiVoicemailDetectionPlan.swift b/Sources/Schemas/OpenAiVoicemailDetectionPlan.swift index 561b696e..180c84b9 100644 --- a/Sources/Schemas/OpenAiVoicemailDetectionPlan.swift +++ b/Sources/Schemas/OpenAiVoicemailDetectionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for detecting voicemail with OpenAI, including detection type, maximum beep wait, and retry backoff. public struct OpenAiVoicemailDetectionPlan: Codable, Hashable, Sendable { /// This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message /// diff --git a/Sources/Schemas/OpenRouterModel.swift b/Sources/Schemas/OpenRouterModel.swift index ff644cd2..7b16a944 100644 --- a/Sources/Schemas/OpenRouterModel.swift +++ b/Sources/Schemas/OpenRouterModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses through OpenRouter, including routed model selection, prompts, tools, knowledge-base access, and generation settings. public struct OpenRouterModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [OpenRouterModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: String, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([OpenRouterModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct OpenRouterModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/Org.swift b/Sources/Schemas/Org.swift index d44b8088..b0c036a2 100644 --- a/Sources/Schemas/Org.swift +++ b/Sources/Schemas/Org.swift @@ -5,6 +5,11 @@ public struct Org: Codable, Hashable, Sendable { /// When HIPAA is enabled, only HIPAA-compliant providers will be available for LLM, Voice, and Transcriber respectively. /// This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements. public let hipaaEnabled: Bool? + /// The org was created locally, but WorkOS access is still being repaired. + /// Clients should keep the current session/org and refresh the org list. + public let workosRepairPending: Bool? + /// Whether the pending WorkOS repair was accepted by Kafka. + public let workosRepairQueued: Bool? public let subscription: Subscription? /// This is the ID of the subscription the org belongs to. public let subscriptionId: String? @@ -54,6 +59,8 @@ public struct Org: Codable, Hashable, Sendable { public init( hipaaEnabled: Bool? = nil, + workosRepairPending: Bool? = nil, + workosRepairQueued: Bool? = nil, subscription: Subscription? = nil, subscriptionId: String? = nil, id: String, @@ -74,6 +81,8 @@ public struct Org: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.hipaaEnabled = hipaaEnabled + self.workosRepairPending = workosRepairPending + self.workosRepairQueued = workosRepairQueued self.subscription = subscription self.subscriptionId = subscriptionId self.id = id @@ -97,6 +106,8 @@ public struct Org: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.hipaaEnabled = try container.decodeIfPresent(Bool.self, forKey: .hipaaEnabled) + self.workosRepairPending = try container.decodeIfPresent(Bool.self, forKey: .workosRepairPending) + self.workosRepairQueued = try container.decodeIfPresent(Bool.self, forKey: .workosRepairQueued) self.subscription = try container.decodeIfPresent(Subscription.self, forKey: .subscription) self.subscriptionId = try container.decodeIfPresent(String.self, forKey: .subscriptionId) self.id = try container.decode(String.self, forKey: .id) @@ -121,6 +132,8 @@ public struct Org: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.hipaaEnabled, forKey: .hipaaEnabled) + try container.encodeIfPresent(self.workosRepairPending, forKey: .workosRepairPending) + try container.encodeIfPresent(self.workosRepairQueued, forKey: .workosRepairQueued) try container.encodeIfPresent(self.subscription, forKey: .subscription) try container.encodeIfPresent(self.subscriptionId, forKey: .subscriptionId) try container.encode(self.id, forKey: .id) @@ -143,6 +156,8 @@ public struct Org: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case hipaaEnabled + case workosRepairPending + case workosRepairQueued case subscription case subscriptionId case id diff --git a/Sources/Schemas/OutputTool.swift b/Sources/Schemas/OutputTool.swift index 351a72fe..e474e2bc 100644 --- a/Sources/Schemas/OutputTool.swift +++ b/Sources/Schemas/OutputTool.swift @@ -1,9 +1,8 @@ import Foundation public struct OutputTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [OutputToolMessagesItem]? /// The type of tool. "output" for Output tool. public let type: OutputToolType @@ -98,6 +97,7 @@ public struct OutputTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [OutputToolMessagesItem]? = nil, type: OutputToolType, id: String, @@ -107,6 +107,7 @@ public struct OutputTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.type = type self.id = id @@ -119,6 +120,7 @@ public struct OutputTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([OutputToolMessagesItem].self, forKey: .messages) self.type = try container.decode(OutputToolType.self, forKey: .type) self.id = try container.decode(String.self, forKey: .id) @@ -132,6 +134,7 @@ public struct OutputTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.type, forKey: .type) try container.encode(self.id, forKey: .id) @@ -143,6 +146,7 @@ public struct OutputTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case type case id diff --git a/Sources/Schemas/PaginationMeta.swift b/Sources/Schemas/PaginationMeta.swift index a677d930..afa9f5bf 100644 --- a/Sources/Schemas/PaginationMeta.swift +++ b/Sources/Schemas/PaginationMeta.swift @@ -1,11 +1,25 @@ import Foundation +/// Pagination and retention metadata returned with a paginated list of phone numbers. public struct PaginationMeta: Codable, Hashable, Sendable { + /// The number of phone numbers returned per page. public let itemsPerPage: Double + /// The total number of phone numbers matching the request. public let totalItems: Double + /// The current page number. public let currentPage: Double + public let totalPages: Double? + public let hasNextPage: Bool? + /// Opaque cursor for the next page under keyset pagination (PRO-3163). Pass it + /// back as the `cursor` query param to fetch the next page without an OFFSET + /// scan. Present only when a further page likely exists. + public let nextCursor: String? + public let sortOrder: PaginationMetaSortOrder? + /// Whether additional matching phone numbers exist beyond the organization's data-retention window. public let itemsBeyondRetention: Bool? + /// The inclusive upper creation-time boundary applied to the result set. public let createdAtLe: Date? + /// The inclusive lower creation-time boundary applied to the result set. public let createdAtGe: Date? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -14,6 +28,10 @@ public struct PaginationMeta: Codable, Hashable, Sendable { itemsPerPage: Double, totalItems: Double, currentPage: Double, + totalPages: Double? = nil, + hasNextPage: Bool? = nil, + nextCursor: String? = nil, + sortOrder: PaginationMetaSortOrder? = nil, itemsBeyondRetention: Bool? = nil, createdAtLe: Date? = nil, createdAtGe: Date? = nil, @@ -22,6 +40,10 @@ public struct PaginationMeta: Codable, Hashable, Sendable { self.itemsPerPage = itemsPerPage self.totalItems = totalItems self.currentPage = currentPage + self.totalPages = totalPages + self.hasNextPage = hasNextPage + self.nextCursor = nextCursor + self.sortOrder = sortOrder self.itemsBeyondRetention = itemsBeyondRetention self.createdAtLe = createdAtLe self.createdAtGe = createdAtGe @@ -33,6 +55,10 @@ public struct PaginationMeta: Codable, Hashable, Sendable { self.itemsPerPage = try container.decode(Double.self, forKey: .itemsPerPage) self.totalItems = try container.decode(Double.self, forKey: .totalItems) self.currentPage = try container.decode(Double.self, forKey: .currentPage) + self.totalPages = try container.decodeIfPresent(Double.self, forKey: .totalPages) + self.hasNextPage = try container.decodeIfPresent(Bool.self, forKey: .hasNextPage) + self.nextCursor = try container.decodeIfPresent(String.self, forKey: .nextCursor) + self.sortOrder = try container.decodeIfPresent(PaginationMetaSortOrder.self, forKey: .sortOrder) self.itemsBeyondRetention = try container.decodeIfPresent(Bool.self, forKey: .itemsBeyondRetention) self.createdAtLe = try container.decodeIfPresent(Date.self, forKey: .createdAtLe) self.createdAtGe = try container.decodeIfPresent(Date.self, forKey: .createdAtGe) @@ -45,6 +71,10 @@ public struct PaginationMeta: Codable, Hashable, Sendable { try container.encode(self.itemsPerPage, forKey: .itemsPerPage) try container.encode(self.totalItems, forKey: .totalItems) try container.encode(self.currentPage, forKey: .currentPage) + try container.encodeIfPresent(self.totalPages, forKey: .totalPages) + try container.encodeIfPresent(self.hasNextPage, forKey: .hasNextPage) + try container.encodeIfPresent(self.nextCursor, forKey: .nextCursor) + try container.encodeIfPresent(self.sortOrder, forKey: .sortOrder) try container.encodeIfPresent(self.itemsBeyondRetention, forKey: .itemsBeyondRetention) try container.encodeIfPresent(self.createdAtLe, forKey: .createdAtLe) try container.encodeIfPresent(self.createdAtGe, forKey: .createdAtGe) @@ -55,6 +85,10 @@ public struct PaginationMeta: Codable, Hashable, Sendable { case itemsPerPage case totalItems case currentPage + case totalPages + case hasNextPage + case nextCursor + case sortOrder case itemsBeyondRetention case createdAtLe case createdAtGe diff --git a/Sources/Schemas/PaginationMetaSortOrder.swift b/Sources/Schemas/PaginationMetaSortOrder.swift new file mode 100644 index 00000000..9ba02988 --- /dev/null +++ b/Sources/Schemas/PaginationMetaSortOrder.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum PaginationMetaSortOrder: String, Codable, Hashable, CaseIterable, Sendable { + case asc = "ASC" + case desc = "DESC" +} \ No newline at end of file diff --git a/Sources/Schemas/PendingInvitationDto.swift b/Sources/Schemas/PendingInvitationDto.swift new file mode 100644 index 00000000..48edd5be --- /dev/null +++ b/Sources/Schemas/PendingInvitationDto.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct PendingInvitationDto: Codable, Hashable, Sendable { + public let id: String + public let email: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + id: String, + email: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.id = id + self.email = email + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.id = try container.decode(String.self, forKey: .id) + self.email = try container.decode(String.self, forKey: .email) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.id, forKey: .id) + try container.encode(self.email, forKey: .email) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case id + case email + } +} \ No newline at end of file diff --git a/Sources/Schemas/PendingInvitationsResponseDto.swift b/Sources/Schemas/PendingInvitationsResponseDto.swift new file mode 100644 index 00000000..939e9bde --- /dev/null +++ b/Sources/Schemas/PendingInvitationsResponseDto.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct PendingInvitationsResponseDto: Codable, Hashable, Sendable { + public let invitations: [PendingInvitationDto] + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + invitations: [PendingInvitationDto], + additionalProperties: [String: JSONValue] = .init() + ) { + self.invitations = invitations + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.invitations = try container.decode([PendingInvitationDto].self, forKey: .invitations) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.invitations, forKey: .invitations) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case invitations + } +} \ No newline at end of file diff --git a/Sources/Schemas/PerformanceMetrics.swift b/Sources/Schemas/PerformanceMetrics.swift index 3034db0d..17aeaf0e 100644 --- a/Sources/Schemas/PerformanceMetrics.swift +++ b/Sources/Schemas/PerformanceMetrics.swift @@ -1,5 +1,6 @@ import Foundation +/// Call performance measurements, including per-turn and average provider, endpointing, transport, and interruption metrics. public struct PerformanceMetrics: Codable, Hashable, Sendable { /// These are the individual latencies for each turn. public let turnLatencies: [TurnLatency]? diff --git a/Sources/Schemas/PerplexityAiModel.swift b/Sources/Schemas/PerplexityAiModel.swift index cba855a6..dbaf0243 100644 --- a/Sources/Schemas/PerplexityAiModel.swift +++ b/Sources/Schemas/PerplexityAiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Perplexity AI, including model, prompts, tools, knowledge-base access, and generation settings. public struct PerplexityAiModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [PerplexityAiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: String, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([PerplexityAiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct PerplexityAiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/PhoneNumberCallEndingHookFilter.swift b/Sources/Schemas/PhoneNumberCallEndingHookFilter.swift index 3e66163e..ad1c77c7 100644 --- a/Sources/Schemas/PhoneNumberCallEndingHookFilter.swift +++ b/Sources/Schemas/PhoneNumberCallEndingHookFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Matches the call's ended reason against configured assistant-request failure reasons before an ending hook runs. public struct PhoneNumberCallEndingHookFilter: Codable, Hashable, Sendable { /// This is the type of filter - currently only "oneOf" is supported public let type: PhoneNumberCallEndingHookFilterType diff --git a/Sources/Schemas/PhoneNumberCallRingingHookFilter.swift b/Sources/Schemas/PhoneNumberCallRingingHookFilter.swift index d84f0580..1cd19c47 100644 --- a/Sources/Schemas/PhoneNumberCallRingingHookFilter.swift +++ b/Sources/Schemas/PhoneNumberCallRingingHookFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Matches an incoming caller's phone number against one or more prefixes before a ringing hook runs. public struct PhoneNumberCallRingingHookFilter: Codable, Hashable, Sendable { /// This is the type of filter - matches when the specified field starts with any of the given prefixes public let type: PhoneNumberCallRingingHookFilterType diff --git a/Sources/Schemas/PhoneNumberControllerFindAllPaginatedRequestSortBy.swift b/Sources/Schemas/PhoneNumberControllerFindAllPaginatedRequestSortBy.swift new file mode 100644 index 00000000..d78b1df2 --- /dev/null +++ b/Sources/Schemas/PhoneNumberControllerFindAllPaginatedRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum PhoneNumberControllerFindAllPaginatedRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/PhoneNumberHookCallEnding.swift b/Sources/Schemas/PhoneNumberHookCallEnding.swift index db7a94b1..a1592b3c 100644 --- a/Sources/Schemas/PhoneNumberHookCallEnding.swift +++ b/Sources/Schemas/PhoneNumberHookCallEnding.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured transfer or message actions when a call ends with a matching assistant-request failure reason. public struct PhoneNumberHookCallEnding: Codable, Hashable, Sendable { /// Optional filters to decide when to trigger - restricted to assistant-request related ended reasons public let filters: [PhoneNumberCallEndingHookFilter]? diff --git a/Sources/Schemas/PhoneNumberHookCallRinging.swift b/Sources/Schemas/PhoneNumberHookCallRinging.swift index 0fcf7f91..b77bcac4 100644 --- a/Sources/Schemas/PhoneNumberHookCallRinging.swift +++ b/Sources/Schemas/PhoneNumberHookCallRinging.swift @@ -1,5 +1,6 @@ import Foundation +/// Runs configured transfer or message actions when an incoming call rings and its caller-number prefix filters match. public struct PhoneNumberHookCallRinging: Codable, Hashable, Sendable { /// Optional filters to decide when to trigger the hook. Currently supports filtering by caller country code. public let filters: [PhoneNumberCallRingingHookFilter]? diff --git a/Sources/Schemas/PhoneNumberPaginatedResponse.swift b/Sources/Schemas/PhoneNumberPaginatedResponse.swift index 3a09e690..6f26c103 100644 --- a/Sources/Schemas/PhoneNumberPaginatedResponse.swift +++ b/Sources/Schemas/PhoneNumberPaginatedResponse.swift @@ -1,5 +1,6 @@ import Foundation +/// A paginated collection of phone numbers and metadata describing the result set. public struct PhoneNumberPaginatedResponse: Codable, Hashable, Sendable { /// A list of phone numbers, which can be of any provider type. public let results: [PhoneNumberPaginatedResponseResultsItem] diff --git a/Sources/Schemas/PieInsight.swift b/Sources/Schemas/PieInsight.swift index 16c99b5c..a6085f1f 100644 --- a/Sources/Schemas/PieInsight.swift +++ b/Sources/Schemas/PieInsight.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved pie-chart insight containing its call-data queries, formulas, grouping, time range, and lifecycle information. public struct PieInsight: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct PieInsight: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formulas: [InsightFormula]? + /// The time range used to query the pie-chart data. public let timeRange: InsightTimeRange? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. @@ -34,6 +36,8 @@ public struct PieInsight: Codable, Hashable, Sendable { public let createdAt: Date /// This is the ISO 8601 date-time string of when the Insight was last updated. public let updatedAt: Date + /// Stable server-owned identifier for system-created insights. + public let systemKey: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -47,6 +51,7 @@ public struct PieInsight: Codable, Hashable, Sendable { orgId: String, createdAt: Date, updatedAt: Date, + systemKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name @@ -58,6 +63,7 @@ public struct PieInsight: Codable, Hashable, Sendable { self.orgId = orgId self.createdAt = createdAt self.updatedAt = updatedAt + self.systemKey = systemKey self.additionalProperties = additionalProperties } @@ -72,6 +78,7 @@ public struct PieInsight: Codable, Hashable, Sendable { self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -87,6 +94,7 @@ public struct PieInsight: Codable, Hashable, Sendable { try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) } /// Keys for encoding/decoding struct properties. @@ -100,5 +108,6 @@ public struct PieInsight: Codable, Hashable, Sendable { case orgId case createdAt case updatedAt + case systemKey } } \ No newline at end of file diff --git a/Sources/Schemas/PlayHtVoice.swift b/Sources/Schemas/PlayHtVoice.swift index 787e02bd..6287ffaa 100644 --- a/Sources/Schemas/PlayHtVoice.swift +++ b/Sources/Schemas/PlayHtVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with PlayHT, including voice and model selection, language, emotion and style guidance, chunking, caching, and fallback settings. public struct PlayHtVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/PromptInjectionSecurityFilter.swift b/Sources/Schemas/PromptInjectionSecurityFilter.swift index 840a3415..39405ae9 100644 --- a/Sources/Schemas/PromptInjectionSecurityFilter.swift +++ b/Sources/Schemas/PromptInjectionSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters potential prompt-injection patterns from transcripts. public struct PromptInjectionSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: PromptInjectionSecurityFilterType diff --git a/Sources/Schemas/ProviderResource.swift b/Sources/Schemas/ProviderResource.swift index ef4730d7..7092cd5f 100644 --- a/Sources/Schemas/ProviderResource.swift +++ b/Sources/Schemas/ProviderResource.swift @@ -1,5 +1,6 @@ import Foundation +/// A provider-managed pronunciation-dictionary resource mirrored in Vapi, including its provider identifiers, resource data, and lifecycle information. public struct ProviderResource: Codable, Hashable, Sendable { /// This is the unique identifier for the provider resource. public let id: String diff --git a/Sources/Schemas/ProviderResourceControllerGetProviderResourcesPaginatedRequestSortBy.swift b/Sources/Schemas/ProviderResourceControllerGetProviderResourcesPaginatedRequestSortBy.swift new file mode 100644 index 00000000..98e09d43 --- /dev/null +++ b/Sources/Schemas/ProviderResourceControllerGetProviderResourcesPaginatedRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum ProviderResourceControllerGetProviderResourcesPaginatedRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/ProviderResourcePaginatedResponse.swift b/Sources/Schemas/ProviderResourcePaginatedResponse.swift index 0c6780c8..5ea8efcb 100644 --- a/Sources/Schemas/ProviderResourcePaginatedResponse.swift +++ b/Sources/Schemas/ProviderResourcePaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of provider resources and metadata describing the result set. public struct ProviderResourcePaginatedResponse: Codable, Hashable, Sendable { + /// The provider resources returned for the current page. public let results: [ProviderResource] + /// Pagination metadata for the provider-resource result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/PublicKeyEncryptionPlan.swift b/Sources/Schemas/PublicKeyEncryptionPlan.swift index 3de362f3..2aece3e3 100644 --- a/Sources/Schemas/PublicKeyEncryptionPlan.swift +++ b/Sources/Schemas/PublicKeyEncryptionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for encrypting sensitive outbound request data with a public key. public struct PublicKeyEncryptionPlan: Codable, Hashable, Sendable { /// The encryption algorithm to use. public let algorithm: PublicKeyEncryptionPlanAlgorithm diff --git a/Sources/Schemas/QueryTool.swift b/Sources/Schemas/QueryTool.swift index 8b6b22b7..0beab355 100644 --- a/Sources/Schemas/QueryTool.swift +++ b/Sources/Schemas/QueryTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that searches configured knowledge bases and returns relevant content to the assistant. public struct QueryTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [QueryToolMessagesItem]? /// The knowledge bases to query public let knowledgeBases: [KnowledgeBase]? @@ -98,6 +98,7 @@ public struct QueryTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [QueryToolMessagesItem]? = nil, knowledgeBases: [KnowledgeBase]? = nil, id: String, @@ -107,6 +108,7 @@ public struct QueryTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.knowledgeBases = knowledgeBases self.id = id @@ -119,6 +121,7 @@ public struct QueryTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([QueryToolMessagesItem].self, forKey: .messages) self.knowledgeBases = try container.decodeIfPresent([KnowledgeBase].self, forKey: .knowledgeBases) self.id = try container.decode(String.self, forKey: .id) @@ -132,6 +135,7 @@ public struct QueryTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.knowledgeBases, forKey: .knowledgeBases) try container.encode(self.id, forKey: .id) @@ -143,6 +147,7 @@ public struct QueryTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case knowledgeBases case id diff --git a/Sources/Schemas/RceSecurityFilter.swift b/Sources/Schemas/RceSecurityFilter.swift index 21a3e83a..fbefbc3d 100644 --- a/Sources/Schemas/RceSecurityFilter.swift +++ b/Sources/Schemas/RceSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters potential remote code execution (RCE) patterns from transcripts. public struct RceSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: RceSecurityFilterType diff --git a/Sources/Schemas/Recording.swift b/Sources/Schemas/Recording.swift index f6ed312d..fc1c2c18 100644 --- a/Sources/Schemas/Recording.swift +++ b/Sources/Schemas/Recording.swift @@ -1,5 +1,6 @@ import Foundation +/// Call recording locations, including stereo, video, and separated mono recording URLs. public struct Recording: Codable, Hashable, Sendable { /// This is the stereo recording url for the call. To enable, set `assistant.artifactPlan.recordingEnabled`. public let stereoUrl: String? diff --git a/Sources/Schemas/RecordingConsent.swift b/Sources/Schemas/RecordingConsent.swift index 12e6f015..c95c81b6 100644 --- a/Sources/Schemas/RecordingConsent.swift +++ b/Sources/Schemas/RecordingConsent.swift @@ -1,8 +1,9 @@ import Foundation +/// Result of the recording-consent flow, including consent type and the time consent was granted. public struct RecordingConsent: Codable, Hashable, Sendable { /// This is the type of recording consent. - public let type: [String: JSONValue] + public let type: RecordingConsentType /// This is the date and time the recording consent was granted. /// If not specified, it means the recording consent was not granted. public let grantedAt: Date? @@ -10,7 +11,7 @@ public struct RecordingConsent: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( - type: [String: JSONValue], + type: RecordingConsentType, grantedAt: Date? = nil, additionalProperties: [String: JSONValue] = .init() ) { @@ -21,7 +22,7 @@ public struct RecordingConsent: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.type = try container.decode([String: JSONValue].self, forKey: .type) + self.type = try container.decode(RecordingConsentType.self, forKey: .type) self.grantedAt = try container.decodeIfPresent(Date.self, forKey: .grantedAt) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } diff --git a/Sources/Schemas/RecordingConsentPlanStayOnLine.swift b/Sources/Schemas/RecordingConsentPlanStayOnLine.swift index ffdf4c47..87655d92 100644 --- a/Sources/Schemas/RecordingConsentPlanStayOnLine.swift +++ b/Sources/Schemas/RecordingConsentPlanStayOnLine.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for requesting recording consent by treating continued presence on the call as consent, including the announcement voice and wait time. public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { /// This is the message asking for consent to record the call. /// If the type is `stay-on-line`, the message should ask the user to hang up if they do not consent. @@ -8,6 +9,18 @@ public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { /// This is the voice to use for the consent message. If not specified, inherits from the assistant's voice. /// Use a different voice for the consent message for a better user experience. public let voice: RecordingConsentPlanStayOnLineVoice? + /// This controls whether the consent assistant speaks first or waits for the caller to speak first. + /// + /// Use: + /// - `assistant-speaks-first` (default) to have the consent assistant play the consent message as soon as the call is answered. + /// - `assistant-waits-for-user` to have the consent assistant wait for the caller to speak before playing the consent message. + /// + /// We strongly recommend `assistant-waits-for-user` for outbound calls. Some telephony providers signal "answered" while the line is still ringing, which can cause the consent message to play into a ringing line and be missed by the caller. Waiting for the caller to speak first guarantees they hear the full consent message. + /// + /// Note: when combined with `type: 'stay-on-line'`, silence only counts toward consent after the caller has spoken at least once. + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: RecordingConsentPlanStayOnLineFirstMessageMode? /// Number of seconds to wait before transferring to the assistant if user stays on the call public let waitSeconds: Double? /// Additional properties that are not explicitly defined in the schema @@ -16,11 +29,13 @@ public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { public init( message: String, voice: RecordingConsentPlanStayOnLineVoice? = nil, + firstMessageMode: RecordingConsentPlanStayOnLineFirstMessageMode? = nil, waitSeconds: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.message = message self.voice = voice + self.firstMessageMode = firstMessageMode self.waitSeconds = waitSeconds self.additionalProperties = additionalProperties } @@ -29,6 +44,7 @@ public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.message = try container.decode(String.self, forKey: .message) self.voice = try container.decodeIfPresent(RecordingConsentPlanStayOnLineVoice.self, forKey: .voice) + self.firstMessageMode = try container.decodeIfPresent(RecordingConsentPlanStayOnLineFirstMessageMode.self, forKey: .firstMessageMode) self.waitSeconds = try container.decodeIfPresent(Double.self, forKey: .waitSeconds) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -38,6 +54,7 @@ public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.message, forKey: .message) try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) try container.encodeIfPresent(self.waitSeconds, forKey: .waitSeconds) } @@ -45,6 +62,7 @@ public struct RecordingConsentPlanStayOnLine: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case message case voice + case firstMessageMode case waitSeconds } } \ No newline at end of file diff --git a/Sources/Schemas/RecordingConsentPlanStayOnLineFirstMessageMode.swift b/Sources/Schemas/RecordingConsentPlanStayOnLineFirstMessageMode.swift new file mode 100644 index 00000000..75901b9f --- /dev/null +++ b/Sources/Schemas/RecordingConsentPlanStayOnLineFirstMessageMode.swift @@ -0,0 +1,17 @@ +import Foundation + +/// This controls whether the consent assistant speaks first or waits for the caller to speak first. +/// +/// Use: +/// - `assistant-speaks-first` (default) to have the consent assistant play the consent message as soon as the call is answered. +/// - `assistant-waits-for-user` to have the consent assistant wait for the caller to speak before playing the consent message. +/// +/// We strongly recommend `assistant-waits-for-user` for outbound calls. Some telephony providers signal "answered" while the line is still ringing, which can cause the consent message to play into a ringing line and be missed by the caller. Waiting for the caller to speak first guarantees they hear the full consent message. +/// +/// Note: when combined with `type: 'stay-on-line'`, silence only counts toward consent after the caller has spoken at least once. +/// +/// @default 'assistant-speaks-first' +public enum RecordingConsentPlanStayOnLineFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/RecordingConsentPlanStayOnLineVoice.swift b/Sources/Schemas/RecordingConsentPlanStayOnLineVoice.swift index 4ae092b1..01a66f5e 100644 --- a/Sources/Schemas/RecordingConsentPlanStayOnLineVoice.swift +++ b/Sources/Schemas/RecordingConsentPlanStayOnLineVoice.swift @@ -11,6 +11,7 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -21,6 +22,7 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -42,6 +44,8 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -62,6 +66,8 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -99,6 +105,9 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -129,6 +138,9 @@ public enum RecordingConsentPlanStayOnLineVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/RecordingConsentPlanVerbal.swift b/Sources/Schemas/RecordingConsentPlanVerbal.swift index 1744df41..56d1c37f 100644 --- a/Sources/Schemas/RecordingConsentPlanVerbal.swift +++ b/Sources/Schemas/RecordingConsentPlanVerbal.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for requesting explicit verbal recording consent, including the announcement voice and action to take when the customer declines. public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { /// This is the message asking for consent to record the call. /// If the type is `stay-on-line`, the message should ask the user to hang up if they do not consent. @@ -8,6 +9,18 @@ public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { /// This is the voice to use for the consent message. If not specified, inherits from the assistant's voice. /// Use a different voice for the consent message for a better user experience. public let voice: RecordingConsentPlanVerbalVoice? + /// This controls whether the consent assistant speaks first or waits for the caller to speak first. + /// + /// Use: + /// - `assistant-speaks-first` (default) to have the consent assistant play the consent message as soon as the call is answered. + /// - `assistant-waits-for-user` to have the consent assistant wait for the caller to speak before playing the consent message. + /// + /// We strongly recommend `assistant-waits-for-user` for outbound calls. Some telephony providers signal "answered" while the line is still ringing, which can cause the consent message to play into a ringing line and be missed by the caller. Waiting for the caller to speak first guarantees they hear the full consent message. + /// + /// Note: when combined with `type: 'stay-on-line'`, silence only counts toward consent after the caller has spoken at least once. + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: RecordingConsentPlanVerbalFirstMessageMode? /// Tool to execute if user verbally declines recording consent public let declineTool: [String: JSONValue]? /// ID of existing tool to execute if user verbally declines recording consent @@ -18,12 +31,14 @@ public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { public init( message: String, voice: RecordingConsentPlanVerbalVoice? = nil, + firstMessageMode: RecordingConsentPlanVerbalFirstMessageMode? = nil, declineTool: [String: JSONValue]? = nil, declineToolId: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.message = message self.voice = voice + self.firstMessageMode = firstMessageMode self.declineTool = declineTool self.declineToolId = declineToolId self.additionalProperties = additionalProperties @@ -33,6 +48,7 @@ public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.message = try container.decode(String.self, forKey: .message) self.voice = try container.decodeIfPresent(RecordingConsentPlanVerbalVoice.self, forKey: .voice) + self.firstMessageMode = try container.decodeIfPresent(RecordingConsentPlanVerbalFirstMessageMode.self, forKey: .firstMessageMode) self.declineTool = try container.decodeIfPresent([String: JSONValue].self, forKey: .declineTool) self.declineToolId = try container.decodeIfPresent(String.self, forKey: .declineToolId) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -43,6 +59,7 @@ public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.message, forKey: .message) try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) try container.encodeIfPresent(self.declineTool, forKey: .declineTool) try container.encodeIfPresent(self.declineToolId, forKey: .declineToolId) } @@ -51,6 +68,7 @@ public struct RecordingConsentPlanVerbal: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case message case voice + case firstMessageMode case declineTool case declineToolId } diff --git a/Sources/Schemas/RecordingConsentPlanVerbalFirstMessageMode.swift b/Sources/Schemas/RecordingConsentPlanVerbalFirstMessageMode.swift new file mode 100644 index 00000000..ad94547b --- /dev/null +++ b/Sources/Schemas/RecordingConsentPlanVerbalFirstMessageMode.swift @@ -0,0 +1,17 @@ +import Foundation + +/// This controls whether the consent assistant speaks first or waits for the caller to speak first. +/// +/// Use: +/// - `assistant-speaks-first` (default) to have the consent assistant play the consent message as soon as the call is answered. +/// - `assistant-waits-for-user` to have the consent assistant wait for the caller to speak before playing the consent message. +/// +/// We strongly recommend `assistant-waits-for-user` for outbound calls. Some telephony providers signal "answered" while the line is still ringing, which can cause the consent message to play into a ringing line and be missed by the caller. Waiting for the caller to speak first guarantees they hear the full consent message. +/// +/// Note: when combined with `type: 'stay-on-line'`, silence only counts toward consent after the caller has spoken at least once. +/// +/// @default 'assistant-speaks-first' +public enum RecordingConsentPlanVerbalFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/RecordingConsentPlanVerbalVoice.swift b/Sources/Schemas/RecordingConsentPlanVerbalVoice.swift index c9f9f3f9..13bf8fb0 100644 --- a/Sources/Schemas/RecordingConsentPlanVerbalVoice.swift +++ b/Sources/Schemas/RecordingConsentPlanVerbalVoice.swift @@ -11,6 +11,7 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -21,6 +22,7 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -42,6 +44,8 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -62,6 +66,8 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -99,6 +105,9 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -129,6 +138,9 @@ public enum RecordingConsentPlanVerbalVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/RecordingConsentType.swift b/Sources/Schemas/RecordingConsentType.swift new file mode 100644 index 00000000..1bc202c4 --- /dev/null +++ b/Sources/Schemas/RecordingConsentType.swift @@ -0,0 +1,7 @@ +import Foundation + +/// This is the type of recording consent. +public enum RecordingConsentType: String, Codable, Hashable, CaseIterable, Sendable { + case stayOnLine = "stay-on-line" + case verbal +} \ No newline at end of file diff --git a/Sources/Schemas/RegexCondition.swift b/Sources/Schemas/RegexCondition.swift index 9c2f92a9..10a5845a 100644 --- a/Sources/Schemas/RegexCondition.swift +++ b/Sources/Schemas/RegexCondition.swift @@ -1,5 +1,6 @@ import Foundation +/// Evaluates whether targeted conversation-message content matches a regular expression. public struct RegexCondition: Codable, Hashable, Sendable { /// This is the regular expression pattern to match against message content. /// diff --git a/Sources/Schemas/RegexOption.swift b/Sources/Schemas/RegexOption.swift index a3353966..fe086a14 100644 --- a/Sources/Schemas/RegexOption.swift +++ b/Sources/Schemas/RegexOption.swift @@ -1,5 +1,6 @@ import Foundation +/// Enables or disables one regular-expression matching option for a text replacement. public struct RegexOption: Codable, Hashable, Sendable { /// This is the type of the regex option. Options are: /// - `ignore-case`: Ignores the case of the text being matched. Add diff --git a/Sources/Schemas/RegexReplacement.swift b/Sources/Schemas/RegexReplacement.swift index 18cabee8..9fbd0211 100644 --- a/Sources/Schemas/RegexReplacement.swift +++ b/Sources/Schemas/RegexReplacement.swift @@ -1,5 +1,6 @@ import Foundation +/// Replaces text matching a regular expression before it is sent to a voice provider. public struct RegexReplacement: Codable, Hashable, Sendable { /// This is the regex pattern to replace. /// diff --git a/Sources/Schemas/RegexSecurityFilter.swift b/Sources/Schemas/RegexSecurityFilter.swift index cd6b9639..292e907c 100644 --- a/Sources/Schemas/RegexSecurityFilter.swift +++ b/Sources/Schemas/RegexSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters transcript content that matches a custom regular expression. public struct RegexSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: RegexSecurityFilterType diff --git a/Sources/Schemas/RevokeInvitationResponseDto.swift b/Sources/Schemas/RevokeInvitationResponseDto.swift new file mode 100644 index 00000000..42b3a776 --- /dev/null +++ b/Sources/Schemas/RevokeInvitationResponseDto.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct RevokeInvitationResponseDto: Codable, Hashable, Sendable { + public let success: Bool + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + success: Bool, + additionalProperties: [String: JSONValue] = .init() + ) { + self.success = success + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.success = try container.decode(Bool.self, forKey: .success) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.success, forKey: .success) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case success + } +} \ No newline at end of file diff --git a/Sources/Schemas/RimeAiVoice.swift b/Sources/Schemas/RimeAiVoice.swift index c2080f96..e155f4d9 100644 --- a/Sources/Schemas/RimeAiVoice.swift +++ b/Sources/Schemas/RimeAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Rime AI, including voice and model selection, language, speed, pauses, phonemization, latency, chunking, caching, and fallback settings. public struct RimeAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/S3CompatibleBucketPlan.swift b/Sources/Schemas/S3CompatibleBucketPlan.swift new file mode 100644 index 00000000..bd467a50 --- /dev/null +++ b/Sources/Schemas/S3CompatibleBucketPlan.swift @@ -0,0 +1,68 @@ +import Foundation + +public struct S3CompatibleBucketPlan: Codable, Hashable, Sendable { + /// S3-compatible endpoint URL, such as https://s3.us-west-004.backblazeb2.com. Must be public HTTPS. + public let url: String + /// SigV4 signing region expected by the object store. Most stores accept us-east-1. + public let region: String + /// S3 access key ID. + public let accessKeyId: String + /// S3 secret access key. This is not returned in the API. + public let secretAccessKey: String + /// Bucket name. + public let name: String + /// Optional key prefix inside the bucket, such as recordings/. + public let path: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + url: String, + region: String, + accessKeyId: String, + secretAccessKey: String, + name: String, + path: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.url = url + self.region = region + self.accessKeyId = accessKeyId + self.secretAccessKey = secretAccessKey + self.name = name + self.path = path + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.url = try container.decode(String.self, forKey: .url) + self.region = try container.decode(String.self, forKey: .region) + self.accessKeyId = try container.decode(String.self, forKey: .accessKeyId) + self.secretAccessKey = try container.decode(String.self, forKey: .secretAccessKey) + self.name = try container.decode(String.self, forKey: .name) + self.path = try container.decodeIfPresent(String.self, forKey: .path) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.url, forKey: .url) + try container.encode(self.region, forKey: .region) + try container.encode(self.accessKeyId, forKey: .accessKeyId) + try container.encode(self.secretAccessKey, forKey: .secretAccessKey) + try container.encode(self.name, forKey: .name) + try container.encodeIfPresent(self.path, forKey: .path) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case url + case region + case accessKeyId + case secretAccessKey + case name + case path + } +} \ No newline at end of file diff --git a/Sources/Schemas/S3CompatibleStorageCredential.swift b/Sources/Schemas/S3CompatibleStorageCredential.swift new file mode 100644 index 00000000..a41f3a32 --- /dev/null +++ b/Sources/Schemas/S3CompatibleStorageCredential.swift @@ -0,0 +1,81 @@ +import Foundation + +public struct S3CompatibleStorageCredential: Codable, Hashable, Sendable { + /// This is for S3-compatible storage such as MinIO, Garage, Ceph, or Backblaze B2. + public let provider: S3CompatibleStorageCredentialProvider + public let bucketPlan: S3CompatibleBucketPlan + /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. + public let fallbackIndex: Double? + /// This is the unique identifier for the credential. + public let id: String + /// This is the unique identifier for the org that this credential belongs to. + public let orgId: String + /// This is the ISO 8601 date-time string of when the credential was created. + public let createdAt: Date + /// This is the ISO 8601 date-time string of when the assistant was last updated. + public let updatedAt: Date + /// This is the name of credential. This is just for your reference. + public let name: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + provider: S3CompatibleStorageCredentialProvider, + bucketPlan: S3CompatibleBucketPlan, + fallbackIndex: Double? = nil, + id: String, + orgId: String, + createdAt: Date, + updatedAt: Date, + name: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.provider = provider + self.bucketPlan = bucketPlan + self.fallbackIndex = fallbackIndex + self.id = id + self.orgId = orgId + self.createdAt = createdAt + self.updatedAt = updatedAt + self.name = name + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decode(S3CompatibleStorageCredentialProvider.self, forKey: .provider) + self.bucketPlan = try container.decode(S3CompatibleBucketPlan.self, forKey: .bucketPlan) + self.fallbackIndex = try container.decodeIfPresent(Double.self, forKey: .fallbackIndex) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.provider, forKey: .provider) + try container.encode(self.bucketPlan, forKey: .bucketPlan) + try container.encodeIfPresent(self.fallbackIndex, forKey: .fallbackIndex) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.name, forKey: .name) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + case bucketPlan + case fallbackIndex + case id + case orgId + case createdAt + case updatedAt + case name + } +} \ No newline at end of file diff --git a/Sources/Schemas/S3CompatibleStorageCredentialProvider.swift b/Sources/Schemas/S3CompatibleStorageCredentialProvider.swift new file mode 100644 index 00000000..63b973fe --- /dev/null +++ b/Sources/Schemas/S3CompatibleStorageCredentialProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is for S3-compatible storage such as MinIO, Garage, Ceph, or Backblaze B2. +public enum S3CompatibleStorageCredentialProvider: String, Codable, Hashable, CaseIterable, Sendable { + case s3Compatible = "s3-compatible" +} \ No newline at end of file diff --git a/Sources/Schemas/SayHookAction.swift b/Sources/Schemas/SayHookAction.swift index 168f6fdf..0d7ec3f4 100644 --- a/Sources/Schemas/SayHookAction.swift +++ b/Sources/Schemas/SayHookAction.swift @@ -1,41 +1,42 @@ import Foundation +/// A hook action that makes the assistant speak exact text or generate a response from a prompt. public struct SayHookAction: Codable, Hashable, Sendable { + /// This is the exact message to say. When a string array is provided, one is randomly selected. + public let exact: SayHookActionExact? /// This is the prompt for the assistant to generate a response based on existing conversation. /// Can be a string or an array of chat messages. public let prompt: SayHookActionPrompt? - /// This is the message to say - public let exact: [String: JSONValue]? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + exact: SayHookActionExact? = nil, prompt: SayHookActionPrompt? = nil, - exact: [String: JSONValue]? = nil, additionalProperties: [String: JSONValue] = .init() ) { - self.prompt = prompt self.exact = exact + self.prompt = prompt self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.exact = try container.decodeIfPresent(SayHookActionExact.self, forKey: .exact) self.prompt = try container.decodeIfPresent(SayHookActionPrompt.self, forKey: .prompt) - self.exact = try container.decodeIfPresent([String: JSONValue].self, forKey: .exact) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.prompt, forKey: .prompt) try container.encodeIfPresent(self.exact, forKey: .exact) + try container.encodeIfPresent(self.prompt, forKey: .prompt) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case prompt case exact + case prompt } } \ No newline at end of file diff --git a/Sources/Schemas/SayHookActionExact.swift b/Sources/Schemas/SayHookActionExact.swift new file mode 100644 index 00000000..7b948a39 --- /dev/null +++ b/Sources/Schemas/SayHookActionExact.swift @@ -0,0 +1,31 @@ +import Foundation + +/// This is the exact message to say. When a string array is provided, one is randomly selected. +public enum SayHookActionExact: Codable, Hashable, Sendable { + case string(String) + case stringArray([String]) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(String.self) { + self = .string(value) + } else if let value = try? container.decode([String].self) { + self = .stringArray(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .string(let value): + try container.encode(value) + case .stringArray(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/SayPhoneNumberHookAction.swift b/Sources/Schemas/SayPhoneNumberHookAction.swift index 4db3c28d..7519aad9 100644 --- a/Sources/Schemas/SayPhoneNumberHookAction.swift +++ b/Sources/Schemas/SayPhoneNumberHookAction.swift @@ -1,5 +1,6 @@ import Foundation +/// A phone-number hook action that speaks an exact message to the caller. public struct SayPhoneNumberHookAction: Codable, Hashable, Sendable { /// This is the message to say public let exact: String diff --git a/Sources/Schemas/SbcConfiguration.swift b/Sources/Schemas/SbcConfiguration.swift index d9749df5..ffa63558 100644 --- a/Sources/Schemas/SbcConfiguration.swift +++ b/Sources/Schemas/SbcConfiguration.swift @@ -1,20 +1,4 @@ import Foundation -public struct SbcConfiguration: Codable, Hashable, Sendable { - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - additionalProperties: [String: JSONValue] = .init() - ) { - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - self.additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) - } - - public func encode(to encoder: Encoder) throws -> Void { - try encoder.encodeAdditionalProperties(self.additionalProperties) - } -} \ No newline at end of file +/// Routes bring-your-own SIP traffic through an on-premises session border controller instead of Vapi's managed controller. +public typealias SbcConfiguration = JSONValue diff --git a/Sources/Schemas/SchedulePlan.swift b/Sources/Schemas/SchedulePlan.swift index 51f08d86..82c0938d 100644 --- a/Sources/Schemas/SchedulePlan.swift +++ b/Sources/Schemas/SchedulePlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Time window that controls the earliest and latest time a call may begin. public struct SchedulePlan: Codable, Hashable, Sendable { /// This is the ISO 8601 date-time string of the earliest time the call can be scheduled. public let earliestAt: Date diff --git a/Sources/Schemas/Scorecard.swift b/Sources/Schemas/Scorecard.swift index 8b7f36e8..45d18e1e 100644 --- a/Sources/Schemas/Scorecard.swift +++ b/Sources/Schemas/Scorecard.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved scorecard containing its evaluation metrics, scoring conditions, assistant associations, descriptive metadata, and lifecycle information. public struct Scorecard: Codable, Hashable, Sendable { /// This is the unique identifier for the scorecard. public let id: String diff --git a/Sources/Schemas/ScorecardControllerGetPaginatedRequestSortBy.swift b/Sources/Schemas/ScorecardControllerGetPaginatedRequestSortBy.swift new file mode 100644 index 00000000..d284dca4 --- /dev/null +++ b/Sources/Schemas/ScorecardControllerGetPaginatedRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum ScorecardControllerGetPaginatedRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/ScorecardMetric.swift b/Sources/Schemas/ScorecardMetric.swift index d022d32a..c0d64424 100644 --- a/Sources/Schemas/ScorecardMetric.swift +++ b/Sources/Schemas/ScorecardMetric.swift @@ -1,44 +1,45 @@ import Foundation +/// A scorecard metric that awards points when a structured output meets its configured conditions. public struct ScorecardMetric: Codable, Hashable, Sendable { - /// This is the unique identifier for the structured output that will be used to evaluate the scorecard. - /// The structured output must be of type number or boolean only for now. - public let structuredOutputId: String /// These are the conditions that will be used to evaluate the scorecard. /// Each condition will have a comparator, value, and points that will be used to calculate the final score. /// The points will be added to the overall score if the condition is met. /// The overall score will be normalized to a 100 point scale to ensure uniformity across different scorecards. - public let conditions: [[String: JSONValue]] + public let conditions: [ScorecardMetricConditionsItem] + /// This is the unique identifier for the structured output that will be used to evaluate the scorecard. + /// The structured output must be of type number or boolean only for now. + public let structuredOutputId: String /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + conditions: [ScorecardMetricConditionsItem], structuredOutputId: String, - conditions: [[String: JSONValue]], additionalProperties: [String: JSONValue] = .init() ) { - self.structuredOutputId = structuredOutputId self.conditions = conditions + self.structuredOutputId = structuredOutputId self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.conditions = try container.decode([ScorecardMetricConditionsItem].self, forKey: .conditions) self.structuredOutputId = try container.decode(String.self, forKey: .structuredOutputId) - self.conditions = try container.decode([[String: JSONValue]].self, forKey: .conditions) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.structuredOutputId, forKey: .structuredOutputId) try container.encode(self.conditions, forKey: .conditions) + try container.encode(self.structuredOutputId, forKey: .structuredOutputId) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case structuredOutputId case conditions + case structuredOutputId } } \ No newline at end of file diff --git a/Sources/Schemas/ScorecardMetricConditionsItem.swift b/Sources/Schemas/ScorecardMetricConditionsItem.swift new file mode 100644 index 00000000..24e6366e --- /dev/null +++ b/Sources/Schemas/ScorecardMetricConditionsItem.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum ScorecardMetricConditionsItem: Codable, Hashable, Sendable { + case booleanComparatorScorecardMetricCondition(BooleanComparatorScorecardMetricCondition) + case numberComparatorScorecardMetricCondition(NumberComparatorScorecardMetricCondition) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(BooleanComparatorScorecardMetricCondition.self) { + self = .booleanComparatorScorecardMetricCondition(value) + } else if let value = try? container.decode(NumberComparatorScorecardMetricCondition.self) { + self = .numberComparatorScorecardMetricCondition(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .booleanComparatorScorecardMetricCondition(let value): + try container.encode(value) + case .numberComparatorScorecardMetricCondition(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/ScorecardPaginatedResponse.swift b/Sources/Schemas/ScorecardPaginatedResponse.swift index e786579a..0a09b88a 100644 --- a/Sources/Schemas/ScorecardPaginatedResponse.swift +++ b/Sources/Schemas/ScorecardPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of scorecards and metadata describing the result set. public struct ScorecardPaginatedResponse: Codable, Hashable, Sendable { + /// The scorecards returned for the current page. public let results: [Scorecard] + /// Pagination metadata for the scorecard result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/SecurityFilterBase.swift b/Sources/Schemas/SecurityFilterBase.swift index 50014236..9a612ca5 100644 --- a/Sources/Schemas/SecurityFilterBase.swift +++ b/Sources/Schemas/SecurityFilterBase.swift @@ -1,5 +1,6 @@ import Foundation +/// Base configuration for a security filter applied to transcripts before model processing. public struct SecurityFilterBase: Codable, Hashable, Sendable { /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/SecurityFilterPlan.swift b/Sources/Schemas/SecurityFilterPlan.swift index ae6e5f05..62b627c9 100644 --- a/Sources/Schemas/SecurityFilterPlan.swift +++ b/Sources/Schemas/SecurityFilterPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls filtering of transcripts for security threats before content is sent to the assistant's language model, including filter selection, handling mode, and replacement text. public struct SecurityFilterPlan: Codable, Hashable, Sendable { /// Whether the security filter is enabled. /// @default false diff --git a/Sources/Schemas/Server.swift b/Sources/Schemas/Server.swift index 362e159e..18be5f67 100644 --- a/Sources/Schemas/Server.swift +++ b/Sources/Schemas/Server.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for requests Vapi sends to a customer server, including URL, authentication, headers, timeout, encryption, static IP addresses, and retry behavior. public struct Server: Codable, Hashable, Sendable { /// This is the timeout in seconds for the request. Defaults to 20 seconds. /// diff --git a/Sources/Schemas/ServerMessageAssistantRequest.swift b/Sources/Schemas/ServerMessageAssistantRequest.swift index 37c401ab..0de6e352 100644 --- a/Sources/Schemas/ServerMessageAssistantRequest.swift +++ b/Sources/Schemas/ServerMessageAssistantRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageAssistantRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "assistant-request" is sent to fetch assistant configuration for an incoming call. public let type: ServerMessageAssistantRequestType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageAssistantRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageAssistantRequestType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageAssistantRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageAssistantRequestType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageAssistantRequest: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageAssistantSpeech.swift b/Sources/Schemas/ServerMessageAssistantSpeech.swift index 2c111f31..29041b7c 100644 --- a/Sources/Schemas/ServerMessageAssistantSpeech.swift +++ b/Sources/Schemas/ServerMessageAssistantSpeech.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageAssistantSpeechPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "assistant-speech" is sent as assistant audio is being played. public let type: ServerMessageAssistantSpeechType /// The full assistant text for the current turn. This is the complete text, @@ -49,6 +54,7 @@ public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageAssistantSpeechPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageAssistantSpeechType, text: String, turn: Double? = nil, @@ -63,6 +69,7 @@ public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.text = text self.turn = turn @@ -80,6 +87,7 @@ public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageAssistantSpeechPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageAssistantSpeechType.self, forKey: .type) self.text = try container.decode(String.self, forKey: .text) self.turn = try container.decodeIfPresent(Double.self, forKey: .turn) @@ -98,6 +106,7 @@ public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.text, forKey: .text) try container.encodeIfPresent(self.turn, forKey: .turn) @@ -114,6 +123,7 @@ public struct ServerMessageAssistantSpeech: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case text case turn diff --git a/Sources/Schemas/ServerMessageCallDeleteFailed.swift b/Sources/Schemas/ServerMessageCallDeleteFailed.swift index d68398bc..c869bd1d 100644 --- a/Sources/Schemas/ServerMessageCallDeleteFailed.swift +++ b/Sources/Schemas/ServerMessageCallDeleteFailed.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageCallDeleteFailedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "call.deleted" is sent when a call is deleted. public let type: ServerMessageCallDeleteFailedType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageCallDeleteFailedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageCallDeleteFailedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageCallDeleteFailedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageCallDeleteFailedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageCallDeleteFailed: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageCallDeleted.swift b/Sources/Schemas/ServerMessageCallDeleted.swift index 56f95fc7..41f4d6d0 100644 --- a/Sources/Schemas/ServerMessageCallDeleted.swift +++ b/Sources/Schemas/ServerMessageCallDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageCallDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "call.deleted" is sent when a call is deleted. public let type: ServerMessageCallDeletedType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageCallDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageCallDeletedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageCallDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageCallDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageCallDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageCallEndpointingRequest.swift b/Sources/Schemas/ServerMessageCallEndpointingRequest.swift index 1d736837..c695691d 100644 --- a/Sources/Schemas/ServerMessageCallEndpointingRequest.swift +++ b/Sources/Schemas/ServerMessageCallEndpointingRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageCallEndpointingRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "call.endpointing.request" is sent when using `assistant.startSpeakingPlan.smartEndpointingPlan={ "provider": "custom-endpointing-model" }`. /// /// Here is what the request will look like: @@ -53,6 +58,7 @@ public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageCallEndpointingRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageCallEndpointingRequestType, messages: [ServerMessageCallEndpointingRequestMessagesItem]? = nil, messagesOpenAiFormatted: [OpenAiMessage], @@ -65,6 +71,7 @@ public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.messages = messages self.messagesOpenAiFormatted = messagesOpenAiFormatted @@ -80,6 +87,7 @@ public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageCallEndpointingRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageCallEndpointingRequestType.self, forKey: .type) self.messages = try container.decodeIfPresent([ServerMessageCallEndpointingRequestMessagesItem].self, forKey: .messages) self.messagesOpenAiFormatted = try container.decode([OpenAiMessage].self, forKey: .messagesOpenAiFormatted) @@ -96,6 +104,7 @@ public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.messagesOpenAiFormatted, forKey: .messagesOpenAiFormatted) @@ -110,6 +119,7 @@ public struct ServerMessageCallEndpointingRequest: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case messages case messagesOpenAiFormatted = "messagesOpenAIFormatted" diff --git a/Sources/Schemas/ServerMessageCampaignPredial.swift b/Sources/Schemas/ServerMessageCampaignPredial.swift new file mode 100644 index 00000000..b0fd4e68 --- /dev/null +++ b/Sources/Schemas/ServerMessageCampaignPredial.swift @@ -0,0 +1,108 @@ +import Foundation + +public struct ServerMessageCampaignPredial: Codable, Hashable, Sendable { + /// This is the phone number that the message is associated with. + public let phoneNumber: ServerMessageCampaignPredialPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? + /// This is the type of the message. "campaign.predial" is sent to the campaign's server before each contact is dialed, so the server can decide whether the contact is eligible to be called. It is only sent when the campaign's `predialPlan` is set (and not disabled). + public let type: ServerMessageCampaignPredialType + /// This is the ID of the campaign the contact belongs to. + public let campaignId: String + /// This is the contact that is about to be dialed. + public let contact: CampaignContact + /// This is the timestamp of the message. + public let timestamp: Double? + /// This is a live version of the `call.artifact`. + /// + /// This matches what is stored on `call.artifact` after the call. + public let artifact: Artifact? + /// This is the assistant that the message is associated with. + public let assistant: CreateAssistantDto? + /// This is the customer that the message is associated with. + public let customer: CreateCustomerDto? + /// This is the call that the message is associated with. + public let call: Call? + /// This is the chat object. + public let chat: Chat? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + phoneNumber: ServerMessageCampaignPredialPhoneNumber? = nil, + assistantVersion: Nullable? = nil, + type: ServerMessageCampaignPredialType, + campaignId: String, + contact: CampaignContact, + timestamp: Double? = nil, + artifact: Artifact? = nil, + assistant: CreateAssistantDto? = nil, + customer: CreateCustomerDto? = nil, + call: Call? = nil, + chat: Chat? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion + self.type = type + self.campaignId = campaignId + self.contact = contact + self.timestamp = timestamp + self.artifact = artifact + self.assistant = assistant + self.customer = customer + self.call = call + self.chat = chat + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.phoneNumber = try container.decodeIfPresent(ServerMessageCampaignPredialPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) + self.type = try container.decode(ServerMessageCampaignPredialType.self, forKey: .type) + self.campaignId = try container.decode(String.self, forKey: .campaignId) + self.contact = try container.decode(CampaignContact.self, forKey: .contact) + self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) + self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) + self.assistant = try container.decodeIfPresent(CreateAssistantDto.self, forKey: .assistant) + self.customer = try container.decodeIfPresent(CreateCustomerDto.self, forKey: .customer) + self.call = try container.decodeIfPresent(Call.self, forKey: .call) + self.chat = try container.decodeIfPresent(Chat.self, forKey: .chat) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) + try container.encode(self.type, forKey: .type) + try container.encode(self.campaignId, forKey: .campaignId) + try container.encode(self.contact, forKey: .contact) + try container.encodeIfPresent(self.timestamp, forKey: .timestamp) + try container.encodeIfPresent(self.artifact, forKey: .artifact) + try container.encodeIfPresent(self.assistant, forKey: .assistant) + try container.encodeIfPresent(self.customer, forKey: .customer) + try container.encodeIfPresent(self.call, forKey: .call) + try container.encodeIfPresent(self.chat, forKey: .chat) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case phoneNumber + case assistantVersion + case type + case campaignId + case contact + case timestamp + case artifact + case assistant + case customer + case call + case chat + } +} \ No newline at end of file diff --git a/Sources/Schemas/ServerMessageCampaignPredialPhoneNumber.swift b/Sources/Schemas/ServerMessageCampaignPredialPhoneNumber.swift new file mode 100644 index 00000000..d5f56b75 --- /dev/null +++ b/Sources/Schemas/ServerMessageCampaignPredialPhoneNumber.swift @@ -0,0 +1,59 @@ +import Foundation + +/// This is the phone number that the message is associated with. +public enum ServerMessageCampaignPredialPhoneNumber: Codable, Hashable, Sendable { + case byoPhoneNumber(CreateByoPhoneNumberDto) + case telnyx(CreateTelnyxPhoneNumberDto) + case twilio(CreateTwilioPhoneNumberDto) + case vapi(CreateVapiPhoneNumberDto) + case vonage(CreateVonagePhoneNumberDto) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "byo-phone-number": + self = .byoPhoneNumber(try CreateByoPhoneNumberDto(from: decoder)) + case "telnyx": + self = .telnyx(try CreateTelnyxPhoneNumberDto(from: decoder)) + case "twilio": + self = .twilio(try CreateTwilioPhoneNumberDto(from: decoder)) + case "vapi": + self = .vapi(try CreateVapiPhoneNumberDto(from: decoder)) + case "vonage": + self = .vonage(try CreateVonagePhoneNumberDto(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .byoPhoneNumber(let data): + try container.encode("byo-phone-number", forKey: .provider) + try data.encode(to: encoder) + case .telnyx(let data): + try container.encode("telnyx", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/ServerMessageCampaignPredialType.swift b/Sources/Schemas/ServerMessageCampaignPredialType.swift new file mode 100644 index 00000000..c3679631 --- /dev/null +++ b/Sources/Schemas/ServerMessageCampaignPredialType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the type of the message. "campaign.predial" is sent to the campaign's server before each contact is dialed, so the server can decide whether the contact is eligible to be called. It is only sent when the campaign's `predialPlan` is set (and not disabled). +public enum ServerMessageCampaignPredialType: String, Codable, Hashable, CaseIterable, Sendable { + case campaignPredial = "campaign.predial" +} \ No newline at end of file diff --git a/Sources/Schemas/ServerMessageChatCreated.swift b/Sources/Schemas/ServerMessageChatCreated.swift index 9ba785d5..3d46d9fc 100644 --- a/Sources/Schemas/ServerMessageChatCreated.swift +++ b/Sources/Schemas/ServerMessageChatCreated.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageChatCreated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageChatCreatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "chat.created" is sent when a new chat is created. public let type: ServerMessageChatCreatedType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageChatCreated: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageChatCreatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageChatCreatedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageChatCreated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageChatCreated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageChatCreatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageChatCreatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageChatCreated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageChatCreated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageChatDeleted.swift b/Sources/Schemas/ServerMessageChatDeleted.swift index 7036a006..3c3ac179 100644 --- a/Sources/Schemas/ServerMessageChatDeleted.swift +++ b/Sources/Schemas/ServerMessageChatDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageChatDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "chat.deleted" is sent when a chat is deleted. public let type: ServerMessageChatDeletedType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageChatDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageChatDeletedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageChatDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageChatDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageChatDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageConversationUpdate.swift b/Sources/Schemas/ServerMessageConversationUpdate.swift index 2b50df43..9638e146 100644 --- a/Sources/Schemas/ServerMessageConversationUpdate.swift +++ b/Sources/Schemas/ServerMessageConversationUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageConversationUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "conversation-update" is sent when an update is committed to the conversation history. public let type: ServerMessageConversationUpdateType /// This is the most up-to-date conversation history at the time the message is sent. @@ -28,6 +33,7 @@ public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageConversationUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageConversationUpdateType, messages: [ServerMessageConversationUpdateMessagesItem]? = nil, messagesOpenAiFormatted: [OpenAiMessage], @@ -40,6 +46,7 @@ public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.messages = messages self.messagesOpenAiFormatted = messagesOpenAiFormatted @@ -55,6 +62,7 @@ public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageConversationUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageConversationUpdateType.self, forKey: .type) self.messages = try container.decodeIfPresent([ServerMessageConversationUpdateMessagesItem].self, forKey: .messages) self.messagesOpenAiFormatted = try container.decode([OpenAiMessage].self, forKey: .messagesOpenAiFormatted) @@ -71,6 +79,7 @@ public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.messagesOpenAiFormatted, forKey: .messagesOpenAiFormatted) @@ -85,6 +94,7 @@ public struct ServerMessageConversationUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case messages case messagesOpenAiFormatted = "messagesOpenAIFormatted" diff --git a/Sources/Schemas/ServerMessageEndOfCallReport.swift b/Sources/Schemas/ServerMessageEndOfCallReport.swift index 80278021..fbf48924 100644 --- a/Sources/Schemas/ServerMessageEndOfCallReport.swift +++ b/Sources/Schemas/ServerMessageEndOfCallReport.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageEndOfCallReportPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "end-of-call-report" is sent when the call ends and post-processing is complete. public let type: ServerMessageEndOfCallReportType /// This is the reason the call ended. This can also be found at `call.endedReason` on GET /call/:id. @@ -39,6 +44,7 @@ public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageEndOfCallReportPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageEndOfCallReportType, endedReason: ServerMessageEndOfCallReportEndedReason, cost: Double? = nil, @@ -57,6 +63,7 @@ public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.endedReason = endedReason self.cost = cost @@ -78,6 +85,7 @@ public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageEndOfCallReportPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageEndOfCallReportType.self, forKey: .type) self.endedReason = try container.decode(ServerMessageEndOfCallReportEndedReason.self, forKey: .endedReason) self.cost = try container.decodeIfPresent(Double.self, forKey: .cost) @@ -100,6 +108,7 @@ public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.endedReason, forKey: .endedReason) try container.encodeIfPresent(self.cost, forKey: .cost) @@ -120,6 +129,7 @@ public struct ServerMessageEndOfCallReport: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case endedReason case cost diff --git a/Sources/Schemas/ServerMessageEndOfCallReportEndedReason.swift b/Sources/Schemas/ServerMessageEndOfCallReportEndedReason.swift index 8e5b04cc..68f32df5 100644 --- a/Sources/Schemas/ServerMessageEndOfCallReportEndedReason.swift +++ b/Sources/Schemas/ServerMessageEndOfCallReportEndedReason.swift @@ -26,6 +26,7 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case callStartErrorSubscriptionUpgradeFailed = "call.start.error-subscription-upgrade-failed" case callStartErrorSubscriptionConcurrencyLimitReached = "call.start.error-subscription-concurrency-limit-reached" case callStartErrorEnterpriseFeatureNotAvailableRecordingConsent = "call.start.error-enterprise-feature-not-available-recording-consent" + case callStartAssistantVersionErrorValidation = "call.start.assistant-version-error-validation" case assistantNotValid = "assistant-not-valid" case callStartErrorVapifaultDatabaseError = "call.start.error-vapifault-database-error" case assistantNotFound = "assistant-not-found" @@ -45,6 +46,9 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case pipelineErrorInworldVoiceFailed = "pipeline-error-inworld-voice-failed" case pipelineErrorMinimaxVoiceFailed = "pipeline-error-minimax-voice-failed" case pipelineErrorWellsaidVoiceFailed = "pipeline-error-wellsaid-voice-failed" + case pipelineErrorXaiVoiceFailed = "pipeline-error-xai-voice-failed" + case pipelineErrorMicrosoftVoiceFailed = "pipeline-error-microsoft-voice-failed" + case pipelineErrorMicrosoftVoiceRequestCanceled = "pipeline-error-microsoft-voice-request-canceled" case pipelineErrorTavusVideoFailed = "pipeline-error-tavus-video-failed" case callInProgressErrorVapifaultOpenaiVoiceFailed = "call.in-progress.error-vapifault-openai-voice-failed" case callInProgressErrorVapifaultCartesiaVoiceFailed = "call.in-progress.error-vapifault-cartesia-voice-failed" @@ -62,6 +66,8 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case callInProgressErrorVapifaultInworldVoiceFailed = "call.in-progress.error-vapifault-inworld-voice-failed" case callInProgressErrorVapifaultMinimaxVoiceFailed = "call.in-progress.error-vapifault-minimax-voice-failed" case callInProgressErrorVapifaultWellsaidVoiceFailed = "call.in-progress.error-vapifault-wellsaid-voice-failed" + case callInProgressErrorVapifaultXaiVoiceFailed = "call.in-progress.error-vapifault-xai-voice-failed" + case callInProgressErrorVapifaultMicrosoftVoiceFailed = "call.in-progress.error-vapifault-microsoft-voice-failed" case callInProgressErrorVapifaultTavusVideoFailed = "call.in-progress.error-vapifault-tavus-video-failed" case pipelineErrorVapiLlmFailed = "pipeline-error-vapi-llm-failed" case pipelineErrorVapi400BadRequestValidationFailed = "pipeline-error-vapi-400-bad-request-validation-failed" @@ -71,12 +77,17 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case pipelineErrorVapi500ServerError = "pipeline-error-vapi-500-server-error" case pipelineErrorVapi503ServerOverloadedError = "pipeline-error-vapi-503-server-overloaded-error" case callInProgressErrorProviderfaultVapiLlmFailed = "call.in-progress.error-providerfault-vapi-llm-failed" + case callInProgressErrorVapifaultVapiLlmFailed = "call.in-progress.error-vapifault-vapi-llm-failed" case callInProgressErrorVapifaultVapi400BadRequestValidationFailed = "call.in-progress.error-vapifault-vapi-400-bad-request-validation-failed" case callInProgressErrorVapifaultVapi401Unauthorized = "call.in-progress.error-vapifault-vapi-401-unauthorized" case callInProgressErrorVapifaultVapi403ModelAccessDenied = "call.in-progress.error-vapifault-vapi-403-model-access-denied" case callInProgressErrorVapifaultVapi429ExceededQuota = "call.in-progress.error-vapifault-vapi-429-exceeded-quota" case callInProgressErrorProviderfaultVapi500ServerError = "call.in-progress.error-providerfault-vapi-500-server-error" case callInProgressErrorProviderfaultVapi503ServerOverloadedError = "call.in-progress.error-providerfault-vapi-503-server-overloaded-error" + case pipelineErrorVapiTranscriberFailed = "pipeline-error-vapi-transcriber-failed" + case callInProgressErrorVapifaultVapiTranscriberFailed = "call.in-progress.error-vapifault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiTranscriberFailed = "call.in-progress.error-providerfault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiVoiceFailed = "call.in-progress.error-providerfault-vapi-voice-failed" case pipelineErrorDeepgramTranscriberFailed = "pipeline-error-deepgram-transcriber-failed" case pipelineErrorDeepgramTranscriberApiKeyMissing = "pipeline-error-deepgram-transcriber-api-key-missing" case callInProgressErrorVapifaultDeepgramTranscriberFailed = "call.in-progress.error-vapifault-deepgram-transcriber-failed" @@ -116,6 +127,18 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case callInProgressErrorVapifaultSonioxTranscriberInvalidConfig = "call.in-progress.error-vapifault-soniox-transcriber-invalid-config" case callInProgressErrorVapifaultSonioxTranscriberServerError = "call.in-progress.error-vapifault-soniox-transcriber-server-error" case callInProgressErrorVapifaultSonioxTranscriberFailed = "call.in-progress.error-vapifault-soniox-transcriber-failed" + case pipelineErrorXaiTranscriberAuthFailed = "pipeline-error-xai-transcriber-auth-failed" + case pipelineErrorXaiTranscriberRateLimited = "pipeline-error-xai-transcriber-rate-limited" + case pipelineErrorXaiTranscriberInvalidConfig = "pipeline-error-xai-transcriber-invalid-config" + case pipelineErrorXaiTranscriberServerError = "pipeline-error-xai-transcriber-server-error" + case pipelineErrorXaiTranscriberFailed = "pipeline-error-xai-transcriber-failed" + case callInProgressErrorVapifaultXaiTranscriberAuthFailed = "call.in-progress.error-vapifault-xai-transcriber-auth-failed" + case callInProgressErrorVapifaultXaiTranscriberRateLimited = "call.in-progress.error-vapifault-xai-transcriber-rate-limited" + case callInProgressErrorVapifaultXaiTranscriberInvalidConfig = "call.in-progress.error-vapifault-xai-transcriber-invalid-config" + case callInProgressErrorVapifaultXaiTranscriberServerError = "call.in-progress.error-vapifault-xai-transcriber-server-error" + case callInProgressErrorVapifaultXaiTranscriberFailed = "call.in-progress.error-vapifault-xai-transcriber-failed" + case pipelineErrorCartesiaTranscriberFailed = "pipeline-error-cartesia-transcriber-failed" + case callInProgressErrorVapifaultCartesiaTranscriberFailed = "call.in-progress.error-vapifault-cartesia-transcriber-failed" case callInProgressErrorPipelineNoAvailableLlmModel = "call.in-progress.error-pipeline-no-available-llm-model" case workerShutdown = "worker-shutdown" case vonageDisconnected = "vonage-disconnected" @@ -558,6 +581,7 @@ public enum ServerMessageEndOfCallReportEndedReason: String, Codable, Hashable, case manuallyCanceled = "manually-canceled" case phoneCallProviderClosedWebsocket = "phone-call-provider-closed-websocket" case callForwardingOperatorBusy = "call.forwarding.operator-busy" + case callForwardingNoAnswer = "call.forwarding.no-answer" case silenceTimedOut = "silence-timed-out" case callInProgressErrorProviderfaultOutboundSip403Forbidden = "call.in-progress.error-providerfault-outbound-sip-403-forbidden" case callInProgressErrorProviderfaultOutboundSip407ProxyAuthenticationRequired = "call.in-progress.error-providerfault-outbound-sip-407-proxy-authentication-required" diff --git a/Sources/Schemas/ServerMessageHandoffDestinationRequest.swift b/Sources/Schemas/ServerMessageHandoffDestinationRequest.swift index 103813ef..1fa17c13 100644 --- a/Sources/Schemas/ServerMessageHandoffDestinationRequest.swift +++ b/Sources/Schemas/ServerMessageHandoffDestinationRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageHandoffDestinationRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "handoff-destination-request" is sent when the model is requesting handoff but destination is unknown. public let type: ServerMessageHandoffDestinationRequestType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendabl public init( phoneNumber: ServerMessageHandoffDestinationRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageHandoffDestinationRequestType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendabl additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendabl public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageHandoffDestinationRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageHandoffDestinationRequestType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendabl var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageHandoffDestinationRequest: Codable, Hashable, Sendabl /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageHang.swift b/Sources/Schemas/ServerMessageHang.swift index 97b4e72d..88a911c8 100644 --- a/Sources/Schemas/ServerMessageHang.swift +++ b/Sources/Schemas/ServerMessageHang.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageHang: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageHangPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "hang" is sent when the assistant is hanging due to a delay. The delay can be caused by many factors, such as: /// - the model is too slow to respond /// - the voice is too slow to respond @@ -28,6 +33,7 @@ public struct ServerMessageHang: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageHangPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageHangType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -38,6 +44,7 @@ public struct ServerMessageHang: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageHang: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageHangPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageHangType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -65,6 +73,7 @@ public struct ServerMessageHang: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -77,6 +86,7 @@ public struct ServerMessageHang: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageKnowledgeBaseRequest.swift b/Sources/Schemas/ServerMessageKnowledgeBaseRequest.swift index 36b8b60d..4689b47a 100644 --- a/Sources/Schemas/ServerMessageKnowledgeBaseRequest.swift +++ b/Sources/Schemas/ServerMessageKnowledgeBaseRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageKnowledgeBaseRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "knowledge-base-request" is sent to request knowledge base documents. To enable, use `assistant.knowledgeBase.provider=custom-knowledge-base`. public let type: ServerMessageKnowledgeBaseRequestType /// These are the messages that are going to be sent to the `model` right after the `knowledge-base-request` webhook completes. @@ -28,6 +33,7 @@ public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageKnowledgeBaseRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageKnowledgeBaseRequestType, messages: [ServerMessageKnowledgeBaseRequestMessagesItem]? = nil, messagesOpenAiFormatted: [OpenAiMessage], @@ -40,6 +46,7 @@ public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.messages = messages self.messagesOpenAiFormatted = messagesOpenAiFormatted @@ -55,6 +62,7 @@ public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageKnowledgeBaseRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageKnowledgeBaseRequestType.self, forKey: .type) self.messages = try container.decodeIfPresent([ServerMessageKnowledgeBaseRequestMessagesItem].self, forKey: .messages) self.messagesOpenAiFormatted = try container.decode([OpenAiMessage].self, forKey: .messagesOpenAiFormatted) @@ -71,6 +79,7 @@ public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.messagesOpenAiFormatted, forKey: .messagesOpenAiFormatted) @@ -85,6 +94,7 @@ public struct ServerMessageKnowledgeBaseRequest: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case messages case messagesOpenAiFormatted = "messagesOpenAIFormatted" diff --git a/Sources/Schemas/ServerMessageLanguageChangeDetected.swift b/Sources/Schemas/ServerMessageLanguageChangeDetected.swift index 57a1f69a..a15a69db 100644 --- a/Sources/Schemas/ServerMessageLanguageChangeDetected.swift +++ b/Sources/Schemas/ServerMessageLanguageChangeDetected.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageLanguageChangeDetectedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "language-change-detected" is sent when the transcriber is automatically switched based on the detected language. public let type: ServerMessageLanguageChangeDetectedType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageLanguageChangeDetectedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageLanguageChangeDetectedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageLanguageChangeDetectedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageLanguageChangeDetectedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageLanguageChangeDetected: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageMessage.swift b/Sources/Schemas/ServerMessageMessage.swift index 7afce71f..be2f3695 100644 --- a/Sources/Schemas/ServerMessageMessage.swift +++ b/Sources/Schemas/ServerMessageMessage.swift @@ -14,6 +14,7 @@ public enum ServerMessageMessage: Codable, Hashable, Sendable { case serverMessageCallDeleted(ServerMessageCallDeleted) case serverMessageCallDeleteFailed(ServerMessageCallDeleteFailed) case serverMessageCallEndpointingRequest(ServerMessageCallEndpointingRequest) + case serverMessageCampaignPredial(ServerMessageCampaignPredial) case serverMessageChatCreated(ServerMessageChatCreated) case serverMessageChatDeleted(ServerMessageChatDeleted) case serverMessageConversationUpdate(ServerMessageConversationUpdate) @@ -49,6 +50,8 @@ public enum ServerMessageMessage: Codable, Hashable, Sendable { self = .serverMessageCallDeleteFailed(value) } else if let value = try? container.decode(ServerMessageCallEndpointingRequest.self) { self = .serverMessageCallEndpointingRequest(value) + } else if let value = try? container.decode(ServerMessageCampaignPredial.self) { + self = .serverMessageCampaignPredial(value) } else if let value = try? container.decode(ServerMessageChatCreated.self) { self = .serverMessageChatCreated(value) } else if let value = try? container.decode(ServerMessageChatDeleted.self) { @@ -114,6 +117,8 @@ public enum ServerMessageMessage: Codable, Hashable, Sendable { try container.encode(value) case .serverMessageCallEndpointingRequest(let value): try container.encode(value) + case .serverMessageCampaignPredial(let value): + try container.encode(value) case .serverMessageChatCreated(let value): try container.encode(value) case .serverMessageChatDeleted(let value): diff --git a/Sources/Schemas/ServerMessageModelOutput.swift b/Sources/Schemas/ServerMessageModelOutput.swift index d5d3f04b..fda90645 100644 --- a/Sources/Schemas/ServerMessageModelOutput.swift +++ b/Sources/Schemas/ServerMessageModelOutput.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageModelOutput: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageModelOutputPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "model-output" is sent as the model outputs tokens. public let type: ServerMessageModelOutputType /// This is the unique identifier for the current LLM turn. All tokens from the same @@ -29,6 +34,7 @@ public struct ServerMessageModelOutput: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageModelOutputPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageModelOutputType, turnId: String? = nil, timestamp: Double? = nil, @@ -41,6 +47,7 @@ public struct ServerMessageModelOutput: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.turnId = turnId self.timestamp = timestamp @@ -56,6 +63,7 @@ public struct ServerMessageModelOutput: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageModelOutputPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageModelOutputType.self, forKey: .type) self.turnId = try container.decodeIfPresent(String.self, forKey: .turnId) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -72,6 +80,7 @@ public struct ServerMessageModelOutput: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.turnId, forKey: .turnId) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -86,6 +95,7 @@ public struct ServerMessageModelOutput: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case turnId case timestamp diff --git a/Sources/Schemas/ServerMessagePhoneCallControl.swift b/Sources/Schemas/ServerMessagePhoneCallControl.swift index 38685280..39165f7e 100644 --- a/Sources/Schemas/ServerMessagePhoneCallControl.swift +++ b/Sources/Schemas/ServerMessagePhoneCallControl.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessagePhoneCallControlPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "phone-call-control" is an advanced type of message. /// /// When it is requested in `assistant.serverMessages`, the hangup and forwarding responsibilities are delegated to your server. Vapi will no longer do the actual transfer and hangup. @@ -30,6 +35,7 @@ public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessagePhoneCallControlPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessagePhoneCallControlType, request: ServerMessagePhoneCallControlRequest, destination: ServerMessagePhoneCallControlDestination? = nil, @@ -42,6 +48,7 @@ public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.request = request self.destination = destination @@ -57,6 +64,7 @@ public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessagePhoneCallControlPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessagePhoneCallControlType.self, forKey: .type) self.request = try container.decode(ServerMessagePhoneCallControlRequest.self, forKey: .request) self.destination = try container.decodeIfPresent(ServerMessagePhoneCallControlDestination.self, forKey: .destination) @@ -73,6 +81,7 @@ public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.request, forKey: .request) try container.encodeIfPresent(self.destination, forKey: .destination) @@ -87,6 +96,7 @@ public struct ServerMessagePhoneCallControl: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case request case destination diff --git a/Sources/Schemas/ServerMessageResponseCampaignPredial.swift b/Sources/Schemas/ServerMessageResponseCampaignPredial.swift new file mode 100644 index 00000000..5ea90e9b --- /dev/null +++ b/Sources/Schemas/ServerMessageResponseCampaignPredial.swift @@ -0,0 +1,33 @@ +import Foundation + +public struct ServerMessageResponseCampaignPredial: Codable, Hashable, Sendable { + /// This is whether the contact is eligible to be dialed. `true` places the call; `false` skips the contact. Any other response — a missing or non-boolean `eligible`, an unreachable server, an error, or a timeout — records a pre-dial failure for the contact and the call is not placed. + public let eligible: Bool + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + eligible: Bool, + additionalProperties: [String: JSONValue] = .init() + ) { + self.eligible = eligible + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.eligible = try container.decode(Bool.self, forKey: .eligible) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.eligible, forKey: .eligible) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case eligible + } +} \ No newline at end of file diff --git a/Sources/Schemas/ServerMessageResponseMessageResponse.swift b/Sources/Schemas/ServerMessageResponseMessageResponse.swift index 23bd2dac..f51dfe49 100644 --- a/Sources/Schemas/ServerMessageResponseMessageResponse.swift +++ b/Sources/Schemas/ServerMessageResponseMessageResponse.swift @@ -6,6 +6,7 @@ import Foundation public enum ServerMessageResponseMessageResponse: Codable, Hashable, Sendable { case serverMessageResponseAssistantRequest(ServerMessageResponseAssistantRequest) case serverMessageResponseCallEndpointingRequest(ServerMessageResponseCallEndpointingRequest) + case serverMessageResponseCampaignPredial(ServerMessageResponseCampaignPredial) case serverMessageResponseHandoffDestinationRequest(ServerMessageResponseHandoffDestinationRequest) case serverMessageResponseKnowledgeBaseRequest(ServerMessageResponseKnowledgeBaseRequest) case serverMessageResponseToolCalls(ServerMessageResponseToolCalls) @@ -18,6 +19,8 @@ public enum ServerMessageResponseMessageResponse: Codable, Hashable, Sendable { self = .serverMessageResponseAssistantRequest(value) } else if let value = try? container.decode(ServerMessageResponseCallEndpointingRequest.self) { self = .serverMessageResponseCallEndpointingRequest(value) + } else if let value = try? container.decode(ServerMessageResponseCampaignPredial.self) { + self = .serverMessageResponseCampaignPredial(value) } else if let value = try? container.decode(ServerMessageResponseHandoffDestinationRequest.self) { self = .serverMessageResponseHandoffDestinationRequest(value) } else if let value = try? container.decode(ServerMessageResponseKnowledgeBaseRequest.self) { @@ -43,6 +46,8 @@ public enum ServerMessageResponseMessageResponse: Codable, Hashable, Sendable { try container.encode(value) case .serverMessageResponseCallEndpointingRequest(let value): try container.encode(value) + case .serverMessageResponseCampaignPredial(let value): + try container.encode(value) case .serverMessageResponseHandoffDestinationRequest(let value): try container.encode(value) case .serverMessageResponseKnowledgeBaseRequest(let value): diff --git a/Sources/Schemas/ServerMessageSessionCreated.swift b/Sources/Schemas/ServerMessageSessionCreated.swift index bcc7e0ed..f9d6199d 100644 --- a/Sources/Schemas/ServerMessageSessionCreated.swift +++ b/Sources/Schemas/ServerMessageSessionCreated.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageSessionCreatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.created" is sent when a new session is created. public let type: ServerMessageSessionCreatedType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageSessionCreatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageSessionCreatedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageSessionCreatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageSessionCreatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageSessionCreated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageSessionDeleted.swift b/Sources/Schemas/ServerMessageSessionDeleted.swift index 34afd93d..4811cfc2 100644 --- a/Sources/Schemas/ServerMessageSessionDeleted.swift +++ b/Sources/Schemas/ServerMessageSessionDeleted.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageSessionDeletedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.deleted" is sent when a session is deleted. public let type: ServerMessageSessionDeletedType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageSessionDeletedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageSessionDeletedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageSessionDeletedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageSessionDeletedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageSessionDeleted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageSessionUpdated.swift b/Sources/Schemas/ServerMessageSessionUpdated.swift index 5b5350a7..be6fcb5e 100644 --- a/Sources/Schemas/ServerMessageSessionUpdated.swift +++ b/Sources/Schemas/ServerMessageSessionUpdated.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageSessionUpdatedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "session.updated" is sent when a session is updated. public let type: ServerMessageSessionUpdatedType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageSessionUpdatedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageSessionUpdatedType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageSessionUpdatedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageSessionUpdatedType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageSessionUpdated: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageSpeechUpdate.swift b/Sources/Schemas/ServerMessageSpeechUpdate.swift index 21621da0..c5307cbb 100644 --- a/Sources/Schemas/ServerMessageSpeechUpdate.swift +++ b/Sources/Schemas/ServerMessageSpeechUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageSpeechUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "speech-update" is sent whenever assistant or user start or stop speaking. public let type: ServerMessageSpeechUpdateType /// This is the status of the speech update. @@ -30,6 +35,7 @@ public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageSpeechUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageSpeechUpdateType, status: ServerMessageSpeechUpdateStatus, role: ServerMessageSpeechUpdateRole, @@ -43,6 +49,7 @@ public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.status = status self.role = role @@ -59,6 +66,7 @@ public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageSpeechUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageSpeechUpdateType.self, forKey: .type) self.status = try container.decode(ServerMessageSpeechUpdateStatus.self, forKey: .status) self.role = try container.decode(ServerMessageSpeechUpdateRole.self, forKey: .role) @@ -76,6 +84,7 @@ public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.status, forKey: .status) try container.encode(self.role, forKey: .role) @@ -91,6 +100,7 @@ public struct ServerMessageSpeechUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case status case role diff --git a/Sources/Schemas/ServerMessageStatusUpdate.swift b/Sources/Schemas/ServerMessageStatusUpdate.swift index f795557a..33a82809 100644 --- a/Sources/Schemas/ServerMessageStatusUpdate.swift +++ b/Sources/Schemas/ServerMessageStatusUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageStatusUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "status-update" is sent whenever the `call.status` changes. public let type: ServerMessageStatusUpdateType /// This is the status of the call. @@ -42,6 +47,7 @@ public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageStatusUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageStatusUpdateType, status: ServerMessageStatusUpdateStatus, endedReason: ServerMessageStatusUpdateEndedReason? = nil, @@ -60,6 +66,7 @@ public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.status = status self.endedReason = endedReason @@ -81,6 +88,7 @@ public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageStatusUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageStatusUpdateType.self, forKey: .type) self.status = try container.decode(ServerMessageStatusUpdateStatus.self, forKey: .status) self.endedReason = try container.decodeIfPresent(ServerMessageStatusUpdateEndedReason.self, forKey: .endedReason) @@ -103,6 +111,7 @@ public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encode(self.status, forKey: .status) try container.encodeIfPresent(self.endedReason, forKey: .endedReason) @@ -123,6 +132,7 @@ public struct ServerMessageStatusUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case status case endedReason diff --git a/Sources/Schemas/ServerMessageStatusUpdateEndedReason.swift b/Sources/Schemas/ServerMessageStatusUpdateEndedReason.swift index f7ffda82..68bbc699 100644 --- a/Sources/Schemas/ServerMessageStatusUpdateEndedReason.swift +++ b/Sources/Schemas/ServerMessageStatusUpdateEndedReason.swift @@ -26,6 +26,7 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case callStartErrorSubscriptionUpgradeFailed = "call.start.error-subscription-upgrade-failed" case callStartErrorSubscriptionConcurrencyLimitReached = "call.start.error-subscription-concurrency-limit-reached" case callStartErrorEnterpriseFeatureNotAvailableRecordingConsent = "call.start.error-enterprise-feature-not-available-recording-consent" + case callStartAssistantVersionErrorValidation = "call.start.assistant-version-error-validation" case assistantNotValid = "assistant-not-valid" case callStartErrorVapifaultDatabaseError = "call.start.error-vapifault-database-error" case assistantNotFound = "assistant-not-found" @@ -45,6 +46,9 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case pipelineErrorInworldVoiceFailed = "pipeline-error-inworld-voice-failed" case pipelineErrorMinimaxVoiceFailed = "pipeline-error-minimax-voice-failed" case pipelineErrorWellsaidVoiceFailed = "pipeline-error-wellsaid-voice-failed" + case pipelineErrorXaiVoiceFailed = "pipeline-error-xai-voice-failed" + case pipelineErrorMicrosoftVoiceFailed = "pipeline-error-microsoft-voice-failed" + case pipelineErrorMicrosoftVoiceRequestCanceled = "pipeline-error-microsoft-voice-request-canceled" case pipelineErrorTavusVideoFailed = "pipeline-error-tavus-video-failed" case callInProgressErrorVapifaultOpenaiVoiceFailed = "call.in-progress.error-vapifault-openai-voice-failed" case callInProgressErrorVapifaultCartesiaVoiceFailed = "call.in-progress.error-vapifault-cartesia-voice-failed" @@ -62,6 +66,8 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case callInProgressErrorVapifaultInworldVoiceFailed = "call.in-progress.error-vapifault-inworld-voice-failed" case callInProgressErrorVapifaultMinimaxVoiceFailed = "call.in-progress.error-vapifault-minimax-voice-failed" case callInProgressErrorVapifaultWellsaidVoiceFailed = "call.in-progress.error-vapifault-wellsaid-voice-failed" + case callInProgressErrorVapifaultXaiVoiceFailed = "call.in-progress.error-vapifault-xai-voice-failed" + case callInProgressErrorVapifaultMicrosoftVoiceFailed = "call.in-progress.error-vapifault-microsoft-voice-failed" case callInProgressErrorVapifaultTavusVideoFailed = "call.in-progress.error-vapifault-tavus-video-failed" case pipelineErrorVapiLlmFailed = "pipeline-error-vapi-llm-failed" case pipelineErrorVapi400BadRequestValidationFailed = "pipeline-error-vapi-400-bad-request-validation-failed" @@ -71,12 +77,17 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case pipelineErrorVapi500ServerError = "pipeline-error-vapi-500-server-error" case pipelineErrorVapi503ServerOverloadedError = "pipeline-error-vapi-503-server-overloaded-error" case callInProgressErrorProviderfaultVapiLlmFailed = "call.in-progress.error-providerfault-vapi-llm-failed" + case callInProgressErrorVapifaultVapiLlmFailed = "call.in-progress.error-vapifault-vapi-llm-failed" case callInProgressErrorVapifaultVapi400BadRequestValidationFailed = "call.in-progress.error-vapifault-vapi-400-bad-request-validation-failed" case callInProgressErrorVapifaultVapi401Unauthorized = "call.in-progress.error-vapifault-vapi-401-unauthorized" case callInProgressErrorVapifaultVapi403ModelAccessDenied = "call.in-progress.error-vapifault-vapi-403-model-access-denied" case callInProgressErrorVapifaultVapi429ExceededQuota = "call.in-progress.error-vapifault-vapi-429-exceeded-quota" case callInProgressErrorProviderfaultVapi500ServerError = "call.in-progress.error-providerfault-vapi-500-server-error" case callInProgressErrorProviderfaultVapi503ServerOverloadedError = "call.in-progress.error-providerfault-vapi-503-server-overloaded-error" + case pipelineErrorVapiTranscriberFailed = "pipeline-error-vapi-transcriber-failed" + case callInProgressErrorVapifaultVapiTranscriberFailed = "call.in-progress.error-vapifault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiTranscriberFailed = "call.in-progress.error-providerfault-vapi-transcriber-failed" + case callInProgressErrorProviderfaultVapiVoiceFailed = "call.in-progress.error-providerfault-vapi-voice-failed" case pipelineErrorDeepgramTranscriberFailed = "pipeline-error-deepgram-transcriber-failed" case pipelineErrorDeepgramTranscriberApiKeyMissing = "pipeline-error-deepgram-transcriber-api-key-missing" case callInProgressErrorVapifaultDeepgramTranscriberFailed = "call.in-progress.error-vapifault-deepgram-transcriber-failed" @@ -116,6 +127,18 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case callInProgressErrorVapifaultSonioxTranscriberInvalidConfig = "call.in-progress.error-vapifault-soniox-transcriber-invalid-config" case callInProgressErrorVapifaultSonioxTranscriberServerError = "call.in-progress.error-vapifault-soniox-transcriber-server-error" case callInProgressErrorVapifaultSonioxTranscriberFailed = "call.in-progress.error-vapifault-soniox-transcriber-failed" + case pipelineErrorXaiTranscriberAuthFailed = "pipeline-error-xai-transcriber-auth-failed" + case pipelineErrorXaiTranscriberRateLimited = "pipeline-error-xai-transcriber-rate-limited" + case pipelineErrorXaiTranscriberInvalidConfig = "pipeline-error-xai-transcriber-invalid-config" + case pipelineErrorXaiTranscriberServerError = "pipeline-error-xai-transcriber-server-error" + case pipelineErrorXaiTranscriberFailed = "pipeline-error-xai-transcriber-failed" + case callInProgressErrorVapifaultXaiTranscriberAuthFailed = "call.in-progress.error-vapifault-xai-transcriber-auth-failed" + case callInProgressErrorVapifaultXaiTranscriberRateLimited = "call.in-progress.error-vapifault-xai-transcriber-rate-limited" + case callInProgressErrorVapifaultXaiTranscriberInvalidConfig = "call.in-progress.error-vapifault-xai-transcriber-invalid-config" + case callInProgressErrorVapifaultXaiTranscriberServerError = "call.in-progress.error-vapifault-xai-transcriber-server-error" + case callInProgressErrorVapifaultXaiTranscriberFailed = "call.in-progress.error-vapifault-xai-transcriber-failed" + case pipelineErrorCartesiaTranscriberFailed = "pipeline-error-cartesia-transcriber-failed" + case callInProgressErrorVapifaultCartesiaTranscriberFailed = "call.in-progress.error-vapifault-cartesia-transcriber-failed" case callInProgressErrorPipelineNoAvailableLlmModel = "call.in-progress.error-pipeline-no-available-llm-model" case workerShutdown = "worker-shutdown" case vonageDisconnected = "vonage-disconnected" @@ -558,6 +581,7 @@ public enum ServerMessageStatusUpdateEndedReason: String, Codable, Hashable, Cas case manuallyCanceled = "manually-canceled" case phoneCallProviderClosedWebsocket = "phone-call-provider-closed-websocket" case callForwardingOperatorBusy = "call.forwarding.operator-busy" + case callForwardingNoAnswer = "call.forwarding.no-answer" case silenceTimedOut = "silence-timed-out" case callInProgressErrorProviderfaultOutboundSip403Forbidden = "call.in-progress.error-providerfault-outbound-sip-403-forbidden" case callInProgressErrorProviderfaultOutboundSip407ProxyAuthenticationRequired = "call.in-progress.error-providerfault-outbound-sip-407-proxy-authentication-required" diff --git a/Sources/Schemas/ServerMessageToolCalls.swift b/Sources/Schemas/ServerMessageToolCalls.swift index 468756be..c1a34c97 100644 --- a/Sources/Schemas/ServerMessageToolCalls.swift +++ b/Sources/Schemas/ServerMessageToolCalls.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageToolCalls: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageToolCallsPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "tool-calls" is sent to call a tool. public let type: ServerMessageToolCallsType? /// This is the list of tools calls that the model is requesting along with the original tool configuration. @@ -28,6 +33,7 @@ public struct ServerMessageToolCalls: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageToolCallsPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageToolCallsType? = nil, toolWithToolCallList: [ServerMessageToolCallsToolWithToolCallListItem], timestamp: Double? = nil, @@ -40,6 +46,7 @@ public struct ServerMessageToolCalls: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.toolWithToolCallList = toolWithToolCallList self.timestamp = timestamp @@ -55,6 +62,7 @@ public struct ServerMessageToolCalls: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageToolCallsPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decodeIfPresent(ServerMessageToolCallsType.self, forKey: .type) self.toolWithToolCallList = try container.decode([ServerMessageToolCallsToolWithToolCallListItem].self, forKey: .toolWithToolCallList) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -71,6 +79,7 @@ public struct ServerMessageToolCalls: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encodeIfPresent(self.type, forKey: .type) try container.encode(self.toolWithToolCallList, forKey: .toolWithToolCallList) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -85,6 +94,7 @@ public struct ServerMessageToolCalls: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case toolWithToolCallList case timestamp diff --git a/Sources/Schemas/ServerMessageTranscript.swift b/Sources/Schemas/ServerMessageTranscript.swift index 49d52e7f..015e5c08 100644 --- a/Sources/Schemas/ServerMessageTranscript.swift +++ b/Sources/Schemas/ServerMessageTranscript.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageTranscript: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageTranscriptPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "transcript" is sent as transcriber outputs partial or final transcript. public let type: ServerMessageTranscriptType /// This is the timestamp of the message. @@ -36,6 +41,7 @@ public struct ServerMessageTranscript: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageTranscriptPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageTranscriptType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -52,6 +58,7 @@ public struct ServerMessageTranscript: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -71,6 +78,7 @@ public struct ServerMessageTranscript: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageTranscriptPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageTranscriptType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -91,6 +99,7 @@ public struct ServerMessageTranscript: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -109,6 +118,7 @@ public struct ServerMessageTranscript: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageTransferDestinationRequest.swift b/Sources/Schemas/ServerMessageTransferDestinationRequest.swift index 151bee41..5b9d1e52 100644 --- a/Sources/Schemas/ServerMessageTransferDestinationRequest.swift +++ b/Sources/Schemas/ServerMessageTransferDestinationRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageTransferDestinationRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "transfer-destination-request" is sent when the model is requesting transfer but destination is unknown. public let type: ServerMessageTransferDestinationRequestType /// This is the timestamp of the message. @@ -24,6 +29,7 @@ public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendab public init( phoneNumber: ServerMessageTransferDestinationRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageTransferDestinationRequestType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -34,6 +40,7 @@ public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendab additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -47,6 +54,7 @@ public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendab public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageTransferDestinationRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageTransferDestinationRequestType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -61,6 +69,7 @@ public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendab var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -73,6 +82,7 @@ public struct ServerMessageTransferDestinationRequest: Codable, Hashable, Sendab /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageTransferUpdate.swift b/Sources/Schemas/ServerMessageTransferUpdate.swift index 216b68d5..f2ba8923 100644 --- a/Sources/Schemas/ServerMessageTransferUpdate.swift +++ b/Sources/Schemas/ServerMessageTransferUpdate.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageTransferUpdatePhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "transfer-update" is sent whenever a transfer happens. public let type: ServerMessageTransferUpdateType /// This is the destination of the transfer. @@ -34,6 +39,7 @@ public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageTransferUpdatePhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageTransferUpdateType, destination: ServerMessageTransferUpdateDestination? = nil, timestamp: Double? = nil, @@ -49,6 +55,7 @@ public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.destination = destination self.timestamp = timestamp @@ -67,6 +74,7 @@ public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageTransferUpdatePhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageTransferUpdateType.self, forKey: .type) self.destination = try container.decodeIfPresent(ServerMessageTransferUpdateDestination.self, forKey: .destination) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -86,6 +94,7 @@ public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.destination, forKey: .destination) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -103,6 +112,7 @@ public struct ServerMessageTransferUpdate: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case destination case timestamp diff --git a/Sources/Schemas/ServerMessageUserInterrupted.swift b/Sources/Schemas/ServerMessageUserInterrupted.swift index 728af2e7..b22ed738 100644 --- a/Sources/Schemas/ServerMessageUserInterrupted.swift +++ b/Sources/Schemas/ServerMessageUserInterrupted.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageUserInterruptedPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "user-interrupted" is sent when the user interrupts the assistant. public let type: ServerMessageUserInterruptedType /// This is the turnId of the LLM response that was interrupted. Matches the turnId @@ -27,6 +32,7 @@ public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageUserInterruptedPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageUserInterruptedType, turnId: String? = nil, timestamp: Double? = nil, @@ -38,6 +44,7 @@ public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.turnId = turnId self.timestamp = timestamp @@ -52,6 +59,7 @@ public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageUserInterruptedPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageUserInterruptedType.self, forKey: .type) self.turnId = try container.decodeIfPresent(String.self, forKey: .turnId) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) @@ -67,6 +75,7 @@ public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.turnId, forKey: .turnId) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) @@ -80,6 +89,7 @@ public struct ServerMessageUserInterrupted: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case turnId case timestamp diff --git a/Sources/Schemas/ServerMessageVoiceInput.swift b/Sources/Schemas/ServerMessageVoiceInput.swift index e80332ed..aff28c70 100644 --- a/Sources/Schemas/ServerMessageVoiceInput.swift +++ b/Sources/Schemas/ServerMessageVoiceInput.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageVoiceInputPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "voice-input" is sent when a generation is requested from voice provider. public let type: ServerMessageVoiceInputType /// This is the timestamp of the message. @@ -26,6 +31,7 @@ public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageVoiceInputPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageVoiceInputType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -37,6 +43,7 @@ public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -51,6 +58,7 @@ public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageVoiceInputPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageVoiceInputType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -66,6 +74,7 @@ public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -79,6 +88,7 @@ public struct ServerMessageVoiceInput: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/ServerMessageVoiceRequest.swift b/Sources/Schemas/ServerMessageVoiceRequest.swift index 28abac4f..ee16fbe9 100644 --- a/Sources/Schemas/ServerMessageVoiceRequest.swift +++ b/Sources/Schemas/ServerMessageVoiceRequest.swift @@ -3,6 +3,11 @@ import Foundation public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { /// This is the phone number that the message is associated with. public let phoneNumber: ServerMessageVoiceRequestPhoneNumber? + /// This is the version label (e.g. `v3`) of the assistant the call was + /// configured with. `null` for inline assistants, squad/workflow calls, + /// pre-resolution assistant-request messages, and orgs not on + /// assistant versioning. + public let assistantVersion: Nullable? /// This is the type of the message. "voice-request" is sent when using `assistant.voice={ "type": "custom-voice" }`. /// /// Here is what the request will look like: @@ -49,6 +54,7 @@ public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { public init( phoneNumber: ServerMessageVoiceRequestPhoneNumber? = nil, + assistantVersion: Nullable? = nil, type: ServerMessageVoiceRequestType, timestamp: Double? = nil, artifact: Artifact? = nil, @@ -61,6 +67,7 @@ public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.phoneNumber = phoneNumber + self.assistantVersion = assistantVersion self.type = type self.timestamp = timestamp self.artifact = artifact @@ -76,6 +83,7 @@ public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.phoneNumber = try container.decodeIfPresent(ServerMessageVoiceRequestPhoneNumber.self, forKey: .phoneNumber) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.type = try container.decode(ServerMessageVoiceRequestType.self, forKey: .type) self.timestamp = try container.decodeIfPresent(Double.self, forKey: .timestamp) self.artifact = try container.decodeIfPresent(Artifact.self, forKey: .artifact) @@ -92,6 +100,7 @@ public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.phoneNumber, forKey: .phoneNumber) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encode(self.type, forKey: .type) try container.encodeIfPresent(self.timestamp, forKey: .timestamp) try container.encodeIfPresent(self.artifact, forKey: .artifact) @@ -106,6 +115,7 @@ public struct ServerMessageVoiceRequest: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case phoneNumber + case assistantVersion case type case timestamp case artifact diff --git a/Sources/Schemas/SesameVoice.swift b/Sources/Schemas/SesameVoice.swift index 22a4ddf0..56e933d2 100644 --- a/Sources/Schemas/SesameVoice.swift +++ b/Sources/Schemas/SesameVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Sesame, including voice and model selection, chunking, caching, and fallback settings. public struct SesameVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/SimulationSuite.swift b/Sources/Schemas/SimulationSuite.swift index fabc64cf..55e52526 100644 --- a/Sources/Schemas/SimulationSuite.swift +++ b/Sources/Schemas/SimulationSuite.swift @@ -19,6 +19,8 @@ public struct SimulationSuite: Codable, Hashable, Sendable { public let path: Nullable? /// This is the list of simulation IDs in this suite. public let simulationIds: [String] + /// This is the ordered list of assistant or squad assignments for the suite. + public let targetAssignments: [SimulationSuiteTargetAssignment] /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -31,6 +33,7 @@ public struct SimulationSuite: Codable, Hashable, Sendable { slackWebhookUrl: String? = nil, path: Nullable? = nil, simulationIds: [String], + targetAssignments: [SimulationSuiteTargetAssignment], additionalProperties: [String: JSONValue] = .init() ) { self.id = id @@ -41,6 +44,7 @@ public struct SimulationSuite: Codable, Hashable, Sendable { self.slackWebhookUrl = slackWebhookUrl self.path = path self.simulationIds = simulationIds + self.targetAssignments = targetAssignments self.additionalProperties = additionalProperties } @@ -54,6 +58,7 @@ public struct SimulationSuite: Codable, Hashable, Sendable { self.slackWebhookUrl = try container.decodeIfPresent(String.self, forKey: .slackWebhookUrl) self.path = try container.decodeNullableIfPresent(String.self, forKey: .path) self.simulationIds = try container.decode([String].self, forKey: .simulationIds) + self.targetAssignments = try container.decode([SimulationSuiteTargetAssignment].self, forKey: .targetAssignments) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -68,6 +73,7 @@ public struct SimulationSuite: Codable, Hashable, Sendable { try container.encodeIfPresent(self.slackWebhookUrl, forKey: .slackWebhookUrl) try container.encodeNullableIfPresent(self.path, forKey: .path) try container.encode(self.simulationIds, forKey: .simulationIds) + try container.encode(self.targetAssignments, forKey: .targetAssignments) } /// Keys for encoding/decoding struct properties. @@ -80,5 +86,6 @@ public struct SimulationSuite: Codable, Hashable, Sendable { case slackWebhookUrl case path case simulationIds + case targetAssignments } } \ No newline at end of file diff --git a/Sources/Schemas/SimulationSuiteTargetAssignment.swift b/Sources/Schemas/SimulationSuiteTargetAssignment.swift new file mode 100644 index 00000000..5c7d0176 --- /dev/null +++ b/Sources/Schemas/SimulationSuiteTargetAssignment.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct SimulationSuiteTargetAssignment: Codable, Hashable, Sendable { + /// This is the type of target assigned to the simulation suite. + public let targetType: SimulationSuiteTargetAssignmentTargetType + /// This is the unique identifier of the assigned assistant or squad. + public let targetId: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + targetType: SimulationSuiteTargetAssignmentTargetType, + targetId: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.targetType = targetType + self.targetId = targetId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.targetType = try container.decode(SimulationSuiteTargetAssignmentTargetType.self, forKey: .targetType) + self.targetId = try container.decode(String.self, forKey: .targetId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.targetType, forKey: .targetType) + try container.encode(self.targetId, forKey: .targetId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case targetType + case targetId + } +} \ No newline at end of file diff --git a/Sources/Schemas/SimulationSuiteTargetAssignmentTargetType.swift b/Sources/Schemas/SimulationSuiteTargetAssignmentTargetType.swift new file mode 100644 index 00000000..97aa03c0 --- /dev/null +++ b/Sources/Schemas/SimulationSuiteTargetAssignmentTargetType.swift @@ -0,0 +1,7 @@ +import Foundation + +/// This is the type of target assigned to the simulation suite. +public enum SimulationSuiteTargetAssignmentTargetType: String, Codable, Hashable, CaseIterable, Sendable { + case assistant + case squad +} \ No newline at end of file diff --git a/Sources/Schemas/SipAuthentication.swift b/Sources/Schemas/SipAuthentication.swift index 83b864db..be513ce4 100644 --- a/Sources/Schemas/SipAuthentication.swift +++ b/Sources/Schemas/SipAuthentication.swift @@ -1,7 +1,8 @@ import Foundation +/// Realm, username, and password used to authenticate SIP requests. public struct SipAuthentication: Codable, Hashable, Sendable { - /// This will be expected in the `realm` field of the `authorization` header of the SIP INVITE. Defaults to sip.vapi.ai. + /// This will be expected in the `realm` field of the `authorization` header of the SIP INVITE. Defaults to the SIP realm of the Vapi region serving the request (e.g. `sip.vapi.ai` for US, `sip.eu.vapi.ai` for EU). public let realm: String? /// This will be expected in the `username` field of the `authorization` header of the SIP INVITE. public let username: String diff --git a/Sources/Schemas/SipRequestTool.swift b/Sources/Schemas/SipRequestTool.swift index 9cf4bc43..84a8811d 100644 --- a/Sources/Schemas/SipRequestTool.swift +++ b/Sources/Schemas/SipRequestTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that sends SIP `INFO`, `MESSAGE`, or `NOTIFY` requests with configured headers and body. public struct SipRequestTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [SipRequestToolMessagesItem]? /// The SIP method to send. public let verb: SipRequestToolVerb @@ -102,6 +102,7 @@ public struct SipRequestTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [SipRequestToolMessagesItem]? = nil, verb: SipRequestToolVerb, headers: JsonSchema? = nil, @@ -113,6 +114,7 @@ public struct SipRequestTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.verb = verb self.headers = headers @@ -127,6 +129,7 @@ public struct SipRequestTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([SipRequestToolMessagesItem].self, forKey: .messages) self.verb = try container.decode(SipRequestToolVerb.self, forKey: .verb) self.headers = try container.decodeIfPresent(JsonSchema.self, forKey: .headers) @@ -142,6 +145,7 @@ public struct SipRequestTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.verb, forKey: .verb) try container.encodeIfPresent(self.headers, forKey: .headers) @@ -155,6 +159,7 @@ public struct SipRequestTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case verb case headers diff --git a/Sources/Schemas/SipTrunkGateway.swift b/Sources/Schemas/SipTrunkGateway.swift index d08b52b4..78fff54e 100644 --- a/Sources/Schemas/SipTrunkGateway.swift +++ b/Sources/Schemas/SipTrunkGateway.swift @@ -1,7 +1,8 @@ import Foundation +/// Network and routing settings for a SIP trunk gateway, including address, port, netmask, inbound and outbound use, signaling protocol, and OPTIONS health checks. public struct SipTrunkGateway: Codable, Hashable, Sendable { - /// This is the address of the gateway. It can be an IPv4 address like 1.1.1.1 or a fully qualified domain name like my-sip-trunk.pstn.twilio.com. + /// This is the address of the gateway. Inbound gateways require an IPv4 address like 1.1.1.1. Outbound-only gateways can also use a fully qualified domain name like my-sip-trunk.pstn.twilio.com. public let ip: String /// This is the port number of the gateway. Default is 5060. /// diff --git a/Sources/Schemas/SipTrunkOutboundAuthenticationPlan.swift b/Sources/Schemas/SipTrunkOutboundAuthenticationPlan.swift index 53df62b7..6c633879 100644 --- a/Sources/Schemas/SipTrunkOutboundAuthenticationPlan.swift +++ b/Sources/Schemas/SipTrunkOutboundAuthenticationPlan.swift @@ -1,8 +1,10 @@ import Foundation +/// Credentials and optional SIP REGISTER settings used to authenticate outbound calls with a SIP trunk. public struct SipTrunkOutboundAuthenticationPlan: Codable, Hashable, Sendable { /// This is not returned in the API. public let authPassword: String? + /// Username used to authenticate outbound SIP requests. public let authUsername: String? /// This can be used to configure if SIP register is required by the SIP trunk. If not provided, no SIP registration will be attempted. public let sipRegisterPlan: SipTrunkOutboundSipRegisterPlan? diff --git a/Sources/Schemas/SipTrunkOutboundSipRegisterPlan.swift b/Sources/Schemas/SipTrunkOutboundSipRegisterPlan.swift index 2eb0c7ca..057c13b9 100644 --- a/Sources/Schemas/SipTrunkOutboundSipRegisterPlan.swift +++ b/Sources/Schemas/SipTrunkOutboundSipRegisterPlan.swift @@ -1,8 +1,12 @@ import Foundation +/// Registration settings used when the SIP trunk requires SIP REGISTER. public struct SipTrunkOutboundSipRegisterPlan: Codable, Hashable, Sendable { + /// SIP registrar domain used for registration. public let domain: String? + /// Username sent with the SIP REGISTER request. public let username: String? + /// Authentication realm used for SIP registration. public let realm: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/SkippedStructuredOutput.swift b/Sources/Schemas/SkippedStructuredOutput.swift new file mode 100644 index 00000000..4736a3b9 --- /dev/null +++ b/Sources/Schemas/SkippedStructuredOutput.swift @@ -0,0 +1,41 @@ +import Foundation + +public struct SkippedStructuredOutput: Codable, Hashable, Sendable { + /// This is the name of the structured output that was skipped. + public let name: String + /// This is the first condition that was not met. Conditions use AND semantics, so + /// evaluation stops as soon as one condition does not pass. + public let unmetCondition: SkippedStructuredOutputUnmetCondition + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + name: String, + unmetCondition: SkippedStructuredOutputUnmetCondition, + additionalProperties: [String: JSONValue] = .init() + ) { + self.name = name + self.unmetCondition = unmetCondition + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.name = try container.decode(String.self, forKey: .name) + self.unmetCondition = try container.decode(SkippedStructuredOutputUnmetCondition.self, forKey: .unmetCondition) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.name, forKey: .name) + try container.encode(self.unmetCondition, forKey: .unmetCondition) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case name + case unmetCondition + } +} \ No newline at end of file diff --git a/Sources/Schemas/SkippedStructuredOutputUnmetCondition.swift b/Sources/Schemas/SkippedStructuredOutputUnmetCondition.swift new file mode 100644 index 00000000..d5b61785 --- /dev/null +++ b/Sources/Schemas/SkippedStructuredOutputUnmetCondition.swift @@ -0,0 +1,48 @@ +import Foundation + +/// This is the first condition that was not met. Conditions use AND semantics, so +/// evaluation stops as soon as one condition does not pass. +public enum SkippedStructuredOutputUnmetCondition: Codable, Hashable, Sendable { + case endedReason(EndedReasonCondition) + case minCallDuration(MinCallDurationCondition) + case minMessages(MinMessagesCondition) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "endedReason": + self = .endedReason(try EndedReasonCondition(from: decoder)) + case "minCallDuration": + self = .minCallDuration(try MinCallDurationCondition(from: decoder)) + case "minMessages": + self = .minMessages(try MinMessagesCondition(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .endedReason(let data): + try container.encode("endedReason", forKey: .type) + try data.encode(to: encoder) + case .minCallDuration(let data): + try container.encode("minCallDuration", forKey: .type) + try data.encode(to: encoder) + case .minMessages(let data): + try container.encode("minMessages", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/SlackSendMessageTool.swift b/Sources/Schemas/SlackSendMessageTool.swift index 156117dc..0c697573 100644 --- a/Sources/Schemas/SlackSendMessageTool.swift +++ b/Sources/Schemas/SlackSendMessageTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that lets an assistant send a message to Slack. public struct SlackSendMessageTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [SlackSendMessageToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct SlackSendMessageTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [SlackSendMessageToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct SlackSendMessageTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct SlackSendMessageTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([SlackSendMessageToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct SlackSendMessageTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct SlackSendMessageTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/SmallestAiVoice.swift b/Sources/Schemas/SmallestAiVoice.swift index 20345813..6176f4f5 100644 --- a/Sources/Schemas/SmallestAiVoice.swift +++ b/Sources/Schemas/SmallestAiVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with Smallest AI, including voice and model selection, speed, chunking, caching, and fallback settings. public struct SmallestAiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/SmartDenoisingPlan.swift b/Sources/Schemas/SmartDenoisingPlan.swift index 0e526ae7..ed174e47 100644 --- a/Sources/Schemas/SmartDenoisingPlan.swift +++ b/Sources/Schemas/SmartDenoisingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls whether Krisp smart denoising filters background speech and noise. public struct SmartDenoisingPlan: Codable, Hashable, Sendable { /// Whether smart denoising using Krisp is enabled. public let enabled: Bool? diff --git a/Sources/Schemas/SmsTool.swift b/Sources/Schemas/SmsTool.swift index fca45b6b..8c70f475 100644 --- a/Sources/Schemas/SmsTool.swift +++ b/Sources/Schemas/SmsTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that lets an assistant send an SMS message during a call. public struct SmsTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [SmsToolMessagesItem]? /// This is the unique identifier for the tool. public let id: String @@ -96,6 +96,7 @@ public struct SmsTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [SmsToolMessagesItem]? = nil, id: String, orgId: String, @@ -104,6 +105,7 @@ public struct SmsTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.id = id self.orgId = orgId @@ -115,6 +117,7 @@ public struct SmsTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([SmsToolMessagesItem].self, forKey: .messages) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) @@ -127,6 +130,7 @@ public struct SmsTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) @@ -137,6 +141,7 @@ public struct SmsTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case id case orgId diff --git a/Sources/Schemas/SonioxContextGeneralItem.swift b/Sources/Schemas/SonioxContextGeneralItem.swift new file mode 100644 index 00000000..cc501d5f --- /dev/null +++ b/Sources/Schemas/SonioxContextGeneralItem.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct SonioxContextGeneralItem: Codable, Hashable, Sendable { + /// The key describing the type of context (e.g., "domain", "topic", "doctor", "organization"). + public let key: String + /// The value for the context key (e.g., "Healthcare", "Diabetes management consultation"). + public let value: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + key: String, + value: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.key = key + self.value = value + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.key = try container.decode(String.self, forKey: .key) + self.value = try container.decode(String.self, forKey: .value) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.key, forKey: .key) + try container.encode(self.value, forKey: .value) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case key + case value + } +} \ No newline at end of file diff --git a/Sources/Schemas/SonioxCredential.swift b/Sources/Schemas/SonioxCredential.swift index f443b1fb..ea784d93 100644 --- a/Sources/Schemas/SonioxCredential.swift +++ b/Sources/Schemas/SonioxCredential.swift @@ -4,6 +4,8 @@ public struct SonioxCredential: Codable, Hashable, Sendable { public let provider: SonioxCredentialProvider /// This is not returned in the API. public let apiKey: String + /// Custom Soniox WebSocket endpoint (e.g. EU server wss://stt-rt.eu.soniox.com/transcribe-websocket). Defaults to the region-appropriate endpoint when omitted. + public let apiUrl: String? /// This is the unique identifier for the credential. public let id: String /// This is the unique identifier for the org that this credential belongs to. @@ -20,6 +22,7 @@ public struct SonioxCredential: Codable, Hashable, Sendable { public init( provider: SonioxCredentialProvider, apiKey: String, + apiUrl: String? = nil, id: String, orgId: String, createdAt: Date, @@ -29,6 +32,7 @@ public struct SonioxCredential: Codable, Hashable, Sendable { ) { self.provider = provider self.apiKey = apiKey + self.apiUrl = apiUrl self.id = id self.orgId = orgId self.createdAt = createdAt @@ -41,6 +45,7 @@ public struct SonioxCredential: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.provider = try container.decode(SonioxCredentialProvider.self, forKey: .provider) self.apiKey = try container.decode(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -54,6 +59,7 @@ public struct SonioxCredential: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.provider, forKey: .provider) try container.encode(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -65,6 +71,7 @@ public struct SonioxCredential: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case provider case apiKey + case apiUrl case id case orgId case createdAt diff --git a/Sources/Schemas/SonioxTranscriber.swift b/Sources/Schemas/SonioxTranscriber.swift index 98fb8b17..2042c59a 100644 --- a/Sources/Schemas/SonioxTranscriber.swift +++ b/Sources/Schemas/SonioxTranscriber.swift @@ -1,16 +1,21 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Soniox, including model, language detection, endpointing, vocabulary, and fallback settings. public struct SonioxTranscriber: Codable, Hashable, Sendable { /// The Soniox model to use for transcription. public let model: SonioxTranscriberModel? - /// The language for transcription. Uses ISO 639-1 codes. Soniox supports 60+ languages with a single universal model. + /// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). For multi-language hints or to enable Soniox auto-detect, use `languages` instead — when `languages` is set (including to an empty array), this field is ignored when building the Soniox request. Defaults to `en` if neither this nor `languages` is set. public let language: SonioxTranscriberLanguage? - /// When enabled, restricts transcription to the language specified in the language field. When disabled, the model can detect and transcribe any of 60+ supported languages. Defaults to true. + /// Language hints sent to Soniox as `language_hints`. Provide `[lang1, lang2, ...]` (ISO 639-1 codes) to bias recognition toward specific languages, or provide an explicit empty array `[]` to enable Soniox auto-detect across all 60+ supported languages. When set (including the empty array), this field takes precedence over the singular `language` field. When omitted, falls back to the singular `language` (which defaults to `en` if also unset). Best accuracy is achieved with a single language. + public let languages: [SonioxTranscriberLanguagesItem]? + /// When `true`, Soniox strictly restricts transcription to the languages in `languages` (or the singular `language` if `languages` is unset). When `false`, Soniox biases toward those languages but still allows transcription in other languages. Has no effect when no language hints are sent (e.g., `languages: []` for auto-detect). Defaults to `true` (strict mode). public let languageHintsStrict: Bool? /// Maximum delay in milliseconds between when the speaker stops and when the endpoint is detected. Lower values mean faster turn-taking but more false endpoints. Range: 500-3000. Default: 500. public let maxEndpointDelayMs: Double? /// Custom vocabulary terms to boost recognition accuracy. Useful for brand names, product names, and domain-specific terminology. Maps to Soniox context.terms. public let customVocabulary: [String]? + /// General context key-value pairs that guide the AI model during transcription. Helps adapt vocabulary to the correct domain, improving accuracy. Recommended: 10 or fewer pairs. Maps to Soniox context.general. + public let contextGeneral: [SonioxContextGeneralItem]? /// This is the plan for transcriber provider fallbacks in the event that the primary transcriber provider fails. public let fallbackPlan: FallbackTranscriberPlan? /// Additional properties that are not explicitly defined in the schema @@ -19,17 +24,21 @@ public struct SonioxTranscriber: Codable, Hashable, Sendable { public init( model: SonioxTranscriberModel? = nil, language: SonioxTranscriberLanguage? = nil, + languages: [SonioxTranscriberLanguagesItem]? = nil, languageHintsStrict: Bool? = nil, maxEndpointDelayMs: Double? = nil, customVocabulary: [String]? = nil, + contextGeneral: [SonioxContextGeneralItem]? = nil, fallbackPlan: FallbackTranscriberPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.model = model self.language = language + self.languages = languages self.languageHintsStrict = languageHintsStrict self.maxEndpointDelayMs = maxEndpointDelayMs self.customVocabulary = customVocabulary + self.contextGeneral = contextGeneral self.fallbackPlan = fallbackPlan self.additionalProperties = additionalProperties } @@ -38,9 +47,11 @@ public struct SonioxTranscriber: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.model = try container.decodeIfPresent(SonioxTranscriberModel.self, forKey: .model) self.language = try container.decodeIfPresent(SonioxTranscriberLanguage.self, forKey: .language) + self.languages = try container.decodeIfPresent([SonioxTranscriberLanguagesItem].self, forKey: .languages) self.languageHintsStrict = try container.decodeIfPresent(Bool.self, forKey: .languageHintsStrict) self.maxEndpointDelayMs = try container.decodeIfPresent(Double.self, forKey: .maxEndpointDelayMs) self.customVocabulary = try container.decodeIfPresent([String].self, forKey: .customVocabulary) + self.contextGeneral = try container.decodeIfPresent([SonioxContextGeneralItem].self, forKey: .contextGeneral) self.fallbackPlan = try container.decodeIfPresent(FallbackTranscriberPlan.self, forKey: .fallbackPlan) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -50,9 +61,11 @@ public struct SonioxTranscriber: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.model, forKey: .model) try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.languages, forKey: .languages) try container.encodeIfPresent(self.languageHintsStrict, forKey: .languageHintsStrict) try container.encodeIfPresent(self.maxEndpointDelayMs, forKey: .maxEndpointDelayMs) try container.encodeIfPresent(self.customVocabulary, forKey: .customVocabulary) + try container.encodeIfPresent(self.contextGeneral, forKey: .contextGeneral) try container.encodeIfPresent(self.fallbackPlan, forKey: .fallbackPlan) } @@ -60,9 +73,11 @@ public struct SonioxTranscriber: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case model case language + case languages case languageHintsStrict case maxEndpointDelayMs case customVocabulary + case contextGeneral case fallbackPlan } } \ No newline at end of file diff --git a/Sources/Schemas/SonioxTranscriberLanguage.swift b/Sources/Schemas/SonioxTranscriberLanguage.swift index e88d970f..ab997cd4 100644 --- a/Sources/Schemas/SonioxTranscriberLanguage.swift +++ b/Sources/Schemas/SonioxTranscriberLanguage.swift @@ -1,6 +1,6 @@ import Foundation -/// The language for transcription. Uses ISO 639-1 codes. Soniox supports 60+ languages with a single universal model. +/// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). For multi-language hints or to enable Soniox auto-detect, use `languages` instead — when `languages` is set (including to an empty array), this field is ignored when building the Soniox request. Defaults to `en` if neither this nor `languages` is set. public enum SonioxTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case aa case ab diff --git a/Sources/Schemas/SonioxTranscriberLanguagesItem.swift b/Sources/Schemas/SonioxTranscriberLanguagesItem.swift new file mode 100644 index 00000000..73de7b54 --- /dev/null +++ b/Sources/Schemas/SonioxTranscriberLanguagesItem.swift @@ -0,0 +1,189 @@ +import Foundation + +public enum SonioxTranscriberLanguagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case aa + case ab + case ae + case af + case ak + case am + case an + case ar + case `as` + case av + case ay + case az + case ba + case be + case bg + case bh + case bi + case bm + case bn + case bo + case br + case bs + case ca + case ce + case ch + case co + case cr + case cs + case cu + case cv + case cy + case da + case de + case dv + case dz + case ee + case el + case en + case eo + case es + case et + case eu + case fa + case ff + case fi + case fj + case fo + case fr + case fy + case ga + case gd + case gl + case gn + case gu + case gv + case ha + case he + case hi + case ho + case hr + case ht + case hu + case hy + case hz + case ia + case id + case ie + case ig + case ii + case ik + case io + case `is` + case it + case iu + case ja + case jv + case ka + case kg + case ki + case kj + case kk + case kl + case km + case kn + case ko + case kr + case ks + case ku + case kv + case kw + case ky + case la + case lb + case lg + case li + case ln + case lo + case lt + case lu + case lv + case mg + case mh + case mi + case mk + case ml + case mn + case mr + case ms + case mt + case my + case na + case nb + case nd + case ne + case ng + case nl + case nn + case no + case nr + case nv + case ny + case oc + case oj + case om + case or + case os + case pa + case pi + case pl + case ps + case pt + case qu + case rm + case rn + case ro + case ru + case rw + case sa + case sc + case sd + case se + case sg + case si + case sk + case sl + case sm + case sn + case so + case sq + case sr + case ss + case st + case su + case sv + case sw + case ta + case te + case tg + case th + case ti + case tk + case tl + case tn + case to + case tr + case ts + case tt + case tw + case ty + case ug + case uk + case ur + case uz + case ve + case vi + case vo + case wa + case wo + case xh + case yi + case yue + case yo + case za + case zh + case zu +} \ No newline at end of file diff --git a/Sources/Schemas/SonioxTranscriberModel.swift b/Sources/Schemas/SonioxTranscriberModel.swift index 4089fc7d..f9322d69 100644 --- a/Sources/Schemas/SonioxTranscriberModel.swift +++ b/Sources/Schemas/SonioxTranscriberModel.swift @@ -3,4 +3,5 @@ import Foundation /// The Soniox model to use for transcription. public enum SonioxTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { case sttRtV4 = "stt-rt-v4" + case sttRtV5 = "stt-rt-v5" } \ No newline at end of file diff --git a/Sources/Schemas/SpeechmaticsCustomVocabularyItem.swift b/Sources/Schemas/SpeechmaticsCustomVocabularyItem.swift index f24b4bc2..d22f60eb 100644 --- a/Sources/Schemas/SpeechmaticsCustomVocabularyItem.swift +++ b/Sources/Schemas/SpeechmaticsCustomVocabularyItem.swift @@ -1,5 +1,6 @@ import Foundation +/// A word or phrase to prioritize during Speechmatics transcription, with optional phonetic alternatives. public struct SpeechmaticsCustomVocabularyItem: Codable, Hashable, Sendable { /// The word or phrase to add to the custom vocabulary. public let content: String diff --git a/Sources/Schemas/SpeechmaticsTranscriber.swift b/Sources/Schemas/SpeechmaticsTranscriber.swift index a66e6c8e..b764cb3f 100644 --- a/Sources/Schemas/SpeechmaticsTranscriber.swift +++ b/Sources/Schemas/SpeechmaticsTranscriber.swift @@ -1,8 +1,10 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Speechmatics, including language, region, diarization, vocabulary, endpointing, formatting, and fallback settings. public struct SpeechmaticsTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: SpeechmaticsTranscriberModel? + /// Language used for transcription. Set to `auto` to detect the language automatically. public let language: SpeechmaticsTranscriberLanguage? /// This is the operating point for the transcription. Choose between `standard` for faster turnaround with strong accuracy or `enhanced` for highest accuracy when precision is critical. /// @@ -20,6 +22,7 @@ public struct SpeechmaticsTranscriber: Codable, Hashable, Sendable { /// /// @default 3000 public let maxDelay: Double? + /// Words and phrases that Speechmatics should recognize more accurately, with optional phonetic alternatives. public let customVocabulary: [SpeechmaticsCustomVocabularyItem] /// This controls how numbers, dates, currencies, and other entities are formatted in the transcription output. /// diff --git a/Sources/Schemas/SpeechmaticsTranscriberLanguage.swift b/Sources/Schemas/SpeechmaticsTranscriberLanguage.swift index e88597e2..2802315b 100644 --- a/Sources/Schemas/SpeechmaticsTranscriberLanguage.swift +++ b/Sources/Schemas/SpeechmaticsTranscriberLanguage.swift @@ -1,5 +1,6 @@ import Foundation +/// Language used for transcription. Set to `auto` to detect the language automatically. public enum SpeechmaticsTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { case auto case ar diff --git a/Sources/Schemas/SpkiPemPublicKeyConfig.swift b/Sources/Schemas/SpkiPemPublicKeyConfig.swift index e40e10ee..c39df065 100644 --- a/Sources/Schemas/SpkiPemPublicKeyConfig.swift +++ b/Sources/Schemas/SpkiPemPublicKeyConfig.swift @@ -1,5 +1,6 @@ import Foundation +/// An SPKI public key in PEM format used to encrypt sensitive request data. public struct SpkiPemPublicKeyConfig: Codable, Hashable, Sendable { /// Optional name of the key for identification purposes. public let name: String? diff --git a/Sources/Schemas/SqlInjectionSecurityFilter.swift b/Sources/Schemas/SqlInjectionSecurityFilter.swift index f9e63c02..845348cc 100644 --- a/Sources/Schemas/SqlInjectionSecurityFilter.swift +++ b/Sources/Schemas/SqlInjectionSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters potential SQL injection patterns from transcripts. public struct SqlInjectionSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: SqlInjectionSecurityFilterType diff --git a/Sources/Schemas/Squad.swift b/Sources/Schemas/Squad.swift index edb3fd7d..dd1a37cc 100644 --- a/Sources/Schemas/Squad.swift +++ b/Sources/Schemas/Squad.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved squad configuration that coordinates a group of assistants during a conversation. The first member starts the call, and member destinations control transfers between assistants. public struct Squad: Codable, Hashable, Sendable { /// This is the name of the squad. public let name: String? diff --git a/Sources/Schemas/SquadMemberDto.swift b/Sources/Schemas/SquadMemberDto.swift index 3fb1205b..ed04c6d1 100644 --- a/Sources/Schemas/SquadMemberDto.swift +++ b/Sources/Schemas/SquadMemberDto.swift @@ -1,6 +1,12 @@ import Foundation +/// An assistant member of a squad. Reference a saved assistant or provide a transient assistant, then configure member-specific overrides and destinations for transfers. public struct SquadMemberDto: Codable, Hashable, Sendable { + /// This is the assistant version (e.g. `v3`) to pin for this squad member. When set, the call uses + /// the snapshot from `assistant_version` (by `(assistantId, version)`) instead of the latest. Valid + /// only with `assistantId`; rejected with inline `assistant`. Omit to follow the latest version. + public let assistantVersion: Nullable? + /// Assistants this squad member can route the conversation to through a transfer or handoff. public let assistantDestinations: [SquadMemberDtoAssistantDestinationsItem]? /// This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. public let assistantId: Nullable? @@ -12,12 +18,14 @@ public struct SquadMemberDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + assistantVersion: Nullable? = nil, assistantDestinations: [SquadMemberDtoAssistantDestinationsItem]? = nil, assistantId: Nullable? = nil, assistant: CreateAssistantDto? = nil, assistantOverrides: AssistantOverrides? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.assistantVersion = assistantVersion self.assistantDestinations = assistantDestinations self.assistantId = assistantId self.assistant = assistant @@ -27,6 +35,7 @@ public struct SquadMemberDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.assistantVersion = try container.decodeNullableIfPresent(String.self, forKey: .assistantVersion) self.assistantDestinations = try container.decodeIfPresent([SquadMemberDtoAssistantDestinationsItem].self, forKey: .assistantDestinations) self.assistantId = try container.decodeNullableIfPresent(String.self, forKey: .assistantId) self.assistant = try container.decodeIfPresent(CreateAssistantDto.self, forKey: .assistant) @@ -37,6 +46,7 @@ public struct SquadMemberDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.assistantVersion, forKey: .assistantVersion) try container.encodeIfPresent(self.assistantDestinations, forKey: .assistantDestinations) try container.encodeNullableIfPresent(self.assistantId, forKey: .assistantId) try container.encodeIfPresent(self.assistant, forKey: .assistant) @@ -45,6 +55,7 @@ public struct SquadMemberDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case assistantVersion case assistantDestinations case assistantId case assistant diff --git a/Sources/Schemas/SsrfSecurityFilter.swift b/Sources/Schemas/SsrfSecurityFilter.swift index ba6472e6..5241550b 100644 --- a/Sources/Schemas/SsrfSecurityFilter.swift +++ b/Sources/Schemas/SsrfSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters potential server-side request forgery (SSRF) patterns from transcripts. public struct SsrfSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: SsrfSecurityFilterType diff --git a/Sources/Schemas/StartSpeakingPlan.swift b/Sources/Schemas/StartSpeakingPlan.swift index f20d0dbc..97138e30 100644 --- a/Sources/Schemas/StartSpeakingPlan.swift +++ b/Sources/Schemas/StartSpeakingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls when the assistant begins speaking after customer speech, including the minimum wait, endpointing strategy, and custom endpointing rules. public struct StartSpeakingPlan: Codable, Hashable, Sendable { /// This is how long assistant waits before speaking. Defaults to 0.4. /// diff --git a/Sources/Schemas/StopSpeakingPlan.swift b/Sources/Schemas/StopSpeakingPlan.swift index d71ed1bc..963d88a5 100644 --- a/Sources/Schemas/StopSpeakingPlan.swift +++ b/Sources/Schemas/StopSpeakingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls when the assistant stops speaking after a customer interruption, including word and voice thresholds, restart delay, and phrase exceptions. public struct StopSpeakingPlan: Codable, Hashable, Sendable { /// This is the number of words that the customer has to say before the assistant will stop talking. /// diff --git a/Sources/Schemas/StructuredDataMultiPlan.swift b/Sources/Schemas/StructuredDataMultiPlan.swift index 30839a64..20d64faf 100644 --- a/Sources/Schemas/StructuredDataMultiPlan.swift +++ b/Sources/Schemas/StructuredDataMultiPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Associates a catalog key with a structured data extraction plan. public struct StructuredDataMultiPlan: Codable, Hashable, Sendable { /// This is the key of the structured data plan in the catalog. public let key: String diff --git a/Sources/Schemas/StructuredDataPlan.swift b/Sources/Schemas/StructuredDataPlan.swift index 0d24ad3c..45f39bbe 100644 --- a/Sources/Schemas/StructuredDataPlan.swift +++ b/Sources/Schemas/StructuredDataPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls extraction of post-call structured data, including prompt messages, JSON schema, enablement, and request timeout. public struct StructuredDataPlan: Codable, Hashable, Sendable { /// These are the messages used to generate the structured data. /// diff --git a/Sources/Schemas/StructuredOutput.swift b/Sources/Schemas/StructuredOutput.swift index 52a2763a..ceb818d6 100644 --- a/Sources/Schemas/StructuredOutput.swift +++ b/Sources/Schemas/StructuredOutput.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved structured-output definition containing its extraction schema, execution method, model or regular expression, linked resources, and lifecycle metadata. public struct StructuredOutput: Codable, Hashable, Sendable { /// This is the type of structured output. /// @@ -33,6 +34,8 @@ public struct StructuredOutput: Codable, Hashable, Sendable { public let model: StructuredOutputModel? /// Compliance configuration for this output. Only enable overrides if no sensitive data will be stored. public let compliancePlan: ComplianceOverride? + /// These are the conditions that gate the execution of this structured output. Every condition must pass for the structured output to run (AND semantics). When omitted or empty, no user-defined conditions gate this output. Send null to clear a previously saved gate. + public let conditions: Nullable<[StructuredOutputConditionsItem]>? /// This is the unique identifier for the structured output. public let id: String /// This is the unique identifier for the org that this structured output belongs to. @@ -73,6 +76,7 @@ public struct StructuredOutput: Codable, Hashable, Sendable { regex: String? = nil, model: StructuredOutputModel? = nil, compliancePlan: ComplianceOverride? = nil, + conditions: Nullable<[StructuredOutputConditionsItem]>? = nil, id: String, orgId: String, createdAt: Date, @@ -88,6 +92,7 @@ public struct StructuredOutput: Codable, Hashable, Sendable { self.regex = regex self.model = model self.compliancePlan = compliancePlan + self.conditions = conditions self.id = id self.orgId = orgId self.createdAt = createdAt @@ -106,6 +111,7 @@ public struct StructuredOutput: Codable, Hashable, Sendable { self.regex = try container.decodeIfPresent(String.self, forKey: .regex) self.model = try container.decodeIfPresent(StructuredOutputModel.self, forKey: .model) self.compliancePlan = try container.decodeIfPresent(ComplianceOverride.self, forKey: .compliancePlan) + self.conditions = try container.decodeNullableIfPresent([StructuredOutputConditionsItem].self, forKey: .conditions) self.id = try container.decode(String.self, forKey: .id) self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) @@ -125,6 +131,7 @@ public struct StructuredOutput: Codable, Hashable, Sendable { try container.encodeIfPresent(self.regex, forKey: .regex) try container.encodeIfPresent(self.model, forKey: .model) try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeNullableIfPresent(self.conditions, forKey: .conditions) try container.encode(self.id, forKey: .id) try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) @@ -142,6 +149,7 @@ public struct StructuredOutput: Codable, Hashable, Sendable { case regex case model case compliancePlan + case conditions case id case orgId case createdAt diff --git a/Sources/Schemas/StructuredOutputConditionsItem.swift b/Sources/Schemas/StructuredOutputConditionsItem.swift new file mode 100644 index 00000000..88dc9c6e --- /dev/null +++ b/Sources/Schemas/StructuredOutputConditionsItem.swift @@ -0,0 +1,46 @@ +import Foundation + +public enum StructuredOutputConditionsItem: Codable, Hashable, Sendable { + case endedReason(EndedReasonCondition) + case minCallDuration(MinCallDurationCondition) + case minMessages(MinMessagesCondition) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "endedReason": + self = .endedReason(try EndedReasonCondition(from: decoder)) + case "minCallDuration": + self = .minCallDuration(try MinCallDurationCondition(from: decoder)) + case "minMessages": + self = .minMessages(try MinMessagesCondition(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .endedReason(let data): + try container.encode("endedReason", forKey: .type) + try data.encode(to: encoder) + case .minCallDuration(let data): + try container.encode("minCallDuration", forKey: .type) + try data.encode(to: encoder) + case .minMessages(let data): + try container.encode("minMessages", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputControllerFindAllRequestSortBy.swift b/Sources/Schemas/StructuredOutputControllerFindAllRequestSortBy.swift new file mode 100644 index 00000000..88366642 --- /dev/null +++ b/Sources/Schemas/StructuredOutputControllerFindAllRequestSortBy.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum StructuredOutputControllerFindAllRequestSortBy: String, Codable, Hashable, CaseIterable, Sendable { + case createdAt + case duration + case cost +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputControllerRunResponse.swift b/Sources/Schemas/StructuredOutputControllerRunResponse.swift new file mode 100644 index 00000000..8c6e68b9 --- /dev/null +++ b/Sources/Schemas/StructuredOutputControllerRunResponse.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum StructuredOutputControllerRunResponse: Codable, Hashable, Sendable { + case structuredOutputControllerRunResponseZero(StructuredOutputControllerRunResponseZero) + case structuredOutputRerunResponse(StructuredOutputRerunResponse) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(StructuredOutputControllerRunResponseZero.self) { + self = .structuredOutputControllerRunResponseZero(value) + } else if let value = try? container.decode(StructuredOutputRerunResponse.self) { + self = .structuredOutputRerunResponse(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .structuredOutputControllerRunResponseZero(let value): + try container.encode(value) + case .structuredOutputRerunResponse(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputControllerRunResponseZero.swift b/Sources/Schemas/StructuredOutputControllerRunResponseZero.swift new file mode 100644 index 00000000..88ac9228 --- /dev/null +++ b/Sources/Schemas/StructuredOutputControllerRunResponseZero.swift @@ -0,0 +1,35 @@ +import Foundation + +public struct StructuredOutputControllerRunResponseZero: Codable, Hashable, Sendable { + /// These are the structured outputs whose conditions gated them, keyed by + /// structured output id. Absent when nothing was skipped. An entry here means + /// no extraction ran and no cost was incurred for that output. + public let skipped: [String: SkippedStructuredOutput]? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + skipped: [String: SkippedStructuredOutput]? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.skipped = skipped + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.skipped = try container.decodeIfPresent([String: SkippedStructuredOutput].self, forKey: .skipped) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.skipped, forKey: .skipped) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case skipped + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputEvaluationResult.swift b/Sources/Schemas/StructuredOutputEvaluationResult.swift index 0d91bde5..08b08c3d 100644 --- a/Sources/Schemas/StructuredOutputEvaluationResult.swift +++ b/Sources/Schemas/StructuredOutputEvaluationResult.swift @@ -6,6 +6,12 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { public let structuredOutputId: String /// This is the name of the structured output. public let name: String + /// This is the optional dot-notation path evaluated within an object structured output. + public let path: String? + /// This is the structured output description captured when the evaluation ran. + public let description: String? + /// This is the structured output schema captured when the evaluation ran. + public let schema: JsonSchema? /// This is the value extracted from the call by the structured output. public let extractedValue: Nullable /// This is the expected value that was defined in the evaluation plan. @@ -28,6 +34,9 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { public init( structuredOutputId: String, name: String, + path: String? = nil, + description: String? = nil, + schema: JsonSchema? = nil, extractedValue: Nullable, expectedValue: StructuredOutputEvaluationResultExpectedValue, comparator: StructuredOutputEvaluationResultComparator, @@ -40,6 +49,9 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { ) { self.structuredOutputId = structuredOutputId self.name = name + self.path = path + self.description = description + self.schema = schema self.extractedValue = extractedValue self.expectedValue = expectedValue self.comparator = comparator @@ -55,6 +67,9 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.structuredOutputId = try container.decode(String.self, forKey: .structuredOutputId) self.name = try container.decode(String.self, forKey: .name) + self.path = try container.decodeIfPresent(String.self, forKey: .path) + self.description = try container.decodeIfPresent(String.self, forKey: .description) + self.schema = try container.decodeIfPresent(JsonSchema.self, forKey: .schema) self.extractedValue = try container.decode(Nullable.self, forKey: .extractedValue) self.expectedValue = try container.decode(StructuredOutputEvaluationResultExpectedValue.self, forKey: .expectedValue) self.comparator = try container.decode(StructuredOutputEvaluationResultComparator.self, forKey: .comparator) @@ -71,6 +86,9 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encode(self.structuredOutputId, forKey: .structuredOutputId) try container.encode(self.name, forKey: .name) + try container.encodeIfPresent(self.path, forKey: .path) + try container.encodeIfPresent(self.description, forKey: .description) + try container.encodeIfPresent(self.schema, forKey: .schema) try container.encode(self.extractedValue, forKey: .extractedValue) try container.encode(self.expectedValue, forKey: .expectedValue) try container.encode(self.comparator, forKey: .comparator) @@ -85,6 +103,9 @@ public struct StructuredOutputEvaluationResult: Codable, Hashable, Sendable { enum CodingKeys: String, CodingKey, CaseIterable { case structuredOutputId case name + case path + case description + case schema case extractedValue case expectedValue case comparator diff --git a/Sources/Schemas/StructuredOutputPaginatedResponse.swift b/Sources/Schemas/StructuredOutputPaginatedResponse.swift index 69e176ca..7209e2ac 100644 --- a/Sources/Schemas/StructuredOutputPaginatedResponse.swift +++ b/Sources/Schemas/StructuredOutputPaginatedResponse.swift @@ -1,7 +1,10 @@ import Foundation +/// A paginated collection of structured-output definitions and metadata describing the result set. public struct StructuredOutputPaginatedResponse: Codable, Hashable, Sendable { + /// The structured-output definitions returned for the current page. public let results: [StructuredOutput] + /// Pagination metadata for the structured-output result set. public let metadata: PaginationMeta /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/StructuredOutputRerunResponse.swift b/Sources/Schemas/StructuredOutputRerunResponse.swift new file mode 100644 index 00000000..9f1bac83 --- /dev/null +++ b/Sources/Schemas/StructuredOutputRerunResponse.swift @@ -0,0 +1,39 @@ +import Foundation + +public struct StructuredOutputRerunResponse: Codable, Hashable, Sendable { + /// This is the id of the workflow processing the rerun. + public let workflowId: String? + public let message: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + workflowId: String? = nil, + message: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.workflowId = workflowId + self.message = message + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) + self.message = try container.decode(String.self, forKey: .message) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.workflowId, forKey: .workflowId) + try container.encode(self.message, forKey: .message) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case workflowId + case message + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputRunPreviewResponse.swift b/Sources/Schemas/StructuredOutputRunPreviewResponse.swift new file mode 100644 index 00000000..73093a35 --- /dev/null +++ b/Sources/Schemas/StructuredOutputRunPreviewResponse.swift @@ -0,0 +1,35 @@ +import Foundation + +public struct StructuredOutputRunPreviewResponse: Codable, Hashable, Sendable { + /// These are the structured outputs whose conditions gated them, keyed by + /// structured output id. Absent when nothing was skipped. An entry here means + /// no extraction ran and no cost was incurred for that output. + public let skipped: [String: SkippedStructuredOutput]? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + skipped: [String: SkippedStructuredOutput]? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.skipped = skipped + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.skipped = try container.decodeIfPresent([String: SkippedStructuredOutput].self, forKey: .skipped) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.skipped, forKey: .skipped) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case skipped + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputRunResult.swift b/Sources/Schemas/StructuredOutputRunResult.swift new file mode 100644 index 00000000..12a5c3e4 --- /dev/null +++ b/Sources/Schemas/StructuredOutputRunResult.swift @@ -0,0 +1,46 @@ +import Foundation + +public struct StructuredOutputRunResult: Codable, Hashable, Sendable { + /// This is the name of the structured output that produced this value. + public let name: String + /// This is the extracted value, shaped by the structured output's schema. + public let result: Nullable + public let compliancePlan: ComplianceOverride? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + name: String, + result: Nullable, + compliancePlan: ComplianceOverride? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.name = name + self.result = result + self.compliancePlan = compliancePlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.name = try container.decode(String.self, forKey: .name) + self.result = try container.decode(Nullable.self, forKey: .result) + self.compliancePlan = try container.decodeIfPresent(ComplianceOverride.self, forKey: .compliancePlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.name, forKey: .name) + try container.encode(self.result, forKey: .result) + try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case name + case result + case compliancePlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/StructuredOutputRunResultResult.swift b/Sources/Schemas/StructuredOutputRunResultResult.swift new file mode 100644 index 00000000..6c91a90e --- /dev/null +++ b/Sources/Schemas/StructuredOutputRunResultResult.swift @@ -0,0 +1,46 @@ +import Foundation + +/// This is the extracted value, shaped by the structured output's schema. +public enum StructuredOutputRunResultResult: Codable, Hashable, Sendable { + case bool(Bool) + case double(Double) + case jsonValueArray([JSONValue]) + case string(String) + case stringToJsonValueDictionary([String: JSONValue]) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(Bool.self) { + self = .bool(value) + } else if let value = try? container.decode(Double.self) { + self = .double(value) + } else if let value = try? container.decode([JSONValue].self) { + self = .jsonValueArray(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else if let value = try? container.decode([String: JSONValue].self) { + self = .stringToJsonValueDictionary(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .bool(let value): + try container.encode(value) + case .double(let value): + try container.encode(value) + case .jsonValueArray(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + case .stringToJsonValueDictionary(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/Subscription.swift b/Sources/Schemas/Subscription.swift index 73689d69..5a00a140 100644 --- a/Sources/Schemas/Subscription.swift +++ b/Sources/Schemas/Subscription.swift @@ -87,9 +87,9 @@ public struct Subscription: Codable, Hashable, Sendable { /// This is the ID for the Common Paper agreement outlining the PCI contract. public let pciCommonPaperAgreementId: String? /// This is the call retention days for the subscription. - public let callRetentionDays: Double? + public let callRetentionDays: Nullable? /// This is the chat retention days for the subscription. - public let chatRetentionDays: Double? + public let chatRetentionDays: Nullable? /// This is the minutes_included reset frequency for the subscription. public let minutesIncludedResetFrequency: SubscriptionMinutesIncludedResetFrequency? /// This is the Role Based Access Control (RBAC) enabled flag for the subscription. @@ -138,8 +138,8 @@ public struct Subscription: Codable, Hashable, Sendable { invoicePlan: InvoicePlan? = nil, pciEnabled: Bool? = nil, pciCommonPaperAgreementId: String? = nil, - callRetentionDays: Double? = nil, - chatRetentionDays: Double? = nil, + callRetentionDays: Nullable? = nil, + chatRetentionDays: Nullable? = nil, minutesIncludedResetFrequency: SubscriptionMinutesIncludedResetFrequency? = nil, rbacEnabled: Bool? = nil, platformFee: Double? = nil, @@ -231,8 +231,8 @@ public struct Subscription: Codable, Hashable, Sendable { self.invoicePlan = try container.decodeIfPresent(InvoicePlan.self, forKey: .invoicePlan) self.pciEnabled = try container.decodeIfPresent(Bool.self, forKey: .pciEnabled) self.pciCommonPaperAgreementId = try container.decodeIfPresent(String.self, forKey: .pciCommonPaperAgreementId) - self.callRetentionDays = try container.decodeIfPresent(Double.self, forKey: .callRetentionDays) - self.chatRetentionDays = try container.decodeIfPresent(Double.self, forKey: .chatRetentionDays) + self.callRetentionDays = try container.decodeNullableIfPresent(Double.self, forKey: .callRetentionDays) + self.chatRetentionDays = try container.decodeNullableIfPresent(Double.self, forKey: .chatRetentionDays) self.minutesIncludedResetFrequency = try container.decodeIfPresent(SubscriptionMinutesIncludedResetFrequency.self, forKey: .minutesIncludedResetFrequency) self.rbacEnabled = try container.decodeIfPresent(Bool.self, forKey: .rbacEnabled) self.platformFee = try container.decodeIfPresent(Double.self, forKey: .platformFee) @@ -280,8 +280,8 @@ public struct Subscription: Codable, Hashable, Sendable { try container.encodeIfPresent(self.invoicePlan, forKey: .invoicePlan) try container.encodeIfPresent(self.pciEnabled, forKey: .pciEnabled) try container.encodeIfPresent(self.pciCommonPaperAgreementId, forKey: .pciCommonPaperAgreementId) - try container.encodeIfPresent(self.callRetentionDays, forKey: .callRetentionDays) - try container.encodeIfPresent(self.chatRetentionDays, forKey: .chatRetentionDays) + try container.encodeNullableIfPresent(self.callRetentionDays, forKey: .callRetentionDays) + try container.encodeNullableIfPresent(self.chatRetentionDays, forKey: .chatRetentionDays) try container.encodeIfPresent(self.minutesIncludedResetFrequency, forKey: .minutesIncludedResetFrequency) try container.encodeIfPresent(self.rbacEnabled, forKey: .rbacEnabled) try container.encodeIfPresent(self.platformFee, forKey: .platformFee) diff --git a/Sources/Schemas/SubscriptionLimits.swift b/Sources/Schemas/SubscriptionLimits.swift index ddf34e7e..091d39c8 100644 --- a/Sources/Schemas/SubscriptionLimits.swift +++ b/Sources/Schemas/SubscriptionLimits.swift @@ -1,5 +1,6 @@ import Foundation +/// Organization concurrency limits and remaining concurrent call capacity. public struct SubscriptionLimits: Codable, Hashable, Sendable { /// True if this call was blocked by the Call Concurrency limit public let concurrencyBlocked: Bool? diff --git a/Sources/Schemas/SuccessEvaluationPlan.swift b/Sources/Schemas/SuccessEvaluationPlan.swift index daf83a5c..fdd76f55 100644 --- a/Sources/Schemas/SuccessEvaluationPlan.swift +++ b/Sources/Schemas/SuccessEvaluationPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls post-call success evaluation, including the rubric, prompt messages, enablement, and request timeout. public struct SuccessEvaluationPlan: Codable, Hashable, Sendable { /// This enforces the rubric of the evaluation. The output is stored in `call.analysis.successEvaluation`. /// diff --git a/Sources/Schemas/SummaryPlan.swift b/Sources/Schemas/SummaryPlan.swift index 9fa4e68f..5d384612 100644 --- a/Sources/Schemas/SummaryPlan.swift +++ b/Sources/Schemas/SummaryPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls generation of a post-call summary, including prompt messages, enablement, and request timeout. public struct SummaryPlan: Codable, Hashable, Sendable { /// These are the messages used to generate the summary. /// diff --git a/Sources/Schemas/SupabaseBucketPlan.swift b/Sources/Schemas/SupabaseBucketPlan.swift index 5966320c..6a6c78f4 100644 --- a/Sources/Schemas/SupabaseBucketPlan.swift +++ b/Sources/Schemas/SupabaseBucketPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Supabase S3-compatible bucket configuration for call artifacts, including region, endpoint, access keys, bucket name, and path. public struct SupabaseBucketPlan: Codable, Hashable, Sendable { /// This is the S3 Region. It should look like us-east-1 /// It should be one of the supabase regions defined in the SUPABASE_REGION enum diff --git a/Sources/Schemas/SyncVoiceLibraryDtoProvidersItem.swift b/Sources/Schemas/SyncVoiceLibraryDtoProvidersItem.swift index 7815b1b0..9a45acc7 100644 --- a/Sources/Schemas/SyncVoiceLibraryDtoProvidersItem.swift +++ b/Sources/Schemas/SyncVoiceLibraryDtoProvidersItem.swift @@ -20,4 +20,6 @@ public enum SyncVoiceLibraryDtoProvidersItem: String, Codable, Hashable, CaseIte case minimax case wellsaid case orpheus + case xai + case microsoft } \ No newline at end of file diff --git a/Sources/Schemas/SystemMessage.swift b/Sources/Schemas/SystemMessage.swift index bd1308e1..702f2a2c 100644 --- a/Sources/Schemas/SystemMessage.swift +++ b/Sources/Schemas/SystemMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// A system-authored entry in the call message history, including its content and timing. public struct SystemMessage: Codable, Hashable, Sendable { /// The role of the system in the conversation. public let role: String diff --git a/Sources/Schemas/TalkscriberTranscriber.swift b/Sources/Schemas/TalkscriberTranscriber.swift index a40f0275..dd0b5908 100644 --- a/Sources/Schemas/TalkscriberTranscriber.swift +++ b/Sources/Schemas/TalkscriberTranscriber.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for transcribing speech during assistant conversations with Talkscriber, including model, language, and fallback settings. public struct TalkscriberTranscriber: Codable, Hashable, Sendable { /// This is the model that will be used for the transcription. public let model: TalkscriberTranscriberModel? diff --git a/Sources/Schemas/TavusConversationProperties.swift b/Sources/Schemas/TavusConversationProperties.swift index eaac036d..893180f3 100644 --- a/Sources/Schemas/TavusConversationProperties.swift +++ b/Sources/Schemas/TavusConversationProperties.swift @@ -1,5 +1,6 @@ import Foundation +/// Tavus conversation behavior and media settings, including duration, participant timeouts, recording, transcription, background, language, and recording storage. public struct TavusConversationProperties: Codable, Hashable, Sendable { /// The maximum duration of the call in seconds. The default `maxCallDuration` is 3600 seconds (1 hour). /// Once the time limit specified by this parameter has been reached, the conversation will automatically shut down. diff --git a/Sources/Schemas/TavusVoice.swift b/Sources/Schemas/TavusVoice.swift index 5690254f..ce15aaf0 100644 --- a/Sources/Schemas/TavusVoice.swift +++ b/Sources/Schemas/TavusVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for using Tavus as the assistant's voice provider, including persona, callback, context, greeting, conversation properties, chunking, caching, and fallback settings. public struct TavusVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/TelnyxPhoneNumber.swift b/Sources/Schemas/TelnyxPhoneNumber.swift index 5089e0dd..4a73444b 100644 --- a/Sources/Schemas/TelnyxPhoneNumber.swift +++ b/Sources/Schemas/TelnyxPhoneNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// A Telnyx phone number connected to Vapi, including its credential, routing, hooks, server settings, and lifecycle metadata. public struct TelnyxPhoneNumber: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/TelnyxTransport.swift b/Sources/Schemas/TelnyxTransport.swift new file mode 100644 index 00000000..31c05be0 --- /dev/null +++ b/Sources/Schemas/TelnyxTransport.swift @@ -0,0 +1,54 @@ +import Foundation + +public struct TelnyxTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: TelnyxTransportConversationType? + /// This is the call control ID of the Telnyx call. + public let callControlId: String? + /// This is the call leg ID of the Telnyx call. + public let callLegId: String? + /// This is the call session ID of the Telnyx call. + public let callSessionId: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: TelnyxTransportConversationType? = nil, + callControlId: String? = nil, + callLegId: String? = nil, + callSessionId: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.callControlId = callControlId + self.callLegId = callLegId + self.callSessionId = callSessionId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(TelnyxTransportConversationType.self, forKey: .conversationType) + self.callControlId = try container.decodeIfPresent(String.self, forKey: .callControlId) + self.callLegId = try container.decodeIfPresent(String.self, forKey: .callLegId) + self.callSessionId = try container.decodeIfPresent(String.self, forKey: .callSessionId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.callControlId, forKey: .callControlId) + try container.encodeIfPresent(self.callLegId, forKey: .callLegId) + try container.encodeIfPresent(self.callSessionId, forKey: .callSessionId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case callControlId + case callLegId + case callSessionId + } +} \ No newline at end of file diff --git a/Sources/Schemas/TelnyxTransportConversationType.swift b/Sources/Schemas/TelnyxTransportConversationType.swift new file mode 100644 index 00000000..179c6b82 --- /dev/null +++ b/Sources/Schemas/TelnyxTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum TelnyxTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/TextContent.swift b/Sources/Schemas/TextContent.swift index d496209d..45e509d0 100644 --- a/Sources/Schemas/TextContent.swift +++ b/Sources/Schemas/TextContent.swift @@ -1,8 +1,12 @@ import Foundation +/// Localized text content used as a language-specific message variant. public struct TextContent: Codable, Hashable, Sendable { + /// Selects text as the content type. public let type: TextContentType + /// Text spoken or displayed for this content variant. public let text: String + /// Language code associated with this text variant. public let language: TextContentLanguage /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/TextContentLanguage.swift b/Sources/Schemas/TextContentLanguage.swift index e332b143..fb39ed96 100644 --- a/Sources/Schemas/TextContentLanguage.swift +++ b/Sources/Schemas/TextContentLanguage.swift @@ -1,5 +1,6 @@ import Foundation +/// Language code associated with this text variant. public enum TextContentLanguage: String, Codable, Hashable, CaseIterable, Sendable { case aa case ab diff --git a/Sources/Schemas/TextContentType.swift b/Sources/Schemas/TextContentType.swift index e3a7ed48..15450d1f 100644 --- a/Sources/Schemas/TextContentType.swift +++ b/Sources/Schemas/TextContentType.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects text as the content type. public enum TextContentType: String, Codable, Hashable, CaseIterable, Sendable { case text } \ No newline at end of file diff --git a/Sources/Schemas/TextEditorTool.swift b/Sources/Schemas/TextEditorTool.swift index 01befe79..c0e6b6e3 100644 --- a/Sources/Schemas/TextEditorTool.swift +++ b/Sources/Schemas/TextEditorTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that reads and edits text files in a configured environment. public struct TextEditorTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [TextEditorToolMessagesItem]? /// The sub type of tool. public let subType: TextEditorToolSubType @@ -110,6 +110,7 @@ public struct TextEditorTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [TextEditorToolMessagesItem]? = nil, subType: TextEditorToolSubType, server: Server? = nil, @@ -121,6 +122,7 @@ public struct TextEditorTool: Codable, Hashable, Sendable { name: TextEditorToolName, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.subType = subType self.server = server @@ -135,6 +137,7 @@ public struct TextEditorTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([TextEditorToolMessagesItem].self, forKey: .messages) self.subType = try container.decode(TextEditorToolSubType.self, forKey: .subType) self.server = try container.decodeIfPresent(Server.self, forKey: .server) @@ -150,6 +153,7 @@ public struct TextEditorTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.subType, forKey: .subType) try container.encodeIfPresent(self.server, forKey: .server) @@ -163,6 +167,7 @@ public struct TextEditorTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case subType case server diff --git a/Sources/Schemas/TextEditorToolWithToolCall.swift b/Sources/Schemas/TextEditorToolWithToolCall.swift index d824876b..18d76762 100644 --- a/Sources/Schemas/TextEditorToolWithToolCall.swift +++ b/Sources/Schemas/TextEditorToolWithToolCall.swift @@ -1,9 +1,7 @@ import Foundation public struct TextEditorToolWithToolCall: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [TextEditorToolWithToolCallMessagesItem]? /// The sub type of tool. public let subType: TextEditorToolWithToolCallSubType diff --git a/Sources/Schemas/TextInsight.swift b/Sources/Schemas/TextInsight.swift index c2641618..efa2e015 100644 --- a/Sources/Schemas/TextInsight.swift +++ b/Sources/Schemas/TextInsight.swift @@ -1,5 +1,6 @@ import Foundation +/// A saved text-value insight containing its call-data queries, formula, time range, and lifecycle information. public struct TextInsight: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct TextInsight: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formula: [String: JSONValue]? + /// The time range used to query the text-value data. public let timeRange: InsightTimeRange? /// These are the queries to run to generate the insight. /// For Text Insights, we only allow a single query, or require a formula if multiple queries are provided @@ -31,6 +33,8 @@ public struct TextInsight: Codable, Hashable, Sendable { public let createdAt: Date /// This is the ISO 8601 date-time string of when the Insight was last updated. public let updatedAt: Date + /// Stable server-owned identifier for system-created insights. + public let systemKey: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] @@ -43,6 +47,7 @@ public struct TextInsight: Codable, Hashable, Sendable { orgId: String, createdAt: Date, updatedAt: Date, + systemKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name @@ -53,6 +58,7 @@ public struct TextInsight: Codable, Hashable, Sendable { self.orgId = orgId self.createdAt = createdAt self.updatedAt = updatedAt + self.systemKey = systemKey self.additionalProperties = additionalProperties } @@ -66,6 +72,7 @@ public struct TextInsight: Codable, Hashable, Sendable { self.orgId = try container.decode(String.self, forKey: .orgId) self.createdAt = try container.decode(Date.self, forKey: .createdAt) self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.systemKey = try container.decodeIfPresent(String.self, forKey: .systemKey) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -80,6 +87,7 @@ public struct TextInsight: Codable, Hashable, Sendable { try container.encode(self.orgId, forKey: .orgId) try container.encode(self.createdAt, forKey: .createdAt) try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.systemKey, forKey: .systemKey) } /// Keys for encoding/decoding struct properties. @@ -92,5 +100,6 @@ public struct TextInsight: Codable, Hashable, Sendable { case orgId case createdAt case updatedAt + case systemKey } } \ No newline at end of file diff --git a/Sources/Schemas/TimeRange.swift b/Sources/Schemas/TimeRange.swift index afaa42a5..78932b47 100644 --- a/Sources/Schemas/TimeRange.swift +++ b/Sources/Schemas/TimeRange.swift @@ -1,5 +1,6 @@ import Foundation +/// Start, end, timezone, and time step used for analytics aggregation. public struct TimeRange: Codable, Hashable, Sendable { /// This is the time step for aggregations. /// diff --git a/Sources/Schemas/TogetherAiModel.swift b/Sources/Schemas/TogetherAiModel.swift index ed1dcf67..9dfa469a 100644 --- a/Sources/Schemas/TogetherAiModel.swift +++ b/Sources/Schemas/TogetherAiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with Together AI, including model, prompts, tools, knowledge-base access, and generation settings. public struct TogetherAiModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [TogetherAiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: String, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([TogetherAiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct TogetherAiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/ToolCall.swift b/Sources/Schemas/ToolCall.swift index 5767b592..49ed36c5 100644 --- a/Sources/Schemas/ToolCall.swift +++ b/Sources/Schemas/ToolCall.swift @@ -1,5 +1,6 @@ import Foundation +/// A tool invocation requested by the assistant, including its identifier, type, and function details. public struct ToolCall: Codable, Hashable, Sendable { /// This is the ID of the tool call public let id: String diff --git a/Sources/Schemas/ToolCallFunction.swift b/Sources/Schemas/ToolCallFunction.swift index 55684277..c80be045 100644 --- a/Sources/Schemas/ToolCallFunction.swift +++ b/Sources/Schemas/ToolCallFunction.swift @@ -1,5 +1,6 @@ import Foundation +/// The function name and serialized arguments associated with a tool call. public struct ToolCallFunction: Codable, Hashable, Sendable { /// This is the arguments to call the function with public let arguments: String diff --git a/Sources/Schemas/ToolCallHookAction.swift b/Sources/Schemas/ToolCallHookAction.swift index ab368806..9a317ec0 100644 --- a/Sources/Schemas/ToolCallHookAction.swift +++ b/Sources/Schemas/ToolCallHookAction.swift @@ -1,5 +1,6 @@ import Foundation +/// A hook action that invokes an inline tool or an existing tool when the hook triggers. public struct ToolCallHookAction: Codable, Hashable, Sendable { /// This is the type of action - must be "tool" public let type: ToolCallHookActionType diff --git a/Sources/Schemas/ToolCallMessage.swift b/Sources/Schemas/ToolCallMessage.swift index 7aff5ee8..db89dc32 100644 --- a/Sources/Schemas/ToolCallMessage.swift +++ b/Sources/Schemas/ToolCallMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// An entry in the call message history that records one or more tool calls requested during the conversation. public struct ToolCallMessage: Codable, Hashable, Sendable { /// The role of the tool call in the conversation. public let role: String diff --git a/Sources/Schemas/ToolCallResultMessage.swift b/Sources/Schemas/ToolCallResultMessage.swift index a6b6b380..4e74d33e 100644 --- a/Sources/Schemas/ToolCallResultMessage.swift +++ b/Sources/Schemas/ToolCallResultMessage.swift @@ -1,75 +1,45 @@ import Foundation -public struct ToolCallResultMessage: Codable, Hashable, Sendable { - /// The role of the tool call result in the conversation. - public let role: String - /// The ID of the tool call. - public let toolCallId: String - /// The name of the tool that returned the result. - public let name: String - /// The result of the tool call in JSON format. - public let result: String - /// The timestamp when the message was sent. - public let time: Double - /// The number of seconds from the start of the conversation. - public let secondsFromStart: Double - /// The metadata for the tool call result. - public let metadata: [String: JSONValue]? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - role: String, - toolCallId: String, - name: String, - result: String, - time: Double, - secondsFromStart: Double, - metadata: [String: JSONValue]? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.role = role - self.toolCallId = toolCallId - self.name = name - self.result = result - self.time = time - self.secondsFromStart = secondsFromStart - self.metadata = metadata - self.additionalProperties = additionalProperties - } +/// This is the message that will be spoken to the user. +/// +/// If this is not returned, assistant will speak: +/// 1. a `request-complete` or `request-failed` message from `tool.messages`, if it exists +/// 2. a response generated by the model, if not +public enum ToolCallResultMessage: Codable, Hashable, Sendable { + case requestComplete(ToolMessageComplete) + case requestFailed(ToolMessageFailed) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.role = try container.decode(String.self, forKey: .role) - self.toolCallId = try container.decode(String.self, forKey: .toolCallId) - self.name = try container.decode(String.self, forKey: .name) - self.result = try container.decode(String.self, forKey: .result) - self.time = try container.decode(Double.self, forKey: .time) - self.secondsFromStart = try container.decode(Double.self, forKey: .secondsFromStart) - self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "request-complete": + self = .requestComplete(try ToolMessageComplete(from: decoder)) + case "request-failed": + self = .requestFailed(try ToolMessageFailed(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.role, forKey: .role) - try container.encode(self.toolCallId, forKey: .toolCallId) - try container.encode(self.name, forKey: .name) - try container.encode(self.result, forKey: .result) - try container.encode(self.time, forKey: .time) - try container.encode(self.secondsFromStart, forKey: .secondsFromStart) - try container.encodeIfPresent(self.metadata, forKey: .metadata) + switch self { + case .requestComplete(let data): + try container.encode("request-complete", forKey: .type) + try data.encode(to: encoder) + case .requestFailed(let data): + try container.encode("request-failed", forKey: .type) + try data.encode(to: encoder) + } } - /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { - case role - case toolCallId - case name - case result - case time - case secondsFromStart - case metadata + case type } } \ No newline at end of file diff --git a/Sources/Schemas/ToolCallResultMessageWarning.swift b/Sources/Schemas/ToolCallResultMessageWarning.swift new file mode 100644 index 00000000..e6df6d49 --- /dev/null +++ b/Sources/Schemas/ToolCallResultMessageWarning.swift @@ -0,0 +1,50 @@ +import Foundation + +public struct ToolCallResultMessageWarning: Codable, Hashable, Sendable { + /// The kind of warning. Currently: + /// - `oversized-tool-response`: the tool's serialized response exceeded the + /// recommended size and is likely to bloat the model context, increasing + /// latency and risking truncation of earlier instructions. + public let type: ToolCallResultMessageWarningType + /// The estimated number of tokens in the serialized tool response. + public let tokenCount: Double + /// The threshold (in tokens) above which the warning is raised. + public let threshold: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + type: ToolCallResultMessageWarningType, + tokenCount: Double, + threshold: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.type = type + self.tokenCount = tokenCount + self.threshold = threshold + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.type = try container.decode(ToolCallResultMessageWarningType.self, forKey: .type) + self.tokenCount = try container.decode(Double.self, forKey: .tokenCount) + self.threshold = try container.decode(Double.self, forKey: .threshold) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.type, forKey: .type) + try container.encode(self.tokenCount, forKey: .tokenCount) + try container.encode(self.threshold, forKey: .threshold) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case type + case tokenCount + case threshold + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolCallResultMessageWarningType.swift b/Sources/Schemas/ToolCallResultMessageWarningType.swift new file mode 100644 index 00000000..129827ca --- /dev/null +++ b/Sources/Schemas/ToolCallResultMessageWarningType.swift @@ -0,0 +1,9 @@ +import Foundation + +/// The kind of warning. Currently: +/// - `oversized-tool-response`: the tool's serialized response exceeded the +/// recommended size and is likely to bloat the model context, increasing +/// latency and risking truncation of earlier instructions. +public enum ToolCallResultMessageWarningType: String, Codable, Hashable, CaseIterable, Sendable { + case oversizedToolResponse = "oversized-tool-response" +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraft.swift b/Sources/Schemas/ToolDraft.swift new file mode 100644 index 00000000..56a191e3 --- /dev/null +++ b/Sources/Schemas/ToolDraft.swift @@ -0,0 +1,394 @@ +import Foundation + +public struct ToolDraft: Codable, Hashable, Sendable { + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. + public let messages: [ToolDraftMessagesItem]? + /// This is the type of the tool. + public let type: ToolDraftType? + /// Key used as `draftId` in URLs. + public let id: String + /// This is the unique identifier for the org that owns this draft. + public let orgId: String + /// This is the unique identifier for the tool this draft was forked from. + /// Intentionally NOT a FK — `tool_draft` mirrors `tool_version` / `version_pin`'s + /// no-FK / app-cleanup philosophy, so there is no `ON DELETE CASCADE`. Drafts + /// must be cleaned up explicitly (`toolDraftDelete({ orgId, toolId })`) on a + /// parent tool hard-delete; nothing reaps them automatically. + public let toolId: String + /// The published version this draft was forked from. Server defaults to + /// `tool.latestVersion` on POST if omitted. Immutable for the draft's lifetime. + public let baseVersion: String + /// Email when JWT, null when API or external JWT. Set on POST, never rewritten on PATCH. + public let createdBy: Nullable? + /// This is the ISO 8601 date-time string of when the draft was created. + public let createdAt: Date + /// This is the ISO 8601 date-time string of when the draft was last updated. + public let updatedAt: Date + /// This is the plan to reject a tool call based on the conversation state. + /// + /// // Example 1: Reject endCall if user didn't say goodbye + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '(?i)\\b(bye|goodbye|farewell|see you later|take care)\\b', + /// target: { position: -1, role: 'user' }, + /// negate: true // Reject if pattern does NOT match + /// }] + /// } + /// ``` + /// + /// // Example 2: Reject transfer if user is actually asking a question + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '\\?', + /// target: { position: -1, role: 'user' } + /// }] + /// } + /// ``` + /// + /// // Example 3: Reject transfer if user didn't mention transfer recently + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 5 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' %} + /// {% assign mentioned = false %} + /// {% for msg in userMessages %} + /// {% if msg.content contains 'transfer' or msg.content contains 'connect' or msg.content contains 'speak to' %} + /// {% assign mentioned = true %} + /// {% break %} + /// {% endif %} + /// {% endfor %} + /// {% if mentioned %} + /// false + /// {% else %} + /// true + /// {% endif %}` + /// }] + /// } + /// ``` + /// + /// // Example 4: Reject endCall if the bot is looping and trying to exit + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 6 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' | reverse %} + /// {% if userMessages.size < 3 %} + /// false + /// {% else %} + /// {% assign msg1 = userMessages[0].content | downcase %} + /// {% assign msg2 = userMessages[1].content | downcase %} + /// {% assign msg3 = userMessages[2].content | downcase %} + /// {% comment %} Check for repetitive messages {% endcomment %} + /// {% if msg1 == msg2 or msg1 == msg3 or msg2 == msg3 %} + /// true + /// {% comment %} Check for common loop phrases {% endcomment %} + /// {% elsif msg1 contains 'cool thanks' or msg2 contains 'cool thanks' or msg3 contains 'cool thanks' %} + /// true + /// {% elsif msg1 contains 'okay thanks' or msg2 contains 'okay thanks' or msg3 contains 'okay thanks' %} + /// true + /// {% elsif msg1 contains 'got it' or msg2 contains 'got it' or msg3 contains 'got it' %} + /// true + /// {% else %} + /// false + /// {% endif %} + /// {% endif %}` + /// }] + /// } + /// ``` + public let rejectionPlan: ToolRejectionPlan? + /// This is the function definition of the tool. + public let function: OpenAiFunction? + /// Provider-specific metadata. Polymorphic across tool variants with no shared + /// discriminator, so it is validated as a plain object (mirrors how + /// `ToolCallResult.metadata` is typed). + public let metadata: [String: JSONValue]? + /// This is the unique identifier for the template this tool was created from. + public let templateId: String? + public let server: Server? + public let async: Bool? + /// These are the destinations that the call can be transferred to. + public let destinations: [[String: JSONValue]]? + /// This is the name of the tool. This will be passed to the model. + public let name: String? + /// This is the sub type of the tool (e.g. for computer, bash and text-editor tools). + public let subType: String? + /// The display width in pixels (computer tool). + public let displayWidthPx: Double? + /// The display height in pixels (computer tool). + public let displayHeightPx: Double? + /// Optional display number (computer tool). + public let displayNumber: Double? + /// The knowledge bases to query (query tool). + public let knowledgeBases: [KnowledgeBase]? + /// This is where the request will be sent (api-request tool). + public let url: String? + /// This is the HTTP method for the request (api-request tool). + public let method: ToolDraftMethod? + /// These are the headers to send with the request (api-request / sip-request tool). + public let headers: JsonSchema? + /// This is the body of the request. Either a JSON schema (api-request) or a + /// literal string / schema (sip-request). + public let body: [String: JSONValue]? + /// This is the backoff plan if the request fails. + public let backoffPlan: BackoffPlan? + /// This is the timeout in seconds for the request. + public let timeoutSeconds: Double? + /// This is the description of the tool. This will be passed to the model. + public let description: String? + /// This is the plan to extract variables from the tool's response. + public let variableExtractionPlan: VariableExtractionPlan? + /// This is the credential ID that will be used for authorization. + public let credentialId: String? + public let extendedDelayWhenPrecededByTextEnabled: Bool? + public let beepDetectionEnabled: Bool? + /// This is the TypeScript code that will be executed when the tool is called (code tool). + public let code: String? + /// These are the environment variables available in the code via the `env` object (code tool). + public let environmentVariables: [CodeToolEnvironmentVariable]? + /// These are the static parameters to merge into the tool's request body. + public let parameters: [ToolParameter]? + /// This is the paths to encrypt in the request body. + public let encryptedPaths: [String]? + /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833. + public let sipInfoDtmfEnabled: Bool? + /// This is the SIP method to send (sip-request tool). + public let verb: ToolDraftVerb? + /// This is the default local tool result message used when no runtime override is returned (handoff tool). + public let defaultResult: String? + /// Per-tool message overrides for individual tools loaded from the MCP server (mcp tool). + public let toolMessages: [McpToolMessages]? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + messages: [ToolDraftMessagesItem]? = nil, + type: ToolDraftType? = nil, + id: String, + orgId: String, + toolId: String, + baseVersion: String, + createdBy: Nullable? = nil, + createdAt: Date, + updatedAt: Date, + rejectionPlan: ToolRejectionPlan? = nil, + function: OpenAiFunction? = nil, + metadata: [String: JSONValue]? = nil, + templateId: String? = nil, + server: Server? = nil, + async: Bool? = nil, + destinations: [[String: JSONValue]]? = nil, + name: String? = nil, + subType: String? = nil, + displayWidthPx: Double? = nil, + displayHeightPx: Double? = nil, + displayNumber: Double? = nil, + knowledgeBases: [KnowledgeBase]? = nil, + url: String? = nil, + method: ToolDraftMethod? = nil, + headers: JsonSchema? = nil, + body: [String: JSONValue]? = nil, + backoffPlan: BackoffPlan? = nil, + timeoutSeconds: Double? = nil, + description: String? = nil, + variableExtractionPlan: VariableExtractionPlan? = nil, + credentialId: String? = nil, + extendedDelayWhenPrecededByTextEnabled: Bool? = nil, + beepDetectionEnabled: Bool? = nil, + code: String? = nil, + environmentVariables: [CodeToolEnvironmentVariable]? = nil, + parameters: [ToolParameter]? = nil, + encryptedPaths: [String]? = nil, + sipInfoDtmfEnabled: Bool? = nil, + verb: ToolDraftVerb? = nil, + defaultResult: String? = nil, + toolMessages: [McpToolMessages]? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.messages = messages + self.type = type + self.id = id + self.orgId = orgId + self.toolId = toolId + self.baseVersion = baseVersion + self.createdBy = createdBy + self.createdAt = createdAt + self.updatedAt = updatedAt + self.rejectionPlan = rejectionPlan + self.function = function + self.metadata = metadata + self.templateId = templateId + self.server = server + self.async = async + self.destinations = destinations + self.name = name + self.subType = subType + self.displayWidthPx = displayWidthPx + self.displayHeightPx = displayHeightPx + self.displayNumber = displayNumber + self.knowledgeBases = knowledgeBases + self.url = url + self.method = method + self.headers = headers + self.body = body + self.backoffPlan = backoffPlan + self.timeoutSeconds = timeoutSeconds + self.description = description + self.variableExtractionPlan = variableExtractionPlan + self.credentialId = credentialId + self.extendedDelayWhenPrecededByTextEnabled = extendedDelayWhenPrecededByTextEnabled + self.beepDetectionEnabled = beepDetectionEnabled + self.code = code + self.environmentVariables = environmentVariables + self.parameters = parameters + self.encryptedPaths = encryptedPaths + self.sipInfoDtmfEnabled = sipInfoDtmfEnabled + self.verb = verb + self.defaultResult = defaultResult + self.toolMessages = toolMessages + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([ToolDraftMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(ToolDraftType.self, forKey: .type) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.toolId = try container.decode(String.self, forKey: .toolId) + self.baseVersion = try container.decode(String.self, forKey: .baseVersion) + self.createdBy = try container.decodeNullableIfPresent(String.self, forKey: .createdBy) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.updatedAt = try container.decode(Date.self, forKey: .updatedAt) + self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) + self.function = try container.decodeIfPresent(OpenAiFunction.self, forKey: .function) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.templateId = try container.decodeIfPresent(String.self, forKey: .templateId) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.async = try container.decodeIfPresent(Bool.self, forKey: .async) + self.destinations = try container.decodeIfPresent([[String: JSONValue]].self, forKey: .destinations) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.subType = try container.decodeIfPresent(String.self, forKey: .subType) + self.displayWidthPx = try container.decodeIfPresent(Double.self, forKey: .displayWidthPx) + self.displayHeightPx = try container.decodeIfPresent(Double.self, forKey: .displayHeightPx) + self.displayNumber = try container.decodeIfPresent(Double.self, forKey: .displayNumber) + self.knowledgeBases = try container.decodeIfPresent([KnowledgeBase].self, forKey: .knowledgeBases) + self.url = try container.decodeIfPresent(String.self, forKey: .url) + self.method = try container.decodeIfPresent(ToolDraftMethod.self, forKey: .method) + self.headers = try container.decodeIfPresent(JsonSchema.self, forKey: .headers) + self.body = try container.decodeIfPresent([String: JSONValue].self, forKey: .body) + self.backoffPlan = try container.decodeIfPresent(BackoffPlan.self, forKey: .backoffPlan) + self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) + self.description = try container.decodeIfPresent(String.self, forKey: .description) + self.variableExtractionPlan = try container.decodeIfPresent(VariableExtractionPlan.self, forKey: .variableExtractionPlan) + self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) + self.extendedDelayWhenPrecededByTextEnabled = try container.decodeIfPresent(Bool.self, forKey: .extendedDelayWhenPrecededByTextEnabled) + self.beepDetectionEnabled = try container.decodeIfPresent(Bool.self, forKey: .beepDetectionEnabled) + self.code = try container.decodeIfPresent(String.self, forKey: .code) + self.environmentVariables = try container.decodeIfPresent([CodeToolEnvironmentVariable].self, forKey: .environmentVariables) + self.parameters = try container.decodeIfPresent([ToolParameter].self, forKey: .parameters) + self.encryptedPaths = try container.decodeIfPresent([String].self, forKey: .encryptedPaths) + self.sipInfoDtmfEnabled = try container.decodeIfPresent(Bool.self, forKey: .sipInfoDtmfEnabled) + self.verb = try container.decodeIfPresent(ToolDraftVerb.self, forKey: .verb) + self.defaultResult = try container.decodeIfPresent(String.self, forKey: .defaultResult) + self.toolMessages = try container.decodeIfPresent([McpToolMessages].self, forKey: .toolMessages) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.toolId, forKey: .toolId) + try container.encode(self.baseVersion, forKey: .baseVersion) + try container.encodeNullableIfPresent(self.createdBy, forKey: .createdBy) + try container.encode(self.createdAt, forKey: .createdAt) + try container.encode(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) + try container.encodeIfPresent(self.function, forKey: .function) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.templateId, forKey: .templateId) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.async, forKey: .async) + try container.encodeIfPresent(self.destinations, forKey: .destinations) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.subType, forKey: .subType) + try container.encodeIfPresent(self.displayWidthPx, forKey: .displayWidthPx) + try container.encodeIfPresent(self.displayHeightPx, forKey: .displayHeightPx) + try container.encodeIfPresent(self.displayNumber, forKey: .displayNumber) + try container.encodeIfPresent(self.knowledgeBases, forKey: .knowledgeBases) + try container.encodeIfPresent(self.url, forKey: .url) + try container.encodeIfPresent(self.method, forKey: .method) + try container.encodeIfPresent(self.headers, forKey: .headers) + try container.encodeIfPresent(self.body, forKey: .body) + try container.encodeIfPresent(self.backoffPlan, forKey: .backoffPlan) + try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) + try container.encodeIfPresent(self.description, forKey: .description) + try container.encodeIfPresent(self.variableExtractionPlan, forKey: .variableExtractionPlan) + try container.encodeIfPresent(self.credentialId, forKey: .credentialId) + try container.encodeIfPresent(self.extendedDelayWhenPrecededByTextEnabled, forKey: .extendedDelayWhenPrecededByTextEnabled) + try container.encodeIfPresent(self.beepDetectionEnabled, forKey: .beepDetectionEnabled) + try container.encodeIfPresent(self.code, forKey: .code) + try container.encodeIfPresent(self.environmentVariables, forKey: .environmentVariables) + try container.encodeIfPresent(self.parameters, forKey: .parameters) + try container.encodeIfPresent(self.encryptedPaths, forKey: .encryptedPaths) + try container.encodeIfPresent(self.sipInfoDtmfEnabled, forKey: .sipInfoDtmfEnabled) + try container.encodeIfPresent(self.verb, forKey: .verb) + try container.encodeIfPresent(self.defaultResult, forKey: .defaultResult) + try container.encodeIfPresent(self.toolMessages, forKey: .toolMessages) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case messages + case type + case id + case orgId + case toolId + case baseVersion + case createdBy + case createdAt + case updatedAt + case rejectionPlan + case function + case metadata + case templateId + case server + case async + case destinations + case name + case subType + case displayWidthPx + case displayHeightPx + case displayNumber + case knowledgeBases + case url + case method + case headers + case body + case backoffPlan + case timeoutSeconds + case description + case variableExtractionPlan + case credentialId + case extendedDelayWhenPrecededByTextEnabled + case beepDetectionEnabled + case code + case environmentVariables + case parameters + case encryptedPaths + case sipInfoDtmfEnabled + case verb + case defaultResult + case toolMessages + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftConflictResponseDto.swift b/Sources/Schemas/ToolDraftConflictResponseDto.swift new file mode 100644 index 00000000..d45437c4 --- /dev/null +++ b/Sources/Schemas/ToolDraftConflictResponseDto.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct ToolDraftConflictResponseDto: Codable, Hashable, Sendable { + public let existingDraftId: Nullable + public let error: String + public let message: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + existingDraftId: Nullable, + error: String, + message: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.existingDraftId = existingDraftId + self.error = error + self.message = message + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.existingDraftId = try container.decode(Nullable.self, forKey: .existingDraftId) + self.error = try container.decode(String.self, forKey: .error) + self.message = try container.decode(String.self, forKey: .message) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.existingDraftId, forKey: .existingDraftId) + try container.encode(self.error, forKey: .error) + try container.encode(self.message, forKey: .message) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case existingDraftId + case error + case message + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftMessagesItem.swift b/Sources/Schemas/ToolDraftMessagesItem.swift new file mode 100644 index 00000000..69d21b2b --- /dev/null +++ b/Sources/Schemas/ToolDraftMessagesItem.swift @@ -0,0 +1,52 @@ +import Foundation + +public enum ToolDraftMessagesItem: Codable, Hashable, Sendable { + case requestComplete(ToolMessageComplete) + case requestFailed(ToolMessageFailed) + case requestResponseDelayed(ToolMessageDelayed) + case requestStart(ToolMessageStart) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "request-complete": + self = .requestComplete(try ToolMessageComplete(from: decoder)) + case "request-failed": + self = .requestFailed(try ToolMessageFailed(from: decoder)) + case "request-response-delayed": + self = .requestResponseDelayed(try ToolMessageDelayed(from: decoder)) + case "request-start": + self = .requestStart(try ToolMessageStart(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .requestComplete(let data): + try container.encode("request-complete", forKey: .type) + try data.encode(to: encoder) + case .requestFailed(let data): + try container.encode("request-failed", forKey: .type) + try data.encode(to: encoder) + case .requestResponseDelayed(let data): + try container.encode("request-response-delayed", forKey: .type) + try data.encode(to: encoder) + case .requestStart(let data): + try container.encode("request-start", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftMethod.swift b/Sources/Schemas/ToolDraftMethod.swift new file mode 100644 index 00000000..efc49433 --- /dev/null +++ b/Sources/Schemas/ToolDraftMethod.swift @@ -0,0 +1,10 @@ +import Foundation + +/// This is the HTTP method for the request (api-request tool). +public enum ToolDraftMethod: String, Codable, Hashable, CaseIterable, Sendable { + case post = "POST" + case get = "GET" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftPaginatedMetadata.swift b/Sources/Schemas/ToolDraftPaginatedMetadata.swift new file mode 100644 index 00000000..a37211af --- /dev/null +++ b/Sources/Schemas/ToolDraftPaginatedMetadata.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct ToolDraftPaginatedMetadata: Codable, Hashable, Sendable { + public let nextCursor: Nullable + public let hasNextPage: Bool + public let limit: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + nextCursor: Nullable, + hasNextPage: Bool, + limit: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.nextCursor = nextCursor + self.hasNextPage = hasNextPage + self.limit = limit + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.nextCursor = try container.decode(Nullable.self, forKey: .nextCursor) + self.hasNextPage = try container.decode(Bool.self, forKey: .hasNextPage) + self.limit = try container.decode(Double.self, forKey: .limit) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.nextCursor, forKey: .nextCursor) + try container.encode(self.hasNextPage, forKey: .hasNextPage) + try container.encode(self.limit, forKey: .limit) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case nextCursor + case hasNextPage + case limit + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftPaginatedResponse.swift b/Sources/Schemas/ToolDraftPaginatedResponse.swift new file mode 100644 index 00000000..fe72aa20 --- /dev/null +++ b/Sources/Schemas/ToolDraftPaginatedResponse.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct ToolDraftPaginatedResponse: Codable, Hashable, Sendable { + public let results: [ToolDraft] + public let metadata: ToolDraftPaginatedMetadata + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + results: [ToolDraft], + metadata: ToolDraftPaginatedMetadata, + additionalProperties: [String: JSONValue] = .init() + ) { + self.results = results + self.metadata = metadata + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.results = try container.decode([ToolDraft].self, forKey: .results) + self.metadata = try container.decode(ToolDraftPaginatedMetadata.self, forKey: .metadata) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.results, forKey: .results) + try container.encode(self.metadata, forKey: .metadata) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case results + case metadata + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftType.swift b/Sources/Schemas/ToolDraftType.swift new file mode 100644 index 00000000..66e8e9a2 --- /dev/null +++ b/Sources/Schemas/ToolDraftType.swift @@ -0,0 +1,33 @@ +import Foundation + +/// This is the type of the tool. +public enum ToolDraftType: String, Codable, Hashable, CaseIterable, Sendable { + case dtmf + case endCall + case transferCall + case transferCancel + case transferSuccessful + case handoff + case output + case voicemail + case query + case sms + case sipRequest + case function + case mcp + case apiRequest + case code + case bash + case computer + case textEditor + case googleCalendarEventCreate = "google.calendar.event.create" + case googleCalendarAvailabilityCheck = "google.calendar.availability.check" + case googleSheetsRowAppend = "google.sheets.row.append" + case slackMessageSend = "slack.message.send" + case gohighlevelCalendarEventCreate = "gohighlevel.calendar.event.create" + case gohighlevelCalendarAvailabilityCheck = "gohighlevel.calendar.availability.check" + case gohighlevelContactCreate = "gohighlevel.contact.create" + case gohighlevelContactGet = "gohighlevel.contact.get" + case make + case ghl +} \ No newline at end of file diff --git a/Sources/Schemas/ToolDraftVerb.swift b/Sources/Schemas/ToolDraftVerb.swift new file mode 100644 index 00000000..ca6ad2a9 --- /dev/null +++ b/Sources/Schemas/ToolDraftVerb.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the SIP method to send (sip-request tool). +public enum ToolDraftVerb: String, Codable, Hashable, CaseIterable, Sendable { + case info = "INFO" + case message = "MESSAGE" + case notify = "NOTIFY" +} \ No newline at end of file diff --git a/Sources/Schemas/ToolMessage.swift b/Sources/Schemas/ToolMessage.swift index ddfbc808..7c1bb3c0 100644 --- a/Sources/Schemas/ToolMessage.swift +++ b/Sources/Schemas/ToolMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// A tool-result message associated with a specific tool call. public struct ToolMessage: Codable, Hashable, Sendable { /// This is the role of the message author public let role: ToolMessageRole diff --git a/Sources/Schemas/ToolMessageComplete.swift b/Sources/Schemas/ToolMessageComplete.swift index 2a15b58d..d6ba022a 100644 --- a/Sources/Schemas/ToolMessageComplete.swift +++ b/Sources/Schemas/ToolMessageComplete.swift @@ -1,5 +1,6 @@ import Foundation +/// Message spoken when a tool call completes, with optional language variants, argument conditions, role, and end-call behavior. public struct ToolMessageComplete: Codable, Hashable, Sendable { /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. /// diff --git a/Sources/Schemas/ToolMessageDelayed.swift b/Sources/Schemas/ToolMessageDelayed.swift index fd3d5d76..3244b4f2 100644 --- a/Sources/Schemas/ToolMessageDelayed.swift +++ b/Sources/Schemas/ToolMessageDelayed.swift @@ -1,5 +1,6 @@ import Foundation +/// Message spoken when a tool call exceeds a configured response delay, with optional language variants and argument conditions. public struct ToolMessageDelayed: Codable, Hashable, Sendable { /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. /// @@ -9,7 +10,7 @@ public struct ToolMessageDelayed: Codable, Hashable, Sendable { /// /// This will override the `content` property. public let contents: [TextContent]? - /// The number of milliseconds to wait for the server response before saying this message. + /// The number of milliseconds to wait for the server response before saying this delayed message. public let timingMilliseconds: Double? /// This is the content that the assistant says when this message is triggered. public let content: String? diff --git a/Sources/Schemas/ToolMessageFailed.swift b/Sources/Schemas/ToolMessageFailed.swift index 20677b39..58313d61 100644 --- a/Sources/Schemas/ToolMessageFailed.swift +++ b/Sources/Schemas/ToolMessageFailed.swift @@ -1,5 +1,6 @@ import Foundation +/// Message spoken when a tool call fails, with optional language variants, argument conditions, and end-call behavior. public struct ToolMessageFailed: Codable, Hashable, Sendable { /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. /// @@ -9,8 +10,24 @@ public struct ToolMessageFailed: Codable, Hashable, Sendable { /// /// This will override the `content` property. public let contents: [TextContent]? + /// This is optional and defaults to "assistant". + /// + /// When role=assistant, `content` is said out loud when the tool call fails. + /// + /// When role=system, `content` is passed to the model as a system message + /// along with the failure result, and the model's generated response is + /// spoken. Example: + /// assistant: tool called + /// tool: error from your server + /// <--- system prompt as hint + /// ---> model generates response which is spoken + /// This is useful when you want the model to generate an error-aware + /// response instead of speaking a fixed failure message. + public let role: ToolMessageFailedRole? /// This is an optional boolean that if true, the call will end after the message is spoken. Default is false. /// + /// This is ignored if `role` is set to `system`. + /// /// @default false public let endCallAfterSpokenEnabled: Bool? /// This is the content that the assistant says when this message is triggered. @@ -22,12 +39,14 @@ public struct ToolMessageFailed: Codable, Hashable, Sendable { public init( contents: [TextContent]? = nil, + role: ToolMessageFailedRole? = nil, endCallAfterSpokenEnabled: Bool? = nil, content: String? = nil, conditions: [Condition]? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.contents = contents + self.role = role self.endCallAfterSpokenEnabled = endCallAfterSpokenEnabled self.content = content self.conditions = conditions @@ -37,6 +56,7 @@ public struct ToolMessageFailed: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.contents = try container.decodeIfPresent([TextContent].self, forKey: .contents) + self.role = try container.decodeIfPresent(ToolMessageFailedRole.self, forKey: .role) self.endCallAfterSpokenEnabled = try container.decodeIfPresent(Bool.self, forKey: .endCallAfterSpokenEnabled) self.content = try container.decodeIfPresent(String.self, forKey: .content) self.conditions = try container.decodeIfPresent([Condition].self, forKey: .conditions) @@ -47,6 +67,7 @@ public struct ToolMessageFailed: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.contents, forKey: .contents) + try container.encodeIfPresent(self.role, forKey: .role) try container.encodeIfPresent(self.endCallAfterSpokenEnabled, forKey: .endCallAfterSpokenEnabled) try container.encodeIfPresent(self.content, forKey: .content) try container.encodeIfPresent(self.conditions, forKey: .conditions) @@ -55,6 +76,7 @@ public struct ToolMessageFailed: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case contents + case role case endCallAfterSpokenEnabled case content case conditions diff --git a/Sources/Schemas/ToolMessageFailedRole.swift b/Sources/Schemas/ToolMessageFailedRole.swift new file mode 100644 index 00000000..a4209b7f --- /dev/null +++ b/Sources/Schemas/ToolMessageFailedRole.swift @@ -0,0 +1,19 @@ +import Foundation + +/// This is optional and defaults to "assistant". +/// +/// When role=assistant, `content` is said out loud when the tool call fails. +/// +/// When role=system, `content` is passed to the model as a system message +/// along with the failure result, and the model's generated response is +/// spoken. Example: +/// assistant: tool called +/// tool: error from your server +/// <--- system prompt as hint +/// ---> model generates response which is spoken +/// This is useful when you want the model to generate an error-aware +/// response instead of speaking a fixed failure message. +public enum ToolMessageFailedRole: String, Codable, Hashable, CaseIterable, Sendable { + case assistant + case system +} \ No newline at end of file diff --git a/Sources/Schemas/ToolMessageStart.swift b/Sources/Schemas/ToolMessageStart.swift index c8656375..fa124f2b 100644 --- a/Sources/Schemas/ToolMessageStart.swift +++ b/Sources/Schemas/ToolMessageStart.swift @@ -1,5 +1,6 @@ import Foundation +/// Message spoken when a tool call starts, with optional language variants, argument conditions, and blocking behavior. public struct ToolMessageStart: Codable, Hashable, Sendable { /// This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. /// diff --git a/Sources/Schemas/ToolNode.swift b/Sources/Schemas/ToolNode.swift index b5a85f13..de0114f3 100644 --- a/Sources/Schemas/ToolNode.swift +++ b/Sources/Schemas/ToolNode.swift @@ -1,10 +1,12 @@ import Foundation +/// A workflow node that invokes an inline tool or an existing saved tool. public struct ToolNode: Codable, Hashable, Sendable { /// This is the tool to call. To use an existing tool, send `toolId` instead. public let tool: ToolNodeTool? /// This is the tool to call. To use a transient tool, send `tool` instead. public let toolId: String? + /// Unique name used to identify this workflow node. public let name: String /// This is whether or not the node is the start of the workflow. public let isStart: Bool? diff --git a/Sources/Schemas/ToolNodeTool.swift b/Sources/Schemas/ToolNodeTool.swift index 6a3dc833..4f6008ec 100644 --- a/Sources/Schemas/ToolNodeTool.swift +++ b/Sources/Schemas/ToolNodeTool.swift @@ -1,7 +1,7 @@ import Foundation /// This is the tool to call. To use an existing tool, send `toolId` instead. -public enum ToolNodeTool: Codable, Hashable, Sendable { +public indirect enum ToolNodeTool: Codable, Hashable, Sendable { case apiRequest(CreateApiRequestToolDto) case bash(CreateBashToolDto) case code(CreateCodeToolDto) diff --git a/Sources/Schemas/ToolParameter.swift b/Sources/Schemas/ToolParameter.swift index 71ae9abf..186c7077 100644 --- a/Sources/Schemas/ToolParameter.swift +++ b/Sources/Schemas/ToolParameter.swift @@ -1,5 +1,6 @@ import Foundation +/// Static key-value parameter added to a tool request, with Liquid template support for string values. public struct ToolParameter: Codable, Hashable, Sendable { /// This is the key of the parameter. public let key: String diff --git a/Sources/Schemas/ToolPinnedConflictResponseDto.swift b/Sources/Schemas/ToolPinnedConflictResponseDto.swift new file mode 100644 index 00000000..5cae9df6 --- /dev/null +++ b/Sources/Schemas/ToolPinnedConflictResponseDto.swift @@ -0,0 +1,39 @@ +import Foundation + +public struct ToolPinnedConflictResponseDto: Codable, Hashable, Sendable { + public let error: ToolPinnedConflictResponseDtoError + /// Human-readable reason the parent-tool delete was rejected. + public let message: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + error: ToolPinnedConflictResponseDtoError, + message: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.error = error + self.message = message + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.error = try container.decode(ToolPinnedConflictResponseDtoError.self, forKey: .error) + self.message = try container.decode(String.self, forKey: .message) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.error, forKey: .error) + try container.encode(self.message, forKey: .message) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case error + case message + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolPinnedConflictResponseDtoError.swift b/Sources/Schemas/ToolPinnedConflictResponseDtoError.swift new file mode 100644 index 00000000..0183e9fa --- /dev/null +++ b/Sources/Schemas/ToolPinnedConflictResponseDtoError.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum ToolPinnedConflictResponseDtoError: String, Codable, Hashable, CaseIterable, Sendable { + case toolPinned = "tool_pinned" +} \ No newline at end of file diff --git a/Sources/Schemas/ToolRef.swift b/Sources/Schemas/ToolRef.swift new file mode 100644 index 00000000..915a63a5 --- /dev/null +++ b/Sources/Schemas/ToolRef.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct ToolRef: Codable, Hashable, Sendable { + /// This is the unique identifier of the tool whose version is being pinned. + public let toolId: String + /// Public version label of the tool, e.g. "v3" + public let version: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + toolId: String, + version: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.toolId = toolId + self.version = version + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.toolId = try container.decode(String.self, forKey: .toolId) + self.version = try container.decode(String.self, forKey: .version) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.toolId, forKey: .toolId) + try container.encode(self.version, forKey: .version) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case toolId + case version + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolRejectionPlan.swift b/Sources/Schemas/ToolRejectionPlan.swift index 57800a12..3562f02f 100644 --- a/Sources/Schemas/ToolRejectionPlan.swift +++ b/Sources/Schemas/ToolRejectionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Conditions evaluated to determine whether a requested tool call should be rejected. public struct ToolRejectionPlan: Codable, Hashable, Sendable { /// This is the list of conditions that must be evaluated. /// diff --git a/Sources/Schemas/ToolVersion.swift b/Sources/Schemas/ToolVersion.swift new file mode 100644 index 00000000..ee26f133 --- /dev/null +++ b/Sources/Schemas/ToolVersion.swift @@ -0,0 +1,308 @@ +import Foundation + +public struct ToolVersion: Codable, Hashable, Sendable { + /// Optional human-readable label for this version. Pass `null` to clear. + public let versionName: Nullable? + /// Optional description for this version. Pass `null` to clear. + public let versionDescription: Nullable? + public let type: [String: JSONValue]? + public let function: Nullable<[String: JSONValue]>? + public let messages: Nullable<[[String: JSONValue]]>? + public let metadata: Nullable<[String: JSONValue]>? + public let templateId: Nullable? + public let server: Nullable? + public let async: Nullable? + public let destinations: Nullable<[[String: JSONValue]]>? + public let name: Nullable? + public let subType: Nullable? + public let displayWidthPx: Nullable? + public let displayHeightPx: Nullable? + public let displayNumber: Nullable? + public let knowledgeBases: Nullable<[[String: JSONValue]]>? + public let url: Nullable? + public let method: Nullable? + public let headers: Nullable<[String: JSONValue]>? + public let body: [String: JSONValue]? + public let backoffPlan: Nullable<[String: JSONValue]>? + public let timeoutSeconds: Nullable? + public let description: Nullable? + public let variableExtractionPlan: Nullable<[String: JSONValue]>? + public let rejectionPlan: Nullable<[String: JSONValue]>? + public let credentialId: Nullable? + public let extendedDelayWhenPrecededByTextEnabled: Nullable? + public let beepDetectionEnabled: Nullable? + public let code: Nullable? + public let environmentVariables: Nullable<[[String: JSONValue]]>? + public let parameters: Nullable<[[String: JSONValue]]>? + public let encryptedPaths: Nullable<[String]>? + public let sipInfoDtmfEnabled: Nullable? + public let verb: Nullable? + public let defaultResult: Nullable? + public let toolMessages: Nullable<[[String: JSONValue]]>? + /// This is the unique identifier for the version row. + public let id: String + /// This is the unique identifier for the org that owns this version. + public let orgId: String + /// This is the unique identifier for the tool this version was snapshotted from. + public let toolId: String + /// This is the public monotonic version label, e.g. "v1". + /// System-owned and incremented per tool; never user-supplied. + public let version: String + /// This is the SHA-256 hex of the snapshotted content used for no-op detection. + public let configHash: String + /// This is the prior version label (vN-1). Null on v1 or for branch roots. + public let parentVersion: Nullable? + /// This is the actor that wrote this version. Email when created via JWT, null when created via API. + public let createdBy: Nullable? + /// This is the soft-delete timestamp. Null when active. + public let deletedAt: Nullable? + /// This is the ISO 8601 date-time string of when the version was created. + public let createdAt: Date + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + versionName: Nullable? = nil, + versionDescription: Nullable? = nil, + type: [String: JSONValue]? = nil, + function: Nullable<[String: JSONValue]>? = nil, + messages: Nullable<[[String: JSONValue]]>? = nil, + metadata: Nullable<[String: JSONValue]>? = nil, + templateId: Nullable? = nil, + server: Nullable? = nil, + async: Nullable? = nil, + destinations: Nullable<[[String: JSONValue]]>? = nil, + name: Nullable? = nil, + subType: Nullable? = nil, + displayWidthPx: Nullable? = nil, + displayHeightPx: Nullable? = nil, + displayNumber: Nullable? = nil, + knowledgeBases: Nullable<[[String: JSONValue]]>? = nil, + url: Nullable? = nil, + method: Nullable? = nil, + headers: Nullable<[String: JSONValue]>? = nil, + body: [String: JSONValue]? = nil, + backoffPlan: Nullable<[String: JSONValue]>? = nil, + timeoutSeconds: Nullable? = nil, + description: Nullable? = nil, + variableExtractionPlan: Nullable<[String: JSONValue]>? = nil, + rejectionPlan: Nullable<[String: JSONValue]>? = nil, + credentialId: Nullable? = nil, + extendedDelayWhenPrecededByTextEnabled: Nullable? = nil, + beepDetectionEnabled: Nullable? = nil, + code: Nullable? = nil, + environmentVariables: Nullable<[[String: JSONValue]]>? = nil, + parameters: Nullable<[[String: JSONValue]]>? = nil, + encryptedPaths: Nullable<[String]>? = nil, + sipInfoDtmfEnabled: Nullable? = nil, + verb: Nullable? = nil, + defaultResult: Nullable? = nil, + toolMessages: Nullable<[[String: JSONValue]]>? = nil, + id: String, + orgId: String, + toolId: String, + version: String, + configHash: String, + parentVersion: Nullable? = nil, + createdBy: Nullable? = nil, + deletedAt: Nullable? = nil, + createdAt: Date, + additionalProperties: [String: JSONValue] = .init() + ) { + self.versionName = versionName + self.versionDescription = versionDescription + self.type = type + self.function = function + self.messages = messages + self.metadata = metadata + self.templateId = templateId + self.server = server + self.async = async + self.destinations = destinations + self.name = name + self.subType = subType + self.displayWidthPx = displayWidthPx + self.displayHeightPx = displayHeightPx + self.displayNumber = displayNumber + self.knowledgeBases = knowledgeBases + self.url = url + self.method = method + self.headers = headers + self.body = body + self.backoffPlan = backoffPlan + self.timeoutSeconds = timeoutSeconds + self.description = description + self.variableExtractionPlan = variableExtractionPlan + self.rejectionPlan = rejectionPlan + self.credentialId = credentialId + self.extendedDelayWhenPrecededByTextEnabled = extendedDelayWhenPrecededByTextEnabled + self.beepDetectionEnabled = beepDetectionEnabled + self.code = code + self.environmentVariables = environmentVariables + self.parameters = parameters + self.encryptedPaths = encryptedPaths + self.sipInfoDtmfEnabled = sipInfoDtmfEnabled + self.verb = verb + self.defaultResult = defaultResult + self.toolMessages = toolMessages + self.id = id + self.orgId = orgId + self.toolId = toolId + self.version = version + self.configHash = configHash + self.parentVersion = parentVersion + self.createdBy = createdBy + self.deletedAt = deletedAt + self.createdAt = createdAt + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.versionName = try container.decodeNullableIfPresent(String.self, forKey: .versionName) + self.versionDescription = try container.decodeNullableIfPresent(String.self, forKey: .versionDescription) + self.type = try container.decodeIfPresent([String: JSONValue].self, forKey: .type) + self.function = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .function) + self.messages = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .messages) + self.metadata = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .metadata) + self.templateId = try container.decodeNullableIfPresent(String.self, forKey: .templateId) + self.server = try container.decodeNullableIfPresent(Server.self, forKey: .server) + self.async = try container.decodeNullableIfPresent(Bool.self, forKey: .async) + self.destinations = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .destinations) + self.name = try container.decodeNullableIfPresent(String.self, forKey: .name) + self.subType = try container.decodeNullableIfPresent(String.self, forKey: .subType) + self.displayWidthPx = try container.decodeNullableIfPresent(Double.self, forKey: .displayWidthPx) + self.displayHeightPx = try container.decodeNullableIfPresent(Double.self, forKey: .displayHeightPx) + self.displayNumber = try container.decodeNullableIfPresent(Double.self, forKey: .displayNumber) + self.knowledgeBases = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .knowledgeBases) + self.url = try container.decodeNullableIfPresent(String.self, forKey: .url) + self.method = try container.decodeNullableIfPresent(String.self, forKey: .method) + self.headers = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .headers) + self.body = try container.decodeIfPresent([String: JSONValue].self, forKey: .body) + self.backoffPlan = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .backoffPlan) + self.timeoutSeconds = try container.decodeNullableIfPresent(Double.self, forKey: .timeoutSeconds) + self.description = try container.decodeNullableIfPresent(String.self, forKey: .description) + self.variableExtractionPlan = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .variableExtractionPlan) + self.rejectionPlan = try container.decodeNullableIfPresent([String: JSONValue].self, forKey: .rejectionPlan) + self.credentialId = try container.decodeNullableIfPresent(String.self, forKey: .credentialId) + self.extendedDelayWhenPrecededByTextEnabled = try container.decodeNullableIfPresent(Bool.self, forKey: .extendedDelayWhenPrecededByTextEnabled) + self.beepDetectionEnabled = try container.decodeNullableIfPresent(Bool.self, forKey: .beepDetectionEnabled) + self.code = try container.decodeNullableIfPresent(String.self, forKey: .code) + self.environmentVariables = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .environmentVariables) + self.parameters = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .parameters) + self.encryptedPaths = try container.decodeNullableIfPresent([String].self, forKey: .encryptedPaths) + self.sipInfoDtmfEnabled = try container.decodeNullableIfPresent(Bool.self, forKey: .sipInfoDtmfEnabled) + self.verb = try container.decodeNullableIfPresent(String.self, forKey: .verb) + self.defaultResult = try container.decodeNullableIfPresent(String.self, forKey: .defaultResult) + self.toolMessages = try container.decodeNullableIfPresent([[String: JSONValue]].self, forKey: .toolMessages) + self.id = try container.decode(String.self, forKey: .id) + self.orgId = try container.decode(String.self, forKey: .orgId) + self.toolId = try container.decode(String.self, forKey: .toolId) + self.version = try container.decode(String.self, forKey: .version) + self.configHash = try container.decode(String.self, forKey: .configHash) + self.parentVersion = try container.decodeNullableIfPresent(String.self, forKey: .parentVersion) + self.createdBy = try container.decodeNullableIfPresent(String.self, forKey: .createdBy) + self.deletedAt = try container.decodeNullableIfPresent(Date.self, forKey: .deletedAt) + self.createdAt = try container.decode(Date.self, forKey: .createdAt) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.versionName, forKey: .versionName) + try container.encodeNullableIfPresent(self.versionDescription, forKey: .versionDescription) + try container.encodeIfPresent(self.type, forKey: .type) + try container.encodeNullableIfPresent(self.function, forKey: .function) + try container.encodeNullableIfPresent(self.messages, forKey: .messages) + try container.encodeNullableIfPresent(self.metadata, forKey: .metadata) + try container.encodeNullableIfPresent(self.templateId, forKey: .templateId) + try container.encodeNullableIfPresent(self.server, forKey: .server) + try container.encodeNullableIfPresent(self.async, forKey: .async) + try container.encodeNullableIfPresent(self.destinations, forKey: .destinations) + try container.encodeNullableIfPresent(self.name, forKey: .name) + try container.encodeNullableIfPresent(self.subType, forKey: .subType) + try container.encodeNullableIfPresent(self.displayWidthPx, forKey: .displayWidthPx) + try container.encodeNullableIfPresent(self.displayHeightPx, forKey: .displayHeightPx) + try container.encodeNullableIfPresent(self.displayNumber, forKey: .displayNumber) + try container.encodeNullableIfPresent(self.knowledgeBases, forKey: .knowledgeBases) + try container.encodeNullableIfPresent(self.url, forKey: .url) + try container.encodeNullableIfPresent(self.method, forKey: .method) + try container.encodeNullableIfPresent(self.headers, forKey: .headers) + try container.encodeIfPresent(self.body, forKey: .body) + try container.encodeNullableIfPresent(self.backoffPlan, forKey: .backoffPlan) + try container.encodeNullableIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) + try container.encodeNullableIfPresent(self.description, forKey: .description) + try container.encodeNullableIfPresent(self.variableExtractionPlan, forKey: .variableExtractionPlan) + try container.encodeNullableIfPresent(self.rejectionPlan, forKey: .rejectionPlan) + try container.encodeNullableIfPresent(self.credentialId, forKey: .credentialId) + try container.encodeNullableIfPresent(self.extendedDelayWhenPrecededByTextEnabled, forKey: .extendedDelayWhenPrecededByTextEnabled) + try container.encodeNullableIfPresent(self.beepDetectionEnabled, forKey: .beepDetectionEnabled) + try container.encodeNullableIfPresent(self.code, forKey: .code) + try container.encodeNullableIfPresent(self.environmentVariables, forKey: .environmentVariables) + try container.encodeNullableIfPresent(self.parameters, forKey: .parameters) + try container.encodeNullableIfPresent(self.encryptedPaths, forKey: .encryptedPaths) + try container.encodeNullableIfPresent(self.sipInfoDtmfEnabled, forKey: .sipInfoDtmfEnabled) + try container.encodeNullableIfPresent(self.verb, forKey: .verb) + try container.encodeNullableIfPresent(self.defaultResult, forKey: .defaultResult) + try container.encodeNullableIfPresent(self.toolMessages, forKey: .toolMessages) + try container.encode(self.id, forKey: .id) + try container.encode(self.orgId, forKey: .orgId) + try container.encode(self.toolId, forKey: .toolId) + try container.encode(self.version, forKey: .version) + try container.encode(self.configHash, forKey: .configHash) + try container.encodeNullableIfPresent(self.parentVersion, forKey: .parentVersion) + try container.encodeNullableIfPresent(self.createdBy, forKey: .createdBy) + try container.encodeNullableIfPresent(self.deletedAt, forKey: .deletedAt) + try container.encode(self.createdAt, forKey: .createdAt) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case versionName + case versionDescription + case type + case function + case messages + case metadata + case templateId + case server + case async + case destinations + case name + case subType + case displayWidthPx + case displayHeightPx + case displayNumber + case knowledgeBases + case url + case method + case headers + case body + case backoffPlan + case timeoutSeconds + case description + case variableExtractionPlan + case rejectionPlan + case credentialId + case extendedDelayWhenPrecededByTextEnabled + case beepDetectionEnabled + case code + case environmentVariables + case parameters + case encryptedPaths + case sipInfoDtmfEnabled + case verb + case defaultResult + case toolMessages + case id + case orgId + case toolId + case version + case configHash + case parentVersion + case createdBy + case deletedAt + case createdAt + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolVersionPaginatedMetadata.swift b/Sources/Schemas/ToolVersionPaginatedMetadata.swift new file mode 100644 index 00000000..efa58858 --- /dev/null +++ b/Sources/Schemas/ToolVersionPaginatedMetadata.swift @@ -0,0 +1,44 @@ +import Foundation + +public struct ToolVersionPaginatedMetadata: Codable, Hashable, Sendable { + public let nextCursor: Nullable? + public let hasNextPage: Bool + public let limit: Double + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + nextCursor: Nullable? = nil, + hasNextPage: Bool, + limit: Double, + additionalProperties: [String: JSONValue] = .init() + ) { + self.nextCursor = nextCursor + self.hasNextPage = hasNextPage + self.limit = limit + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.nextCursor = try container.decodeNullableIfPresent(String.self, forKey: .nextCursor) + self.hasNextPage = try container.decode(Bool.self, forKey: .hasNextPage) + self.limit = try container.decode(Double.self, forKey: .limit) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.nextCursor, forKey: .nextCursor) + try container.encode(self.hasNextPage, forKey: .hasNextPage) + try container.encode(self.limit, forKey: .limit) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case nextCursor + case hasNextPage + case limit + } +} \ No newline at end of file diff --git a/Sources/Schemas/ToolVersionPaginatedResponse.swift b/Sources/Schemas/ToolVersionPaginatedResponse.swift new file mode 100644 index 00000000..f2f276c2 --- /dev/null +++ b/Sources/Schemas/ToolVersionPaginatedResponse.swift @@ -0,0 +1,38 @@ +import Foundation + +public struct ToolVersionPaginatedResponse: Codable, Hashable, Sendable { + public let results: [ToolVersion] + public let metadata: ToolVersionPaginatedMetadata + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + results: [ToolVersion], + metadata: ToolVersionPaginatedMetadata, + additionalProperties: [String: JSONValue] = .init() + ) { + self.results = results + self.metadata = metadata + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.results = try container.decode([ToolVersion].self, forKey: .results) + self.metadata = try container.decode(ToolVersionPaginatedMetadata.self, forKey: .metadata) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.results, forKey: .results) + try container.encode(self.metadata, forKey: .metadata) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case results + case metadata + } +} \ No newline at end of file diff --git a/Sources/Schemas/TranscriberCost.swift b/Sources/Schemas/TranscriberCost.swift index fff17b1b..7730cce3 100644 --- a/Sources/Schemas/TranscriberCost.swift +++ b/Sources/Schemas/TranscriberCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Speech-to-text cost for a call, including transcriber, billable minutes, and amount. public struct TranscriberCost: Codable, Hashable, Sendable { /// This is the transcriber that was used during the call. /// diff --git a/Sources/Schemas/TranscriptPlan.swift b/Sources/Schemas/TranscriptPlan.swift index 7aa1d1a8..f3d97dc8 100644 --- a/Sources/Schemas/TranscriptPlan.swift +++ b/Sources/Schemas/TranscriptPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls whether the call transcript is stored and the speaker names used in the transcript. public struct TranscriptPlan: Codable, Hashable, Sendable { /// This determines whether the transcript is stored in `call.artifact.transcript`. Defaults to true. /// diff --git a/Sources/Schemas/TranscriptionEndpointingPlan.swift b/Sources/Schemas/TranscriptionEndpointingPlan.swift index 67aaf1de..6c4e2c15 100644 --- a/Sources/Schemas/TranscriptionEndpointingPlan.swift +++ b/Sources/Schemas/TranscriptionEndpointingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls endpointing delays based on whether customer speech ends with punctuation, without punctuation, or with a number. public struct TranscriptionEndpointingPlan: Codable, Hashable, Sendable { /// The minimum number of seconds to wait after transcription ending with punctuation before sending a request to the model. Defaults to 0.1. /// diff --git a/Sources/Schemas/TransferArtifact.swift b/Sources/Schemas/TransferArtifact.swift new file mode 100644 index 00000000..77dd7cfd --- /dev/null +++ b/Sources/Schemas/TransferArtifact.swift @@ -0,0 +1,62 @@ +import Foundation + +public struct TransferArtifact: Codable, Hashable, Sendable { + /// The transfer destination (phone number or SIP URI). + public let destination: TransferArtifactDestination + /// The transfer mode (e.g. warm-transfer-experimental, blind-transfer). + public let mode: TransferArtifactMode? + /// Flat-text transcript / announcement preview of the transfer. + public let transcript: String? + /// The terminal status of the transfer, rendered as the status line. + public let status: TransferArtifactStatus? + /// The agent↔operator conversation captured during a + /// warm-transfer-experimental, rendered as bubbles. + public let messages: [TransferArtifactMessagesItem]? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + destination: TransferArtifactDestination, + mode: TransferArtifactMode? = nil, + transcript: String? = nil, + status: TransferArtifactStatus? = nil, + messages: [TransferArtifactMessagesItem]? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.destination = destination + self.mode = mode + self.transcript = transcript + self.status = status + self.messages = messages + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.destination = try container.decode(TransferArtifactDestination.self, forKey: .destination) + self.mode = try container.decodeIfPresent(TransferArtifactMode.self, forKey: .mode) + self.transcript = try container.decodeIfPresent(String.self, forKey: .transcript) + self.status = try container.decodeIfPresent(TransferArtifactStatus.self, forKey: .status) + self.messages = try container.decodeIfPresent([TransferArtifactMessagesItem].self, forKey: .messages) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.destination, forKey: .destination) + try container.encodeIfPresent(self.mode, forKey: .mode) + try container.encodeIfPresent(self.transcript, forKey: .transcript) + try container.encodeIfPresent(self.status, forKey: .status) + try container.encodeIfPresent(self.messages, forKey: .messages) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case destination + case mode + case transcript + case status + case messages + } +} \ No newline at end of file diff --git a/Sources/Schemas/TransferArtifactDestination.swift b/Sources/Schemas/TransferArtifactDestination.swift new file mode 100644 index 00000000..2a576d15 --- /dev/null +++ b/Sources/Schemas/TransferArtifactDestination.swift @@ -0,0 +1,41 @@ +import Foundation + +/// The transfer destination (phone number or SIP URI). +public enum TransferArtifactDestination: Codable, Hashable, Sendable { + case number(TransferDestinationNumber) + case sip(TransferDestinationSip) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "number": + self = .number(try TransferDestinationNumber(from: decoder)) + case "sip": + self = .sip(try TransferDestinationSip(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .number(let data): + try container.encode("number", forKey: .type) + try data.encode(to: encoder) + case .sip(let data): + try container.encode("sip", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/TransferArtifactMessagesItem.swift b/Sources/Schemas/TransferArtifactMessagesItem.swift new file mode 100644 index 00000000..c3e40f30 --- /dev/null +++ b/Sources/Schemas/TransferArtifactMessagesItem.swift @@ -0,0 +1,45 @@ +import Foundation + +public enum TransferArtifactMessagesItem: Codable, Hashable, Sendable { + case botMessage(BotMessage) + case systemMessage(SystemMessage) + case toolCallMessage(ToolCallMessage) + case toolCallResultMessage(ToolCallResultMessage) + case userMessage(UserMessage) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(BotMessage.self) { + self = .botMessage(value) + } else if let value = try? container.decode(SystemMessage.self) { + self = .systemMessage(value) + } else if let value = try? container.decode(ToolCallMessage.self) { + self = .toolCallMessage(value) + } else if let value = try? container.decode(ToolCallResultMessage.self) { + self = .toolCallResultMessage(value) + } else if let value = try? container.decode(UserMessage.self) { + self = .userMessage(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .botMessage(let value): + try container.encode(value) + case .systemMessage(let value): + try container.encode(value) + case .toolCallMessage(let value): + try container.encode(value) + case .toolCallResultMessage(let value): + try container.encode(value) + case .userMessage(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/TransferArtifactMode.swift b/Sources/Schemas/TransferArtifactMode.swift new file mode 100644 index 00000000..060c2766 --- /dev/null +++ b/Sources/Schemas/TransferArtifactMode.swift @@ -0,0 +1,13 @@ +import Foundation + +/// The transfer mode (e.g. warm-transfer-experimental, blind-transfer). +public enum TransferArtifactMode: String, Codable, Hashable, CaseIterable, Sendable { + case blindTransfer = "blind-transfer" + case blindTransferAddSummaryToSipHeader = "blind-transfer-add-summary-to-sip-header" + case warmTransferSayMessage = "warm-transfer-say-message" + case warmTransferSaySummary = "warm-transfer-say-summary" + case warmTransferTwiml = "warm-transfer-twiml" + case warmTransferWaitForOperatorToSpeakFirstAndThenSayMessage = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message" + case warmTransferWaitForOperatorToSpeakFirstAndThenSaySummary = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary" + case warmTransferExperimental = "warm-transfer-experimental" +} \ No newline at end of file diff --git a/Sources/Schemas/TransferArtifactStatus.swift b/Sources/Schemas/TransferArtifactStatus.swift new file mode 100644 index 00000000..29ca1153 --- /dev/null +++ b/Sources/Schemas/TransferArtifactStatus.swift @@ -0,0 +1,12 @@ +import Foundation + +/// The terminal status of the transfer, rendered as the status line. +public enum TransferArtifactStatus: String, Codable, Hashable, CaseIterable, Sendable { + case connected + case noAnswer = "no-answer" + case busy + case voicemail + case failed + case completed + case cancelled +} \ No newline at end of file diff --git a/Sources/Schemas/TransferAssistantTranscriber.swift b/Sources/Schemas/TransferAssistantTranscriber.swift index e15a8060..51019ee6 100644 --- a/Sources/Schemas/TransferAssistantTranscriber.swift +++ b/Sources/Schemas/TransferAssistantTranscriber.swift @@ -14,6 +14,8 @@ public enum TransferAssistantTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,10 @@ public enum TransferAssistantTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -92,6 +98,12 @@ public enum TransferAssistantTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/TransferAssistantVoice.swift b/Sources/Schemas/TransferAssistantVoice.swift index 11384165..adfa96bd 100644 --- a/Sources/Schemas/TransferAssistantVoice.swift +++ b/Sources/Schemas/TransferAssistantVoice.swift @@ -10,6 +10,7 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -20,6 +21,7 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -41,6 +43,8 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -61,6 +65,8 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -98,6 +104,9 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -128,6 +137,9 @@ public enum TransferAssistantVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/TransferCallTool.swift b/Sources/Schemas/TransferCallTool.swift index a61242a9..d2514b1e 100644 --- a/Sources/Schemas/TransferCallTool.swift +++ b/Sources/Schemas/TransferCallTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable tool that transfers the active call to one of its configured destinations. public struct TransferCallTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [TransferCallToolMessagesItem]? /// These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. public let destinations: [TransferCallToolDestinationsItem]? @@ -98,6 +98,7 @@ public struct TransferCallTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [TransferCallToolMessagesItem]? = nil, destinations: [TransferCallToolDestinationsItem]? = nil, id: String, @@ -107,6 +108,7 @@ public struct TransferCallTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.destinations = destinations self.id = id @@ -119,6 +121,7 @@ public struct TransferCallTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([TransferCallToolMessagesItem].self, forKey: .messages) self.destinations = try container.decodeIfPresent([TransferCallToolDestinationsItem].self, forKey: .destinations) self.id = try container.decode(String.self, forKey: .id) @@ -132,6 +135,7 @@ public struct TransferCallTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.destinations, forKey: .destinations) try container.encode(self.id, forKey: .id) @@ -143,6 +147,7 @@ public struct TransferCallTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case destinations case id diff --git a/Sources/Schemas/TransferCancelToolUserEditable.swift b/Sources/Schemas/TransferCancelToolUserEditable.swift index e1d180f0..86a3cd83 100644 --- a/Sources/Schemas/TransferCancelToolUserEditable.swift +++ b/Sources/Schemas/TransferCancelToolUserEditable.swift @@ -1,9 +1,7 @@ import Foundation public struct TransferCancelToolUserEditable: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [TransferCancelToolUserEditableMessagesItem]? /// The type of tool. "transferCancel" for Transfer Cancel tool. This tool can only be used during warm-transfer-experimental by the transfer assistant to cancel an ongoing transfer and return the call back to the original assistant when the transfer cannot be completed. public let type: TransferCancelToolUserEditableType diff --git a/Sources/Schemas/TransferDestinationAssistant.swift b/Sources/Schemas/TransferDestinationAssistant.swift index 0fb162f5..dda69860 100644 --- a/Sources/Schemas/TransferDestinationAssistant.swift +++ b/Sources/Schemas/TransferDestinationAssistant.swift @@ -1,5 +1,6 @@ import Foundation +/// Transfers a call to another assistant by name, with an optional message and assistant-transfer mode. public struct TransferDestinationAssistant: Codable, Hashable, Sendable { /// This is spoken to the customer before connecting them to the destination. /// @@ -9,6 +10,7 @@ public struct TransferDestinationAssistant: Codable, Hashable, Sendable { /// /// This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field. public let message: TransferDestinationAssistantMessage? + /// Selects another assistant as the transfer destination. public let type: TransferDestinationAssistantType /// This is the mode to use for the transfer. Defaults to `rolling-history`. /// diff --git a/Sources/Schemas/TransferDestinationAssistantType.swift b/Sources/Schemas/TransferDestinationAssistantType.swift index 1c85e0c3..6149b826 100644 --- a/Sources/Schemas/TransferDestinationAssistantType.swift +++ b/Sources/Schemas/TransferDestinationAssistantType.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects another assistant as the transfer destination. public enum TransferDestinationAssistantType: String, Codable, Hashable, CaseIterable, Sendable { case assistant } \ No newline at end of file diff --git a/Sources/Schemas/TransferDestinationNumber.swift b/Sources/Schemas/TransferDestinationNumber.swift index 2cee8be8..4d297cd1 100644 --- a/Sources/Schemas/TransferDestinationNumber.swift +++ b/Sources/Schemas/TransferDestinationNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// Transfers a call to a phone number, with optional extension, caller ID, message, transfer plan, and number validation. public struct TransferDestinationNumber: Codable, Hashable, Sendable { /// This is spoken to the customer before connecting them to the destination. /// diff --git a/Sources/Schemas/TransferDestinationSip.swift b/Sources/Schemas/TransferDestinationSip.swift index 6609b510..3a9ec979 100644 --- a/Sources/Schemas/TransferDestinationSip.swift +++ b/Sources/Schemas/TransferDestinationSip.swift @@ -1,5 +1,6 @@ import Foundation +/// Transfers a call to a SIP URI, with optional caller ID, headers, message, and transfer plan. public struct TransferDestinationSip: Codable, Hashable, Sendable { /// This is spoken to the customer before connecting them to the destination. /// diff --git a/Sources/Schemas/TransferFallbackPlan.swift b/Sources/Schemas/TransferFallbackPlan.swift index a17e0c8c..c0d24f74 100644 --- a/Sources/Schemas/TransferFallbackPlan.swift +++ b/Sources/Schemas/TransferFallbackPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls the message and end-call behavior used when a call transfer fails. public struct TransferFallbackPlan: Codable, Hashable, Sendable { /// This is the message the assistant will deliver to the customer if the transfer fails. public let message: TransferFallbackPlanMessage diff --git a/Sources/Schemas/TransferPhoneNumberHookAction.swift b/Sources/Schemas/TransferPhoneNumberHookAction.swift index d86f3a45..688c2b66 100644 --- a/Sources/Schemas/TransferPhoneNumberHookAction.swift +++ b/Sources/Schemas/TransferPhoneNumberHookAction.swift @@ -1,5 +1,6 @@ import Foundation +/// A phone-number hook action that transfers the call to a phone number or SIP destination. public struct TransferPhoneNumberHookAction: Codable, Hashable, Sendable { /// This is the destination details for the transfer - can be a phone number or SIP URI public let destination: TransferPhoneNumberHookActionDestination? diff --git a/Sources/Schemas/TransferPlan.swift b/Sources/Schemas/TransferPlan.swift index ee3a4245..9af9f7f7 100644 --- a/Sources/Schemas/TransferPlan.swift +++ b/Sources/Schemas/TransferPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls how a call transfer is executed, including blind and warm transfer modes, dialing and SIP behavior, hold audio, context, summary, and failure handling. public struct TransferPlan: Codable, Hashable, Sendable { /// This configures how transfer is executed and the experience of the destination party receiving the call. /// @@ -88,8 +89,10 @@ public struct TransferPlan: Codable, Hashable, Sendable { /// This configures the fallback plan when the transfer fails (destination unreachable, busy, or not human). /// /// Usage: - /// - Used only when `mode` is `warm-transfer-experimental`. - /// - If not provided when using `warm-transfer-experimental`, a default message will be used. + /// - Used when `mode` is `warm-transfer-experimental`. If not provided, a default message will be used. + /// - Used for SIP cold transfers (`blind-transfer` modes) when transfer outcome detection and fallback + /// are enabled for the organization: on a failed transfer, the assistant speaks `message`, then ends + /// the call or continues with the customer per `endCallEnabled`. public let fallbackPlan: TransferFallbackPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/TransferSuccessfulToolUserEditable.swift b/Sources/Schemas/TransferSuccessfulToolUserEditable.swift index b1f3a7b1..e9da1036 100644 --- a/Sources/Schemas/TransferSuccessfulToolUserEditable.swift +++ b/Sources/Schemas/TransferSuccessfulToolUserEditable.swift @@ -1,9 +1,7 @@ import Foundation public struct TransferSuccessfulToolUserEditable: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [TransferSuccessfulToolUserEditableMessagesItem]? /// The type of tool. "transferSuccessful" for Transfer Successful tool. This tool can only be used during warm-transfer-experimental by the transfer assistant to confirm that the transfer should proceed and finalize the handoff to the destination. public let type: TransferSuccessfulToolUserEditableType diff --git a/Sources/Schemas/TransportConfigurationTwilio.swift b/Sources/Schemas/TransportConfigurationTwilio.swift index e8650430..8f314068 100644 --- a/Sources/Schemas/TransportConfigurationTwilio.swift +++ b/Sources/Schemas/TransportConfigurationTwilio.swift @@ -1,6 +1,8 @@ import Foundation +/// Configuration passed to Twilio for assistant calls, including ring timeout and Twilio recording behavior. public struct TransportConfigurationTwilio: Codable, Hashable, Sendable { + /// Selects Twilio as the call transport provider. public let provider: TransportConfigurationTwilioProvider /// The integer number of seconds that we should allow the phone to ring before assuming there is no answer. /// The default is `60` seconds and the maximum is `600` seconds. diff --git a/Sources/Schemas/TransportConfigurationTwilioProvider.swift b/Sources/Schemas/TransportConfigurationTwilioProvider.swift index 87268aea..f3990b2f 100644 --- a/Sources/Schemas/TransportConfigurationTwilioProvider.swift +++ b/Sources/Schemas/TransportConfigurationTwilioProvider.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects Twilio as the call transport provider. public enum TransportConfigurationTwilioProvider: String, Codable, Hashable, CaseIterable, Sendable { case twilio } \ No newline at end of file diff --git a/Sources/Schemas/TransportCost.swift b/Sources/Schemas/TransportCost.swift index e11e3404..cf8da9cd 100644 --- a/Sources/Schemas/TransportCost.swift +++ b/Sources/Schemas/TransportCost.swift @@ -1,6 +1,8 @@ import Foundation +/// Telephony transport cost for a call, including provider, billable minutes, and amount. public struct TransportCost: Codable, Hashable, Sendable { + /// Telephony or transport provider that generated the cost. public let provider: TransportCostProvider? /// This is the minutes of `transport` usage. This should match `call.endedAt` - `call.startedAt`. public let minutes: Double diff --git a/Sources/Schemas/TransportCostProvider.swift b/Sources/Schemas/TransportCostProvider.swift index 09da7540..b988b90e 100644 --- a/Sources/Schemas/TransportCostProvider.swift +++ b/Sources/Schemas/TransportCostProvider.swift @@ -1,5 +1,6 @@ import Foundation +/// Telephony or transport provider that generated the cost. public enum TransportCostProvider: String, Codable, Hashable, CaseIterable, Sendable { case daily case vapiWebsocket = "vapi.websocket" diff --git a/Sources/Schemas/TrieveCredentialProvider.swift b/Sources/Schemas/TrieveCredentialProvider.swift deleted file mode 100644 index 9db69c59..00000000 --- a/Sources/Schemas/TrieveCredentialProvider.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public enum TrieveCredentialProvider: String, Codable, Hashable, CaseIterable, Sendable { - case trieve -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBase.swift b/Sources/Schemas/TrieveKnowledgeBase.swift index 8fb88a99..3164ae85 100644 --- a/Sources/Schemas/TrieveKnowledgeBase.swift +++ b/Sources/Schemas/TrieveKnowledgeBase.swift @@ -1,74 +1,3 @@ import Foundation -public struct TrieveKnowledgeBase: Codable, Hashable, Sendable { - /// This knowledge base is provided by Trieve. - /// - /// To learn more about Trieve, visit https://trieve.ai. - public let provider: TrieveKnowledgeBaseProvider - /// This is the name of the knowledge base. - public let name: String? - /// This is the searching plan used when searching for relevant chunks from the vector store. - /// - /// You should configure this if you're running into these issues: - /// - Too much unnecessary context is being fed as knowledge base context. - /// - Not enough relevant context is being fed as knowledge base context. - public let searchPlan: TrieveKnowledgeBaseSearchPlan? - /// This is the plan if you want us to create/import a new vector store using Trieve. - public let createPlan: TrieveKnowledgeBaseImport? - /// This is the id of the knowledge base. - public let id: String - /// This is the org id of the knowledge base. - public let orgId: String - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - provider: TrieveKnowledgeBaseProvider, - name: String? = nil, - searchPlan: TrieveKnowledgeBaseSearchPlan? = nil, - createPlan: TrieveKnowledgeBaseImport? = nil, - id: String, - orgId: String, - additionalProperties: [String: JSONValue] = .init() - ) { - self.provider = provider - self.name = name - self.searchPlan = searchPlan - self.createPlan = createPlan - self.id = id - self.orgId = orgId - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.provider = try container.decode(TrieveKnowledgeBaseProvider.self, forKey: .provider) - self.name = try container.decodeIfPresent(String.self, forKey: .name) - self.searchPlan = try container.decodeIfPresent(TrieveKnowledgeBaseSearchPlan.self, forKey: .searchPlan) - self.createPlan = try container.decodeIfPresent(TrieveKnowledgeBaseImport.self, forKey: .createPlan) - self.id = try container.decode(String.self, forKey: .id) - self.orgId = try container.decode(String.self, forKey: .orgId) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.provider, forKey: .provider) - try container.encodeIfPresent(self.name, forKey: .name) - try container.encodeIfPresent(self.searchPlan, forKey: .searchPlan) - try container.encodeIfPresent(self.createPlan, forKey: .createPlan) - try container.encode(self.id, forKey: .id) - try container.encode(self.orgId, forKey: .orgId) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case provider - case name - case searchPlan - case createPlan - case id - case orgId - } -} \ No newline at end of file +public typealias TrieveKnowledgeBase = JSONValue diff --git a/Sources/Schemas/TrieveKnowledgeBaseChunkPlan.swift b/Sources/Schemas/TrieveKnowledgeBaseChunkPlan.swift deleted file mode 100644 index e2b0f314..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseChunkPlan.swift +++ /dev/null @@ -1,61 +0,0 @@ -import Foundation - -public struct TrieveKnowledgeBaseChunkPlan: Codable, Hashable, Sendable { - /// These are the file ids that will be used to create the vector store. To upload files, use the `POST /files` endpoint. - public let fileIds: [String]? - /// These are the websites that will be used to create the vector store. - public let websites: [String]? - /// This is an optional field which allows you to specify the number of splits you want per chunk. If not specified, the default 20 is used. However, you may want to use a different number. - public let targetSplitsPerChunk: Double? - /// This is an optional field which allows you to specify the delimiters to use when splitting the file before chunking the text. If not specified, the default [.!?\n] are used to split into sentences. However, you may want to use spaces or other delimiters. - public let splitDelimiters: [String]? - /// This is an optional field which allows you to specify whether or not to rebalance the chunks created from the file. If not specified, the default true is used. If true, Trieve will evenly distribute remainder splits across chunks such that 66 splits with a target_splits_per_chunk of 20 will result in 3 chunks with 22 splits each. - public let rebalanceChunks: Bool? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - fileIds: [String]? = nil, - websites: [String]? = nil, - targetSplitsPerChunk: Double? = nil, - splitDelimiters: [String]? = nil, - rebalanceChunks: Bool? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.fileIds = fileIds - self.websites = websites - self.targetSplitsPerChunk = targetSplitsPerChunk - self.splitDelimiters = splitDelimiters - self.rebalanceChunks = rebalanceChunks - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.fileIds = try container.decodeIfPresent([String].self, forKey: .fileIds) - self.websites = try container.decodeIfPresent([String].self, forKey: .websites) - self.targetSplitsPerChunk = try container.decodeIfPresent(Double.self, forKey: .targetSplitsPerChunk) - self.splitDelimiters = try container.decodeIfPresent([String].self, forKey: .splitDelimiters) - self.rebalanceChunks = try container.decodeIfPresent(Bool.self, forKey: .rebalanceChunks) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.fileIds, forKey: .fileIds) - try container.encodeIfPresent(self.websites, forKey: .websites) - try container.encodeIfPresent(self.targetSplitsPerChunk, forKey: .targetSplitsPerChunk) - try container.encodeIfPresent(self.splitDelimiters, forKey: .splitDelimiters) - try container.encodeIfPresent(self.rebalanceChunks, forKey: .rebalanceChunks) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case fileIds - case websites - case targetSplitsPerChunk - case splitDelimiters - case rebalanceChunks - } -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseCreateType.swift b/Sources/Schemas/TrieveKnowledgeBaseCreateType.swift deleted file mode 100644 index a5084a4c..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseCreateType.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -/// This is to create a new dataset on Trieve. -public enum TrieveKnowledgeBaseCreateType: String, Codable, Hashable, CaseIterable, Sendable { - case create -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseImport.swift b/Sources/Schemas/TrieveKnowledgeBaseImport.swift index 164508f3..5af37fec 100644 --- a/Sources/Schemas/TrieveKnowledgeBaseImport.swift +++ b/Sources/Schemas/TrieveKnowledgeBaseImport.swift @@ -1,40 +1,3 @@ import Foundation -public struct TrieveKnowledgeBaseImport: Codable, Hashable, Sendable { - /// This is to import an existing dataset from Trieve. - public let type: TrieveKnowledgeBaseImportType - /// This is the `datasetId` of the dataset on your Trieve account. - public let providerId: String - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - type: TrieveKnowledgeBaseImportType, - providerId: String, - additionalProperties: [String: JSONValue] = .init() - ) { - self.type = type - self.providerId = providerId - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.type = try container.decode(TrieveKnowledgeBaseImportType.self, forKey: .type) - self.providerId = try container.decode(String.self, forKey: .providerId) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encode(self.type, forKey: .type) - try container.encode(self.providerId, forKey: .providerId) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case type - case providerId - } -} \ No newline at end of file +public typealias TrieveKnowledgeBaseImport = JSONValue diff --git a/Sources/Schemas/TrieveKnowledgeBaseImportType.swift b/Sources/Schemas/TrieveKnowledgeBaseImportType.swift deleted file mode 100644 index d138abf7..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseImportType.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -/// This is to import an existing dataset from Trieve. -public enum TrieveKnowledgeBaseImportType: String, Codable, Hashable, CaseIterable, Sendable { - case `import` -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseProvider.swift b/Sources/Schemas/TrieveKnowledgeBaseProvider.swift deleted file mode 100644 index 31269927..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseProvider.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation - -/// This knowledge base is provided by Trieve. -/// -/// To learn more about Trieve, visit https://trieve.ai. -public enum TrieveKnowledgeBaseProvider: String, Codable, Hashable, CaseIterable, Sendable { - case trieve -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseSearchPlan.swift b/Sources/Schemas/TrieveKnowledgeBaseSearchPlan.swift deleted file mode 100644 index dc020a22..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseSearchPlan.swift +++ /dev/null @@ -1,54 +0,0 @@ -import Foundation - -public struct TrieveKnowledgeBaseSearchPlan: Codable, Hashable, Sendable { - /// Specifies the number of top chunks to return. This corresponds to the `page_size` parameter in Trieve. - public let topK: Double? - /// If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. This will preserve queries that are entirely stop words. - public let removeStopWords: Bool? - /// This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric. For Manhattan Distance, Euclidean Distance, and Dot Product, it will filter out scores above the threshold distance. This threshold applies before weight and bias modifications. If not specified, this defaults to no threshold. A threshold of 0 will default to no threshold. - public let scoreThreshold: Double? - /// This is the search method used when searching for relevant chunks from the vector store. - public let searchType: TrieveKnowledgeBaseSearchPlanSearchType - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - topK: Double? = nil, - removeStopWords: Bool? = nil, - scoreThreshold: Double? = nil, - searchType: TrieveKnowledgeBaseSearchPlanSearchType, - additionalProperties: [String: JSONValue] = .init() - ) { - self.topK = topK - self.removeStopWords = removeStopWords - self.scoreThreshold = scoreThreshold - self.searchType = searchType - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.topK = try container.decodeIfPresent(Double.self, forKey: .topK) - self.removeStopWords = try container.decodeIfPresent(Bool.self, forKey: .removeStopWords) - self.scoreThreshold = try container.decodeIfPresent(Double.self, forKey: .scoreThreshold) - self.searchType = try container.decode(TrieveKnowledgeBaseSearchPlanSearchType.self, forKey: .searchType) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.topK, forKey: .topK) - try container.encodeIfPresent(self.removeStopWords, forKey: .removeStopWords) - try container.encodeIfPresent(self.scoreThreshold, forKey: .scoreThreshold) - try container.encode(self.searchType, forKey: .searchType) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case topK - case removeStopWords - case scoreThreshold - case searchType - } -} \ No newline at end of file diff --git a/Sources/Schemas/TrieveKnowledgeBaseSearchPlanSearchType.swift b/Sources/Schemas/TrieveKnowledgeBaseSearchPlanSearchType.swift deleted file mode 100644 index 272a5198..00000000 --- a/Sources/Schemas/TrieveKnowledgeBaseSearchPlanSearchType.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -/// This is the search method used when searching for relevant chunks from the vector store. -public enum TrieveKnowledgeBaseSearchPlanSearchType: String, Codable, Hashable, CaseIterable, Sendable { - case fulltext - case semantic - case hybrid - case bm25 -} \ No newline at end of file diff --git a/Sources/Schemas/TurnLatency.swift b/Sources/Schemas/TurnLatency.swift index 8d72af61..4b825ada 100644 --- a/Sources/Schemas/TurnLatency.swift +++ b/Sources/Schemas/TurnLatency.swift @@ -1,5 +1,6 @@ import Foundation +/// Model, voice, transcription, endpointing, and total latency measurements for a conversation turn. public struct TurnLatency: Codable, Hashable, Sendable { /// This is the model latency for the first token. public let modelLatency: Double? diff --git a/Sources/Schemas/TwilioPhoneNumber.swift b/Sources/Schemas/TwilioPhoneNumber.swift index dec2064c..835ebf79 100644 --- a/Sources/Schemas/TwilioPhoneNumber.swift +++ b/Sources/Schemas/TwilioPhoneNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// A Twilio phone number connected to Vapi, including its Twilio account details, SMS configuration, routing, hooks, server settings, and lifecycle metadata. public struct TwilioPhoneNumber: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/TwilioTransport.swift b/Sources/Schemas/TwilioTransport.swift new file mode 100644 index 00000000..dabb93d4 --- /dev/null +++ b/Sources/Schemas/TwilioTransport.swift @@ -0,0 +1,62 @@ +import Foundation + +public struct TwilioTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: TwilioTransportConversationType? + /// This is the account SID of the Twilio account. + public let accountSid: String? + /// This is the call SID of the Twilio call. + public let callSid: String? + /// This is the call token of the Twilio call. + public let callToken: String? + /// This is the phone number from which the call was forwarded. + /// Undefined if the call was not forwarded. + public let forwardedFrom: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: TwilioTransportConversationType? = nil, + accountSid: String? = nil, + callSid: String? = nil, + callToken: String? = nil, + forwardedFrom: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.accountSid = accountSid + self.callSid = callSid + self.callToken = callToken + self.forwardedFrom = forwardedFrom + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(TwilioTransportConversationType.self, forKey: .conversationType) + self.accountSid = try container.decodeIfPresent(String.self, forKey: .accountSid) + self.callSid = try container.decodeIfPresent(String.self, forKey: .callSid) + self.callToken = try container.decodeIfPresent(String.self, forKey: .callToken) + self.forwardedFrom = try container.decodeIfPresent(String.self, forKey: .forwardedFrom) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.accountSid, forKey: .accountSid) + try container.encodeIfPresent(self.callSid, forKey: .callSid) + try container.encodeIfPresent(self.callToken, forKey: .callToken) + try container.encodeIfPresent(self.forwardedFrom, forKey: .forwardedFrom) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case accountSid + case callSid + case callToken + case forwardedFrom + } +} \ No newline at end of file diff --git a/Sources/Schemas/TwilioTransportConversationType.swift b/Sources/Schemas/TwilioTransportConversationType.swift new file mode 100644 index 00000000..11783e01 --- /dev/null +++ b/Sources/Schemas/TwilioTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum TwilioTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/TwilioVoicemailDetectionPlan.swift b/Sources/Schemas/TwilioVoicemailDetectionPlan.swift index 1bec2f2a..c1fc472b 100644 --- a/Sources/Schemas/TwilioVoicemailDetectionPlan.swift +++ b/Sources/Schemas/TwilioVoicemailDetectionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for Twilio answering-machine detection, including recognized outcomes, enablement, timeout, speech thresholds, and silence timeout. public struct TwilioVoicemailDetectionPlan: Codable, Hashable, Sendable { /// This is the provider to use for voicemail detection. public let provider: TwilioVoicemailDetectionPlanProvider diff --git a/Sources/Schemas/UpdateAnthropicBedrockCredentialDto.swift b/Sources/Schemas/UpdateAnthropicBedrockCredentialDto.swift index 3d47c66c..7b47659b 100644 --- a/Sources/Schemas/UpdateAnthropicBedrockCredentialDto.swift +++ b/Sources/Schemas/UpdateAnthropicBedrockCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAnthropicBedrockCredentialDtoProvider? /// AWS region where Bedrock is configured. public let region: UpdateAnthropicBedrockCredentialDtoRegion? /// Authentication method - either direct IAM credentials or cross-account role assumption. @@ -11,11 +12,13 @@ public struct UpdateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAnthropicBedrockCredentialDtoProvider? = nil, region: UpdateAnthropicBedrockCredentialDtoRegion? = nil, authenticationPlan: UpdateAnthropicBedrockCredentialDtoAuthenticationPlan? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.region = region self.authenticationPlan = authenticationPlan self.name = name @@ -24,6 +27,7 @@ public struct UpdateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAnthropicBedrockCredentialDtoProvider.self, forKey: .provider) self.region = try container.decodeIfPresent(UpdateAnthropicBedrockCredentialDtoRegion.self, forKey: .region) self.authenticationPlan = try container.decodeIfPresent(UpdateAnthropicBedrockCredentialDtoAuthenticationPlan.self, forKey: .authenticationPlan) self.name = try container.decodeIfPresent(String.self, forKey: .name) @@ -33,6 +37,7 @@ public struct UpdateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.region, forKey: .region) try container.encodeIfPresent(self.authenticationPlan, forKey: .authenticationPlan) try container.encodeIfPresent(self.name, forKey: .name) @@ -40,6 +45,7 @@ public struct UpdateAnthropicBedrockCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case region case authenticationPlan case name diff --git a/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoProvider.swift b/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoProvider.swift new file mode 100644 index 00000000..ef036715 --- /dev/null +++ b/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAnthropicBedrockCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case anthropicBedrock = "anthropic-bedrock" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoRegion.swift b/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoRegion.swift index 94a53802..c0ee258c 100644 --- a/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoRegion.swift +++ b/Sources/Schemas/UpdateAnthropicBedrockCredentialDtoRegion.swift @@ -4,6 +4,7 @@ import Foundation public enum UpdateAnthropicBedrockCredentialDtoRegion: String, Codable, Hashable, CaseIterable, Sendable { case usEast1 = "us-east-1" case usWest2 = "us-west-2" + case euCentral1 = "eu-central-1" case euWest1 = "eu-west-1" case euWest3 = "eu-west-3" case apNortheast1 = "ap-northeast-1" diff --git a/Sources/Schemas/UpdateAnthropicCredentialDto.swift b/Sources/Schemas/UpdateAnthropicCredentialDto.swift index 00801b75..ec68e3cb 100644 --- a/Sources/Schemas/UpdateAnthropicCredentialDto.swift +++ b/Sources/Schemas/UpdateAnthropicCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAnthropicCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAnthropicCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateAnthropicCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAnthropicCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateAnthropicCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAnthropicCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateAnthropicCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateAnthropicCredentialDtoProvider.swift b/Sources/Schemas/UpdateAnthropicCredentialDtoProvider.swift new file mode 100644 index 00000000..f6a77f96 --- /dev/null +++ b/Sources/Schemas/UpdateAnthropicCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAnthropicCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case anthropic +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAnyscaleCredentialDto.swift b/Sources/Schemas/UpdateAnyscaleCredentialDto.swift index ef00f463..903ed218 100644 --- a/Sources/Schemas/UpdateAnyscaleCredentialDto.swift +++ b/Sources/Schemas/UpdateAnyscaleCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAnyscaleCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAnyscaleCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateAnyscaleCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAnyscaleCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateAnyscaleCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAnyscaleCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateAnyscaleCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateAnyscaleCredentialDtoProvider.swift b/Sources/Schemas/UpdateAnyscaleCredentialDtoProvider.swift new file mode 100644 index 00000000..8405b4f9 --- /dev/null +++ b/Sources/Schemas/UpdateAnyscaleCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAnyscaleCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case anyscale +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateApiRequestToolDto.swift b/Sources/Schemas/UpdateApiRequestToolDto.swift index ffbf372a..5633ca12 100644 --- a/Sources/Schemas/UpdateApiRequestToolDto.swift +++ b/Sources/Schemas/UpdateApiRequestToolDto.swift @@ -1,10 +1,14 @@ import Foundation +/// Fields used to update an API-request tool, including its URL, HTTP method, authentication, request data, retries, and response handling. public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateApiRequestToolDtoMessagesItem]? + /// This is the name of the tool. This will be passed to the model. + /// + /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. + public let name: String? + /// The HTTP method used for the API request. public let method: UpdateApiRequestToolDtoMethod? /// This is the timeout in seconds for the request. Defaults to 20 seconds. /// @@ -95,10 +99,6 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { /// } /// ``` public let rejectionPlan: ToolRejectionPlan? - /// This is the name of the tool. This will be passed to the model. - /// - /// Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 40. - public let name: String? /// This is the description of the tool. This will be passed to the model. public let description: String? /// This is where the request will be sent. @@ -270,13 +270,13 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { public init( messages: [UpdateApiRequestToolDtoMessagesItem]? = nil, + name: String? = nil, method: UpdateApiRequestToolDtoMethod? = nil, timeoutSeconds: Double? = nil, credentialId: String? = nil, encryptedPaths: [String]? = nil, parameters: [ToolParameter]? = nil, rejectionPlan: ToolRejectionPlan? = nil, - name: String? = nil, description: String? = nil, url: String? = nil, body: JsonSchema? = nil, @@ -286,13 +286,13 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.name = name self.method = method self.timeoutSeconds = timeoutSeconds self.credentialId = credentialId self.encryptedPaths = encryptedPaths self.parameters = parameters self.rejectionPlan = rejectionPlan - self.name = name self.description = description self.url = url self.body = body @@ -305,13 +305,13 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([UpdateApiRequestToolDtoMessagesItem].self, forKey: .messages) + self.name = try container.decodeIfPresent(String.self, forKey: .name) self.method = try container.decodeIfPresent(UpdateApiRequestToolDtoMethod.self, forKey: .method) self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) self.encryptedPaths = try container.decodeIfPresent([String].self, forKey: .encryptedPaths) self.parameters = try container.decodeIfPresent([ToolParameter].self, forKey: .parameters) self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) - self.name = try container.decodeIfPresent(String.self, forKey: .name) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.url = try container.decodeIfPresent(String.self, forKey: .url) self.body = try container.decodeIfPresent(JsonSchema.self, forKey: .body) @@ -325,13 +325,13 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.method, forKey: .method) try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) try container.encodeIfPresent(self.credentialId, forKey: .credentialId) try container.encodeIfPresent(self.encryptedPaths, forKey: .encryptedPaths) try container.encodeIfPresent(self.parameters, forKey: .parameters) try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) - try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.description, forKey: .description) try container.encodeIfPresent(self.url, forKey: .url) try container.encodeIfPresent(self.body, forKey: .body) @@ -343,13 +343,13 @@ public struct UpdateApiRequestToolDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case name case method case timeoutSeconds case credentialId case encryptedPaths case parameters case rejectionPlan - case name case description case url case body diff --git a/Sources/Schemas/UpdateApiRequestToolDtoMethod.swift b/Sources/Schemas/UpdateApiRequestToolDtoMethod.swift index f1c98970..3ebe1608 100644 --- a/Sources/Schemas/UpdateApiRequestToolDtoMethod.swift +++ b/Sources/Schemas/UpdateApiRequestToolDtoMethod.swift @@ -1,5 +1,6 @@ import Foundation +/// The HTTP method used for the API request. public enum UpdateApiRequestToolDtoMethod: String, Codable, Hashable, CaseIterable, Sendable { case post = "POST" case get = "GET" diff --git a/Sources/Schemas/UpdateAssemblyAiCredentialDto.swift b/Sources/Schemas/UpdateAssemblyAiCredentialDto.swift index 17469ee2..778d1061 100644 --- a/Sources/Schemas/UpdateAssemblyAiCredentialDto.swift +++ b/Sources/Schemas/UpdateAssemblyAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAssemblyAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAssemblyAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateAssemblyAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAssemblyAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateAssemblyAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAssemblyAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateAssemblyAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateAssemblyAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateAssemblyAiCredentialDtoProvider.swift new file mode 100644 index 00000000..71201249 --- /dev/null +++ b/Sources/Schemas/UpdateAssemblyAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAssemblyAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case assemblyAi = "assembly-ai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDto.swift b/Sources/Schemas/UpdateAssistantDraftDto.swift new file mode 100644 index 00000000..d1203819 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDto.swift @@ -0,0 +1,296 @@ +import Foundation + +public struct UpdateAssistantDraftDto: Codable, Hashable, Sendable { + /// These are the options for the assistant's transcriber. + public let transcriber: UpdateAssistantDraftDtoTranscriber? + /// These are the options for the assistant's LLM. + public let model: UpdateAssistantDraftDtoModel? + /// These are the options for the assistant's voice. + public let voice: UpdateAssistantDraftDtoVoice? + /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + /// + /// If unspecified, assistant will wait for user to speak and use the model to respond once they speak. + public let firstMessage: String? + public let firstMessageInterruptionsEnabled: Bool? + /// This is the mode for the first message. Default is 'assistant-speaks-first'. + /// + /// Use: + /// - 'assistant-speaks-first' to have the assistant speak first. + /// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. + /// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). + /// + /// @default 'assistant-speaks-first' + public let firstMessageMode: UpdateAssistantDraftDtoFirstMessageMode? + /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + /// By default, voicemail detection is disabled. + public let voicemailDetection: UpdateAssistantDraftDtoVoicemailDetection? + /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started,assistant.started. You can check the shape of the messages in ClientMessage schema. + public let clientMessages: [UpdateAssistantDraftDtoClientMessagesItem]? + /// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,handoff-destination-request,user-interrupted,assistant.started. You can check the shape of the messages in ServerMessage schema. + public let serverMessages: [UpdateAssistantDraftDtoServerMessagesItem]? + /// This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + /// + /// @default 600 (10 minutes) + public let maxDurationSeconds: Double? + /// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + /// You can also provide a custom sound by providing a URL to an audio file. + public let backgroundSound: UpdateAssistantDraftDtoBackgroundSound? + /// This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + /// + /// @default false + public let modelOutputInMessagesEnabled: Bool? + /// These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + public let transportConfigurations: [TransportConfigurationTwilio]? + /// This is the plan for observability of assistant's calls. + /// + /// Currently, only Langfuse is supported. + public let observabilityPlan: LangfuseObservabilityPlan? + /// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials. + public let credentials: [UpdateAssistantDraftDtoCredentialsItem]? + /// This is a set of actions that will be performed on certain events. + public let hooks: [UpdateAssistantDraftDtoHooksItem]? + /// This is the name of the assistant. + /// + /// This is required when you want to transfer between assistants in a call. + public let name: String? + /// This is the message that the assistant will say if the call is forwarded to voicemail. + /// + /// If unspecified, it will hang up. + public let voicemailMessage: String? + /// This is the message that the assistant will say if it ends the call. + /// + /// If unspecified, it will hang up without saying anything. + public let endCallMessage: String? + /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + public let endCallPhrases: [String]? + public let compliancePlan: CompliancePlan? + /// This is for metadata you want to store on the assistant. + public let metadata: [String: JSONValue]? + /// This enables filtering of noise and background speech while the user is talking. + /// + /// Features: + /// - Smart denoising using Krisp + /// - Fourier denoising + /// + /// Smart denoising can be combined with or used independently of Fourier denoising. + /// + /// Order of precedence: + /// - Smart denoising + /// - Fourier denoising + public let backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? + /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`. + public let analysisPlan: AnalysisPlan? + /// This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`. + public let artifactPlan: ArtifactPlan? + /// This is the plan for when the assistant should start talking. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to start talking after the customer is done speaking. + /// - The assistant is too fast to start talking after the customer is done speaking. + /// - The assistant is so fast that it's actually interrupting the customer. + public let startSpeakingPlan: StartSpeakingPlan? + /// This is the plan for when assistant should stop talking on customer interruption. + /// + /// You should configure this if you're running into these issues: + /// - The assistant is too slow to recognize customer's interruption. + /// - The assistant is too fast to recognize customer's interruption. + /// - The assistant is getting interrupted by phrases that are just acknowledgments. + /// - The assistant is getting interrupted by background noises. + /// - The assistant is not properly stopping -- it starts talking right after getting interrupted. + public let stopSpeakingPlan: StopSpeakingPlan? + /// This is the plan for real-time monitoring of the assistant's calls. + /// + /// Usage: + /// - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. + /// - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`. + /// - To attach monitors to the assistant, set `monitorPlan.monitorIds` to the set of monitor ids. + public let monitorPlan: MonitorPlan? + /// These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + public let credentialIds: [String]? + /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. + /// + /// The order of precedence is: + /// + /// 1. assistant.server.url + /// 2. phoneNumber.serverUrl + /// 3. org.serverUrl + public let server: Server? + public let keypadInputPlan: KeypadInputPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + transcriber: UpdateAssistantDraftDtoTranscriber? = nil, + model: UpdateAssistantDraftDtoModel? = nil, + voice: UpdateAssistantDraftDtoVoice? = nil, + firstMessage: String? = nil, + firstMessageInterruptionsEnabled: Bool? = nil, + firstMessageMode: UpdateAssistantDraftDtoFirstMessageMode? = nil, + voicemailDetection: UpdateAssistantDraftDtoVoicemailDetection? = nil, + clientMessages: [UpdateAssistantDraftDtoClientMessagesItem]? = nil, + serverMessages: [UpdateAssistantDraftDtoServerMessagesItem]? = nil, + maxDurationSeconds: Double? = nil, + backgroundSound: UpdateAssistantDraftDtoBackgroundSound? = nil, + modelOutputInMessagesEnabled: Bool? = nil, + transportConfigurations: [TransportConfigurationTwilio]? = nil, + observabilityPlan: LangfuseObservabilityPlan? = nil, + credentials: [UpdateAssistantDraftDtoCredentialsItem]? = nil, + hooks: [UpdateAssistantDraftDtoHooksItem]? = nil, + name: String? = nil, + voicemailMessage: String? = nil, + endCallMessage: String? = nil, + endCallPhrases: [String]? = nil, + compliancePlan: CompliancePlan? = nil, + metadata: [String: JSONValue]? = nil, + backgroundSpeechDenoisingPlan: BackgroundSpeechDenoisingPlan? = nil, + analysisPlan: AnalysisPlan? = nil, + artifactPlan: ArtifactPlan? = nil, + startSpeakingPlan: StartSpeakingPlan? = nil, + stopSpeakingPlan: StopSpeakingPlan? = nil, + monitorPlan: MonitorPlan? = nil, + credentialIds: [String]? = nil, + server: Server? = nil, + keypadInputPlan: KeypadInputPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.transcriber = transcriber + self.model = model + self.voice = voice + self.firstMessage = firstMessage + self.firstMessageInterruptionsEnabled = firstMessageInterruptionsEnabled + self.firstMessageMode = firstMessageMode + self.voicemailDetection = voicemailDetection + self.clientMessages = clientMessages + self.serverMessages = serverMessages + self.maxDurationSeconds = maxDurationSeconds + self.backgroundSound = backgroundSound + self.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled + self.transportConfigurations = transportConfigurations + self.observabilityPlan = observabilityPlan + self.credentials = credentials + self.hooks = hooks + self.name = name + self.voicemailMessage = voicemailMessage + self.endCallMessage = endCallMessage + self.endCallPhrases = endCallPhrases + self.compliancePlan = compliancePlan + self.metadata = metadata + self.backgroundSpeechDenoisingPlan = backgroundSpeechDenoisingPlan + self.analysisPlan = analysisPlan + self.artifactPlan = artifactPlan + self.startSpeakingPlan = startSpeakingPlan + self.stopSpeakingPlan = stopSpeakingPlan + self.monitorPlan = monitorPlan + self.credentialIds = credentialIds + self.server = server + self.keypadInputPlan = keypadInputPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.transcriber = try container.decodeIfPresent(UpdateAssistantDraftDtoTranscriber.self, forKey: .transcriber) + self.model = try container.decodeIfPresent(UpdateAssistantDraftDtoModel.self, forKey: .model) + self.voice = try container.decodeIfPresent(UpdateAssistantDraftDtoVoice.self, forKey: .voice) + self.firstMessage = try container.decodeIfPresent(String.self, forKey: .firstMessage) + self.firstMessageInterruptionsEnabled = try container.decodeIfPresent(Bool.self, forKey: .firstMessageInterruptionsEnabled) + self.firstMessageMode = try container.decodeIfPresent(UpdateAssistantDraftDtoFirstMessageMode.self, forKey: .firstMessageMode) + self.voicemailDetection = try container.decodeIfPresent(UpdateAssistantDraftDtoVoicemailDetection.self, forKey: .voicemailDetection) + self.clientMessages = try container.decodeIfPresent([UpdateAssistantDraftDtoClientMessagesItem].self, forKey: .clientMessages) + self.serverMessages = try container.decodeIfPresent([UpdateAssistantDraftDtoServerMessagesItem].self, forKey: .serverMessages) + self.maxDurationSeconds = try container.decodeIfPresent(Double.self, forKey: .maxDurationSeconds) + self.backgroundSound = try container.decodeIfPresent(UpdateAssistantDraftDtoBackgroundSound.self, forKey: .backgroundSound) + self.modelOutputInMessagesEnabled = try container.decodeIfPresent(Bool.self, forKey: .modelOutputInMessagesEnabled) + self.transportConfigurations = try container.decodeIfPresent([TransportConfigurationTwilio].self, forKey: .transportConfigurations) + self.observabilityPlan = try container.decodeIfPresent(LangfuseObservabilityPlan.self, forKey: .observabilityPlan) + self.credentials = try container.decodeIfPresent([UpdateAssistantDraftDtoCredentialsItem].self, forKey: .credentials) + self.hooks = try container.decodeIfPresent([UpdateAssistantDraftDtoHooksItem].self, forKey: .hooks) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.voicemailMessage = try container.decodeIfPresent(String.self, forKey: .voicemailMessage) + self.endCallMessage = try container.decodeIfPresent(String.self, forKey: .endCallMessage) + self.endCallPhrases = try container.decodeIfPresent([String].self, forKey: .endCallPhrases) + self.compliancePlan = try container.decodeIfPresent(CompliancePlan.self, forKey: .compliancePlan) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.backgroundSpeechDenoisingPlan = try container.decodeIfPresent(BackgroundSpeechDenoisingPlan.self, forKey: .backgroundSpeechDenoisingPlan) + self.analysisPlan = try container.decodeIfPresent(AnalysisPlan.self, forKey: .analysisPlan) + self.artifactPlan = try container.decodeIfPresent(ArtifactPlan.self, forKey: .artifactPlan) + self.startSpeakingPlan = try container.decodeIfPresent(StartSpeakingPlan.self, forKey: .startSpeakingPlan) + self.stopSpeakingPlan = try container.decodeIfPresent(StopSpeakingPlan.self, forKey: .stopSpeakingPlan) + self.monitorPlan = try container.decodeIfPresent(MonitorPlan.self, forKey: .monitorPlan) + self.credentialIds = try container.decodeIfPresent([String].self, forKey: .credentialIds) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.keypadInputPlan = try container.decodeIfPresent(KeypadInputPlan.self, forKey: .keypadInputPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.transcriber, forKey: .transcriber) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.voice, forKey: .voice) + try container.encodeIfPresent(self.firstMessage, forKey: .firstMessage) + try container.encodeIfPresent(self.firstMessageInterruptionsEnabled, forKey: .firstMessageInterruptionsEnabled) + try container.encodeIfPresent(self.firstMessageMode, forKey: .firstMessageMode) + try container.encodeIfPresent(self.voicemailDetection, forKey: .voicemailDetection) + try container.encodeIfPresent(self.clientMessages, forKey: .clientMessages) + try container.encodeIfPresent(self.serverMessages, forKey: .serverMessages) + try container.encodeIfPresent(self.maxDurationSeconds, forKey: .maxDurationSeconds) + try container.encodeIfPresent(self.backgroundSound, forKey: .backgroundSound) + try container.encodeIfPresent(self.modelOutputInMessagesEnabled, forKey: .modelOutputInMessagesEnabled) + try container.encodeIfPresent(self.transportConfigurations, forKey: .transportConfigurations) + try container.encodeIfPresent(self.observabilityPlan, forKey: .observabilityPlan) + try container.encodeIfPresent(self.credentials, forKey: .credentials) + try container.encodeIfPresent(self.hooks, forKey: .hooks) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.voicemailMessage, forKey: .voicemailMessage) + try container.encodeIfPresent(self.endCallMessage, forKey: .endCallMessage) + try container.encodeIfPresent(self.endCallPhrases, forKey: .endCallPhrases) + try container.encodeIfPresent(self.compliancePlan, forKey: .compliancePlan) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.backgroundSpeechDenoisingPlan, forKey: .backgroundSpeechDenoisingPlan) + try container.encodeIfPresent(self.analysisPlan, forKey: .analysisPlan) + try container.encodeIfPresent(self.artifactPlan, forKey: .artifactPlan) + try container.encodeIfPresent(self.startSpeakingPlan, forKey: .startSpeakingPlan) + try container.encodeIfPresent(self.stopSpeakingPlan, forKey: .stopSpeakingPlan) + try container.encodeIfPresent(self.monitorPlan, forKey: .monitorPlan) + try container.encodeIfPresent(self.credentialIds, forKey: .credentialIds) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.keypadInputPlan, forKey: .keypadInputPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case transcriber + case model + case voice + case firstMessage + case firstMessageInterruptionsEnabled + case firstMessageMode + case voicemailDetection + case clientMessages + case serverMessages + case maxDurationSeconds + case backgroundSound + case modelOutputInMessagesEnabled + case transportConfigurations + case observabilityPlan + case credentials + case hooks + case name + case voicemailMessage + case endCallMessage + case endCallPhrases + case compliancePlan + case metadata + case backgroundSpeechDenoisingPlan + case analysisPlan + case artifactPlan + case startSpeakingPlan + case stopSpeakingPlan + case monitorPlan + case credentialIds + case server + case keypadInputPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSound.swift b/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSound.swift new file mode 100644 index 00000000..6ad052d1 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSound.swift @@ -0,0 +1,32 @@ +import Foundation + +/// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. +/// You can also provide a custom sound by providing a URL to an audio file. +public enum UpdateAssistantDraftDtoBackgroundSound: Codable, Hashable, Sendable { + case string(String) + case updateAssistantDraftDtoBackgroundSoundZero(UpdateAssistantDraftDtoBackgroundSoundZero) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(String.self) { + self = .string(value) + } else if let value = try? container.decode(UpdateAssistantDraftDtoBackgroundSoundZero.self) { + self = .updateAssistantDraftDtoBackgroundSoundZero(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .string(let value): + try container.encode(value) + case .updateAssistantDraftDtoBackgroundSoundZero(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSoundZero.swift b/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSoundZero.swift new file mode 100644 index 00000000..68a273fb --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoBackgroundSoundZero.swift @@ -0,0 +1,6 @@ +import Foundation + +public enum UpdateAssistantDraftDtoBackgroundSoundZero: String, Codable, Hashable, CaseIterable, Sendable { + case off + case office +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoClientMessagesItem.swift b/Sources/Schemas/UpdateAssistantDraftDtoClientMessagesItem.swift new file mode 100644 index 00000000..0c5eda1c --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoClientMessagesItem.swift @@ -0,0 +1,23 @@ +import Foundation + +public enum UpdateAssistantDraftDtoClientMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case conversationUpdate = "conversation-update" + case assistantSpeechStarted = "assistant.speechStarted" + case functionCall = "function-call" + case functionCallResult = "function-call-result" + case hang + case languageChanged = "language-changed" + case metadata + case modelOutput = "model-output" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case toolCalls = "tool-calls" + case toolCallsResult = "tool-calls-result" + case toolCompleted = "tool.completed" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case workflowNodeStarted = "workflow.node.started" + case assistantStarted = "assistant.started" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoCredentialsItem.swift b/Sources/Schemas/UpdateAssistantDraftDtoCredentialsItem.swift new file mode 100644 index 00000000..81691c2e --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoCredentialsItem.swift @@ -0,0 +1,370 @@ +import Foundation + +public enum UpdateAssistantDraftDtoCredentialsItem: Codable, Hashable, Sendable { + case anthropic(CreateAnthropicCredentialDto) + case anthropicBedrock(CreateAnthropicBedrockCredentialDto) + case anyscale(CreateAnyscaleCredentialDto) + case assemblyAi(CreateAssemblyAiCredentialDto) + case azure(CreateAzureCredentialDto) + case azureOpenai(CreateAzureOpenAiCredentialDto) + case byoSipTrunk(CreateByoSipTrunkCredentialDto) + case cartesia(CreateCartesiaCredentialDto) + case cerebras(CreateCerebrasCredentialDto) + case cloudflare(CreateCloudflareCredentialDto) + case customCredential(CreateCustomCredentialDto) + case customLlm(CreateCustomLlmCredentialDto) + case deepgram(CreateDeepgramCredentialDto) + case deepinfra(CreateDeepInfraCredentialDto) + case deepSeek(CreateDeepSeekCredentialDto) + case elevenLabs(CreateElevenLabsCredentialDto) + case email(CreateEmailCredentialDto) + case gcp(CreateGcpCredentialDto) + case ghlOauth2Authorization(CreateGoHighLevelMcpCredentialDto) + case gladia(CreateGladiaCredentialDto) + case gohighlevel(CreateGoHighLevelCredentialDto) + case google(CreateGoogleCredentialDto) + case googleCalendarOauth2Authorization(CreateGoogleCalendarOAuth2AuthorizationCredentialDto) + case googleCalendarOauth2Client(CreateGoogleCalendarOAuth2ClientCredentialDto) + case googleSheetsOauth2Authorization(CreateGoogleSheetsOAuth2AuthorizationCredentialDto) + case groq(CreateGroqCredentialDto) + case hume(CreateHumeCredentialDto) + case inflectionAi(CreateInflectionAiCredentialDto) + case inworld(CreateInworldCredentialDto) + case langfuse(CreateLangfuseCredentialDto) + case lmnt(CreateLmntCredentialDto) + case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) + case minimax(CreateMinimaxCredentialDto) + case mistral(CreateMistralCredentialDto) + case neuphonic(CreateNeuphonicCredentialDto) + case openai(CreateOpenAiCredentialDto) + case openrouter(CreateOpenRouterCredentialDto) + case perplexityAi(CreatePerplexityAiCredentialDto) + case playht(CreatePlayHtCredentialDto) + case rimeAi(CreateRimeAiCredentialDto) + case runpod(CreateRunpodCredentialDto) + case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) + case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) + case slackWebhook(CreateSlackWebhookCredentialDto) + case smallestAi(CreateSmallestAiCredentialDto) + case soniox(CreateSonioxCredentialDto) + case speechmatics(CreateSpeechmaticsCredentialDto) + case supabase(CreateSupabaseCredentialDto) + case tavus(CreateTavusCredentialDto) + case togetherAi(CreateTogetherAiCredentialDto) + case twilio(CreateTwilioCredentialDto) + case vonage(CreateVonageCredentialDto) + case webhook(CreateWebhookCredentialDto) + case wellsaid(CreateWellSaidCredentialDto) + case xai(CreateXAiCredentialDto) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try CreateAnthropicCredentialDto(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try CreateAnthropicBedrockCredentialDto(from: decoder)) + case "anyscale": + self = .anyscale(try CreateAnyscaleCredentialDto(from: decoder)) + case "assembly-ai": + self = .assemblyAi(try CreateAssemblyAiCredentialDto(from: decoder)) + case "azure": + self = .azure(try CreateAzureCredentialDto(from: decoder)) + case "azure-openai": + self = .azureOpenai(try CreateAzureOpenAiCredentialDto(from: decoder)) + case "byo-sip-trunk": + self = .byoSipTrunk(try CreateByoSipTrunkCredentialDto(from: decoder)) + case "cartesia": + self = .cartesia(try CreateCartesiaCredentialDto(from: decoder)) + case "cerebras": + self = .cerebras(try CreateCerebrasCredentialDto(from: decoder)) + case "cloudflare": + self = .cloudflare(try CreateCloudflareCredentialDto(from: decoder)) + case "custom-credential": + self = .customCredential(try CreateCustomCredentialDto(from: decoder)) + case "custom-llm": + self = .customLlm(try CreateCustomLlmCredentialDto(from: decoder)) + case "deepgram": + self = .deepgram(try CreateDeepgramCredentialDto(from: decoder)) + case "deepinfra": + self = .deepinfra(try CreateDeepInfraCredentialDto(from: decoder)) + case "deep-seek": + self = .deepSeek(try CreateDeepSeekCredentialDto(from: decoder)) + case "11labs": + self = .elevenLabs(try CreateElevenLabsCredentialDto(from: decoder)) + case "email": + self = .email(try CreateEmailCredentialDto(from: decoder)) + case "gcp": + self = .gcp(try CreateGcpCredentialDto(from: decoder)) + case "ghl.oauth2-authorization": + self = .ghlOauth2Authorization(try CreateGoHighLevelMcpCredentialDto(from: decoder)) + case "gladia": + self = .gladia(try CreateGladiaCredentialDto(from: decoder)) + case "gohighlevel": + self = .gohighlevel(try CreateGoHighLevelCredentialDto(from: decoder)) + case "google": + self = .google(try CreateGoogleCredentialDto(from: decoder)) + case "google.calendar.oauth2-authorization": + self = .googleCalendarOauth2Authorization(try CreateGoogleCalendarOAuth2AuthorizationCredentialDto(from: decoder)) + case "google.calendar.oauth2-client": + self = .googleCalendarOauth2Client(try CreateGoogleCalendarOAuth2ClientCredentialDto(from: decoder)) + case "google.sheets.oauth2-authorization": + self = .googleSheetsOauth2Authorization(try CreateGoogleSheetsOAuth2AuthorizationCredentialDto(from: decoder)) + case "groq": + self = .groq(try CreateGroqCredentialDto(from: decoder)) + case "hume": + self = .hume(try CreateHumeCredentialDto(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try CreateInflectionAiCredentialDto(from: decoder)) + case "inworld": + self = .inworld(try CreateInworldCredentialDto(from: decoder)) + case "langfuse": + self = .langfuse(try CreateLangfuseCredentialDto(from: decoder)) + case "lmnt": + self = .lmnt(try CreateLmntCredentialDto(from: decoder)) + case "make": + self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) + case "minimax": + self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) + case "mistral": + self = .mistral(try CreateMistralCredentialDto(from: decoder)) + case "neuphonic": + self = .neuphonic(try CreateNeuphonicCredentialDto(from: decoder)) + case "openai": + self = .openai(try CreateOpenAiCredentialDto(from: decoder)) + case "openrouter": + self = .openrouter(try CreateOpenRouterCredentialDto(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try CreatePerplexityAiCredentialDto(from: decoder)) + case "playht": + self = .playht(try CreatePlayHtCredentialDto(from: decoder)) + case "rime-ai": + self = .rimeAi(try CreateRimeAiCredentialDto(from: decoder)) + case "runpod": + self = .runpod(try CreateRunpodCredentialDto(from: decoder)) + case "s3": + self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) + case "slack.oauth2-authorization": + self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) + case "slack-webhook": + self = .slackWebhook(try CreateSlackWebhookCredentialDto(from: decoder)) + case "smallest-ai": + self = .smallestAi(try CreateSmallestAiCredentialDto(from: decoder)) + case "soniox": + self = .soniox(try CreateSonioxCredentialDto(from: decoder)) + case "speechmatics": + self = .speechmatics(try CreateSpeechmaticsCredentialDto(from: decoder)) + case "supabase": + self = .supabase(try CreateSupabaseCredentialDto(from: decoder)) + case "tavus": + self = .tavus(try CreateTavusCredentialDto(from: decoder)) + case "together-ai": + self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) + case "twilio": + self = .twilio(try CreateTwilioCredentialDto(from: decoder)) + case "vonage": + self = .vonage(try CreateVonageCredentialDto(from: decoder)) + case "webhook": + self = .webhook(try CreateWebhookCredentialDto(from: decoder)) + case "wellsaid": + self = .wellsaid(try CreateWellSaidCredentialDto(from: decoder)) + case "xai": + self = .xai(try CreateXAiCredentialDto(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .azureOpenai(let data): + try container.encode("azure-openai", forKey: .provider) + try data.encode(to: encoder) + case .byoSipTrunk(let data): + try container.encode("byo-sip-trunk", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .cloudflare(let data): + try container.encode("cloudflare", forKey: .provider) + try data.encode(to: encoder) + case .customCredential(let data): + try container.encode("custom-credential", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .email(let data): + try container.encode("email", forKey: .provider) + try data.encode(to: encoder) + case .gcp(let data): + try container.encode("gcp", forKey: .provider) + try data.encode(to: encoder) + case .ghlOauth2Authorization(let data): + try container.encode("ghl.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .gohighlevel(let data): + try container.encode("gohighlevel", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Authorization(let data): + try container.encode("google.calendar.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .googleCalendarOauth2Client(let data): + try container.encode("google.calendar.oauth2-client", forKey: .provider) + try data.encode(to: encoder) + case .googleSheetsOauth2Authorization(let data): + try container.encode("google.sheets.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .langfuse(let data): + try container.encode("langfuse", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .make(let data): + try container.encode("make", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .mistral(let data): + try container.encode("mistral", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .runpod(let data): + try container.encode("runpod", forKey: .provider) + try data.encode(to: encoder) + case .s3(let data): + try container.encode("s3", forKey: .provider) + try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) + case .slackOauth2Authorization(let data): + try container.encode("slack.oauth2-authorization", forKey: .provider) + try data.encode(to: encoder) + case .slackWebhook(let data): + try container.encode("slack-webhook", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .supabase(let data): + try container.encode("supabase", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .twilio(let data): + try container.encode("twilio", forKey: .provider) + try data.encode(to: encoder) + case .vonage(let data): + try container.encode("vonage", forKey: .provider) + try data.encode(to: encoder) + case .webhook(let data): + try container.encode("webhook", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoFirstMessageMode.swift b/Sources/Schemas/UpdateAssistantDraftDtoFirstMessageMode.swift new file mode 100644 index 00000000..5c07e851 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoFirstMessageMode.swift @@ -0,0 +1,15 @@ +import Foundation + +/// This is the mode for the first message. Default is 'assistant-speaks-first'. +/// +/// Use: +/// - 'assistant-speaks-first' to have the assistant speak first. +/// - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. +/// - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points). +/// +/// @default 'assistant-speaks-first' +public enum UpdateAssistantDraftDtoFirstMessageMode: String, Codable, Hashable, CaseIterable, Sendable { + case assistantSpeaksFirst = "assistant-speaks-first" + case assistantSpeaksFirstWithModelGeneratedMessage = "assistant-speaks-first-with-model-generated-message" + case assistantWaitsForUser = "assistant-waits-for-user" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoHooksItem.swift b/Sources/Schemas/UpdateAssistantDraftDtoHooksItem.swift new file mode 100644 index 00000000..e8bd0071 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoHooksItem.swift @@ -0,0 +1,45 @@ +import Foundation + +public enum UpdateAssistantDraftDtoHooksItem: Codable, Hashable, Sendable { + case callHookAssistantSpeechInterrupted(CallHookAssistantSpeechInterrupted) + case callHookCallEnding(CallHookCallEnding) + case callHookCustomerSpeechInterrupted(CallHookCustomerSpeechInterrupted) + case callHookCustomerSpeechTimeout(CallHookCustomerSpeechTimeout) + case sessionCreatedHook(SessionCreatedHook) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(CallHookAssistantSpeechInterrupted.self) { + self = .callHookAssistantSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCallEnding.self) { + self = .callHookCallEnding(value) + } else if let value = try? container.decode(CallHookCustomerSpeechInterrupted.self) { + self = .callHookCustomerSpeechInterrupted(value) + } else if let value = try? container.decode(CallHookCustomerSpeechTimeout.self) { + self = .callHookCustomerSpeechTimeout(value) + } else if let value = try? container.decode(SessionCreatedHook.self) { + self = .sessionCreatedHook(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .callHookAssistantSpeechInterrupted(let value): + try container.encode(value) + case .callHookCallEnding(let value): + try container.encode(value) + case .callHookCustomerSpeechInterrupted(let value): + try container.encode(value) + case .callHookCustomerSpeechTimeout(let value): + try container.encode(value) + case .sessionCreatedHook(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoModel.swift b/Sources/Schemas/UpdateAssistantDraftDtoModel.swift new file mode 100644 index 00000000..93a42792 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoModel.swift @@ -0,0 +1,131 @@ +import Foundation + +/// These are the options for the assistant's LLM. +public enum UpdateAssistantDraftDtoModel: Codable, Hashable, Sendable { + case anthropic(AnthropicModel) + case anthropicBedrock(AnthropicBedrockModel) + case anyscale(AnyscaleModel) + case cerebras(CerebrasModel) + case customLlm(CustomLlmModel) + case deepinfra(DeepInfraModel) + case deepSeek(DeepSeekModel) + case google(GoogleModel) + case groq(GroqModel) + case inflectionAi(InflectionAiModel) + case minimax(MinimaxLlmModel) + case openai(OpenAiModel) + case openrouter(OpenRouterModel) + case perplexityAi(PerplexityAiModel) + case togetherAi(TogetherAiModel) + case vapi(VapiModel) + case xai(XaiModel) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "anthropic": + self = .anthropic(try AnthropicModel(from: decoder)) + case "anthropic-bedrock": + self = .anthropicBedrock(try AnthropicBedrockModel(from: decoder)) + case "anyscale": + self = .anyscale(try AnyscaleModel(from: decoder)) + case "cerebras": + self = .cerebras(try CerebrasModel(from: decoder)) + case "custom-llm": + self = .customLlm(try CustomLlmModel(from: decoder)) + case "deepinfra": + self = .deepinfra(try DeepInfraModel(from: decoder)) + case "deep-seek": + self = .deepSeek(try DeepSeekModel(from: decoder)) + case "google": + self = .google(try GoogleModel(from: decoder)) + case "groq": + self = .groq(try GroqModel(from: decoder)) + case "inflection-ai": + self = .inflectionAi(try InflectionAiModel(from: decoder)) + case "minimax": + self = .minimax(try MinimaxLlmModel(from: decoder)) + case "openai": + self = .openai(try OpenAiModel(from: decoder)) + case "openrouter": + self = .openrouter(try OpenRouterModel(from: decoder)) + case "perplexity-ai": + self = .perplexityAi(try PerplexityAiModel(from: decoder)) + case "together-ai": + self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) + case "xai": + self = .xai(try XaiModel(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .anthropic(let data): + try container.encode("anthropic", forKey: .provider) + try data.encode(to: encoder) + case .anthropicBedrock(let data): + try container.encode("anthropic-bedrock", forKey: .provider) + try data.encode(to: encoder) + case .anyscale(let data): + try container.encode("anyscale", forKey: .provider) + try data.encode(to: encoder) + case .cerebras(let data): + try container.encode("cerebras", forKey: .provider) + try data.encode(to: encoder) + case .customLlm(let data): + try container.encode("custom-llm", forKey: .provider) + try data.encode(to: encoder) + case .deepinfra(let data): + try container.encode("deepinfra", forKey: .provider) + try data.encode(to: encoder) + case .deepSeek(let data): + try container.encode("deep-seek", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .groq(let data): + try container.encode("groq", forKey: .provider) + try data.encode(to: encoder) + case .inflectionAi(let data): + try container.encode("inflection-ai", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .openrouter(let data): + try container.encode("openrouter", forKey: .provider) + try data.encode(to: encoder) + case .perplexityAi(let data): + try container.encode("perplexity-ai", forKey: .provider) + try data.encode(to: encoder) + case .togetherAi(let data): + try container.encode("together-ai", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoServerMessagesItem.swift b/Sources/Schemas/UpdateAssistantDraftDtoServerMessagesItem.swift new file mode 100644 index 00000000..0328d7dd --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoServerMessagesItem.swift @@ -0,0 +1,31 @@ +import Foundation + +public enum UpdateAssistantDraftDtoServerMessagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case assistantStarted = "assistant.started" + case assistantSpeechStarted = "assistant.speechStarted" + case conversationUpdate = "conversation-update" + case endOfCallReport = "end-of-call-report" + case functionCall = "function-call" + case hang + case languageChanged = "language-changed" + case languageChangeDetected = "language-change-detected" + case modelOutput = "model-output" + case phoneCallControl = "phone-call-control" + case speechUpdate = "speech-update" + case statusUpdate = "status-update" + case transcript + case transcriptTranscriptTypeFinal = "transcript[transcriptType=\"final\"]" + case toolCalls = "tool-calls" + case transferDestinationRequest = "transfer-destination-request" + case handoffDestinationRequest = "handoff-destination-request" + case transferUpdate = "transfer-update" + case userInterrupted = "user-interrupted" + case voiceInput = "voice-input" + case chatCreated = "chat.created" + case chatDeleted = "chat.deleted" + case sessionCreated = "session.created" + case sessionUpdated = "session.updated" + case sessionDeleted = "session.deleted" + case callDeleted = "call.deleted" + case callDeleteFailed = "call.delete.failed" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoTranscriber.swift b/Sources/Schemas/UpdateAssistantDraftDtoTranscriber.swift new file mode 100644 index 00000000..b12de847 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoTranscriber.swift @@ -0,0 +1,113 @@ +import Foundation + +/// These are the options for the assistant's transcriber. +public enum UpdateAssistantDraftDtoTranscriber: Codable, Hashable, Sendable { + case assemblyAi(AssemblyAiTranscriber) + case azure(AzureSpeechTranscriber) + case cartesia(CartesiaTranscriber) + case customTranscriber(CustomTranscriber) + case deepgram(DeepgramTranscriber) + case elevenLabs(ElevenLabsTranscriber) + case gladia(GladiaTranscriber) + case google(GoogleTranscriber) + case openai(OpenAiTranscriber) + case soniox(SonioxTranscriber) + case speechmatics(SpeechmaticsTranscriber) + case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "assembly-ai": + self = .assemblyAi(try AssemblyAiTranscriber(from: decoder)) + case "azure": + self = .azure(try AzureSpeechTranscriber(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaTranscriber(from: decoder)) + case "custom-transcriber": + self = .customTranscriber(try CustomTranscriber(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramTranscriber(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsTranscriber(from: decoder)) + case "gladia": + self = .gladia(try GladiaTranscriber(from: decoder)) + case "google": + self = .google(try GoogleTranscriber(from: decoder)) + case "openai": + self = .openai(try OpenAiTranscriber(from: decoder)) + case "soniox": + self = .soniox(try SonioxTranscriber(from: decoder)) + case "speechmatics": + self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) + case "talkscriber": + self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .assemblyAi(let data): + try container.encode("assembly-ai", forKey: .provider) + try data.encode(to: encoder) + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customTranscriber(let data): + try container.encode("custom-transcriber", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .gladia(let data): + try container.encode("gladia", forKey: .provider) + try data.encode(to: encoder) + case .google(let data): + try container.encode("google", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .soniox(let data): + try container.encode("soniox", forKey: .provider) + try data.encode(to: encoder) + case .speechmatics(let data): + try container.encode("speechmatics", forKey: .provider) + try data.encode(to: encoder) + case .talkscriber(let data): + try container.encode("talkscriber", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoVoice.swift b/Sources/Schemas/UpdateAssistantDraftDtoVoice.swift new file mode 100644 index 00000000..1ddbede3 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoVoice.swift @@ -0,0 +1,149 @@ +import Foundation + +/// These are the options for the assistant's voice. +public enum UpdateAssistantDraftDtoVoice: Codable, Hashable, Sendable { + case azure(AzureVoice) + case cartesia(CartesiaVoice) + case customVoice(CustomVoice) + case deepgram(DeepgramVoice) + case elevenLabs(ElevenLabsVoice) + case hume(HumeVoice) + case inworld(InworldVoice) + case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) + case minimax(MinimaxVoice) + case neuphonic(NeuphonicVoice) + case openai(OpenAiVoice) + case playht(PlayHtVoice) + case rimeAi(RimeAiVoice) + case sesame(SesameVoice) + case smallestAi(SmallestAiVoice) + case tavus(TavusVoice) + case vapi(VapiVoice) + case wellsaid(WellSaidVoice) + case xai(XaiVoice) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .provider) + switch discriminant { + case "azure": + self = .azure(try AzureVoice(from: decoder)) + case "cartesia": + self = .cartesia(try CartesiaVoice(from: decoder)) + case "custom-voice": + self = .customVoice(try CustomVoice(from: decoder)) + case "deepgram": + self = .deepgram(try DeepgramVoice(from: decoder)) + case "11labs": + self = .elevenLabs(try ElevenLabsVoice(from: decoder)) + case "hume": + self = .hume(try HumeVoice(from: decoder)) + case "inworld": + self = .inworld(try InworldVoice(from: decoder)) + case "lmnt": + self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) + case "minimax": + self = .minimax(try MinimaxVoice(from: decoder)) + case "neuphonic": + self = .neuphonic(try NeuphonicVoice(from: decoder)) + case "openai": + self = .openai(try OpenAiVoice(from: decoder)) + case "playht": + self = .playht(try PlayHtVoice(from: decoder)) + case "rime-ai": + self = .rimeAi(try RimeAiVoice(from: decoder)) + case "sesame": + self = .sesame(try SesameVoice(from: decoder)) + case "smallest-ai": + self = .smallestAi(try SmallestAiVoice(from: decoder)) + case "tavus": + self = .tavus(try TavusVoice(from: decoder)) + case "vapi": + self = .vapi(try VapiVoice(from: decoder)) + case "wellsaid": + self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .azure(let data): + try container.encode("azure", forKey: .provider) + try data.encode(to: encoder) + case .cartesia(let data): + try container.encode("cartesia", forKey: .provider) + try data.encode(to: encoder) + case .customVoice(let data): + try container.encode("custom-voice", forKey: .provider) + try data.encode(to: encoder) + case .deepgram(let data): + try container.encode("deepgram", forKey: .provider) + try data.encode(to: encoder) + case .elevenLabs(let data): + try container.encode("11labs", forKey: .provider) + try data.encode(to: encoder) + case .hume(let data): + try container.encode("hume", forKey: .provider) + try data.encode(to: encoder) + case .inworld(let data): + try container.encode("inworld", forKey: .provider) + try data.encode(to: encoder) + case .lmnt(let data): + try container.encode("lmnt", forKey: .provider) + try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) + case .minimax(let data): + try container.encode("minimax", forKey: .provider) + try data.encode(to: encoder) + case .neuphonic(let data): + try container.encode("neuphonic", forKey: .provider) + try data.encode(to: encoder) + case .openai(let data): + try container.encode("openai", forKey: .provider) + try data.encode(to: encoder) + case .playht(let data): + try container.encode("playht", forKey: .provider) + try data.encode(to: encoder) + case .rimeAi(let data): + try container.encode("rime-ai", forKey: .provider) + try data.encode(to: encoder) + case .sesame(let data): + try container.encode("sesame", forKey: .provider) + try data.encode(to: encoder) + case .smallestAi(let data): + try container.encode("smallest-ai", forKey: .provider) + try data.encode(to: encoder) + case .tavus(let data): + try container.encode("tavus", forKey: .provider) + try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .wellsaid(let data): + try container.encode("wellsaid", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetection.swift b/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetection.swift new file mode 100644 index 00000000..8486236f --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetection.swift @@ -0,0 +1,47 @@ +import Foundation + +/// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. +/// By default, voicemail detection is disabled. +public enum UpdateAssistantDraftDtoVoicemailDetection: Codable, Hashable, Sendable { + case googleVoicemailDetectionPlan(GoogleVoicemailDetectionPlan) + case openAiVoicemailDetectionPlan(OpenAiVoicemailDetectionPlan) + case twilioVoicemailDetectionPlan(TwilioVoicemailDetectionPlan) + case updateAssistantDraftDtoVoicemailDetectionZero(UpdateAssistantDraftDtoVoicemailDetectionZero) + case vapiVoicemailDetectionPlan(VapiVoicemailDetectionPlan) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(GoogleVoicemailDetectionPlan.self) { + self = .googleVoicemailDetectionPlan(value) + } else if let value = try? container.decode(OpenAiVoicemailDetectionPlan.self) { + self = .openAiVoicemailDetectionPlan(value) + } else if let value = try? container.decode(TwilioVoicemailDetectionPlan.self) { + self = .twilioVoicemailDetectionPlan(value) + } else if let value = try? container.decode(UpdateAssistantDraftDtoVoicemailDetectionZero.self) { + self = .updateAssistantDraftDtoVoicemailDetectionZero(value) + } else if let value = try? container.decode(VapiVoicemailDetectionPlan.self) { + self = .vapiVoicemailDetectionPlan(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .googleVoicemailDetectionPlan(let value): + try container.encode(value) + case .openAiVoicemailDetectionPlan(let value): + try container.encode(value) + case .twilioVoicemailDetectionPlan(let value): + try container.encode(value) + case .updateAssistantDraftDtoVoicemailDetectionZero(let value): + try container.encode(value) + case .vapiVoicemailDetectionPlan(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetectionZero.swift b/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetectionZero.swift new file mode 100644 index 00000000..8cfd0e61 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantDraftDtoVoicemailDetectionZero.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAssistantDraftDtoVoicemailDetectionZero: String, Codable, Hashable, CaseIterable, Sendable { + case off +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAssistantDtoCredentialsItem.swift b/Sources/Schemas/UpdateAssistantDtoCredentialsItem.swift index ecb24b41..9b3ddda9 100644 --- a/Sources/Schemas/UpdateAssistantDtoCredentialsItem.swift +++ b/Sources/Schemas/UpdateAssistantDtoCredentialsItem.swift @@ -33,6 +33,7 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum UpdateAssistantDtoCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/UpdateAssistantDtoModel.swift b/Sources/Schemas/UpdateAssistantDtoModel.swift index 8f502549..cb3fb7c5 100644 --- a/Sources/Schemas/UpdateAssistantDtoModel.swift +++ b/Sources/Schemas/UpdateAssistantDtoModel.swift @@ -17,6 +17,7 @@ public enum UpdateAssistantDtoModel: Codable, Hashable, Sendable { case openrouter(OpenRouterModel) case perplexityAi(PerplexityAiModel) case togetherAi(TogetherAiModel) + case vapi(VapiModel) case xai(XaiModel) public init(from decoder: Decoder) throws { @@ -53,6 +54,8 @@ public enum UpdateAssistantDtoModel: Codable, Hashable, Sendable { self = .perplexityAi(try PerplexityAiModel(from: decoder)) case "together-ai": self = .togetherAi(try TogetherAiModel(from: decoder)) + case "vapi": + self = .vapi(try VapiModel(from: decoder)) case "xai": self = .xai(try XaiModel(from: decoder)) default: @@ -113,6 +116,9 @@ public enum UpdateAssistantDtoModel: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) case .xai(let data): try container.encode("xai", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/UpdateAssistantDtoTranscriber.swift b/Sources/Schemas/UpdateAssistantDtoTranscriber.swift index 16eacd9a..816dca52 100644 --- a/Sources/Schemas/UpdateAssistantDtoTranscriber.swift +++ b/Sources/Schemas/UpdateAssistantDtoTranscriber.swift @@ -14,6 +14,8 @@ public enum UpdateAssistantDtoTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,10 @@ public enum UpdateAssistantDtoTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -92,6 +98,12 @@ public enum UpdateAssistantDtoTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/UpdateAssistantDtoVoice.swift b/Sources/Schemas/UpdateAssistantDtoVoice.swift index d6104244..db87b2b9 100644 --- a/Sources/Schemas/UpdateAssistantDtoVoice.swift +++ b/Sources/Schemas/UpdateAssistantDtoVoice.swift @@ -10,6 +10,7 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -20,6 +21,7 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -41,6 +43,8 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -61,6 +65,8 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -98,6 +104,9 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -128,6 +137,9 @@ public enum UpdateAssistantDtoVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/UpdateAssistantVersionMetadataDto.swift b/Sources/Schemas/UpdateAssistantVersionMetadataDto.swift new file mode 100644 index 00000000..b54e6bd8 --- /dev/null +++ b/Sources/Schemas/UpdateAssistantVersionMetadataDto.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct UpdateAssistantVersionMetadataDto: Codable, Hashable, Sendable { + /// Optional human-readable label for this version. Pass `null` to clear. + public let versionName: Nullable? + /// Optional description for this version. Pass `null` to clear. + public let versionDescription: Nullable? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + versionName: Nullable? = nil, + versionDescription: Nullable? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.versionName = versionName + self.versionDescription = versionDescription + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.versionName = try container.decodeNullableIfPresent(String.self, forKey: .versionName) + self.versionDescription = try container.decodeNullableIfPresent(String.self, forKey: .versionDescription) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.versionName, forKey: .versionName) + try container.encodeNullableIfPresent(self.versionDescription, forKey: .versionDescription) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case versionName + case versionDescription + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAzureCredentialDto.swift b/Sources/Schemas/UpdateAzureCredentialDto.swift index 1a8937ed..6eeceff2 100644 --- a/Sources/Schemas/UpdateAzureCredentialDto.swift +++ b/Sources/Schemas/UpdateAzureCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAzureCredentialDtoProvider? /// This is the service being used in Azure. public let service: UpdateAzureCredentialDtoService? /// This is the region of the Azure resource. @@ -17,6 +18,7 @@ public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAzureCredentialDtoProvider? = nil, service: UpdateAzureCredentialDtoService? = nil, region: UpdateAzureCredentialDtoRegion? = nil, apiKey: String? = nil, @@ -25,6 +27,7 @@ public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { bucketPlan: AzureBlobStorageBucketPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.service = service self.region = region self.apiKey = apiKey @@ -36,6 +39,7 @@ public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAzureCredentialDtoProvider.self, forKey: .provider) self.service = try container.decodeIfPresent(UpdateAzureCredentialDtoService.self, forKey: .service) self.region = try container.decodeIfPresent(UpdateAzureCredentialDtoRegion.self, forKey: .region) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) @@ -48,6 +52,7 @@ public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.service, forKey: .service) try container.encodeIfPresent(self.region, forKey: .region) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) @@ -58,6 +63,7 @@ public struct UpdateAzureCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case service case region case apiKey diff --git a/Sources/Schemas/UpdateAzureCredentialDtoProvider.swift b/Sources/Schemas/UpdateAzureCredentialDtoProvider.swift new file mode 100644 index 00000000..e115e683 --- /dev/null +++ b/Sources/Schemas/UpdateAzureCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAzureCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case azure +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAzureCredentialDtoRegion.swift b/Sources/Schemas/UpdateAzureCredentialDtoRegion.swift index 054f2891..0c95c3ae 100644 --- a/Sources/Schemas/UpdateAzureCredentialDtoRegion.swift +++ b/Sources/Schemas/UpdateAzureCredentialDtoRegion.swift @@ -20,6 +20,8 @@ public enum UpdateAzureCredentialDtoRegion: String, Codable, Hashable, CaseItera case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/UpdateAzureOpenAiCredentialDto.swift b/Sources/Schemas/UpdateAzureOpenAiCredentialDto.swift index e1dd89ad..42a6b109 100644 --- a/Sources/Schemas/UpdateAzureOpenAiCredentialDto.swift +++ b/Sources/Schemas/UpdateAzureOpenAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateAzureOpenAiCredentialDtoProvider? public let region: UpdateAzureOpenAiCredentialDtoRegion? public let models: [UpdateAzureOpenAiCredentialDtoModelsItem]? /// This is not returned in the API. @@ -14,6 +15,7 @@ public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateAzureOpenAiCredentialDtoProvider? = nil, region: UpdateAzureOpenAiCredentialDtoRegion? = nil, models: [UpdateAzureOpenAiCredentialDtoModelsItem]? = nil, openAiKey: String? = nil, @@ -22,6 +24,7 @@ public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { openAiEndpoint: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.region = region self.models = models self.openAiKey = openAiKey @@ -33,6 +36,7 @@ public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateAzureOpenAiCredentialDtoProvider.self, forKey: .provider) self.region = try container.decodeIfPresent(UpdateAzureOpenAiCredentialDtoRegion.self, forKey: .region) self.models = try container.decodeIfPresent([UpdateAzureOpenAiCredentialDtoModelsItem].self, forKey: .models) self.openAiKey = try container.decodeIfPresent(String.self, forKey: .openAiKey) @@ -45,6 +49,7 @@ public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.region, forKey: .region) try container.encodeIfPresent(self.models, forKey: .models) try container.encodeIfPresent(self.openAiKey, forKey: .openAiKey) @@ -55,6 +60,7 @@ public struct UpdateAzureOpenAiCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case region case models case openAiKey = "openAIKey" diff --git a/Sources/Schemas/UpdateAzureOpenAiCredentialDtoModelsItem.swift b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoModelsItem.swift index fcfeed4b..9d711044 100644 --- a/Sources/Schemas/UpdateAzureOpenAiCredentialDtoModelsItem.swift +++ b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoModelsItem.swift @@ -24,4 +24,7 @@ public enum UpdateAzureOpenAiCredentialDtoModelsItem: String, Codable, Hashable, case gpt40613 = "gpt-4-0613" case gpt35Turbo0125 = "gpt-35-turbo-0125" case gpt35Turbo1106 = "gpt-35-turbo-1106" + case gpt4O = "gpt-4o" + case gpt41 = "gpt-4.1" + case gpt54Mini20260317 = "gpt-5.4-mini-2026-03-17" } \ No newline at end of file diff --git a/Sources/Schemas/UpdateAzureOpenAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoProvider.swift new file mode 100644 index 00000000..fd06d655 --- /dev/null +++ b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateAzureOpenAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case azureOpenai = "azure-openai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateAzureOpenAiCredentialDtoRegion.swift b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoRegion.swift index a2a61b50..7206dd88 100644 --- a/Sources/Schemas/UpdateAzureOpenAiCredentialDtoRegion.swift +++ b/Sources/Schemas/UpdateAzureOpenAiCredentialDtoRegion.swift @@ -19,6 +19,8 @@ public enum UpdateAzureOpenAiCredentialDtoRegion: String, Codable, Hashable, Cas case spaincentral case swedencentral case switzerland + case switzerlandnorth + case switzerlandwest case uaenorth case uk case westeurope diff --git a/Sources/Schemas/UpdateBarInsightFromCallTableDto.swift b/Sources/Schemas/UpdateBarInsightFromCallTableDto.swift index 636636b9..9b1e24ce 100644 --- a/Sources/Schemas/UpdateBarInsightFromCallTableDto.swift +++ b/Sources/Schemas/UpdateBarInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a bar-chart insight, including its queries, formulas, grouping, time range, metadata, and name. public struct UpdateBarInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct UpdateBarInsightFromCallTableDto: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: BarInsightMetadata? + /// The time range and interval used to aggregate the bar-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/UpdateBashToolDto.swift b/Sources/Schemas/UpdateBashToolDto.swift index fafeeba5..d8877a4e 100644 --- a/Sources/Schemas/UpdateBashToolDto.swift +++ b/Sources/Schemas/UpdateBashToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a Bash tool, including its name, environment subtype, server, messages, and rejection plan. public struct UpdateBashToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateBashToolDtoMessagesItem]? /// The sub type of tool. public let subType: UpdateBashToolDtoSubType? diff --git a/Sources/Schemas/UpdateBoardDtoItemsItem.swift b/Sources/Schemas/UpdateBoardDtoItemsItem.swift new file mode 100644 index 00000000..e5d630ad --- /dev/null +++ b/Sources/Schemas/UpdateBoardDtoItemsItem.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum UpdateBoardDtoItemsItem: Codable, Hashable, Sendable { + case boardInsightItem(BoardInsightItem) + case boardMetricWidgetItem(BoardMetricWidgetItem) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(BoardInsightItem.self) { + self = .boardInsightItem(value) + } else if let value = try? container.decode(BoardMetricWidgetItem.self) { + self = .boardMetricWidgetItem(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .boardInsightItem(let value): + try container.encode(value) + case .boardMetricWidgetItem(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateByoPhoneNumberDto.swift b/Sources/Schemas/UpdateByoPhoneNumberDto.swift index 324bb519..3fcb936d 100644 --- a/Sources/Schemas/UpdateByoPhoneNumberDto.swift +++ b/Sources/Schemas/UpdateByoPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a bring-your-own phone number, including its credential, number, routing, hooks, and server settings. public struct UpdateByoPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/UpdateByoSipTrunkCredentialDto.swift b/Sources/Schemas/UpdateByoSipTrunkCredentialDto.swift index b78df030..9d7622b6 100644 --- a/Sources/Schemas/UpdateByoSipTrunkCredentialDto.swift +++ b/Sources/Schemas/UpdateByoSipTrunkCredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { + /// This can be used to bring your own SIP trunks or to connect to a Carrier. + public let provider: UpdateByoSipTrunkCredentialDtoProvider? /// This is the name of credential. This is just for your reference. public let name: String? /// This is the list of SIP trunk's gateways. @@ -18,63 +20,61 @@ public struct UpdateByoSipTrunkCredentialDto: Codable, Hashable, Sendable { public let techPrefix: String? /// This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property. public let sipDiversionHeader: String? - /// This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC provided by Vapi. - public let sbcConfiguration: SbcConfiguration? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + provider: UpdateByoSipTrunkCredentialDtoProvider? = nil, name: String? = nil, gateways: [SipTrunkGateway]? = nil, outboundAuthenticationPlan: SipTrunkOutboundAuthenticationPlan? = nil, outboundLeadingPlusEnabled: Bool? = nil, techPrefix: String? = nil, sipDiversionHeader: String? = nil, - sbcConfiguration: SbcConfiguration? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.name = name self.gateways = gateways self.outboundAuthenticationPlan = outboundAuthenticationPlan self.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled self.techPrefix = techPrefix self.sipDiversionHeader = sipDiversionHeader - self.sbcConfiguration = sbcConfiguration self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateByoSipTrunkCredentialDtoProvider.self, forKey: .provider) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.gateways = try container.decodeIfPresent([SipTrunkGateway].self, forKey: .gateways) self.outboundAuthenticationPlan = try container.decodeIfPresent(SipTrunkOutboundAuthenticationPlan.self, forKey: .outboundAuthenticationPlan) self.outboundLeadingPlusEnabled = try container.decodeIfPresent(Bool.self, forKey: .outboundLeadingPlusEnabled) self.techPrefix = try container.decodeIfPresent(String.self, forKey: .techPrefix) self.sipDiversionHeader = try container.decodeIfPresent(String.self, forKey: .sipDiversionHeader) - self.sbcConfiguration = try container.decodeIfPresent(SbcConfiguration.self, forKey: .sbcConfiguration) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.gateways, forKey: .gateways) try container.encodeIfPresent(self.outboundAuthenticationPlan, forKey: .outboundAuthenticationPlan) try container.encodeIfPresent(self.outboundLeadingPlusEnabled, forKey: .outboundLeadingPlusEnabled) try container.encodeIfPresent(self.techPrefix, forKey: .techPrefix) try container.encodeIfPresent(self.sipDiversionHeader, forKey: .sipDiversionHeader) - try container.encodeIfPresent(self.sbcConfiguration, forKey: .sbcConfiguration) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case name case gateways case outboundAuthenticationPlan case outboundLeadingPlusEnabled case techPrefix case sipDiversionHeader - case sbcConfiguration } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateByoSipTrunkCredentialDtoProvider.swift b/Sources/Schemas/UpdateByoSipTrunkCredentialDtoProvider.swift new file mode 100644 index 00000000..a9179570 --- /dev/null +++ b/Sources/Schemas/UpdateByoSipTrunkCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This can be used to bring your own SIP trunks or to connect to a Carrier. +public enum UpdateByoSipTrunkCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case byoSipTrunk = "byo-sip-trunk" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCampaignDto.swift b/Sources/Schemas/UpdateCampaignDto.swift new file mode 100644 index 00000000..ee69a6d2 --- /dev/null +++ b/Sources/Schemas/UpdateCampaignDto.swift @@ -0,0 +1,90 @@ +import Foundation + +/// Fields used to update an outbound calling campaign, including its name, status, calling resource, phone-number or dial-plan settings, and schedule. +public struct UpdateCampaignDto: Codable, Hashable, Sendable { + /// This is the name of the campaign. This is just for your own reference. + public let name: String? + /// This is the assistant ID that will be used for the campaign calls. + /// Can only be updated if campaign is not in progress or has ended. + public let assistantId: String? + /// This is the workflow ID that will be used for the campaign calls. + /// Can only be updated if campaign is not in progress or has ended. + public let workflowId: String? + /// This is the squad ID that will be used for the campaign calls. + /// Can only be updated if campaign is not in progress or has ended. + public let squadId: String? + /// This is the phone number ID that will be used for the campaign calls. + /// Can only be updated if campaign is not in progress or has ended. + /// Note: `phoneNumberId` and `dialPlan` are mutually exclusive. + public let phoneNumberId: String? + /// This is a list of dial entries, each specifying a phone number and the customers to call using that number. Can only be updated if campaign is not in progress or has ended. Note: phoneNumberId and dialPlan are mutually exclusive. + public let dialPlan: [DialPlanEntry]? + /// This is the schedule plan for the campaign. + /// Can only be updated if campaign is not in progress or has ended. + public let schedulePlan: SchedulePlan? + /// Set to 'cancelled' to stop the campaign ('ended' is a V1 alias). Scheduled + /// calls are deleted; in-progress calls are allowed to finish. + public let status: UpdateCampaignDtoStatus? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + name: String? = nil, + assistantId: String? = nil, + workflowId: String? = nil, + squadId: String? = nil, + phoneNumberId: String? = nil, + dialPlan: [DialPlanEntry]? = nil, + schedulePlan: SchedulePlan? = nil, + status: UpdateCampaignDtoStatus? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.name = name + self.assistantId = assistantId + self.workflowId = workflowId + self.squadId = squadId + self.phoneNumberId = phoneNumberId + self.dialPlan = dialPlan + self.schedulePlan = schedulePlan + self.status = status + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.assistantId = try container.decodeIfPresent(String.self, forKey: .assistantId) + self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) + self.squadId = try container.decodeIfPresent(String.self, forKey: .squadId) + self.phoneNumberId = try container.decodeIfPresent(String.self, forKey: .phoneNumberId) + self.dialPlan = try container.decodeIfPresent([DialPlanEntry].self, forKey: .dialPlan) + self.schedulePlan = try container.decodeIfPresent(SchedulePlan.self, forKey: .schedulePlan) + self.status = try container.decodeIfPresent(UpdateCampaignDtoStatus.self, forKey: .status) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.assistantId, forKey: .assistantId) + try container.encodeIfPresent(self.workflowId, forKey: .workflowId) + try container.encodeIfPresent(self.squadId, forKey: .squadId) + try container.encodeIfPresent(self.phoneNumberId, forKey: .phoneNumberId) + try container.encodeIfPresent(self.dialPlan, forKey: .dialPlan) + try container.encodeIfPresent(self.schedulePlan, forKey: .schedulePlan) + try container.encodeIfPresent(self.status, forKey: .status) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case name + case assistantId + case workflowId + case squadId + case phoneNumberId + case dialPlan + case schedulePlan + case status + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCampaignDtoStatus.swift b/Sources/Schemas/UpdateCampaignDtoStatus.swift index 52da0c0b..94eea113 100644 --- a/Sources/Schemas/UpdateCampaignDtoStatus.swift +++ b/Sources/Schemas/UpdateCampaignDtoStatus.swift @@ -1,8 +1,8 @@ import Foundation -/// This is the status of the campaign. -/// Can only be updated to 'ended' if you want to end the campaign. -/// When set to 'ended', it will delete all scheduled calls. Calls in progress will be allowed to complete. +/// Set to 'cancelled' to stop the campaign ('ended' is a V1 alias). Scheduled +/// calls are deleted; in-progress calls are allowed to finish. public enum UpdateCampaignDtoStatus: String, Codable, Hashable, CaseIterable, Sendable { case ended + case cancelled } \ No newline at end of file diff --git a/Sources/Schemas/UpdateCartesiaCredentialDto.swift b/Sources/Schemas/UpdateCartesiaCredentialDto.swift index 495ee36c..346b6bc2 100644 --- a/Sources/Schemas/UpdateCartesiaCredentialDto.swift +++ b/Sources/Schemas/UpdateCartesiaCredentialDto.swift @@ -1,40 +1,53 @@ import Foundation public struct UpdateCartesiaCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateCartesiaCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. public let name: String? + /// This can be used to point to an onprem Cartesia instance. Defaults to api.cartesia.ai. + public let apiUrl: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCartesiaCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, + apiUrl: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name + self.apiUrl = apiUrl self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCartesiaCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name + case apiUrl } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateCartesiaCredentialDtoProvider.swift b/Sources/Schemas/UpdateCartesiaCredentialDtoProvider.swift new file mode 100644 index 00000000..c2db7490 --- /dev/null +++ b/Sources/Schemas/UpdateCartesiaCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateCartesiaCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case cartesia +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCerebrasCredentialDto.swift b/Sources/Schemas/UpdateCerebrasCredentialDto.swift index 305f6ed7..47c0752e 100644 --- a/Sources/Schemas/UpdateCerebrasCredentialDto.swift +++ b/Sources/Schemas/UpdateCerebrasCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateCerebrasCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateCerebrasCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateCerebrasCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCerebrasCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateCerebrasCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCerebrasCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateCerebrasCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateCerebrasCredentialDtoProvider.swift b/Sources/Schemas/UpdateCerebrasCredentialDtoProvider.swift new file mode 100644 index 00000000..719fd638 --- /dev/null +++ b/Sources/Schemas/UpdateCerebrasCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateCerebrasCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case cerebras +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCloudflareCredentialDto.swift b/Sources/Schemas/UpdateCloudflareCredentialDto.swift index 78fb49df..9ebbb4c0 100644 --- a/Sources/Schemas/UpdateCloudflareCredentialDto.swift +++ b/Sources/Schemas/UpdateCloudflareCredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { + /// Credential provider. Only allowed value is cloudflare + public let provider: UpdateCloudflareCredentialDtoProvider? /// Cloudflare Account Id. public let accountId: String? /// Cloudflare API Key / Token. @@ -17,6 +19,7 @@ public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCloudflareCredentialDtoProvider? = nil, accountId: String? = nil, apiKey: String? = nil, accountEmail: String? = nil, @@ -25,6 +28,7 @@ public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { bucketPlan: CloudflareR2BucketPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.accountId = accountId self.apiKey = apiKey self.accountEmail = accountEmail @@ -36,6 +40,7 @@ public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCloudflareCredentialDtoProvider.self, forKey: .provider) self.accountId = try container.decodeIfPresent(String.self, forKey: .accountId) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.accountEmail = try container.decodeIfPresent(String.self, forKey: .accountEmail) @@ -48,6 +53,7 @@ public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.accountId, forKey: .accountId) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.accountEmail, forKey: .accountEmail) @@ -58,6 +64,7 @@ public struct UpdateCloudflareCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case accountId case apiKey case accountEmail diff --git a/Sources/Schemas/UpdateCloudflareCredentialDtoProvider.swift b/Sources/Schemas/UpdateCloudflareCredentialDtoProvider.swift new file mode 100644 index 00000000..e2ad067d --- /dev/null +++ b/Sources/Schemas/UpdateCloudflareCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// Credential provider. Only allowed value is cloudflare +public enum UpdateCloudflareCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case cloudflare +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCodeToolDto.swift b/Sources/Schemas/UpdateCodeToolDto.swift index dc5054f5..b52bd440 100644 --- a/Sources/Schemas/UpdateCodeToolDto.swift +++ b/Sources/Schemas/UpdateCodeToolDto.swift @@ -1,10 +1,10 @@ import Foundation public struct UpdateCodeToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateCodeToolDtoMessagesItem]? + /// The type of tool. "code" for Code tool. + public let type: UpdateCodeToolDtoType? /// This determines if the tool is async. /// /// If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. @@ -125,6 +125,7 @@ public struct UpdateCodeToolDto: Codable, Hashable, Sendable { public init( messages: [UpdateCodeToolDtoMessagesItem]? = nil, + type: UpdateCodeToolDtoType? = nil, async: Bool? = nil, server: Server? = nil, code: String? = nil, @@ -137,6 +138,7 @@ public struct UpdateCodeToolDto: Codable, Hashable, Sendable { additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.type = type self.async = async self.server = server self.code = code @@ -152,6 +154,7 @@ public struct UpdateCodeToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([UpdateCodeToolDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(UpdateCodeToolDtoType.self, forKey: .type) self.async = try container.decodeIfPresent(Bool.self, forKey: .async) self.server = try container.decodeIfPresent(Server.self, forKey: .server) self.code = try container.decodeIfPresent(String.self, forKey: .code) @@ -168,6 +171,7 @@ public struct UpdateCodeToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) try container.encodeIfPresent(self.async, forKey: .async) try container.encodeIfPresent(self.server, forKey: .server) try container.encodeIfPresent(self.code, forKey: .code) @@ -182,6 +186,7 @@ public struct UpdateCodeToolDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case type case async case server case code diff --git a/Sources/Schemas/UpdateCodeToolDtoType.swift b/Sources/Schemas/UpdateCodeToolDtoType.swift new file mode 100644 index 00000000..1b97404f --- /dev/null +++ b/Sources/Schemas/UpdateCodeToolDtoType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The type of tool. "code" for Code tool. +public enum UpdateCodeToolDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case code +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateComputerToolDto.swift b/Sources/Schemas/UpdateComputerToolDto.swift index 7ba4621c..26e30a47 100644 --- a/Sources/Schemas/UpdateComputerToolDto.swift +++ b/Sources/Schemas/UpdateComputerToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a computer tool, including its display settings, environment subtype, server, messages, and rejection plan. public struct UpdateComputerToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateComputerToolDtoMessagesItem]? /// The sub type of tool. public let subType: UpdateComputerToolDtoSubType? diff --git a/Sources/Schemas/UpdateCustomCredentialDto.swift b/Sources/Schemas/UpdateCustomCredentialDto.swift index 9698ed16..0ffb1bf5 100644 --- a/Sources/Schemas/UpdateCustomCredentialDto.swift +++ b/Sources/Schemas/UpdateCustomCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateCustomCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateCustomCredentialDtoProvider? /// This is the authentication plan. Supports OAuth2 RFC 6749, HMAC signing, and Bearer authentication. public let authenticationPlan: UpdateCustomCredentialDtoAuthenticationPlan? /// This is the encryption plan for encrypting sensitive data. Currently supports public-key encryption. @@ -11,11 +12,13 @@ public struct UpdateCustomCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCustomCredentialDtoProvider? = nil, authenticationPlan: UpdateCustomCredentialDtoAuthenticationPlan? = nil, encryptionPlan: UpdateCustomCredentialDtoEncryptionPlan? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authenticationPlan = authenticationPlan self.encryptionPlan = encryptionPlan self.name = name @@ -24,6 +27,7 @@ public struct UpdateCustomCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCustomCredentialDtoProvider.self, forKey: .provider) self.authenticationPlan = try container.decodeIfPresent(UpdateCustomCredentialDtoAuthenticationPlan.self, forKey: .authenticationPlan) self.encryptionPlan = try container.decodeIfPresent(UpdateCustomCredentialDtoEncryptionPlan.self, forKey: .encryptionPlan) self.name = try container.decodeIfPresent(String.self, forKey: .name) @@ -33,6 +37,7 @@ public struct UpdateCustomCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authenticationPlan, forKey: .authenticationPlan) try container.encodeIfPresent(self.encryptionPlan, forKey: .encryptionPlan) try container.encodeIfPresent(self.name, forKey: .name) @@ -40,6 +45,7 @@ public struct UpdateCustomCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authenticationPlan case encryptionPlan case name diff --git a/Sources/Schemas/UpdateCustomCredentialDtoProvider.swift b/Sources/Schemas/UpdateCustomCredentialDtoProvider.swift new file mode 100644 index 00000000..7887445b --- /dev/null +++ b/Sources/Schemas/UpdateCustomCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateCustomCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case customCredential = "custom-credential" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCustomKnowledgeBaseDto.swift b/Sources/Schemas/UpdateCustomKnowledgeBaseDto.swift index d9ea006a..0331fbcb 100644 --- a/Sources/Schemas/UpdateCustomKnowledgeBaseDto.swift +++ b/Sources/Schemas/UpdateCustomKnowledgeBaseDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateCustomKnowledgeBaseDto: Codable, Hashable, Sendable { + /// This knowledge base is bring your own knowledge base implementation. + public let provider: UpdateCustomKnowledgeBaseDtoProvider? /// This is where the knowledge base request will be sent. /// /// Request Example: @@ -45,15 +47,18 @@ public struct UpdateCustomKnowledgeBaseDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCustomKnowledgeBaseDtoProvider? = nil, server: Server? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.server = server self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCustomKnowledgeBaseDtoProvider.self, forKey: .provider) self.server = try container.decodeIfPresent(Server.self, forKey: .server) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -61,11 +66,13 @@ public struct UpdateCustomKnowledgeBaseDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.server, forKey: .server) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case server } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateCustomKnowledgeBaseDtoProvider.swift b/Sources/Schemas/UpdateCustomKnowledgeBaseDtoProvider.swift new file mode 100644 index 00000000..bd9c17e3 --- /dev/null +++ b/Sources/Schemas/UpdateCustomKnowledgeBaseDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This knowledge base is bring your own knowledge base implementation. +public enum UpdateCustomKnowledgeBaseDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case customKnowledgeBase = "custom-knowledge-base" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateCustomLlmCredentialDto.swift b/Sources/Schemas/UpdateCustomLlmCredentialDto.swift index b620a6b1..ead721ea 100644 --- a/Sources/Schemas/UpdateCustomLlmCredentialDto.swift +++ b/Sources/Schemas/UpdateCustomLlmCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateCustomLlmCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateCustomLlmCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey @@ -11,11 +12,13 @@ public struct UpdateCustomLlmCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateCustomLlmCredentialDtoProvider? = nil, apiKey: String? = nil, authenticationPlan: OAuth2AuthenticationPlan? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.authenticationPlan = authenticationPlan self.name = name @@ -24,6 +27,7 @@ public struct UpdateCustomLlmCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateCustomLlmCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.authenticationPlan = try container.decodeIfPresent(OAuth2AuthenticationPlan.self, forKey: .authenticationPlan) self.name = try container.decodeIfPresent(String.self, forKey: .name) @@ -33,6 +37,7 @@ public struct UpdateCustomLlmCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.authenticationPlan, forKey: .authenticationPlan) try container.encodeIfPresent(self.name, forKey: .name) @@ -40,6 +45,7 @@ public struct UpdateCustomLlmCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case authenticationPlan case name diff --git a/Sources/Schemas/UpdateCustomLlmCredentialDtoProvider.swift b/Sources/Schemas/UpdateCustomLlmCredentialDtoProvider.swift new file mode 100644 index 00000000..c5c3ea0d --- /dev/null +++ b/Sources/Schemas/UpdateCustomLlmCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateCustomLlmCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case customLlm = "custom-llm" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateDeepInfraCredentialDto.swift b/Sources/Schemas/UpdateDeepInfraCredentialDto.swift index 0fc2c490..0651f94c 100644 --- a/Sources/Schemas/UpdateDeepInfraCredentialDto.swift +++ b/Sources/Schemas/UpdateDeepInfraCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateDeepInfraCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateDeepInfraCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateDeepInfraCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateDeepInfraCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateDeepInfraCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateDeepInfraCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateDeepInfraCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateDeepInfraCredentialDtoProvider.swift b/Sources/Schemas/UpdateDeepInfraCredentialDtoProvider.swift new file mode 100644 index 00000000..eee01988 --- /dev/null +++ b/Sources/Schemas/UpdateDeepInfraCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateDeepInfraCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case deepinfra +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateDeepSeekCredentialDto.swift b/Sources/Schemas/UpdateDeepSeekCredentialDto.swift index 0c42123e..620b607c 100644 --- a/Sources/Schemas/UpdateDeepSeekCredentialDto.swift +++ b/Sources/Schemas/UpdateDeepSeekCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateDeepSeekCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateDeepSeekCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateDeepSeekCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateDeepSeekCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateDeepSeekCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateDeepSeekCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateDeepSeekCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateDeepSeekCredentialDtoProvider.swift b/Sources/Schemas/UpdateDeepSeekCredentialDtoProvider.swift new file mode 100644 index 00000000..06824c0a --- /dev/null +++ b/Sources/Schemas/UpdateDeepSeekCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateDeepSeekCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case deepSeek = "deep-seek" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateDeepgramCredentialDto.swift b/Sources/Schemas/UpdateDeepgramCredentialDto.swift index 326c296f..5f7babbf 100644 --- a/Sources/Schemas/UpdateDeepgramCredentialDto.swift +++ b/Sources/Schemas/UpdateDeepgramCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateDeepgramCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateDeepgramCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -11,11 +12,13 @@ public struct UpdateDeepgramCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateDeepgramCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, apiUrl: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.apiUrl = apiUrl @@ -24,6 +27,7 @@ public struct UpdateDeepgramCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateDeepgramCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) @@ -33,6 +37,7 @@ public struct UpdateDeepgramCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) @@ -40,6 +45,7 @@ public struct UpdateDeepgramCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name case apiUrl diff --git a/Sources/Schemas/UpdateDeepgramCredentialDtoProvider.swift b/Sources/Schemas/UpdateDeepgramCredentialDtoProvider.swift new file mode 100644 index 00000000..2d77d617 --- /dev/null +++ b/Sources/Schemas/UpdateDeepgramCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateDeepgramCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case deepgram +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateDtmfToolDto.swift b/Sources/Schemas/UpdateDtmfToolDto.swift index 8798a2ab..407c01b7 100644 --- a/Sources/Schemas/UpdateDtmfToolDto.swift +++ b/Sources/Schemas/UpdateDtmfToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a DTMF tool, including its spoken messages, rejection plan, and SIP INFO behavior. public struct UpdateDtmfToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateDtmfToolDtoMessagesItem]? /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833 (RTP events). When enabled, DTMF digits will be sent using the SIP INFO method, which can be more reliable in some network configurations. Only relevant when using the `vapi.sip` transport. public let sipInfoDtmfEnabled: Bool? diff --git a/Sources/Schemas/UpdateElevenLabsCredentialDto.swift b/Sources/Schemas/UpdateElevenLabsCredentialDto.swift index e6dba322..0232abf5 100644 --- a/Sources/Schemas/UpdateElevenLabsCredentialDto.swift +++ b/Sources/Schemas/UpdateElevenLabsCredentialDto.swift @@ -1,40 +1,46 @@ import Foundation public struct UpdateElevenLabsCredentialDto: Codable, Hashable, Sendable { + public let provider: Value? /// This is not returned in the API. public let apiKey: String? + /// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. + public let apiUrl: Nullable? /// This is the name of credential. This is just for your reference. public let name: String? - public let provider: Value? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + provider: Value? = nil, apiKey: String? = nil, + apiUrl: Nullable? = nil, name: String? = nil, - provider: Value? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey + self.apiUrl = apiUrl self.name = name - self.provider = provider self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(Value.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeNullableIfPresent(UpdateElevenLabsCredentialDtoApiUrl.self, forKey: .apiUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) - self.provider = try container.decodeIfPresent(Value.self, forKey: .provider) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) + try container.encodeNullableIfPresent(self.apiUrl, forKey: .apiUrl) try container.encodeIfPresent(self.name, forKey: .name) - try container.encodeIfPresent(self.provider, forKey: .provider) } public enum Value: String, Codable, Hashable, CaseIterable, Sendable { @@ -43,8 +49,9 @@ public struct UpdateElevenLabsCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey + case apiUrl case name - case provider } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateElevenLabsCredentialDtoApiUrl.swift b/Sources/Schemas/UpdateElevenLabsCredentialDtoApiUrl.swift new file mode 100644 index 00000000..ca0d82f5 --- /dev/null +++ b/Sources/Schemas/UpdateElevenLabsCredentialDtoApiUrl.swift @@ -0,0 +1,7 @@ +import Foundation + +/// ElevenLabs-only API environment for this key: the global endpoint or the EU data residency endpoint. In EU deployments, new credentials must explicitly use the EU data residency endpoint; existing credentials may omit this field on update to retain their saved endpoint. Outside EU deployments, Vapi detects an omitted endpoint automatically and null on update clears and re-detects the endpoint. +public enum UpdateElevenLabsCredentialDtoApiUrl: String, Codable, Hashable, CaseIterable, Sendable { + case httpsApiElevenlabsIo = "https://api.elevenlabs.io" + case httpsApiEuResidencyElevenlabsIo = "https://api.eu.residency.elevenlabs.io" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateEmailCredentialDto.swift b/Sources/Schemas/UpdateEmailCredentialDto.swift index 24734f0a..427c3463 100644 --- a/Sources/Schemas/UpdateEmailCredentialDto.swift +++ b/Sources/Schemas/UpdateEmailCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateEmailCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateEmailCredentialDtoProvider? /// The recipient email address for alerts public let email: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateEmailCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateEmailCredentialDtoProvider? = nil, email: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.email = email self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateEmailCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateEmailCredentialDtoProvider.self, forKey: .provider) self.email = try container.decodeIfPresent(String.self, forKey: .email) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateEmailCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.email, forKey: .email) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case email case name } diff --git a/Sources/Schemas/UpdateEmailCredentialDtoProvider.swift b/Sources/Schemas/UpdateEmailCredentialDtoProvider.swift new file mode 100644 index 00000000..5cd3ab3b --- /dev/null +++ b/Sources/Schemas/UpdateEmailCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateEmailCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case email +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateEndCallToolDto.swift b/Sources/Schemas/UpdateEndCallToolDto.swift index a8bbdf20..ec678c50 100644 --- a/Sources/Schemas/UpdateEndCallToolDto.swift +++ b/Sources/Schemas/UpdateEndCallToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update an end-call tool, including its spoken messages and rejection plan. public struct UpdateEndCallToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateEndCallToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateFunctionToolDto.swift b/Sources/Schemas/UpdateFunctionToolDto.swift index 039a5ae4..3528d976 100644 --- a/Sources/Schemas/UpdateFunctionToolDto.swift +++ b/Sources/Schemas/UpdateFunctionToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a custom function tool, including its function definition, server, parameters, messages, and execution behavior. public struct UpdateFunctionToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateFunctionToolDtoMessagesItem]? /// This determines if the tool is async. /// diff --git a/Sources/Schemas/UpdateGcpCredentialDto.swift b/Sources/Schemas/UpdateGcpCredentialDto.swift index 73a1f968..ae85f344 100644 --- a/Sources/Schemas/UpdateGcpCredentialDto.swift +++ b/Sources/Schemas/UpdateGcpCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGcpCredentialDtoProvider? /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. public let fallbackIndex: Double? /// This is the name of credential. This is just for your reference. @@ -16,6 +17,7 @@ public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGcpCredentialDtoProvider? = nil, fallbackIndex: Double? = nil, name: String? = nil, gcpKey: GcpKey? = nil, @@ -23,6 +25,7 @@ public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { bucketPlan: BucketPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.fallbackIndex = fallbackIndex self.name = name self.gcpKey = gcpKey @@ -33,6 +36,7 @@ public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGcpCredentialDtoProvider.self, forKey: .provider) self.fallbackIndex = try container.decodeIfPresent(Double.self, forKey: .fallbackIndex) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.gcpKey = try container.decodeIfPresent(GcpKey.self, forKey: .gcpKey) @@ -44,6 +48,7 @@ public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.fallbackIndex, forKey: .fallbackIndex) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.gcpKey, forKey: .gcpKey) @@ -53,6 +58,7 @@ public struct UpdateGcpCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case fallbackIndex case name case gcpKey diff --git a/Sources/Schemas/UpdateGcpCredentialDtoProvider.swift b/Sources/Schemas/UpdateGcpCredentialDtoProvider.swift new file mode 100644 index 00000000..238a9a4c --- /dev/null +++ b/Sources/Schemas/UpdateGcpCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGcpCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case gcp +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGhlToolDto.swift b/Sources/Schemas/UpdateGhlToolDto.swift index 26bdc546..f8c278ac 100644 --- a/Sources/Schemas/UpdateGhlToolDto.swift +++ b/Sources/Schemas/UpdateGhlToolDto.swift @@ -1,10 +1,10 @@ import Foundation public struct UpdateGhlToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGhlToolDtoMessagesItem]? + /// The type of tool. "ghl" for GHL tool. + public let type: UpdateGhlToolDtoType? /// This is the plan to reject a tool call based on the conversation state. /// /// // Example 1: Reject endCall if user didn't say goodbye @@ -90,11 +90,13 @@ public struct UpdateGhlToolDto: Codable, Hashable, Sendable { public init( messages: [UpdateGhlToolDtoMessagesItem]? = nil, + type: UpdateGhlToolDtoType? = nil, rejectionPlan: ToolRejectionPlan? = nil, metadata: GhlToolMetadata? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.type = type self.rejectionPlan = rejectionPlan self.metadata = metadata self.additionalProperties = additionalProperties @@ -103,6 +105,7 @@ public struct UpdateGhlToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([UpdateGhlToolDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(UpdateGhlToolDtoType.self, forKey: .type) self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) self.metadata = try container.decodeIfPresent(GhlToolMetadata.self, forKey: .metadata) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -112,6 +115,7 @@ public struct UpdateGhlToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) try container.encodeIfPresent(self.metadata, forKey: .metadata) } @@ -119,6 +123,7 @@ public struct UpdateGhlToolDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case type case rejectionPlan case metadata } diff --git a/Sources/Schemas/UpdateGhlToolDtoType.swift b/Sources/Schemas/UpdateGhlToolDtoType.swift new file mode 100644 index 00000000..3054e0c8 --- /dev/null +++ b/Sources/Schemas/UpdateGhlToolDtoType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The type of tool. "ghl" for GHL tool. +public enum UpdateGhlToolDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case ghl +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGladiaCredentialDto.swift b/Sources/Schemas/UpdateGladiaCredentialDto.swift index 8d6d5dd6..0652e0d7 100644 --- a/Sources/Schemas/UpdateGladiaCredentialDto.swift +++ b/Sources/Schemas/UpdateGladiaCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGladiaCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGladiaCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGladiaCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGladiaCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGladiaCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGladiaCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGladiaCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateGladiaCredentialDtoProvider.swift b/Sources/Schemas/UpdateGladiaCredentialDtoProvider.swift new file mode 100644 index 00000000..9c9c9a09 --- /dev/null +++ b/Sources/Schemas/UpdateGladiaCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGladiaCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case gladia +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoHighLevelCalendarAvailabilityToolDto.swift b/Sources/Schemas/UpdateGoHighLevelCalendarAvailabilityToolDto.swift index 5db191ca..f9877aa6 100644 --- a/Sources/Schemas/UpdateGoHighLevelCalendarAvailabilityToolDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelCalendarAvailabilityToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a GoHighLevel calendar-availability tool, including its spoken messages and rejection plan. public struct UpdateGoHighLevelCalendarAvailabilityToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoHighLevelCalendarAvailabilityToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoHighLevelCalendarEventCreateToolDto.swift b/Sources/Schemas/UpdateGoHighLevelCalendarEventCreateToolDto.swift index 5003b66b..9547ec52 100644 --- a/Sources/Schemas/UpdateGoHighLevelCalendarEventCreateToolDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelCalendarEventCreateToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a GoHighLevel calendar-event tool, including its spoken messages and rejection plan. public struct UpdateGoHighLevelCalendarEventCreateToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoHighLevelCalendarEventCreateToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoHighLevelContactCreateToolDto.swift b/Sources/Schemas/UpdateGoHighLevelContactCreateToolDto.swift index 940f8821..ceadb2be 100644 --- a/Sources/Schemas/UpdateGoHighLevelContactCreateToolDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelContactCreateToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a GoHighLevel contact-creation tool, including its spoken messages and rejection plan. public struct UpdateGoHighLevelContactCreateToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoHighLevelContactCreateToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoHighLevelContactGetToolDto.swift b/Sources/Schemas/UpdateGoHighLevelContactGetToolDto.swift index 654a3210..c5e9bee3 100644 --- a/Sources/Schemas/UpdateGoHighLevelContactGetToolDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelContactGetToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a GoHighLevel contact-retrieval tool, including its spoken messages and rejection plan. public struct UpdateGoHighLevelContactGetToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoHighLevelContactGetToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoHighLevelCredentialDto.swift b/Sources/Schemas/UpdateGoHighLevelCredentialDto.swift index d4e53c30..670760da 100644 --- a/Sources/Schemas/UpdateGoHighLevelCredentialDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGoHighLevelCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGoHighLevelCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGoHighLevelCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoHighLevelCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGoHighLevelCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoHighLevelCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGoHighLevelCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateGoHighLevelCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoHighLevelCredentialDtoProvider.swift new file mode 100644 index 00000000..6ffd6963 --- /dev/null +++ b/Sources/Schemas/UpdateGoHighLevelCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGoHighLevelCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case gohighlevel +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoHighLevelMcpCredentialDto.swift b/Sources/Schemas/UpdateGoHighLevelMcpCredentialDto.swift index fe5b082e..2175a7ac 100644 --- a/Sources/Schemas/UpdateGoHighLevelMcpCredentialDto.swift +++ b/Sources/Schemas/UpdateGoHighLevelMcpCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGoHighLevelMcpCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGoHighLevelMcpCredentialDtoProvider? /// This is the authentication session for the credential. public let authenticationSession: Oauth2AuthenticationSession? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGoHighLevelMcpCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoHighLevelMcpCredentialDtoProvider? = nil, authenticationSession: Oauth2AuthenticationSession? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authenticationSession = authenticationSession self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGoHighLevelMcpCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoHighLevelMcpCredentialDtoProvider.self, forKey: .provider) self.authenticationSession = try container.decodeIfPresent(Oauth2AuthenticationSession.self, forKey: .authenticationSession) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGoHighLevelMcpCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authenticationSession, forKey: .authenticationSession) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authenticationSession case name } diff --git a/Sources/Schemas/UpdateGoHighLevelMcpCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoHighLevelMcpCredentialDtoProvider.swift new file mode 100644 index 00000000..149c39e6 --- /dev/null +++ b/Sources/Schemas/UpdateGoHighLevelMcpCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGoHighLevelMcpCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case ghlOauth2Authorization = "ghl.oauth2-authorization" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleCalendarCheckAvailabilityToolDto.swift b/Sources/Schemas/UpdateGoogleCalendarCheckAvailabilityToolDto.swift index d4ec10fd..92715469 100644 --- a/Sources/Schemas/UpdateGoogleCalendarCheckAvailabilityToolDto.swift +++ b/Sources/Schemas/UpdateGoogleCalendarCheckAvailabilityToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a Google Calendar availability tool, including its spoken messages and rejection plan. public struct UpdateGoogleCalendarCheckAvailabilityToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoogleCalendarCheckAvailabilityToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoogleCalendarCreateEventToolDto.swift b/Sources/Schemas/UpdateGoogleCalendarCreateEventToolDto.swift index 478bdba0..265e06bc 100644 --- a/Sources/Schemas/UpdateGoogleCalendarCreateEventToolDto.swift +++ b/Sources/Schemas/UpdateGoogleCalendarCreateEventToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a Google Calendar event-creation tool, including its spoken messages and rejection plan. public struct UpdateGoogleCalendarCreateEventToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoogleCalendarCreateEventToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDto.swift index 22de4a4a..bc7fcda5 100644 --- a/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGoogleCalendarOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider? /// The authorization ID for the OAuth2 authorization public let authorizationId: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGoogleCalendarOAuth2AuthorizationCredentialDto: Codable, Has public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider? = nil, authorizationId: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authorizationId = authorizationId self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGoogleCalendarOAuth2AuthorizationCredentialDto: Codable, Has public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider.self, forKey: .provider) self.authorizationId = try container.decodeIfPresent(String.self, forKey: .authorizationId) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGoogleCalendarOAuth2AuthorizationCredentialDto: Codable, Has public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authorizationId, forKey: .authorizationId) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authorizationId case name } diff --git a/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider.swift new file mode 100644 index 00000000..f012c33c --- /dev/null +++ b/Sources/Schemas/UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGoogleCalendarOAuth2AuthorizationCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case googleCalendarOauth2Authorization = "google.calendar.oauth2-authorization" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDto.swift b/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDto.swift index a1e67806..b6149daa 100644 --- a/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDto.swift +++ b/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDto.swift @@ -1,21 +1,25 @@ import Foundation public struct UpdateGoogleCalendarOAuth2ClientCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.name = name self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider.self, forKey: .provider) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -23,11 +27,13 @@ public struct UpdateGoogleCalendarOAuth2ClientCredentialDto: Codable, Hashable, public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case name } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider.swift new file mode 100644 index 00000000..dfc252e2 --- /dev/null +++ b/Sources/Schemas/UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGoogleCalendarOAuth2ClientCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case googleCalendarOauth2Client = "google.calendar.oauth2-client" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleCredentialDto.swift b/Sources/Schemas/UpdateGoogleCredentialDto.swift index 0b1e4ad8..7f796d9c 100644 --- a/Sources/Schemas/UpdateGoogleCredentialDto.swift +++ b/Sources/Schemas/UpdateGoogleCredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateGoogleCredentialDto: Codable, Hashable, Sendable { + /// This is the key for Gemini in Google AI Studio. Get it from here: https://aistudio.google.com/app/apikey + public let provider: UpdateGoogleCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +11,12 @@ public struct UpdateGoogleCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoogleCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +24,7 @@ public struct UpdateGoogleCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoogleCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +33,14 @@ public struct UpdateGoogleCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateGoogleCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoogleCredentialDtoProvider.swift new file mode 100644 index 00000000..794988d8 --- /dev/null +++ b/Sources/Schemas/UpdateGoogleCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the key for Gemini in Google AI Studio. Get it from here: https://aistudio.google.com/app/apikey +public enum UpdateGoogleCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case google +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDto.swift index f00b4300..1a90b811 100644 --- a/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGoogleSheetsOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider? /// The authorization ID for the OAuth2 authorization public let authorizationId: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGoogleSheetsOAuth2AuthorizationCredentialDto: Codable, Hasha public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider? = nil, authorizationId: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authorizationId = authorizationId self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGoogleSheetsOAuth2AuthorizationCredentialDto: Codable, Hasha public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider.self, forKey: .provider) self.authorizationId = try container.decodeIfPresent(String.self, forKey: .authorizationId) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGoogleSheetsOAuth2AuthorizationCredentialDto: Codable, Hasha public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authorizationId, forKey: .authorizationId) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authorizationId case name } diff --git a/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider.swift b/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider.swift new file mode 100644 index 00000000..c14f037e --- /dev/null +++ b/Sources/Schemas/UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGoogleSheetsOAuth2AuthorizationCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case googleSheetsOauth2Authorization = "google.sheets.oauth2-authorization" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateGoogleSheetsRowAppendToolDto.swift b/Sources/Schemas/UpdateGoogleSheetsRowAppendToolDto.swift index 37059c7c..8bb5446f 100644 --- a/Sources/Schemas/UpdateGoogleSheetsRowAppendToolDto.swift +++ b/Sources/Schemas/UpdateGoogleSheetsRowAppendToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a Google Sheets row-append tool, including its spoken messages and rejection plan. public struct UpdateGoogleSheetsRowAppendToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateGoogleSheetsRowAppendToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateGroqCredentialDto.swift b/Sources/Schemas/UpdateGroqCredentialDto.swift index 92fc4d30..04675faf 100644 --- a/Sources/Schemas/UpdateGroqCredentialDto.swift +++ b/Sources/Schemas/UpdateGroqCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateGroqCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateGroqCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateGroqCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateGroqCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateGroqCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateGroqCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateGroqCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateGroqCredentialDtoProvider.swift b/Sources/Schemas/UpdateGroqCredentialDtoProvider.swift new file mode 100644 index 00000000..0a854615 --- /dev/null +++ b/Sources/Schemas/UpdateGroqCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateGroqCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case groq +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateHandoffToolDto.swift b/Sources/Schemas/UpdateHandoffToolDto.swift index fa1d54ac..9176f7fc 100644 --- a/Sources/Schemas/UpdateHandoffToolDto.swift +++ b/Sources/Schemas/UpdateHandoffToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a handoff tool, including its destinations, function definition, default result, messages, and rejection plan. public struct UpdateHandoffToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateHandoffToolDtoMessagesItem]? /// This is the default local tool result message used when no runtime handoff result override is returned. public let defaultResult: String? diff --git a/Sources/Schemas/UpdateHumeCredentialDto.swift b/Sources/Schemas/UpdateHumeCredentialDto.swift index 8fcbecd4..1dcf6eca 100644 --- a/Sources/Schemas/UpdateHumeCredentialDto.swift +++ b/Sources/Schemas/UpdateHumeCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateHumeCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateHumeCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateHumeCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateHumeCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateHumeCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateHumeCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateHumeCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateHumeCredentialDtoProvider.swift b/Sources/Schemas/UpdateHumeCredentialDtoProvider.swift new file mode 100644 index 00000000..608ed565 --- /dev/null +++ b/Sources/Schemas/UpdateHumeCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateHumeCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case hume +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateInflectionAiCredentialDto.swift b/Sources/Schemas/UpdateInflectionAiCredentialDto.swift index 8d984421..14e6a3e1 100644 --- a/Sources/Schemas/UpdateInflectionAiCredentialDto.swift +++ b/Sources/Schemas/UpdateInflectionAiCredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateInflectionAiCredentialDto: Codable, Hashable, Sendable { + /// This is the api key for Pi in InflectionAI's console. Get it from here: https://developers.inflection.ai/keys, billing will need to be setup + public let provider: UpdateInflectionAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +11,12 @@ public struct UpdateInflectionAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateInflectionAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +24,7 @@ public struct UpdateInflectionAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateInflectionAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +33,14 @@ public struct UpdateInflectionAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateInflectionAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateInflectionAiCredentialDtoProvider.swift new file mode 100644 index 00000000..dfbb82c1 --- /dev/null +++ b/Sources/Schemas/UpdateInflectionAiCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the api key for Pi in InflectionAI's console. Get it from here: https://developers.inflection.ai/keys, billing will need to be setup +public enum UpdateInflectionAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case inflectionAi = "inflection-ai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateInworldCredentialDto.swift b/Sources/Schemas/UpdateInworldCredentialDto.swift index 4dcf6919..f1ff0338 100644 --- a/Sources/Schemas/UpdateInworldCredentialDto.swift +++ b/Sources/Schemas/UpdateInworldCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateInworldCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateInworldCredentialDtoProvider? /// This is the Inworld Basic (Base64) authentication token. This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateInworldCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateInworldCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateInworldCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateInworldCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateInworldCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateInworldCredentialDtoProvider.swift b/Sources/Schemas/UpdateInworldCredentialDtoProvider.swift new file mode 100644 index 00000000..15238fad --- /dev/null +++ b/Sources/Schemas/UpdateInworldCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateInworldCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case inworld +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateLangfuseCredentialDto.swift b/Sources/Schemas/UpdateLangfuseCredentialDto.swift index a890961e..f9ed552f 100644 --- a/Sources/Schemas/UpdateLangfuseCredentialDto.swift +++ b/Sources/Schemas/UpdateLangfuseCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateLangfuseCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateLangfuseCredentialDtoProvider? /// The public key for Langfuse project. Eg: pk-lf-... public let publicKey: String? /// The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the API. @@ -13,12 +14,14 @@ public struct UpdateLangfuseCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateLangfuseCredentialDtoProvider? = nil, publicKey: String? = nil, apiKey: String? = nil, apiUrl: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.publicKey = publicKey self.apiKey = apiKey self.apiUrl = apiUrl @@ -28,6 +31,7 @@ public struct UpdateLangfuseCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateLangfuseCredentialDtoProvider.self, forKey: .provider) self.publicKey = try container.decodeIfPresent(String.self, forKey: .publicKey) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) @@ -38,6 +42,7 @@ public struct UpdateLangfuseCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.publicKey, forKey: .publicKey) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) @@ -46,6 +51,7 @@ public struct UpdateLangfuseCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case publicKey case apiKey case apiUrl diff --git a/Sources/Schemas/UpdateLangfuseCredentialDtoProvider.swift b/Sources/Schemas/UpdateLangfuseCredentialDtoProvider.swift new file mode 100644 index 00000000..f22d337b --- /dev/null +++ b/Sources/Schemas/UpdateLangfuseCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateLangfuseCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case langfuse +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateLineInsightFromCallTableDto.swift b/Sources/Schemas/UpdateLineInsightFromCallTableDto.swift index 112e1163..e08d6990 100644 --- a/Sources/Schemas/UpdateLineInsightFromCallTableDto.swift +++ b/Sources/Schemas/UpdateLineInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a line-chart insight, including its queries, formulas, grouping, time range, metadata, and name. public struct UpdateLineInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -21,6 +22,7 @@ public struct UpdateLineInsightFromCallTableDto: Codable, Hashable, Sendable { public let formulas: [InsightFormula]? /// This is the metadata for the insight. public let metadata: LineInsightMetadata? + /// The time range and interval used to aggregate the line-chart data. public let timeRange: InsightTimeRangeWithStep? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/UpdateLmntCredentialDto.swift b/Sources/Schemas/UpdateLmntCredentialDto.swift index 5079710f..a6d2ae3f 100644 --- a/Sources/Schemas/UpdateLmntCredentialDto.swift +++ b/Sources/Schemas/UpdateLmntCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateLmntCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateLmntCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateLmntCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateLmntCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateLmntCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateLmntCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateLmntCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateLmntCredentialDtoProvider.swift b/Sources/Schemas/UpdateLmntCredentialDtoProvider.swift new file mode 100644 index 00000000..4567ca23 --- /dev/null +++ b/Sources/Schemas/UpdateLmntCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateLmntCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case lmnt +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateMakeCredentialDto.swift b/Sources/Schemas/UpdateMakeCredentialDto.swift index dd4b0824..f9aa4419 100644 --- a/Sources/Schemas/UpdateMakeCredentialDto.swift +++ b/Sources/Schemas/UpdateMakeCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateMakeCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateMakeCredentialDtoProvider? /// Team ID public let teamId: String? /// Region of your application. For example: eu1, eu2, us1, us2 @@ -13,12 +14,14 @@ public struct UpdateMakeCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateMakeCredentialDtoProvider? = nil, teamId: String? = nil, region: String? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.teamId = teamId self.region = region self.apiKey = apiKey @@ -28,6 +31,7 @@ public struct UpdateMakeCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateMakeCredentialDtoProvider.self, forKey: .provider) self.teamId = try container.decodeIfPresent(String.self, forKey: .teamId) self.region = try container.decodeIfPresent(String.self, forKey: .region) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) @@ -38,6 +42,7 @@ public struct UpdateMakeCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.teamId, forKey: .teamId) try container.encodeIfPresent(self.region, forKey: .region) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) @@ -46,6 +51,7 @@ public struct UpdateMakeCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case teamId case region case apiKey diff --git a/Sources/Schemas/UpdateMakeCredentialDtoProvider.swift b/Sources/Schemas/UpdateMakeCredentialDtoProvider.swift new file mode 100644 index 00000000..5ad53b5c --- /dev/null +++ b/Sources/Schemas/UpdateMakeCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateMakeCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case make +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateMakeToolDto.swift b/Sources/Schemas/UpdateMakeToolDto.swift index 99d0a167..2a8f96d6 100644 --- a/Sources/Schemas/UpdateMakeToolDto.swift +++ b/Sources/Schemas/UpdateMakeToolDto.swift @@ -1,10 +1,10 @@ import Foundation public struct UpdateMakeToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateMakeToolDtoMessagesItem]? + /// The type of tool. "make" for Make tool. + public let type: UpdateMakeToolDtoType? /// This is the plan to reject a tool call based on the conversation state. /// /// // Example 1: Reject endCall if user didn't say goodbye @@ -90,11 +90,13 @@ public struct UpdateMakeToolDto: Codable, Hashable, Sendable { public init( messages: [UpdateMakeToolDtoMessagesItem]? = nil, + type: UpdateMakeToolDtoType? = nil, rejectionPlan: ToolRejectionPlan? = nil, metadata: MakeToolMetadata? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.type = type self.rejectionPlan = rejectionPlan self.metadata = metadata self.additionalProperties = additionalProperties @@ -103,6 +105,7 @@ public struct UpdateMakeToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([UpdateMakeToolDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(UpdateMakeToolDtoType.self, forKey: .type) self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) self.metadata = try container.decodeIfPresent(MakeToolMetadata.self, forKey: .metadata) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -112,6 +115,7 @@ public struct UpdateMakeToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) try container.encodeIfPresent(self.metadata, forKey: .metadata) } @@ -119,6 +123,7 @@ public struct UpdateMakeToolDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case type case rejectionPlan case metadata } diff --git a/Sources/Schemas/UpdateMakeToolDtoType.swift b/Sources/Schemas/UpdateMakeToolDtoType.swift new file mode 100644 index 00000000..a7202390 --- /dev/null +++ b/Sources/Schemas/UpdateMakeToolDtoType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The type of tool. "make" for Make tool. +public enum UpdateMakeToolDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case make +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateMcpToolDto.swift b/Sources/Schemas/UpdateMcpToolDto.swift index af31e55f..62fc1cf4 100644 --- a/Sources/Schemas/UpdateMcpToolDto.swift +++ b/Sources/Schemas/UpdateMcpToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update an MCP tool, including its server, connection metadata, exposed tool messages, and rejection plan. public struct UpdateMcpToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateMcpToolDtoMessagesItem]? /// /// This is the server where a `tool-calls` webhook will be sent. @@ -96,6 +95,7 @@ public struct UpdateMcpToolDto: Codable, Hashable, Sendable { /// } /// ``` public let rejectionPlan: ToolRejectionPlan? + /// Connection metadata for the MCP server, including its communication protocol. public let metadata: McpToolMetadata? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] diff --git a/Sources/Schemas/UpdateMicrosoftCredentialDto.swift b/Sources/Schemas/UpdateMicrosoftCredentialDto.swift new file mode 100644 index 00000000..be2b45a4 --- /dev/null +++ b/Sources/Schemas/UpdateMicrosoftCredentialDto.swift @@ -0,0 +1,53 @@ +import Foundation + +public struct UpdateMicrosoftCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateMicrosoftCredentialDtoProvider? + /// This is not returned in the API. + public let apiKey: String? + /// Azure region for the Speech resource. Defaults to `eastus` when omitted. MAI-Voice-2 is preview and region-limited. + public let region: String? + /// This is the name of credential. This is just for your reference. + public let name: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + provider: UpdateMicrosoftCredentialDtoProvider? = nil, + apiKey: String? = nil, + region: String? = nil, + name: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.provider = provider + self.apiKey = apiKey + self.region = region + self.name = name + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateMicrosoftCredentialDtoProvider.self, forKey: .provider) + self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) + self.region = try container.decodeIfPresent(String.self, forKey: .region) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) + try container.encodeIfPresent(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.region, forKey: .region) + try container.encodeIfPresent(self.name, forKey: .name) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + case apiKey + case region + case name + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateMicrosoftCredentialDtoProvider.swift b/Sources/Schemas/UpdateMicrosoftCredentialDtoProvider.swift new file mode 100644 index 00000000..8973a63f --- /dev/null +++ b/Sources/Schemas/UpdateMicrosoftCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateMicrosoftCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case microsoft +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateMistralCredentialDto.swift b/Sources/Schemas/UpdateMistralCredentialDto.swift index 0a261d24..99bd1e5e 100644 --- a/Sources/Schemas/UpdateMistralCredentialDto.swift +++ b/Sources/Schemas/UpdateMistralCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateMistralCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateMistralCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateMistralCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateMistralCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateMistralCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateMistralCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateMistralCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateMistralCredentialDtoProvider.swift b/Sources/Schemas/UpdateMistralCredentialDtoProvider.swift new file mode 100644 index 00000000..681ba6c8 --- /dev/null +++ b/Sources/Schemas/UpdateMistralCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateMistralCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case mistral +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateNeuphonicCredentialDto.swift b/Sources/Schemas/UpdateNeuphonicCredentialDto.swift index 50b89374..fab43979 100644 --- a/Sources/Schemas/UpdateNeuphonicCredentialDto.swift +++ b/Sources/Schemas/UpdateNeuphonicCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateNeuphonicCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateNeuphonicCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateNeuphonicCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateNeuphonicCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateNeuphonicCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateNeuphonicCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateNeuphonicCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateNeuphonicCredentialDtoProvider.swift b/Sources/Schemas/UpdateNeuphonicCredentialDtoProvider.swift new file mode 100644 index 00000000..5afaa64b --- /dev/null +++ b/Sources/Schemas/UpdateNeuphonicCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateNeuphonicCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case neuphonic +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateOpenAiCredentialDto.swift b/Sources/Schemas/UpdateOpenAiCredentialDto.swift index bac2fdb0..b0fcf38c 100644 --- a/Sources/Schemas/UpdateOpenAiCredentialDto.swift +++ b/Sources/Schemas/UpdateOpenAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateOpenAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateOpenAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateOpenAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateOpenAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateOpenAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateOpenAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateOpenAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateOpenAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateOpenAiCredentialDtoProvider.swift new file mode 100644 index 00000000..a304a792 --- /dev/null +++ b/Sources/Schemas/UpdateOpenAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateOpenAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case openai +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateOpenRouterCredentialDto.swift b/Sources/Schemas/UpdateOpenRouterCredentialDto.swift index ce898925..a3db78cc 100644 --- a/Sources/Schemas/UpdateOpenRouterCredentialDto.swift +++ b/Sources/Schemas/UpdateOpenRouterCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateOpenRouterCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateOpenRouterCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateOpenRouterCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateOpenRouterCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateOpenRouterCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateOpenRouterCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateOpenRouterCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateOpenRouterCredentialDtoProvider.swift b/Sources/Schemas/UpdateOpenRouterCredentialDtoProvider.swift new file mode 100644 index 00000000..7e74fdda --- /dev/null +++ b/Sources/Schemas/UpdateOpenRouterCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateOpenRouterCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case openrouter +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateOutputToolDto.swift b/Sources/Schemas/UpdateOutputToolDto.swift index 8195185c..0ba85793 100644 --- a/Sources/Schemas/UpdateOutputToolDto.swift +++ b/Sources/Schemas/UpdateOutputToolDto.swift @@ -1,10 +1,10 @@ import Foundation public struct UpdateOutputToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateOutputToolDtoMessagesItem]? + /// The type of tool. "output" for Output tool. + public let type: UpdateOutputToolDtoType? /// This is the plan to reject a tool call based on the conversation state. /// /// // Example 1: Reject endCall if user didn't say goodbye @@ -89,10 +89,12 @@ public struct UpdateOutputToolDto: Codable, Hashable, Sendable { public init( messages: [UpdateOutputToolDtoMessagesItem]? = nil, + type: UpdateOutputToolDtoType? = nil, rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.messages = messages + self.type = type self.rejectionPlan = rejectionPlan self.additionalProperties = additionalProperties } @@ -100,6 +102,7 @@ public struct UpdateOutputToolDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.messages = try container.decodeIfPresent([UpdateOutputToolDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(UpdateOutputToolDtoType.self, forKey: .type) self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -108,12 +111,14 @@ public struct UpdateOutputToolDto: Codable, Hashable, Sendable { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case messages + case type case rejectionPlan } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateOutputToolDtoType.swift b/Sources/Schemas/UpdateOutputToolDtoType.swift new file mode 100644 index 00000000..b98438f7 --- /dev/null +++ b/Sources/Schemas/UpdateOutputToolDtoType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The type of tool. "output" for Output tool. +public enum UpdateOutputToolDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case output +} \ No newline at end of file diff --git a/Sources/Schemas/UpdatePerplexityAiCredentialDto.swift b/Sources/Schemas/UpdatePerplexityAiCredentialDto.swift index 780ebcfa..cc80456b 100644 --- a/Sources/Schemas/UpdatePerplexityAiCredentialDto.swift +++ b/Sources/Schemas/UpdatePerplexityAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdatePerplexityAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdatePerplexityAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdatePerplexityAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdatePerplexityAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdatePerplexityAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdatePerplexityAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdatePerplexityAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdatePerplexityAiCredentialDtoProvider.swift b/Sources/Schemas/UpdatePerplexityAiCredentialDtoProvider.swift new file mode 100644 index 00000000..31675ffe --- /dev/null +++ b/Sources/Schemas/UpdatePerplexityAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdatePerplexityAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case perplexityAi = "perplexity-ai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdatePieInsightFromCallTableDto.swift b/Sources/Schemas/UpdatePieInsightFromCallTableDto.swift index a7674372..becd9963 100644 --- a/Sources/Schemas/UpdatePieInsightFromCallTableDto.swift +++ b/Sources/Schemas/UpdatePieInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a pie-chart insight, including its queries, formulas, grouping, time range, and name. public struct UpdatePieInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct UpdatePieInsightFromCallTableDto: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formulas: [InsightFormula]? + /// The time range used to query the pie-chart data. public let timeRange: InsightTimeRange? /// This is the group by column for the insight when table is `call`. /// These are the columns to group the results by. diff --git a/Sources/Schemas/UpdatePlayHtCredentialDto.swift b/Sources/Schemas/UpdatePlayHtCredentialDto.swift index 43d1b90b..2e68d3c1 100644 --- a/Sources/Schemas/UpdatePlayHtCredentialDto.swift +++ b/Sources/Schemas/UpdatePlayHtCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdatePlayHtCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdatePlayHtCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -10,11 +11,13 @@ public struct UpdatePlayHtCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdatePlayHtCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, userId: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.userId = userId @@ -23,6 +26,7 @@ public struct UpdatePlayHtCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdatePlayHtCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.userId = try container.decodeIfPresent(String.self, forKey: .userId) @@ -32,6 +36,7 @@ public struct UpdatePlayHtCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.userId, forKey: .userId) @@ -39,6 +44,7 @@ public struct UpdatePlayHtCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name case userId diff --git a/Sources/Schemas/UpdatePlayHtCredentialDtoProvider.swift b/Sources/Schemas/UpdatePlayHtCredentialDtoProvider.swift new file mode 100644 index 00000000..8fc23cef --- /dev/null +++ b/Sources/Schemas/UpdatePlayHtCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdatePlayHtCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case playht +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateQueryToolDto.swift b/Sources/Schemas/UpdateQueryToolDto.swift index efe8c0da..a7034836 100644 --- a/Sources/Schemas/UpdateQueryToolDto.swift +++ b/Sources/Schemas/UpdateQueryToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a query tool, including its knowledge bases, spoken messages, and rejection plan. public struct UpdateQueryToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateQueryToolDtoMessagesItem]? /// The knowledge bases to query public let knowledgeBases: [KnowledgeBase]? diff --git a/Sources/Schemas/UpdateRimeAiCredentialDto.swift b/Sources/Schemas/UpdateRimeAiCredentialDto.swift index aa0c8cbc..445ea6aa 100644 --- a/Sources/Schemas/UpdateRimeAiCredentialDto.swift +++ b/Sources/Schemas/UpdateRimeAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateRimeAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateRimeAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateRimeAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateRimeAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateRimeAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateRimeAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateRimeAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateRimeAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateRimeAiCredentialDtoProvider.swift new file mode 100644 index 00000000..012920e9 --- /dev/null +++ b/Sources/Schemas/UpdateRimeAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateRimeAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case rimeAi = "rime-ai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateRunpodCredentialDto.swift b/Sources/Schemas/UpdateRunpodCredentialDto.swift index 470ddb92..b12dfaaf 100644 --- a/Sources/Schemas/UpdateRunpodCredentialDto.swift +++ b/Sources/Schemas/UpdateRunpodCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateRunpodCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateRunpodCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateRunpodCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateRunpodCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateRunpodCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateRunpodCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateRunpodCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateRunpodCredentialDtoProvider.swift b/Sources/Schemas/UpdateRunpodCredentialDtoProvider.swift new file mode 100644 index 00000000..5522fd57 --- /dev/null +++ b/Sources/Schemas/UpdateRunpodCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateRunpodCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case runpod +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateS3CompatibleBucketPlanDto.swift b/Sources/Schemas/UpdateS3CompatibleBucketPlanDto.swift new file mode 100644 index 00000000..2f388023 --- /dev/null +++ b/Sources/Schemas/UpdateS3CompatibleBucketPlanDto.swift @@ -0,0 +1,68 @@ +import Foundation + +public struct UpdateS3CompatibleBucketPlanDto: Codable, Hashable, Sendable { + /// S3-compatible endpoint URL, such as https://s3.us-west-004.backblazeb2.com. Must be public HTTPS. + public let url: String? + /// SigV4 signing region expected by the object store. Most stores accept us-east-1. + public let region: String? + /// S3 access key ID. + public let accessKeyId: String? + /// S3 secret access key. This is not returned in the API. + public let secretAccessKey: String? + /// Bucket name. + public let name: String? + /// Optional key prefix inside the bucket, such as recordings/. + public let path: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + url: String? = nil, + region: String? = nil, + accessKeyId: String? = nil, + secretAccessKey: String? = nil, + name: String? = nil, + path: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.url = url + self.region = region + self.accessKeyId = accessKeyId + self.secretAccessKey = secretAccessKey + self.name = name + self.path = path + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.url = try container.decodeIfPresent(String.self, forKey: .url) + self.region = try container.decodeIfPresent(String.self, forKey: .region) + self.accessKeyId = try container.decodeIfPresent(String.self, forKey: .accessKeyId) + self.secretAccessKey = try container.decodeIfPresent(String.self, forKey: .secretAccessKey) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.path = try container.decodeIfPresent(String.self, forKey: .path) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.url, forKey: .url) + try container.encodeIfPresent(self.region, forKey: .region) + try container.encodeIfPresent(self.accessKeyId, forKey: .accessKeyId) + try container.encodeIfPresent(self.secretAccessKey, forKey: .secretAccessKey) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.path, forKey: .path) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case url + case region + case accessKeyId + case secretAccessKey + case name + case path + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateS3CompatibleCredentialDto.swift b/Sources/Schemas/UpdateS3CompatibleCredentialDto.swift new file mode 100644 index 00000000..ad4824b2 --- /dev/null +++ b/Sources/Schemas/UpdateS3CompatibleCredentialDto.swift @@ -0,0 +1,53 @@ +import Foundation + +public struct UpdateS3CompatibleCredentialDto: Codable, Hashable, Sendable { + /// This is for S3-compatible storage such as MinIO, Garage, Ceph, or Backblaze B2. + public let provider: UpdateS3CompatibleCredentialDtoProvider? + /// This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order. + public let fallbackIndex: Double? + public let bucketPlan: UpdateS3CompatibleBucketPlanDto? + /// This is the name of credential. This is just for your reference. + public let name: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + provider: UpdateS3CompatibleCredentialDtoProvider? = nil, + fallbackIndex: Double? = nil, + bucketPlan: UpdateS3CompatibleBucketPlanDto? = nil, + name: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.provider = provider + self.fallbackIndex = fallbackIndex + self.bucketPlan = bucketPlan + self.name = name + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateS3CompatibleCredentialDtoProvider.self, forKey: .provider) + self.fallbackIndex = try container.decodeIfPresent(Double.self, forKey: .fallbackIndex) + self.bucketPlan = try container.decodeIfPresent(UpdateS3CompatibleBucketPlanDto.self, forKey: .bucketPlan) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) + try container.encodeIfPresent(self.fallbackIndex, forKey: .fallbackIndex) + try container.encodeIfPresent(self.bucketPlan, forKey: .bucketPlan) + try container.encodeIfPresent(self.name, forKey: .name) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case provider + case fallbackIndex + case bucketPlan + case name + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateS3CompatibleCredentialDtoProvider.swift b/Sources/Schemas/UpdateS3CompatibleCredentialDtoProvider.swift new file mode 100644 index 00000000..cbfbb167 --- /dev/null +++ b/Sources/Schemas/UpdateS3CompatibleCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is for S3-compatible storage such as MinIO, Garage, Ceph, or Backblaze B2. +public enum UpdateS3CompatibleCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case s3Compatible = "s3-compatible" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateS3CredentialDto.swift b/Sources/Schemas/UpdateS3CredentialDto.swift index 5011b6c7..f625a204 100644 --- a/Sources/Schemas/UpdateS3CredentialDto.swift +++ b/Sources/Schemas/UpdateS3CredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { + /// Credential provider. Only allowed value is s3 + public let provider: UpdateS3CredentialDtoProvider? /// AWS access key ID. public let awsAccessKeyId: String? /// AWS access key secret. This is not returned in the API. @@ -19,6 +21,7 @@ public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateS3CredentialDtoProvider? = nil, awsAccessKeyId: String? = nil, awsSecretAccessKey: String? = nil, region: String? = nil, @@ -28,6 +31,7 @@ public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.awsAccessKeyId = awsAccessKeyId self.awsSecretAccessKey = awsSecretAccessKey self.region = region @@ -40,6 +44,7 @@ public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateS3CredentialDtoProvider.self, forKey: .provider) self.awsAccessKeyId = try container.decodeIfPresent(String.self, forKey: .awsAccessKeyId) self.awsSecretAccessKey = try container.decodeIfPresent(String.self, forKey: .awsSecretAccessKey) self.region = try container.decodeIfPresent(String.self, forKey: .region) @@ -53,6 +58,7 @@ public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.awsAccessKeyId, forKey: .awsAccessKeyId) try container.encodeIfPresent(self.awsSecretAccessKey, forKey: .awsSecretAccessKey) try container.encodeIfPresent(self.region, forKey: .region) @@ -64,6 +70,7 @@ public struct UpdateS3CredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case awsAccessKeyId case awsSecretAccessKey case region diff --git a/Sources/Schemas/UpdateS3CredentialDtoProvider.swift b/Sources/Schemas/UpdateS3CredentialDtoProvider.swift new file mode 100644 index 00000000..aa92bc40 --- /dev/null +++ b/Sources/Schemas/UpdateS3CredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// Credential provider. Only allowed value is s3 +public enum UpdateS3CredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case s3 +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateSimulationSuiteDto.swift b/Sources/Schemas/UpdateSimulationSuiteDto.swift index 44301d0c..9cc90f08 100644 --- a/Sources/Schemas/UpdateSimulationSuiteDto.swift +++ b/Sources/Schemas/UpdateSimulationSuiteDto.swift @@ -7,6 +7,8 @@ public struct UpdateSimulationSuiteDto: Codable, Hashable, Sendable { public let slackWebhookUrl: String? /// This is the list of simulation IDs to include in the suite (replaces existing). public let simulationIds: [String]? + /// Optional assistant or squad assignments (replaces existing). + public let targetAssignments: [SimulationSuiteTargetAssignment]? /// Optional folder path for organizing simulation suites. /// Supports up to 3 levels (e.g., "dept/feature/variant"). /// Set to null to remove from folder. @@ -18,12 +20,14 @@ public struct UpdateSimulationSuiteDto: Codable, Hashable, Sendable { name: String? = nil, slackWebhookUrl: String? = nil, simulationIds: [String]? = nil, + targetAssignments: [SimulationSuiteTargetAssignment]? = nil, path: Nullable? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.name = name self.slackWebhookUrl = slackWebhookUrl self.simulationIds = simulationIds + self.targetAssignments = targetAssignments self.path = path self.additionalProperties = additionalProperties } @@ -33,6 +37,7 @@ public struct UpdateSimulationSuiteDto: Codable, Hashable, Sendable { self.name = try container.decodeIfPresent(String.self, forKey: .name) self.slackWebhookUrl = try container.decodeIfPresent(String.self, forKey: .slackWebhookUrl) self.simulationIds = try container.decodeIfPresent([String].self, forKey: .simulationIds) + self.targetAssignments = try container.decodeIfPresent([SimulationSuiteTargetAssignment].self, forKey: .targetAssignments) self.path = try container.decodeNullableIfPresent(String.self, forKey: .path) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -43,6 +48,7 @@ public struct UpdateSimulationSuiteDto: Codable, Hashable, Sendable { try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.slackWebhookUrl, forKey: .slackWebhookUrl) try container.encodeIfPresent(self.simulationIds, forKey: .simulationIds) + try container.encodeIfPresent(self.targetAssignments, forKey: .targetAssignments) try container.encodeNullableIfPresent(self.path, forKey: .path) } @@ -51,6 +57,7 @@ public struct UpdateSimulationSuiteDto: Codable, Hashable, Sendable { case name case slackWebhookUrl case simulationIds + case targetAssignments case path } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateSipRequestToolDto.swift b/Sources/Schemas/UpdateSipRequestToolDto.swift index c150e2d3..34a13900 100644 --- a/Sources/Schemas/UpdateSipRequestToolDto.swift +++ b/Sources/Schemas/UpdateSipRequestToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a SIP-request tool, including its method, headers, body, spoken messages, and rejection plan. public struct UpdateSipRequestToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateSipRequestToolDtoMessagesItem]? /// The SIP method to send. public let verb: UpdateSipRequestToolDtoVerb? diff --git a/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDto.swift b/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDto.swift index ea6ad0e1..cdc7efdc 100644 --- a/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDto.swift +++ b/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateSlackOAuth2AuthorizationCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateSlackOAuth2AuthorizationCredentialDtoProvider? /// The authorization ID for the OAuth2 authorization public let authorizationId: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateSlackOAuth2AuthorizationCredentialDto: Codable, Hashable, Se public let additionalProperties: [String: JSONValue] public init( + provider: UpdateSlackOAuth2AuthorizationCredentialDtoProvider? = nil, authorizationId: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authorizationId = authorizationId self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateSlackOAuth2AuthorizationCredentialDto: Codable, Hashable, Se public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateSlackOAuth2AuthorizationCredentialDtoProvider.self, forKey: .provider) self.authorizationId = try container.decodeIfPresent(String.self, forKey: .authorizationId) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateSlackOAuth2AuthorizationCredentialDto: Codable, Hashable, Se public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authorizationId, forKey: .authorizationId) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authorizationId case name } diff --git a/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDtoProvider.swift b/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDtoProvider.swift new file mode 100644 index 00000000..aec769d9 --- /dev/null +++ b/Sources/Schemas/UpdateSlackOAuth2AuthorizationCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateSlackOAuth2AuthorizationCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case slackOauth2Authorization = "slack.oauth2-authorization" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateSlackSendMessageToolDto.swift b/Sources/Schemas/UpdateSlackSendMessageToolDto.swift index d0913d96..32117f79 100644 --- a/Sources/Schemas/UpdateSlackSendMessageToolDto.swift +++ b/Sources/Schemas/UpdateSlackSendMessageToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a Slack message tool, including its spoken messages and rejection plan. public struct UpdateSlackSendMessageToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateSlackSendMessageToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateSlackWebhookCredentialDto.swift b/Sources/Schemas/UpdateSlackWebhookCredentialDto.swift index b7ab156f..16b30be9 100644 --- a/Sources/Schemas/UpdateSlackWebhookCredentialDto.swift +++ b/Sources/Schemas/UpdateSlackWebhookCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateSlackWebhookCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateSlackWebhookCredentialDtoProvider? /// Slack incoming webhook URL. See https://api.slack.com/messaging/webhooks for setup instructions. This is not returned in the API. public let webhookUrl: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateSlackWebhookCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateSlackWebhookCredentialDtoProvider? = nil, webhookUrl: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.webhookUrl = webhookUrl self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateSlackWebhookCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateSlackWebhookCredentialDtoProvider.self, forKey: .provider) self.webhookUrl = try container.decodeIfPresent(String.self, forKey: .webhookUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateSlackWebhookCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.webhookUrl, forKey: .webhookUrl) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case webhookUrl case name } diff --git a/Sources/Schemas/UpdateSlackWebhookCredentialDtoProvider.swift b/Sources/Schemas/UpdateSlackWebhookCredentialDtoProvider.swift new file mode 100644 index 00000000..f2975b5e --- /dev/null +++ b/Sources/Schemas/UpdateSlackWebhookCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateSlackWebhookCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case slackWebhook = "slack-webhook" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateSmsToolDto.swift b/Sources/Schemas/UpdateSmsToolDto.swift index edef672f..4ad32bbd 100644 --- a/Sources/Schemas/UpdateSmsToolDto.swift +++ b/Sources/Schemas/UpdateSmsToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update an SMS tool, including its spoken messages and rejection plan. public struct UpdateSmsToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateSmsToolDtoMessagesItem]? /// This is the plan to reject a tool call based on the conversation state. /// diff --git a/Sources/Schemas/UpdateSonioxCredentialDto.swift b/Sources/Schemas/UpdateSonioxCredentialDto.swift index 7ebd6e9e..882ee0d0 100644 --- a/Sources/Schemas/UpdateSonioxCredentialDto.swift +++ b/Sources/Schemas/UpdateSonioxCredentialDto.swift @@ -1,26 +1,35 @@ import Foundation public struct UpdateSonioxCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateSonioxCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? + /// Custom Soniox WebSocket endpoint (e.g. EU server wss://stt-rt.eu.soniox.com/transcribe-websocket). Defaults to the region-appropriate endpoint when omitted. + public let apiUrl: String? /// This is the name of credential. This is just for your reference. public let name: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + provider: UpdateSonioxCredentialDtoProvider? = nil, apiKey: String? = nil, + apiUrl: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey + self.apiUrl = apiUrl self.name = name self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateSonioxCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) + self.apiUrl = try container.decodeIfPresent(String.self, forKey: .apiUrl) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -28,13 +37,17 @@ public struct UpdateSonioxCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) + try container.encodeIfPresent(self.apiUrl, forKey: .apiUrl) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey + case apiUrl case name } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateSonioxCredentialDtoProvider.swift b/Sources/Schemas/UpdateSonioxCredentialDtoProvider.swift new file mode 100644 index 00000000..3b8a2388 --- /dev/null +++ b/Sources/Schemas/UpdateSonioxCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateSonioxCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case soniox +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateStructuredOutputDtoConditionsItem.swift b/Sources/Schemas/UpdateStructuredOutputDtoConditionsItem.swift new file mode 100644 index 00000000..a7097e20 --- /dev/null +++ b/Sources/Schemas/UpdateStructuredOutputDtoConditionsItem.swift @@ -0,0 +1,46 @@ +import Foundation + +public enum UpdateStructuredOutputDtoConditionsItem: Codable, Hashable, Sendable { + case endedReason(EndedReasonCondition) + case minCallDuration(MinCallDurationCondition) + case minMessages(MinMessagesCondition) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "endedReason": + self = .endedReason(try EndedReasonCondition(from: decoder)) + case "minCallDuration": + self = .minCallDuration(try MinCallDurationCondition(from: decoder)) + case "minMessages": + self = .minMessages(try MinMessagesCondition(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .endedReason(let data): + try container.encode("endedReason", forKey: .type) + try data.encode(to: encoder) + case .minCallDuration(let data): + try container.encode("minCallDuration", forKey: .type) + try data.encode(to: encoder) + case .minMessages(let data): + try container.encode("minMessages", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateTelnyxPhoneNumberDto.swift b/Sources/Schemas/UpdateTelnyxPhoneNumberDto.swift index 9c9f9015..8fe3de19 100644 --- a/Sources/Schemas/UpdateTelnyxPhoneNumberDto.swift +++ b/Sources/Schemas/UpdateTelnyxPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a Telnyx phone number, including its credential, number, routing, hooks, and server settings. public struct UpdateTelnyxPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/UpdateTextEditorToolDto.swift b/Sources/Schemas/UpdateTextEditorToolDto.swift index 4474ce5f..5550e712 100644 --- a/Sources/Schemas/UpdateTextEditorToolDto.swift +++ b/Sources/Schemas/UpdateTextEditorToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a text-editor tool, including its name, environment subtype, server, messages, and rejection plan. public struct UpdateTextEditorToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateTextEditorToolDtoMessagesItem]? /// The sub type of tool. public let subType: UpdateTextEditorToolDtoSubType? diff --git a/Sources/Schemas/UpdateTextInsightFromCallTableDto.swift b/Sources/Schemas/UpdateTextInsightFromCallTableDto.swift index 6ff269d3..483d9f41 100644 --- a/Sources/Schemas/UpdateTextInsightFromCallTableDto.swift +++ b/Sources/Schemas/UpdateTextInsightFromCallTableDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a text-value insight, including its queries, formula, time range, and name. public struct UpdateTextInsightFromCallTableDto: Codable, Hashable, Sendable { /// This is the name of the Insight. public let name: String? @@ -19,6 +20,7 @@ public struct UpdateTextInsightFromCallTableDto: Codable, Hashable, Sendable { /// /// You can also use the query names as the variable in the formula. public let formula: [String: JSONValue]? + /// The time range used to query the text-value data. public let timeRange: InsightTimeRange? /// These are the queries to run to generate the insight. /// For Text Insights, we only allow a single query, or require a formula if multiple queries are provided diff --git a/Sources/Schemas/UpdateTogetherAiCredentialDto.swift b/Sources/Schemas/UpdateTogetherAiCredentialDto.swift index a3dd9c8b..2b8bec19 100644 --- a/Sources/Schemas/UpdateTogetherAiCredentialDto.swift +++ b/Sources/Schemas/UpdateTogetherAiCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateTogetherAiCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateTogetherAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateTogetherAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateTogetherAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateTogetherAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateTogetherAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateTogetherAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateTogetherAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateTogetherAiCredentialDtoProvider.swift new file mode 100644 index 00000000..0d5cbfe9 --- /dev/null +++ b/Sources/Schemas/UpdateTogetherAiCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateTogetherAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case togetherAi = "together-ai" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolDraftDto.swift b/Sources/Schemas/UpdateToolDraftDto.swift new file mode 100644 index 00000000..f606da77 --- /dev/null +++ b/Sources/Schemas/UpdateToolDraftDto.swift @@ -0,0 +1,340 @@ +import Foundation + +public struct UpdateToolDraftDto: Codable, Hashable, Sendable { + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. + public let messages: [UpdateToolDraftDtoMessagesItem]? + /// This is the type of the tool. + public let type: UpdateToolDraftDtoType? + /// This is the function definition of the tool. + public let function: OpenAiFunction? + /// Provider-specific metadata. Polymorphic across tool variants with no shared + /// discriminator, so it is validated as a plain object (mirrors how + /// `ToolCallResult.metadata` is typed). + public let metadata: [String: JSONValue]? + /// This is the unique identifier for the template this tool was created from. + public let templateId: String? + public let server: Server? + public let async: Bool? + /// These are the destinations that the call can be transferred to. + public let destinations: [[String: JSONValue]]? + /// This is the name of the tool. This will be passed to the model. + public let name: String? + /// This is the sub type of the tool (e.g. for computer, bash and text-editor tools). + public let subType: String? + /// The display width in pixels (computer tool). + public let displayWidthPx: Double? + /// The display height in pixels (computer tool). + public let displayHeightPx: Double? + /// Optional display number (computer tool). + public let displayNumber: Double? + /// The knowledge bases to query (query tool). + public let knowledgeBases: [KnowledgeBase]? + /// This is where the request will be sent (api-request tool). + public let url: String? + /// This is the HTTP method for the request (api-request tool). + public let method: UpdateToolDraftDtoMethod? + /// These are the headers to send with the request (api-request / sip-request tool). + public let headers: JsonSchema? + /// This is the body of the request. Either a JSON schema (api-request) or a + /// literal string / schema (sip-request). + public let body: [String: JSONValue]? + /// This is the backoff plan if the request fails. + public let backoffPlan: BackoffPlan? + /// This is the timeout in seconds for the request. + public let timeoutSeconds: Double? + /// This is the description of the tool. This will be passed to the model. + public let description: String? + /// This is the plan to extract variables from the tool's response. + public let variableExtractionPlan: VariableExtractionPlan? + /// This is the credential ID that will be used for authorization. + public let credentialId: String? + public let extendedDelayWhenPrecededByTextEnabled: Bool? + public let beepDetectionEnabled: Bool? + /// This is the TypeScript code that will be executed when the tool is called (code tool). + public let code: String? + /// These are the environment variables available in the code via the `env` object (code tool). + public let environmentVariables: [CodeToolEnvironmentVariable]? + /// These are the static parameters to merge into the tool's request body. + public let parameters: [ToolParameter]? + /// This is the paths to encrypt in the request body. + public let encryptedPaths: [String]? + /// This enables sending DTMF tones via SIP INFO messages instead of RFC 2833. + public let sipInfoDtmfEnabled: Bool? + /// This is the SIP method to send (sip-request tool). + public let verb: UpdateToolDraftDtoVerb? + /// This is the default local tool result message used when no runtime override is returned (handoff tool). + public let defaultResult: String? + /// Per-tool message overrides for individual tools loaded from the MCP server (mcp tool). + public let toolMessages: [McpToolMessages]? + /// This is the plan to reject a tool call based on the conversation state. + /// + /// // Example 1: Reject endCall if user didn't say goodbye + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '(?i)\\b(bye|goodbye|farewell|see you later|take care)\\b', + /// target: { position: -1, role: 'user' }, + /// negate: true // Reject if pattern does NOT match + /// }] + /// } + /// ``` + /// + /// // Example 2: Reject transfer if user is actually asking a question + /// ```json + /// { + /// conditions: [{ + /// type: 'regex', + /// regex: '\\?', + /// target: { position: -1, role: 'user' } + /// }] + /// } + /// ``` + /// + /// // Example 3: Reject transfer if user didn't mention transfer recently + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 5 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' %} + /// {% assign mentioned = false %} + /// {% for msg in userMessages %} + /// {% if msg.content contains 'transfer' or msg.content contains 'connect' or msg.content contains 'speak to' %} + /// {% assign mentioned = true %} + /// {% break %} + /// {% endif %} + /// {% endfor %} + /// {% if mentioned %} + /// false + /// {% else %} + /// true + /// {% endif %}` + /// }] + /// } + /// ``` + /// + /// // Example 4: Reject endCall if the bot is looping and trying to exit + /// ```json + /// { + /// conditions: [{ + /// type: 'liquid', + /// liquid: `{% assign recentMessages = messages | last: 6 %} + /// {% assign userMessages = recentMessages | where: 'role', 'user' | reverse %} + /// {% if userMessages.size < 3 %} + /// false + /// {% else %} + /// {% assign msg1 = userMessages[0].content | downcase %} + /// {% assign msg2 = userMessages[1].content | downcase %} + /// {% assign msg3 = userMessages[2].content | downcase %} + /// {% comment %} Check for repetitive messages {% endcomment %} + /// {% if msg1 == msg2 or msg1 == msg3 or msg2 == msg3 %} + /// true + /// {% comment %} Check for common loop phrases {% endcomment %} + /// {% elsif msg1 contains 'cool thanks' or msg2 contains 'cool thanks' or msg3 contains 'cool thanks' %} + /// true + /// {% elsif msg1 contains 'okay thanks' or msg2 contains 'okay thanks' or msg3 contains 'okay thanks' %} + /// true + /// {% elsif msg1 contains 'got it' or msg2 contains 'got it' or msg3 contains 'got it' %} + /// true + /// {% else %} + /// false + /// {% endif %} + /// {% endif %}` + /// }] + /// } + /// ``` + public let rejectionPlan: ToolRejectionPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + messages: [UpdateToolDraftDtoMessagesItem]? = nil, + type: UpdateToolDraftDtoType? = nil, + function: OpenAiFunction? = nil, + metadata: [String: JSONValue]? = nil, + templateId: String? = nil, + server: Server? = nil, + async: Bool? = nil, + destinations: [[String: JSONValue]]? = nil, + name: String? = nil, + subType: String? = nil, + displayWidthPx: Double? = nil, + displayHeightPx: Double? = nil, + displayNumber: Double? = nil, + knowledgeBases: [KnowledgeBase]? = nil, + url: String? = nil, + method: UpdateToolDraftDtoMethod? = nil, + headers: JsonSchema? = nil, + body: [String: JSONValue]? = nil, + backoffPlan: BackoffPlan? = nil, + timeoutSeconds: Double? = nil, + description: String? = nil, + variableExtractionPlan: VariableExtractionPlan? = nil, + credentialId: String? = nil, + extendedDelayWhenPrecededByTextEnabled: Bool? = nil, + beepDetectionEnabled: Bool? = nil, + code: String? = nil, + environmentVariables: [CodeToolEnvironmentVariable]? = nil, + parameters: [ToolParameter]? = nil, + encryptedPaths: [String]? = nil, + sipInfoDtmfEnabled: Bool? = nil, + verb: UpdateToolDraftDtoVerb? = nil, + defaultResult: String? = nil, + toolMessages: [McpToolMessages]? = nil, + rejectionPlan: ToolRejectionPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.messages = messages + self.type = type + self.function = function + self.metadata = metadata + self.templateId = templateId + self.server = server + self.async = async + self.destinations = destinations + self.name = name + self.subType = subType + self.displayWidthPx = displayWidthPx + self.displayHeightPx = displayHeightPx + self.displayNumber = displayNumber + self.knowledgeBases = knowledgeBases + self.url = url + self.method = method + self.headers = headers + self.body = body + self.backoffPlan = backoffPlan + self.timeoutSeconds = timeoutSeconds + self.description = description + self.variableExtractionPlan = variableExtractionPlan + self.credentialId = credentialId + self.extendedDelayWhenPrecededByTextEnabled = extendedDelayWhenPrecededByTextEnabled + self.beepDetectionEnabled = beepDetectionEnabled + self.code = code + self.environmentVariables = environmentVariables + self.parameters = parameters + self.encryptedPaths = encryptedPaths + self.sipInfoDtmfEnabled = sipInfoDtmfEnabled + self.verb = verb + self.defaultResult = defaultResult + self.toolMessages = toolMessages + self.rejectionPlan = rejectionPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([UpdateToolDraftDtoMessagesItem].self, forKey: .messages) + self.type = try container.decodeIfPresent(UpdateToolDraftDtoType.self, forKey: .type) + self.function = try container.decodeIfPresent(OpenAiFunction.self, forKey: .function) + self.metadata = try container.decodeIfPresent([String: JSONValue].self, forKey: .metadata) + self.templateId = try container.decodeIfPresent(String.self, forKey: .templateId) + self.server = try container.decodeIfPresent(Server.self, forKey: .server) + self.async = try container.decodeIfPresent(Bool.self, forKey: .async) + self.destinations = try container.decodeIfPresent([[String: JSONValue]].self, forKey: .destinations) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.subType = try container.decodeIfPresent(String.self, forKey: .subType) + self.displayWidthPx = try container.decodeIfPresent(Double.self, forKey: .displayWidthPx) + self.displayHeightPx = try container.decodeIfPresent(Double.self, forKey: .displayHeightPx) + self.displayNumber = try container.decodeIfPresent(Double.self, forKey: .displayNumber) + self.knowledgeBases = try container.decodeIfPresent([KnowledgeBase].self, forKey: .knowledgeBases) + self.url = try container.decodeIfPresent(String.self, forKey: .url) + self.method = try container.decodeIfPresent(UpdateToolDraftDtoMethod.self, forKey: .method) + self.headers = try container.decodeIfPresent(JsonSchema.self, forKey: .headers) + self.body = try container.decodeIfPresent([String: JSONValue].self, forKey: .body) + self.backoffPlan = try container.decodeIfPresent(BackoffPlan.self, forKey: .backoffPlan) + self.timeoutSeconds = try container.decodeIfPresent(Double.self, forKey: .timeoutSeconds) + self.description = try container.decodeIfPresent(String.self, forKey: .description) + self.variableExtractionPlan = try container.decodeIfPresent(VariableExtractionPlan.self, forKey: .variableExtractionPlan) + self.credentialId = try container.decodeIfPresent(String.self, forKey: .credentialId) + self.extendedDelayWhenPrecededByTextEnabled = try container.decodeIfPresent(Bool.self, forKey: .extendedDelayWhenPrecededByTextEnabled) + self.beepDetectionEnabled = try container.decodeIfPresent(Bool.self, forKey: .beepDetectionEnabled) + self.code = try container.decodeIfPresent(String.self, forKey: .code) + self.environmentVariables = try container.decodeIfPresent([CodeToolEnvironmentVariable].self, forKey: .environmentVariables) + self.parameters = try container.decodeIfPresent([ToolParameter].self, forKey: .parameters) + self.encryptedPaths = try container.decodeIfPresent([String].self, forKey: .encryptedPaths) + self.sipInfoDtmfEnabled = try container.decodeIfPresent(Bool.self, forKey: .sipInfoDtmfEnabled) + self.verb = try container.decodeIfPresent(UpdateToolDraftDtoVerb.self, forKey: .verb) + self.defaultResult = try container.decodeIfPresent(String.self, forKey: .defaultResult) + self.toolMessages = try container.decodeIfPresent([McpToolMessages].self, forKey: .toolMessages) + self.rejectionPlan = try container.decodeIfPresent(ToolRejectionPlan.self, forKey: .rejectionPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) + try container.encodeIfPresent(self.type, forKey: .type) + try container.encodeIfPresent(self.function, forKey: .function) + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.templateId, forKey: .templateId) + try container.encodeIfPresent(self.server, forKey: .server) + try container.encodeIfPresent(self.async, forKey: .async) + try container.encodeIfPresent(self.destinations, forKey: .destinations) + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.subType, forKey: .subType) + try container.encodeIfPresent(self.displayWidthPx, forKey: .displayWidthPx) + try container.encodeIfPresent(self.displayHeightPx, forKey: .displayHeightPx) + try container.encodeIfPresent(self.displayNumber, forKey: .displayNumber) + try container.encodeIfPresent(self.knowledgeBases, forKey: .knowledgeBases) + try container.encodeIfPresent(self.url, forKey: .url) + try container.encodeIfPresent(self.method, forKey: .method) + try container.encodeIfPresent(self.headers, forKey: .headers) + try container.encodeIfPresent(self.body, forKey: .body) + try container.encodeIfPresent(self.backoffPlan, forKey: .backoffPlan) + try container.encodeIfPresent(self.timeoutSeconds, forKey: .timeoutSeconds) + try container.encodeIfPresent(self.description, forKey: .description) + try container.encodeIfPresent(self.variableExtractionPlan, forKey: .variableExtractionPlan) + try container.encodeIfPresent(self.credentialId, forKey: .credentialId) + try container.encodeIfPresent(self.extendedDelayWhenPrecededByTextEnabled, forKey: .extendedDelayWhenPrecededByTextEnabled) + try container.encodeIfPresent(self.beepDetectionEnabled, forKey: .beepDetectionEnabled) + try container.encodeIfPresent(self.code, forKey: .code) + try container.encodeIfPresent(self.environmentVariables, forKey: .environmentVariables) + try container.encodeIfPresent(self.parameters, forKey: .parameters) + try container.encodeIfPresent(self.encryptedPaths, forKey: .encryptedPaths) + try container.encodeIfPresent(self.sipInfoDtmfEnabled, forKey: .sipInfoDtmfEnabled) + try container.encodeIfPresent(self.verb, forKey: .verb) + try container.encodeIfPresent(self.defaultResult, forKey: .defaultResult) + try container.encodeIfPresent(self.toolMessages, forKey: .toolMessages) + try container.encodeIfPresent(self.rejectionPlan, forKey: .rejectionPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case messages + case type + case function + case metadata + case templateId + case server + case async + case destinations + case name + case subType + case displayWidthPx + case displayHeightPx + case displayNumber + case knowledgeBases + case url + case method + case headers + case body + case backoffPlan + case timeoutSeconds + case description + case variableExtractionPlan + case credentialId + case extendedDelayWhenPrecededByTextEnabled + case beepDetectionEnabled + case code + case environmentVariables + case parameters + case encryptedPaths + case sipInfoDtmfEnabled + case verb + case defaultResult + case toolMessages + case rejectionPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolDraftDtoMessagesItem.swift b/Sources/Schemas/UpdateToolDraftDtoMessagesItem.swift new file mode 100644 index 00000000..9ce83d2f --- /dev/null +++ b/Sources/Schemas/UpdateToolDraftDtoMessagesItem.swift @@ -0,0 +1,52 @@ +import Foundation + +public enum UpdateToolDraftDtoMessagesItem: Codable, Hashable, Sendable { + case requestComplete(ToolMessageComplete) + case requestFailed(ToolMessageFailed) + case requestResponseDelayed(ToolMessageDelayed) + case requestStart(ToolMessageStart) + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let discriminant = try container.decode(String.self, forKey: .type) + switch discriminant { + case "request-complete": + self = .requestComplete(try ToolMessageComplete(from: decoder)) + case "request-failed": + self = .requestFailed(try ToolMessageFailed(from: decoder)) + case "request-response-delayed": + self = .requestResponseDelayed(try ToolMessageDelayed(from: decoder)) + case "request-start": + self = .requestStart(try ToolMessageStart(from: decoder)) + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown shape discriminant value: \(discriminant)" + ) + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .requestComplete(let data): + try container.encode("request-complete", forKey: .type) + try data.encode(to: encoder) + case .requestFailed(let data): + try container.encode("request-failed", forKey: .type) + try data.encode(to: encoder) + case .requestResponseDelayed(let data): + try container.encode("request-response-delayed", forKey: .type) + try data.encode(to: encoder) + case .requestStart(let data): + try container.encode("request-start", forKey: .type) + try data.encode(to: encoder) + } + } + + enum CodingKeys: String, CodingKey, CaseIterable { + case type + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolDraftDtoMethod.swift b/Sources/Schemas/UpdateToolDraftDtoMethod.swift new file mode 100644 index 00000000..37e1baee --- /dev/null +++ b/Sources/Schemas/UpdateToolDraftDtoMethod.swift @@ -0,0 +1,10 @@ +import Foundation + +/// This is the HTTP method for the request (api-request tool). +public enum UpdateToolDraftDtoMethod: String, Codable, Hashable, CaseIterable, Sendable { + case post = "POST" + case get = "GET" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolDraftDtoType.swift b/Sources/Schemas/UpdateToolDraftDtoType.swift new file mode 100644 index 00000000..1c8ea029 --- /dev/null +++ b/Sources/Schemas/UpdateToolDraftDtoType.swift @@ -0,0 +1,33 @@ +import Foundation + +/// This is the type of the tool. +public enum UpdateToolDraftDtoType: String, Codable, Hashable, CaseIterable, Sendable { + case dtmf + case endCall + case transferCall + case transferCancel + case transferSuccessful + case handoff + case output + case voicemail + case query + case sms + case sipRequest + case function + case mcp + case apiRequest + case code + case bash + case computer + case textEditor + case googleCalendarEventCreate = "google.calendar.event.create" + case googleCalendarAvailabilityCheck = "google.calendar.availability.check" + case googleSheetsRowAppend = "google.sheets.row.append" + case slackMessageSend = "slack.message.send" + case gohighlevelCalendarEventCreate = "gohighlevel.calendar.event.create" + case gohighlevelCalendarAvailabilityCheck = "gohighlevel.calendar.availability.check" + case gohighlevelContactCreate = "gohighlevel.contact.create" + case gohighlevelContactGet = "gohighlevel.contact.get" + case make + case ghl +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolDraftDtoVerb.swift b/Sources/Schemas/UpdateToolDraftDtoVerb.swift new file mode 100644 index 00000000..9527007f --- /dev/null +++ b/Sources/Schemas/UpdateToolDraftDtoVerb.swift @@ -0,0 +1,8 @@ +import Foundation + +/// This is the SIP method to send (sip-request tool). +public enum UpdateToolDraftDtoVerb: String, Codable, Hashable, CaseIterable, Sendable { + case info = "INFO" + case message = "MESSAGE" + case notify = "NOTIFY" +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateToolVersionMetadataDto.swift b/Sources/Schemas/UpdateToolVersionMetadataDto.swift new file mode 100644 index 00000000..7b8bbdc3 --- /dev/null +++ b/Sources/Schemas/UpdateToolVersionMetadataDto.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct UpdateToolVersionMetadataDto: Codable, Hashable, Sendable { + /// Optional human-readable label for this version. Pass `null` to clear. + public let versionName: Nullable? + /// Optional description for this version. Pass `null` to clear. + public let versionDescription: Nullable? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + versionName: Nullable? = nil, + versionDescription: Nullable? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.versionName = versionName + self.versionDescription = versionDescription + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.versionName = try container.decodeNullableIfPresent(String.self, forKey: .versionName) + self.versionDescription = try container.decodeNullableIfPresent(String.self, forKey: .versionDescription) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.versionName, forKey: .versionName) + try container.encodeNullableIfPresent(self.versionDescription, forKey: .versionDescription) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case versionName + case versionDescription + } +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateTransferCallToolDto.swift b/Sources/Schemas/UpdateTransferCallToolDto.swift index 25007b58..bda3024d 100644 --- a/Sources/Schemas/UpdateTransferCallToolDto.swift +++ b/Sources/Schemas/UpdateTransferCallToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a call-transfer tool, including its destinations, spoken messages, and rejection plan. public struct UpdateTransferCallToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateTransferCallToolDtoMessagesItem]? /// These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. public let destinations: [UpdateTransferCallToolDtoDestinationsItem]? diff --git a/Sources/Schemas/UpdateTrieveKnowledgeBaseDto.swift b/Sources/Schemas/UpdateTrieveKnowledgeBaseDto.swift index 10883cae..59fa2bf7 100644 --- a/Sources/Schemas/UpdateTrieveKnowledgeBaseDto.swift +++ b/Sources/Schemas/UpdateTrieveKnowledgeBaseDto.swift @@ -1,51 +1,3 @@ import Foundation -public struct UpdateTrieveKnowledgeBaseDto: Codable, Hashable, Sendable { - /// This is the name of the knowledge base. - public let name: String? - /// This is the searching plan used when searching for relevant chunks from the vector store. - /// - /// You should configure this if you're running into these issues: - /// - Too much unnecessary context is being fed as knowledge base context. - /// - Not enough relevant context is being fed as knowledge base context. - public let searchPlan: TrieveKnowledgeBaseSearchPlan? - /// This is the plan if you want us to create/import a new vector store using Trieve. - public let createPlan: TrieveKnowledgeBaseImport? - /// Additional properties that are not explicitly defined in the schema - public let additionalProperties: [String: JSONValue] - - public init( - name: String? = nil, - searchPlan: TrieveKnowledgeBaseSearchPlan? = nil, - createPlan: TrieveKnowledgeBaseImport? = nil, - additionalProperties: [String: JSONValue] = .init() - ) { - self.name = name - self.searchPlan = searchPlan - self.createPlan = createPlan - self.additionalProperties = additionalProperties - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.name = try container.decodeIfPresent(String.self, forKey: .name) - self.searchPlan = try container.decodeIfPresent(TrieveKnowledgeBaseSearchPlan.self, forKey: .searchPlan) - self.createPlan = try container.decodeIfPresent(TrieveKnowledgeBaseImport.self, forKey: .createPlan) - self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) - } - - public func encode(to encoder: Encoder) throws -> Void { - var container = encoder.container(keyedBy: CodingKeys.self) - try encoder.encodeAdditionalProperties(self.additionalProperties) - try container.encodeIfPresent(self.name, forKey: .name) - try container.encodeIfPresent(self.searchPlan, forKey: .searchPlan) - try container.encodeIfPresent(self.createPlan, forKey: .createPlan) - } - - /// Keys for encoding/decoding struct properties. - enum CodingKeys: String, CodingKey, CaseIterable { - case name - case searchPlan - case createPlan - } -} \ No newline at end of file +public typealias UpdateTrieveKnowledgeBaseDto = JSONValue diff --git a/Sources/Schemas/UpdateTwilioCredentialDto.swift b/Sources/Schemas/UpdateTwilioCredentialDto.swift index babcef08..a3818f06 100644 --- a/Sources/Schemas/UpdateTwilioCredentialDto.swift +++ b/Sources/Schemas/UpdateTwilioCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateTwilioCredentialDtoProvider? /// This is not returned in the API. public let authToken: String? /// This is not returned in the API. @@ -14,6 +15,7 @@ public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateTwilioCredentialDtoProvider? = nil, authToken: String? = nil, apiKey: String? = nil, apiSecret: String? = nil, @@ -21,6 +23,7 @@ public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { accountSid: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authToken = authToken self.apiKey = apiKey self.apiSecret = apiSecret @@ -31,6 +34,7 @@ public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateTwilioCredentialDtoProvider.self, forKey: .provider) self.authToken = try container.decodeIfPresent(String.self, forKey: .authToken) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.apiSecret = try container.decodeIfPresent(String.self, forKey: .apiSecret) @@ -42,6 +46,7 @@ public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authToken, forKey: .authToken) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.apiSecret, forKey: .apiSecret) @@ -51,6 +56,7 @@ public struct UpdateTwilioCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authToken case apiKey case apiSecret diff --git a/Sources/Schemas/UpdateTwilioCredentialDtoProvider.swift b/Sources/Schemas/UpdateTwilioCredentialDtoProvider.swift new file mode 100644 index 00000000..e36dc050 --- /dev/null +++ b/Sources/Schemas/UpdateTwilioCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateTwilioCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case twilio +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateTwilioPhoneNumberDto.swift b/Sources/Schemas/UpdateTwilioPhoneNumberDto.swift index a833b79e..d4bcae53 100644 --- a/Sources/Schemas/UpdateTwilioPhoneNumberDto.swift +++ b/Sources/Schemas/UpdateTwilioPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a Twilio phone number, including its account credentials, SMS configuration, routing, hooks, and server settings. public struct UpdateTwilioPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/UpdateUserRoleDtoRole.swift b/Sources/Schemas/UpdateUserRoleDtoRole.swift index 2201ad0e..fde4e62c 100644 --- a/Sources/Schemas/UpdateUserRoleDtoRole.swift +++ b/Sources/Schemas/UpdateUserRoleDtoRole.swift @@ -1,7 +1,30 @@ import Foundation -public enum UpdateUserRoleDtoRole: String, Codable, Hashable, CaseIterable, Sendable { - case admin - case editor - case viewer +public enum UpdateUserRoleDtoRole: Codable, Hashable, Sendable { + case string(String) + case updateUserRoleDtoRoleZero(UpdateUserRoleDtoRoleZero) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(String.self) { + self = .string(value) + } else if let value = try? container.decode(UpdateUserRoleDtoRoleZero.self) { + self = .updateUserRoleDtoRoleZero(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .string(let value): + try container.encode(value) + case .updateUserRoleDtoRoleZero(let value): + try container.encode(value) + } + } } \ No newline at end of file diff --git a/Sources/Schemas/UpdateUserRoleDtoRoleZero.swift b/Sources/Schemas/UpdateUserRoleDtoRoleZero.swift new file mode 100644 index 00000000..8df79a75 --- /dev/null +++ b/Sources/Schemas/UpdateUserRoleDtoRoleZero.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum UpdateUserRoleDtoRoleZero: String, Codable, Hashable, CaseIterable, Sendable { + case admin + case editor + case viewer +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateVapiPhoneNumberDto.swift b/Sources/Schemas/UpdateVapiPhoneNumberDto.swift index c2c4fd6b..73e711b6 100644 --- a/Sources/Schemas/UpdateVapiPhoneNumberDto.swift +++ b/Sources/Schemas/UpdateVapiPhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a Vapi-managed phone number or SIP URI, including its authentication, routing, hooks, and server settings. public struct UpdateVapiPhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/UpdateVoicemailToolDto.swift b/Sources/Schemas/UpdateVoicemailToolDto.swift index c9cfca44..0fd15c4b 100644 --- a/Sources/Schemas/UpdateVoicemailToolDto.swift +++ b/Sources/Schemas/UpdateVoicemailToolDto.swift @@ -1,9 +1,8 @@ import Foundation +/// Fields used to update a voicemail-detection tool, including beep detection, spoken messages, and rejection plan. public struct UpdateVoicemailToolDto: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [UpdateVoicemailToolDtoMessagesItem]? /// This is the flag that enables beep detection for voicemail detection and applies only for twilio based calls. /// diff --git a/Sources/Schemas/UpdateVonageCredentialDto.swift b/Sources/Schemas/UpdateVonageCredentialDto.swift index 05ce4064..02375126 100644 --- a/Sources/Schemas/UpdateVonageCredentialDto.swift +++ b/Sources/Schemas/UpdateVonageCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateVonageCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateVonageCredentialDtoProvider? /// This is not returned in the API. public let apiSecret: String? /// This is the name of credential. This is just for your reference. @@ -10,11 +11,13 @@ public struct UpdateVonageCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateVonageCredentialDtoProvider? = nil, apiSecret: String? = nil, name: String? = nil, apiKey: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiSecret = apiSecret self.name = name self.apiKey = apiKey @@ -23,6 +26,7 @@ public struct UpdateVonageCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateVonageCredentialDtoProvider.self, forKey: .provider) self.apiSecret = try container.decodeIfPresent(String.self, forKey: .apiSecret) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) @@ -32,6 +36,7 @@ public struct UpdateVonageCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiSecret, forKey: .apiSecret) try container.encodeIfPresent(self.name, forKey: .name) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) @@ -39,6 +44,7 @@ public struct UpdateVonageCredentialDto: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiSecret case name case apiKey diff --git a/Sources/Schemas/UpdateVonageCredentialDtoProvider.swift b/Sources/Schemas/UpdateVonageCredentialDtoProvider.swift new file mode 100644 index 00000000..65491806 --- /dev/null +++ b/Sources/Schemas/UpdateVonageCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateVonageCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case vonage +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateVonagePhoneNumberDto.swift b/Sources/Schemas/UpdateVonagePhoneNumberDto.swift index f7cfa8ef..aa0c8ec7 100644 --- a/Sources/Schemas/UpdateVonagePhoneNumberDto.swift +++ b/Sources/Schemas/UpdateVonagePhoneNumberDto.swift @@ -1,5 +1,6 @@ import Foundation +/// Fields used to update a Vonage phone number, including its credential, number, routing, hooks, and server settings. public struct UpdateVonagePhoneNumberDto: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/UpdateWebhookCredentialDto.swift b/Sources/Schemas/UpdateWebhookCredentialDto.swift index 0ce81311..014d5026 100644 --- a/Sources/Schemas/UpdateWebhookCredentialDto.swift +++ b/Sources/Schemas/UpdateWebhookCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateWebhookCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateWebhookCredentialDtoProvider? /// This is the authentication plan. Supports OAuth2 RFC 6749, HMAC signing, and Bearer authentication. public let authenticationPlan: UpdateWebhookCredentialDtoAuthenticationPlan? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateWebhookCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateWebhookCredentialDtoProvider? = nil, authenticationPlan: UpdateWebhookCredentialDtoAuthenticationPlan? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.authenticationPlan = authenticationPlan self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateWebhookCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateWebhookCredentialDtoProvider.self, forKey: .provider) self.authenticationPlan = try container.decodeIfPresent(UpdateWebhookCredentialDtoAuthenticationPlan.self, forKey: .authenticationPlan) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateWebhookCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.authenticationPlan, forKey: .authenticationPlan) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case authenticationPlan case name } diff --git a/Sources/Schemas/UpdateWebhookCredentialDtoProvider.swift b/Sources/Schemas/UpdateWebhookCredentialDtoProvider.swift new file mode 100644 index 00000000..7938b94b --- /dev/null +++ b/Sources/Schemas/UpdateWebhookCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateWebhookCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case webhook +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateWellSaidCredentialDto.swift b/Sources/Schemas/UpdateWellSaidCredentialDto.swift index a8168140..672aef15 100644 --- a/Sources/Schemas/UpdateWellSaidCredentialDto.swift +++ b/Sources/Schemas/UpdateWellSaidCredentialDto.swift @@ -1,6 +1,7 @@ import Foundation public struct UpdateWellSaidCredentialDto: Codable, Hashable, Sendable { + public let provider: UpdateWellSaidCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +10,12 @@ public struct UpdateWellSaidCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateWellSaidCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +23,7 @@ public struct UpdateWellSaidCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateWellSaidCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +32,14 @@ public struct UpdateWellSaidCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateWellSaidCredentialDtoProvider.swift b/Sources/Schemas/UpdateWellSaidCredentialDtoProvider.swift new file mode 100644 index 00000000..2bb541c2 --- /dev/null +++ b/Sources/Schemas/UpdateWellSaidCredentialDtoProvider.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum UpdateWellSaidCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case wellsaid +} \ No newline at end of file diff --git a/Sources/Schemas/UpdateWorkflowDtoCredentialsItem.swift b/Sources/Schemas/UpdateWorkflowDtoCredentialsItem.swift index cb810c9f..0aed508e 100644 --- a/Sources/Schemas/UpdateWorkflowDtoCredentialsItem.swift +++ b/Sources/Schemas/UpdateWorkflowDtoCredentialsItem.swift @@ -33,6 +33,7 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum UpdateWorkflowDtoCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/UpdateWorkflowDtoTranscriber.swift b/Sources/Schemas/UpdateWorkflowDtoTranscriber.swift index c87edc06..2df8d6e2 100644 --- a/Sources/Schemas/UpdateWorkflowDtoTranscriber.swift +++ b/Sources/Schemas/UpdateWorkflowDtoTranscriber.swift @@ -16,6 +16,8 @@ public enum UpdateWorkflowDtoTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -45,6 +47,10 @@ public enum UpdateWorkflowDtoTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,12 @@ public enum UpdateWorkflowDtoTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/UpdateWorkflowDtoVoice.swift b/Sources/Schemas/UpdateWorkflowDtoVoice.swift index 8cf738a5..dce86e60 100644 --- a/Sources/Schemas/UpdateWorkflowDtoVoice.swift +++ b/Sources/Schemas/UpdateWorkflowDtoVoice.swift @@ -12,6 +12,7 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -22,6 +23,7 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,8 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -63,6 +67,8 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -100,6 +106,9 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -130,6 +139,9 @@ public enum UpdateWorkflowDtoVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/UpdateXAiCredentialDto.swift b/Sources/Schemas/UpdateXAiCredentialDto.swift index 78c94856..4896be79 100644 --- a/Sources/Schemas/UpdateXAiCredentialDto.swift +++ b/Sources/Schemas/UpdateXAiCredentialDto.swift @@ -1,6 +1,8 @@ import Foundation public struct UpdateXAiCredentialDto: Codable, Hashable, Sendable { + /// This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai + public let provider: UpdateXAiCredentialDtoProvider? /// This is not returned in the API. public let apiKey: String? /// This is the name of credential. This is just for your reference. @@ -9,10 +11,12 @@ public struct UpdateXAiCredentialDto: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + provider: UpdateXAiCredentialDtoProvider? = nil, apiKey: String? = nil, name: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.provider = provider self.apiKey = apiKey self.name = name self.additionalProperties = additionalProperties @@ -20,6 +24,7 @@ public struct UpdateXAiCredentialDto: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.provider = try container.decodeIfPresent(UpdateXAiCredentialDtoProvider.self, forKey: .provider) self.apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) self.name = try container.decodeIfPresent(String.self, forKey: .name) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -28,12 +33,14 @@ public struct UpdateXAiCredentialDto: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.provider, forKey: .provider) try container.encodeIfPresent(self.apiKey, forKey: .apiKey) try container.encodeIfPresent(self.name, forKey: .name) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case provider case apiKey case name } diff --git a/Sources/Schemas/UpdateXAiCredentialDtoProvider.swift b/Sources/Schemas/UpdateXAiCredentialDtoProvider.swift new file mode 100644 index 00000000..e26607f5 --- /dev/null +++ b/Sources/Schemas/UpdateXAiCredentialDtoProvider.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai +public enum UpdateXAiCredentialDtoProvider: String, Codable, Hashable, CaseIterable, Sendable { + case xai +} \ No newline at end of file diff --git a/Sources/Schemas/UserMessage.swift b/Sources/Schemas/UserMessage.swift index f2fd6d1d..77a56ba3 100644 --- a/Sources/Schemas/UserMessage.swift +++ b/Sources/Schemas/UserMessage.swift @@ -1,5 +1,6 @@ import Foundation +/// A user-authored entry in the call message history, including content, timing, security-filter results, and optional speaker metadata. public struct UserMessage: Codable, Hashable, Sendable { /// The role of the user in the conversation. public let role: String diff --git a/Sources/Schemas/VapiCost.swift b/Sources/Schemas/VapiCost.swift index b0b3a4ae..6886070b 100644 --- a/Sources/Schemas/VapiCost.swift +++ b/Sources/Schemas/VapiCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Vapi platform cost for a call, including cost subtype, billable minutes, and amount. public struct VapiCost: Codable, Hashable, Sendable { /// This is the sub type of the cost. public let subType: VapiCostSubType diff --git a/Sources/Schemas/VapiModel.swift b/Sources/Schemas/VapiModel.swift index 9f41f1aa..5e71239a 100644 --- a/Sources/Schemas/VapiModel.swift +++ b/Sources/Schemas/VapiModel.swift @@ -11,19 +11,31 @@ public struct VapiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? - public let provider: VapiModelProvider + /// White-label Vapi models are selected by `version`, not a model name, so + /// `model` is optional here (the runtime already accepts a version-only Vapi + /// payload). Overriding the required `ModelBase.model`: the declared type stays + /// `string` to match the base (avoids TS2416) and the `= undefined!` initializer + /// satisfies TS2612 for the field override, while `@IsOptional` + + /// `@ApiPropertyOptional` make validation and the generated OpenAPI schema treat + /// it as optional (so `VapiModel.required` is `['provider']`). + public let model: String? + /// Vapi-managed model version (update channel). When set, this is a Vapi-managed + /// LLM routed by the registry; when absent, this is the legacy workflow form + /// below (`steps` / `workflow`). + public let version: VapiModelVersion? /// This is the workflow that will be used for the call. To use a transient workflow, use `workflow` instead. public let workflowId: String? /// This is the workflow that will be used for the call. To use an existing workflow, use `workflowId` instead. public let workflow: WorkflowUserEditable? - /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b - public let model: String - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? - /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. - public let maxTokens: Double? /// This determines whether we detect user's emotion while they speak and send it as an additional info to model. /// /// Default `false` because the model is usually are good at understanding the user's emotion from text. @@ -43,13 +55,13 @@ public struct VapiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [VapiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, - provider: VapiModelProvider, + model: String? = nil, + version: VapiModelVersion? = nil, workflowId: String? = nil, workflow: WorkflowUserEditable? = nil, - model: String, temperature: Double? = nil, - maxTokens: Double? = nil, emotionRecognitionEnabled: Bool? = nil, numFastTurns: Double? = nil, additionalProperties: [String: JSONValue] = .init() @@ -57,13 +69,13 @@ public struct VapiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase - self.provider = provider + self.model = model + self.version = version self.workflowId = workflowId self.workflow = workflow - self.model = model self.temperature = temperature - self.maxTokens = maxTokens self.emotionRecognitionEnabled = emotionRecognitionEnabled self.numFastTurns = numFastTurns self.additionalProperties = additionalProperties @@ -74,13 +86,13 @@ public struct VapiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([VapiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) - self.provider = try container.decode(VapiModelProvider.self, forKey: .provider) + self.model = try container.decodeIfPresent(String.self, forKey: .model) + self.version = try container.decodeIfPresent(VapiModelVersion.self, forKey: .version) self.workflowId = try container.decodeIfPresent(String.self, forKey: .workflowId) self.workflow = try container.decodeIfPresent(WorkflowUserEditable.self, forKey: .workflow) - self.model = try container.decode(String.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) - self.maxTokens = try container.decodeIfPresent(Double.self, forKey: .maxTokens) self.emotionRecognitionEnabled = try container.decodeIfPresent(Bool.self, forKey: .emotionRecognitionEnabled) self.numFastTurns = try container.decodeIfPresent(Double.self, forKey: .numFastTurns) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) @@ -92,13 +104,13 @@ public struct VapiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) - try container.encode(self.provider, forKey: .provider) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.version, forKey: .version) try container.encodeIfPresent(self.workflowId, forKey: .workflowId) try container.encodeIfPresent(self.workflow, forKey: .workflow) - try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) - try container.encodeIfPresent(self.maxTokens, forKey: .maxTokens) try container.encodeIfPresent(self.emotionRecognitionEnabled, forKey: .emotionRecognitionEnabled) try container.encodeIfPresent(self.numFastTurns, forKey: .numFastTurns) } @@ -108,13 +120,13 @@ public struct VapiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase - case provider + case model + case version case workflowId case workflow - case model case temperature - case maxTokens case emotionRecognitionEnabled case numFastTurns } diff --git a/Sources/Schemas/VapiModelProvider.swift b/Sources/Schemas/VapiModelProvider.swift deleted file mode 100644 index 188f1438..00000000 --- a/Sources/Schemas/VapiModelProvider.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public enum VapiModelProvider: String, Codable, Hashable, CaseIterable, Sendable { - case vapi -} \ No newline at end of file diff --git a/Sources/Schemas/VapiModelToolsItem.swift b/Sources/Schemas/VapiModelToolsItem.swift index 539b7f41..ac4c6c1e 100644 --- a/Sources/Schemas/VapiModelToolsItem.swift +++ b/Sources/Schemas/VapiModelToolsItem.swift @@ -1,6 +1,6 @@ import Foundation -public enum VapiModelToolsItem: Codable, Hashable, Sendable { +public indirect enum VapiModelToolsItem: Codable, Hashable, Sendable { case apiRequest(CreateApiRequestToolDto) case bash(CreateBashToolDto) case code(CreateCodeToolDto) diff --git a/Sources/Schemas/VapiModelVersion.swift b/Sources/Schemas/VapiModelVersion.swift new file mode 100644 index 00000000..b2ca62b5 --- /dev/null +++ b/Sources/Schemas/VapiModelVersion.swift @@ -0,0 +1,9 @@ +import Foundation + +/// Vapi-managed model version (update channel). When set, this is a Vapi-managed +/// LLM routed by the registry; when absent, this is the legacy workflow form +/// below (`steps` / `workflow`). +public enum VapiModelVersion: String, Codable, Hashable, CaseIterable, Sendable { + case latest + case one = "1" +} \ No newline at end of file diff --git a/Sources/Schemas/VapiPhoneNumber.swift b/Sources/Schemas/VapiPhoneNumber.swift index 78567eaa..78568d8a 100644 --- a/Sources/Schemas/VapiPhoneNumber.swift +++ b/Sources/Schemas/VapiPhoneNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// A Vapi-managed phone number or SIP URI, including its authentication, routing, hooks, server settings, and lifecycle metadata. public struct VapiPhoneNumber: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/VapiPronunciationDictionaryLocator.swift b/Sources/Schemas/VapiPronunciationDictionaryLocator.swift index 09bc4c6b..ccf0203c 100644 --- a/Sources/Schemas/VapiPronunciationDictionaryLocator.swift +++ b/Sources/Schemas/VapiPronunciationDictionaryLocator.swift @@ -1,5 +1,6 @@ import Foundation +/// Identifies a pronunciation dictionary and optional version used for voice synthesis. public struct VapiPronunciationDictionaryLocator: Codable, Hashable, Sendable { /// The pronunciation dictionary ID public let pronunciationDictId: String diff --git a/Sources/Schemas/VapiSipTransport.swift b/Sources/Schemas/VapiSipTransport.swift new file mode 100644 index 00000000..7e4e15f1 --- /dev/null +++ b/Sources/Schemas/VapiSipTransport.swift @@ -0,0 +1,56 @@ +import Foundation + +public struct VapiSipTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: VapiSipTransportConversationType? + /// This sets the timeout for outbound dial operations in seconds. This is the duration the call will ring before timing out. + /// + /// @default 60 + public let dialTimeout: Double? + /// This is the call SID of the Vapi SIP call. + public let sbcCallSid: String? + /// This is the call ID of the Vapi SIP call. + public let callSid: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: VapiSipTransportConversationType? = nil, + dialTimeout: Double? = nil, + sbcCallSid: String? = nil, + callSid: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.dialTimeout = dialTimeout + self.sbcCallSid = sbcCallSid + self.callSid = callSid + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(VapiSipTransportConversationType.self, forKey: .conversationType) + self.dialTimeout = try container.decodeIfPresent(Double.self, forKey: .dialTimeout) + self.sbcCallSid = try container.decodeIfPresent(String.self, forKey: .sbcCallSid) + self.callSid = try container.decodeIfPresent(String.self, forKey: .callSid) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.dialTimeout, forKey: .dialTimeout) + try container.encodeIfPresent(self.sbcCallSid, forKey: .sbcCallSid) + try container.encodeIfPresent(self.callSid, forKey: .callSid) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case dialTimeout + case sbcCallSid + case callSid + } +} \ No newline at end of file diff --git a/Sources/Schemas/VapiSipTransportConversationType.swift b/Sources/Schemas/VapiSipTransportConversationType.swift new file mode 100644 index 00000000..d73b7ac8 --- /dev/null +++ b/Sources/Schemas/VapiSipTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum VapiSipTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/VapiSmartEndpointingPlan.swift b/Sources/Schemas/VapiSmartEndpointingPlan.swift index 64a3c30c..b4e39c4e 100644 --- a/Sources/Schemas/VapiSmartEndpointingPlan.swift +++ b/Sources/Schemas/VapiSmartEndpointingPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Selects Vapi smart endpointing to determine when customer speech is complete. public struct VapiSmartEndpointingPlan: Codable, Hashable, Sendable { /// This is the provider for the smart endpointing plan. public let provider: VapiSmartEndpointingPlanProvider diff --git a/Sources/Schemas/VapiTranscriber.swift b/Sources/Schemas/VapiTranscriber.swift new file mode 100644 index 00000000..992f3cd1 --- /dev/null +++ b/Sources/Schemas/VapiTranscriber.swift @@ -0,0 +1,74 @@ +import Foundation + +public struct VapiTranscriber: Codable, Hashable, Sendable { + /// This is the version of the Vapi transcriber. Vapi manages the underlying + /// model and routing. When omitted, the latest version is used. + /// + /// Managed version params are additive-only and `'latest'` is an auto-update + /// channel — see the param-evolution INVARIANT in `vapiManaged/types.ts`. + public let version: VapiTranscriberVersion? + /// This is the language for transcription as an ISO 639-1 code (e.g. `en`). + /// Selecting a language locks transcription to it. For multiple languages, + /// use `languages` instead. When neither `language` nor `languages` is set, + /// the transcriber auto-detects the spoken language. + public let language: VapiTranscriberLanguage? + /// These are the languages for transcription as ISO 639-1 codes. Set one or + /// more codes to restrict and bias recognition to those languages. An empty + /// array `[]` (or omitting both this and `language`) enables auto-detection + /// of the spoken language. + public let languages: [VapiTranscriberLanguagesItem]? + /// These are custom keywords/vocabulary to boost recognition of use-case + /// specific words (company names, product names, jargon). + public let keywords: [String]? + /// This is the turn-taking mode. `intelligent` uses the underlying model's + /// native end-of-turn detection; `manual` ignores it and waits a fixed + /// end-of-turn delay. Defaults to `intelligent`. + public let turnTaking: VapiTranscriberTurnTaking? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + version: VapiTranscriberVersion? = nil, + language: VapiTranscriberLanguage? = nil, + languages: [VapiTranscriberLanguagesItem]? = nil, + keywords: [String]? = nil, + turnTaking: VapiTranscriberTurnTaking? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.version = version + self.language = language + self.languages = languages + self.keywords = keywords + self.turnTaking = turnTaking + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.version = try container.decodeIfPresent(VapiTranscriberVersion.self, forKey: .version) + self.language = try container.decodeIfPresent(VapiTranscriberLanguage.self, forKey: .language) + self.languages = try container.decodeIfPresent([VapiTranscriberLanguagesItem].self, forKey: .languages) + self.keywords = try container.decodeIfPresent([String].self, forKey: .keywords) + self.turnTaking = try container.decodeIfPresent(VapiTranscriberTurnTaking.self, forKey: .turnTaking) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.version, forKey: .version) + try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.languages, forKey: .languages) + try container.encodeIfPresent(self.keywords, forKey: .keywords) + try container.encodeIfPresent(self.turnTaking, forKey: .turnTaking) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case version + case language + case languages + case keywords + case turnTaking + } +} \ No newline at end of file diff --git a/Sources/Schemas/VapiTranscriberLanguage.swift b/Sources/Schemas/VapiTranscriberLanguage.swift new file mode 100644 index 00000000..a0ede9dc --- /dev/null +++ b/Sources/Schemas/VapiTranscriberLanguage.swift @@ -0,0 +1,193 @@ +import Foundation + +/// This is the language for transcription as an ISO 639-1 code (e.g. `en`). +/// Selecting a language locks transcription to it. For multiple languages, +/// use `languages` instead. When neither `language` nor `languages` is set, +/// the transcriber auto-detects the spoken language. +public enum VapiTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case aa + case ab + case ae + case af + case ak + case am + case an + case ar + case `as` + case av + case ay + case az + case ba + case be + case bg + case bh + case bi + case bm + case bn + case bo + case br + case bs + case ca + case ce + case ch + case co + case cr + case cs + case cu + case cv + case cy + case da + case de + case dv + case dz + case ee + case el + case en + case eo + case es + case et + case eu + case fa + case ff + case fi + case fj + case fo + case fr + case fy + case ga + case gd + case gl + case gn + case gu + case gv + case ha + case he + case hi + case ho + case hr + case ht + case hu + case hy + case hz + case ia + case id + case ie + case ig + case ii + case ik + case io + case `is` + case it + case iu + case ja + case jv + case ka + case kg + case ki + case kj + case kk + case kl + case km + case kn + case ko + case kr + case ks + case ku + case kv + case kw + case ky + case la + case lb + case lg + case li + case ln + case lo + case lt + case lu + case lv + case mg + case mh + case mi + case mk + case ml + case mn + case mr + case ms + case mt + case my + case na + case nb + case nd + case ne + case ng + case nl + case nn + case no + case nr + case nv + case ny + case oc + case oj + case om + case or + case os + case pa + case pi + case pl + case ps + case pt + case qu + case rm + case rn + case ro + case ru + case rw + case sa + case sc + case sd + case se + case sg + case si + case sk + case sl + case sm + case sn + case so + case sq + case sr + case ss + case st + case su + case sv + case sw + case ta + case te + case tg + case th + case ti + case tk + case tl + case tn + case to + case tr + case ts + case tt + case tw + case ty + case ug + case uk + case ur + case uz + case ve + case vi + case vo + case wa + case wo + case xh + case yi + case yue + case yo + case za + case zh + case zu +} \ No newline at end of file diff --git a/Sources/Schemas/VapiTranscriberLanguagesItem.swift b/Sources/Schemas/VapiTranscriberLanguagesItem.swift new file mode 100644 index 00000000..04f1a56e --- /dev/null +++ b/Sources/Schemas/VapiTranscriberLanguagesItem.swift @@ -0,0 +1,189 @@ +import Foundation + +public enum VapiTranscriberLanguagesItem: String, Codable, Hashable, CaseIterable, Sendable { + case aa + case ab + case ae + case af + case ak + case am + case an + case ar + case `as` + case av + case ay + case az + case ba + case be + case bg + case bh + case bi + case bm + case bn + case bo + case br + case bs + case ca + case ce + case ch + case co + case cr + case cs + case cu + case cv + case cy + case da + case de + case dv + case dz + case ee + case el + case en + case eo + case es + case et + case eu + case fa + case ff + case fi + case fj + case fo + case fr + case fy + case ga + case gd + case gl + case gn + case gu + case gv + case ha + case he + case hi + case ho + case hr + case ht + case hu + case hy + case hz + case ia + case id + case ie + case ig + case ii + case ik + case io + case `is` + case it + case iu + case ja + case jv + case ka + case kg + case ki + case kj + case kk + case kl + case km + case kn + case ko + case kr + case ks + case ku + case kv + case kw + case ky + case la + case lb + case lg + case li + case ln + case lo + case lt + case lu + case lv + case mg + case mh + case mi + case mk + case ml + case mn + case mr + case ms + case mt + case my + case na + case nb + case nd + case ne + case ng + case nl + case nn + case no + case nr + case nv + case ny + case oc + case oj + case om + case or + case os + case pa + case pi + case pl + case ps + case pt + case qu + case rm + case rn + case ro + case ru + case rw + case sa + case sc + case sd + case se + case sg + case si + case sk + case sl + case sm + case sn + case so + case sq + case sr + case ss + case st + case su + case sv + case sw + case ta + case te + case tg + case th + case ti + case tk + case tl + case tn + case to + case tr + case ts + case tt + case tw + case ty + case ug + case uk + case ur + case uz + case ve + case vi + case vo + case wa + case wo + case xh + case yi + case yue + case yo + case za + case zh + case zu +} \ No newline at end of file diff --git a/Sources/Schemas/VapiTranscriberTurnTaking.swift b/Sources/Schemas/VapiTranscriberTurnTaking.swift new file mode 100644 index 00000000..d5e17e3a --- /dev/null +++ b/Sources/Schemas/VapiTranscriberTurnTaking.swift @@ -0,0 +1,9 @@ +import Foundation + +/// This is the turn-taking mode. `intelligent` uses the underlying model's +/// native end-of-turn detection; `manual` ignores it and waits a fixed +/// end-of-turn delay. Defaults to `intelligent`. +public enum VapiTranscriberTurnTaking: String, Codable, Hashable, CaseIterable, Sendable { + case intelligent + case manual +} \ No newline at end of file diff --git a/Sources/Schemas/VapiTranscriberVersion.swift b/Sources/Schemas/VapiTranscriberVersion.swift new file mode 100644 index 00000000..665d566f --- /dev/null +++ b/Sources/Schemas/VapiTranscriberVersion.swift @@ -0,0 +1,11 @@ +import Foundation + +/// This is the version of the Vapi transcriber. Vapi manages the underlying +/// model and routing. When omitted, the latest version is used. +/// +/// Managed version params are additive-only and `'latest'` is an auto-update +/// channel — see the param-evolution INVARIANT in `vapiManaged/types.ts`. +public enum VapiTranscriberVersion: String, Codable, Hashable, CaseIterable, Sendable { + case latest + case one = "1" +} \ No newline at end of file diff --git a/Sources/Schemas/VapiVoice.swift b/Sources/Schemas/VapiVoice.swift index 38b2c85e..d434bdee 100644 --- a/Sources/Schemas/VapiVoice.swift +++ b/Sources/Schemas/VapiVoice.swift @@ -1,38 +1,43 @@ import Foundation +/// Configuration for synthesizing assistant speech with Vapi, including voice selection, speed, pronunciation dictionary, chunking, caching, and fallback settings. public struct VapiVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? /// The voices provided by Vapi public let voiceId: VapiVoiceVoiceId + /// The Vapi voice routing generation. `latest` auto-updates to the newest generation; version 1 uses legacy mappings; version 2 can use xAI-backed voices when available. When omitted, Version 1 is used. Accepts the string channel ('latest', '1', '2'); legacy numeric values (1, 2) are also accepted and coerced to their string form. + public let version: VapiVoiceVersion? /// This is the speed multiplier that will be used. /// /// @default 1 public let speed: Double? + /// Language for Vapi voice synthesis. For Version 2, omit this field or set `auto` for automatic language detection. Version 1 supports legacy Vapi language values. + public let language: VapiVoiceLanguage? /// List of pronunciation dictionary locators for custom word pronunciations. public let pronunciationDictionary: [VapiPronunciationDictionaryLocator]? /// This is the plan for chunking the model output before it is sent to the voice provider. public let chunkPlan: ChunkPlan? - /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. - public let fallbackPlan: FallbackPlan? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( cachingEnabled: Bool? = nil, voiceId: VapiVoiceVoiceId, + version: VapiVoiceVersion? = nil, speed: Double? = nil, + language: VapiVoiceLanguage? = nil, pronunciationDictionary: [VapiPronunciationDictionaryLocator]? = nil, chunkPlan: ChunkPlan? = nil, - fallbackPlan: FallbackPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { self.cachingEnabled = cachingEnabled self.voiceId = voiceId + self.version = version self.speed = speed + self.language = language self.pronunciationDictionary = pronunciationDictionary self.chunkPlan = chunkPlan - self.fallbackPlan = fallbackPlan self.additionalProperties = additionalProperties } @@ -40,10 +45,11 @@ public struct VapiVoice: Codable, Hashable, Sendable { let container = try decoder.container(keyedBy: CodingKeys.self) self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) self.voiceId = try container.decode(VapiVoiceVoiceId.self, forKey: .voiceId) + self.version = try container.decodeIfPresent(VapiVoiceVersion.self, forKey: .version) self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.language = try container.decodeIfPresent(VapiVoiceLanguage.self, forKey: .language) self.pronunciationDictionary = try container.decodeIfPresent([VapiPronunciationDictionaryLocator].self, forKey: .pronunciationDictionary) self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) - self.fallbackPlan = try container.decodeIfPresent(FallbackPlan.self, forKey: .fallbackPlan) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -52,19 +58,21 @@ public struct VapiVoice: Codable, Hashable, Sendable { try encoder.encodeAdditionalProperties(self.additionalProperties) try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.version, forKey: .version) try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.language, forKey: .language) try container.encodeIfPresent(self.pronunciationDictionary, forKey: .pronunciationDictionary) try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) - try container.encodeIfPresent(self.fallbackPlan, forKey: .fallbackPlan) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { case cachingEnabled case voiceId + case version case speed + case language case pronunciationDictionary case chunkPlan - case fallbackPlan } } \ No newline at end of file diff --git a/Sources/Schemas/VapiVoiceLanguage.swift b/Sources/Schemas/VapiVoiceLanguage.swift new file mode 100644 index 00000000..77e4b5c7 --- /dev/null +++ b/Sources/Schemas/VapiVoiceLanguage.swift @@ -0,0 +1,62 @@ +import Foundation + +/// Language for Vapi voice synthesis. For Version 2, omit this field or set `auto` for automatic language detection. Version 1 supports legacy Vapi language values. +public enum VapiVoiceLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case enUs = "en-US" + case enGb = "en-GB" + case enAu = "en-AU" + case enCa = "en-CA" + case ja + case zh + case de + case hi + case frFr = "fr-FR" + case frCa = "fr-CA" + case ko + case ptBr = "pt-BR" + case ptPt = "pt-PT" + case it + case esEs = "es-ES" + case esMx = "es-MX" + case id + case nl + case tr + case fil + case pl + case sv + case bg + case ro + case arSa = "ar-SA" + case arAe = "ar-AE" + case cs + case el + case fi + case hr + case ms + case sk + case da + case ta + case uk + case ru + case hu + case no + case vi + case auto + case en + case ar + case arEg = "ar-EG" + case bn + case es + case fr + case gu + case he + case ka + case kn + case ml + case mr + case pa + case pt + case te + case th + case tl +} \ No newline at end of file diff --git a/Sources/Schemas/VapiVoiceVersion.swift b/Sources/Schemas/VapiVoiceVersion.swift new file mode 100644 index 00000000..77cb1821 --- /dev/null +++ b/Sources/Schemas/VapiVoiceVersion.swift @@ -0,0 +1,8 @@ +import Foundation + +/// The Vapi voice routing generation. `latest` auto-updates to the newest generation; version 1 uses legacy mappings; version 2 can use xAI-backed voices when available. When omitted, Version 1 is used. Accepts the string channel ('latest', '1', '2'); legacy numeric values (1, 2) are also accepted and coerced to their string form. +public enum VapiVoiceVersion: String, Codable, Hashable, CaseIterable, Sendable { + case one = "1" + case two = "2" + case latest +} \ No newline at end of file diff --git a/Sources/Schemas/VapiVoiceVoiceId.swift b/Sources/Schemas/VapiVoiceVoiceId.swift index bd92a85c..19766ea5 100644 --- a/Sources/Schemas/VapiVoiceVoiceId.swift +++ b/Sources/Schemas/VapiVoiceVoiceId.swift @@ -4,25 +4,25 @@ import Foundation public enum VapiVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { case clara = "Clara" case godfrey = "Godfrey" + case elliot = "Elliot" + case savannah = "Savannah" + case nico = "Nico" + case kai = "Kai" + case emma = "Emma" + case sagar = "Sagar" + case neil = "Neil" case layla = "Layla" case sid = "Sid" case gustavo = "Gustavo" - case elliot = "Elliot" case kylie = "Kylie" case rohan = "Rohan" case lily = "Lily" - case savannah = "Savannah" case hana = "Hana" case neha = "Neha" case cole = "Cole" case harry = "Harry" case paige = "Paige" case spencer = "Spencer" - case nico = "Nico" - case kai = "Kai" - case emma = "Emma" - case sagar = "Sagar" - case neil = "Neil" case naina = "Naina" case leah = "Leah" case tara = "Tara" diff --git a/Sources/Schemas/VapiVoicemailDetectionPlan.swift b/Sources/Schemas/VapiVoicemailDetectionPlan.swift index be409556..6454c46e 100644 --- a/Sources/Schemas/VapiVoicemailDetectionPlan.swift +++ b/Sources/Schemas/VapiVoicemailDetectionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for detecting voicemail with Vapi, including detection type, maximum beep wait, and retry backoff. public struct VapiVoicemailDetectionPlan: Codable, Hashable, Sendable { /// This is the maximum duration from the start of the call that we will wait for a voicemail beep, before speaking our message /// diff --git a/Sources/Schemas/VapiWebCallTransport.swift b/Sources/Schemas/VapiWebCallTransport.swift new file mode 100644 index 00000000..2b249d38 --- /dev/null +++ b/Sources/Schemas/VapiWebCallTransport.swift @@ -0,0 +1,58 @@ +import Foundation + +public struct VapiWebCallTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: VapiWebCallTransportConversationType? + /// This determines whether the daily room will be deleted and all participants will be kicked once the user leaves the room. + /// If set to `false`, the room will be kept alive even after the user leaves, allowing clients to reconnect to the same room. + /// If set to `true`, the room will be deleted and reconnection will not be allowed. + /// + /// Defaults to `true`. + public let roomDeleteOnUserLeaveEnabled: Bool? + /// This is the URL of the web call. + public let callUrl: String? + /// This is the SIP URI of the web call. + public let callSipUri: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: VapiWebCallTransportConversationType? = nil, + roomDeleteOnUserLeaveEnabled: Bool? = nil, + callUrl: String? = nil, + callSipUri: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.roomDeleteOnUserLeaveEnabled = roomDeleteOnUserLeaveEnabled + self.callUrl = callUrl + self.callSipUri = callSipUri + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(VapiWebCallTransportConversationType.self, forKey: .conversationType) + self.roomDeleteOnUserLeaveEnabled = try container.decodeIfPresent(Bool.self, forKey: .roomDeleteOnUserLeaveEnabled) + self.callUrl = try container.decodeIfPresent(String.self, forKey: .callUrl) + self.callSipUri = try container.decodeIfPresent(String.self, forKey: .callSipUri) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.roomDeleteOnUserLeaveEnabled, forKey: .roomDeleteOnUserLeaveEnabled) + try container.encodeIfPresent(self.callUrl, forKey: .callUrl) + try container.encodeIfPresent(self.callSipUri, forKey: .callSipUri) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case roomDeleteOnUserLeaveEnabled + case callUrl + case callSipUri + } +} \ No newline at end of file diff --git a/Sources/Schemas/VapiWebCallTransportConversationType.swift b/Sources/Schemas/VapiWebCallTransportConversationType.swift new file mode 100644 index 00000000..46dc57d4 --- /dev/null +++ b/Sources/Schemas/VapiWebCallTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum VapiWebCallTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/VapiWebsocketTransport.swift b/Sources/Schemas/VapiWebsocketTransport.swift new file mode 100644 index 00000000..35c860ea --- /dev/null +++ b/Sources/Schemas/VapiWebsocketTransport.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct VapiWebsocketTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: VapiWebsocketTransportConversationType? + /// This is the audio format of the call. Defaults to 16KHz raw pcm_s16le + public let audioFormat: AudioFormat? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: VapiWebsocketTransportConversationType? = nil, + audioFormat: AudioFormat? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.audioFormat = audioFormat + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(VapiWebsocketTransportConversationType.self, forKey: .conversationType) + self.audioFormat = try container.decodeIfPresent(AudioFormat.self, forKey: .audioFormat) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.audioFormat, forKey: .audioFormat) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case audioFormat + } +} \ No newline at end of file diff --git a/Sources/Schemas/VapiWebsocketTransportConversationType.swift b/Sources/Schemas/VapiWebsocketTransportConversationType.swift new file mode 100644 index 00000000..49afc6be --- /dev/null +++ b/Sources/Schemas/VapiWebsocketTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum VapiWebsocketTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/VariableExtractionAlias.swift b/Sources/Schemas/VariableExtractionAlias.swift index d6a09440..a60d17b7 100644 --- a/Sources/Schemas/VariableExtractionAlias.swift +++ b/Sources/Schemas/VariableExtractionAlias.swift @@ -1,5 +1,6 @@ import Foundation +/// Defines an additional Liquid-based variable from values extracted during a call. public struct VariableExtractionAlias: Codable, Hashable, Sendable { /// This is the key of the variable. /// diff --git a/Sources/Schemas/VariableExtractionPlan.swift b/Sources/Schemas/VariableExtractionPlan.swift index d972a28a..0ec29a71 100644 --- a/Sources/Schemas/VariableExtractionPlan.swift +++ b/Sources/Schemas/VariableExtractionPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Defines structured variables to extract and optional aliases made available during and after a call. public struct VariableExtractionPlan: Codable, Hashable, Sendable { /// This is the schema to extract. /// diff --git a/Sources/Schemas/VariableValueGroupBy.swift b/Sources/Schemas/VariableValueGroupBy.swift index ba760dd2..7c495ee0 100644 --- a/Sources/Schemas/VariableValueGroupBy.swift +++ b/Sources/Schemas/VariableValueGroupBy.swift @@ -1,5 +1,6 @@ import Foundation +/// Groups analytics results by a selected assistant variable-value key. public struct VariableValueGroupBy: Codable, Hashable, Sendable { /// This is the key of the variable value to group by. public let key: String diff --git a/Sources/Schemas/VersionPinConflictResponseDto.swift b/Sources/Schemas/VersionPinConflictResponseDto.swift new file mode 100644 index 00000000..c1a33eb4 --- /dev/null +++ b/Sources/Schemas/VersionPinConflictResponseDto.swift @@ -0,0 +1,46 @@ +import Foundation + +public struct VersionPinConflictResponseDto: Codable, Hashable, Sendable { + public let error: VersionPinConflictResponseDtoError + /// Human-readable reason the delete was rejected. + public let message: String + /// Pins that block the delete. + public let pinnedBy: [VersionPinReference] + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + error: VersionPinConflictResponseDtoError, + message: String, + pinnedBy: [VersionPinReference], + additionalProperties: [String: JSONValue] = .init() + ) { + self.error = error + self.message = message + self.pinnedBy = pinnedBy + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.error = try container.decode(VersionPinConflictResponseDtoError.self, forKey: .error) + self.message = try container.decode(String.self, forKey: .message) + self.pinnedBy = try container.decode([VersionPinReference].self, forKey: .pinnedBy) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.error, forKey: .error) + try container.encode(self.message, forKey: .message) + try container.encode(self.pinnedBy, forKey: .pinnedBy) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case error + case message + case pinnedBy + } +} \ No newline at end of file diff --git a/Sources/Schemas/VersionPinConflictResponseDtoError.swift b/Sources/Schemas/VersionPinConflictResponseDtoError.swift new file mode 100644 index 00000000..c30cea45 --- /dev/null +++ b/Sources/Schemas/VersionPinConflictResponseDtoError.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum VersionPinConflictResponseDtoError: String, Codable, Hashable, CaseIterable, Sendable { + case versionPinned = "version_pinned" +} \ No newline at end of file diff --git a/Sources/Schemas/VersionPinReference.swift b/Sources/Schemas/VersionPinReference.swift new file mode 100644 index 00000000..e826ea02 --- /dev/null +++ b/Sources/Schemas/VersionPinReference.swift @@ -0,0 +1,40 @@ +import Foundation + +public struct VersionPinReference: Codable, Hashable, Sendable { + /// Kind of source row the pin originates from. + public let sourceType: VersionPinReferenceSourceType + /// UUID of the source row (polymorphic, not FK-enforced). + public let sourceId: String + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + sourceType: VersionPinReferenceSourceType, + sourceId: String, + additionalProperties: [String: JSONValue] = .init() + ) { + self.sourceType = sourceType + self.sourceId = sourceId + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.sourceType = try container.decode(VersionPinReferenceSourceType.self, forKey: .sourceType) + self.sourceId = try container.decode(String.self, forKey: .sourceId) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encode(self.sourceType, forKey: .sourceType) + try container.encode(self.sourceId, forKey: .sourceId) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case sourceType + case sourceId + } +} \ No newline at end of file diff --git a/Sources/Schemas/VersionPinReferenceSourceType.swift b/Sources/Schemas/VersionPinReferenceSourceType.swift new file mode 100644 index 00000000..58dde7fe --- /dev/null +++ b/Sources/Schemas/VersionPinReferenceSourceType.swift @@ -0,0 +1,8 @@ +import Foundation + +/// Kind of source row the pin originates from. +public enum VersionPinReferenceSourceType: String, Codable, Hashable, CaseIterable, Sendable { + case assistantVersion = "assistant_version" + case squad + case toolVersion = "tool_version" +} \ No newline at end of file diff --git a/Sources/Schemas/VoiceCost.swift b/Sources/Schemas/VoiceCost.swift index f76c2a68..213b01aa 100644 --- a/Sources/Schemas/VoiceCost.swift +++ b/Sources/Schemas/VoiceCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Voice-synthesis cost for a call, including voice, character usage, and amount. public struct VoiceCost: Codable, Hashable, Sendable { /// This is the voice that was used during the call. /// diff --git a/Sources/Schemas/VoiceLibraryVoiceResponse.swift b/Sources/Schemas/VoiceLibraryVoiceResponse.swift index c1c91acc..bd4884dc 100644 --- a/Sources/Schemas/VoiceLibraryVoiceResponse.swift +++ b/Sources/Schemas/VoiceLibraryVoiceResponse.swift @@ -1,44 +1,44 @@ import Foundation public struct VoiceLibraryVoiceResponse: Codable, Hashable, Sendable { + public let age: VoiceLibraryVoiceResponseAge? public let voiceId: String public let name: String public let publicOwnerId: String? public let description: String? public let gender: String? - public let age: [String: JSONValue]? public let accent: String? /// Additional properties that are not explicitly defined in the schema public let additionalProperties: [String: JSONValue] public init( + age: VoiceLibraryVoiceResponseAge? = nil, voiceId: String, name: String, publicOwnerId: String? = nil, description: String? = nil, gender: String? = nil, - age: [String: JSONValue]? = nil, accent: String? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.age = age self.voiceId = voiceId self.name = name self.publicOwnerId = publicOwnerId self.description = description self.gender = gender - self.age = age self.accent = accent self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.age = try container.decodeIfPresent(VoiceLibraryVoiceResponseAge.self, forKey: .age) self.voiceId = try container.decode(String.self, forKey: .voiceId) self.name = try container.decode(String.self, forKey: .name) self.publicOwnerId = try container.decodeIfPresent(String.self, forKey: .publicOwnerId) self.description = try container.decodeIfPresent(String.self, forKey: .description) self.gender = try container.decodeIfPresent(String.self, forKey: .gender) - self.age = try container.decodeIfPresent([String: JSONValue].self, forKey: .age) self.accent = try container.decodeIfPresent(String.self, forKey: .accent) self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) } @@ -46,23 +46,23 @@ public struct VoiceLibraryVoiceResponse: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.age, forKey: .age) try container.encode(self.voiceId, forKey: .voiceId) try container.encode(self.name, forKey: .name) try container.encodeIfPresent(self.publicOwnerId, forKey: .publicOwnerId) try container.encodeIfPresent(self.description, forKey: .description) try container.encodeIfPresent(self.gender, forKey: .gender) - try container.encodeIfPresent(self.age, forKey: .age) try container.encodeIfPresent(self.accent, forKey: .accent) } /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case age case voiceId case name case publicOwnerId case description case gender - case age case accent } } \ No newline at end of file diff --git a/Sources/Schemas/VoiceLibraryVoiceResponseAge.swift b/Sources/Schemas/VoiceLibraryVoiceResponseAge.swift new file mode 100644 index 00000000..ffe2eace --- /dev/null +++ b/Sources/Schemas/VoiceLibraryVoiceResponseAge.swift @@ -0,0 +1,30 @@ +import Foundation + +public enum VoiceLibraryVoiceResponseAge: Codable, Hashable, Sendable { + case double(Double) + case string(String) + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(Double.self) { + self = .double(value) + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unexpected value." + ) + } + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.singleValueContainer() + switch self { + case .double(let value): + try container.encode(value) + case .string(let value): + try container.encode(value) + } + } +} \ No newline at end of file diff --git a/Sources/Schemas/VoicemailDetectionBackoffPlan.swift b/Sources/Schemas/VoicemailDetectionBackoffPlan.swift index 2542abc7..792ece47 100644 --- a/Sources/Schemas/VoicemailDetectionBackoffPlan.swift +++ b/Sources/Schemas/VoicemailDetectionBackoffPlan.swift @@ -1,5 +1,6 @@ import Foundation +/// Controls voicemail-detection retry timing, including when retries start, retry frequency, and maximum attempts. public struct VoicemailDetectionBackoffPlan: Codable, Hashable, Sendable { /// This is the number of seconds to wait before starting the first retry attempt. public let startAtSeconds: Double? diff --git a/Sources/Schemas/VoicemailDetectionCost.swift b/Sources/Schemas/VoicemailDetectionCost.swift index 11d6c103..4483dea9 100644 --- a/Sources/Schemas/VoicemailDetectionCost.swift +++ b/Sources/Schemas/VoicemailDetectionCost.swift @@ -1,5 +1,6 @@ import Foundation +/// Voicemail-detection model cost, including provider, model, multimodal token usage, and amount. public struct VoicemailDetectionCost: Codable, Hashable, Sendable { /// This is the model that was used to perform the analysis. public let model: [String: JSONValue] diff --git a/Sources/Schemas/VoicemailTool.swift b/Sources/Schemas/VoicemailTool.swift index 1ea83b3b..35efa614 100644 --- a/Sources/Schemas/VoicemailTool.swift +++ b/Sources/Schemas/VoicemailTool.swift @@ -1,9 +1,9 @@ import Foundation +/// A reusable voicemail-detection tool with optional beep detection for supported calls. public struct VoicemailTool: Codable, Hashable, Sendable { - /// These are the messages that will be spoken to the user as the tool is running. - /// - /// For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + public let latestVersion: Nullable? + /// Messages spoken while the tool is running. Multiple request-start messages are variants. For request-response-delayed, same timing means variants and different timings mean staged updates. public let messages: [VoicemailToolMessagesItem]? /// This is the flag that enables beep detection for voicemail detection and applies only for twilio based calls. /// @@ -100,6 +100,7 @@ public struct VoicemailTool: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + latestVersion: Nullable? = nil, messages: [VoicemailToolMessagesItem]? = nil, beepDetectionEnabled: Bool? = nil, id: String, @@ -109,6 +110,7 @@ public struct VoicemailTool: Codable, Hashable, Sendable { rejectionPlan: ToolRejectionPlan? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.latestVersion = latestVersion self.messages = messages self.beepDetectionEnabled = beepDetectionEnabled self.id = id @@ -121,6 +123,7 @@ public struct VoicemailTool: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.latestVersion = try container.decodeNullableIfPresent(String.self, forKey: .latestVersion) self.messages = try container.decodeIfPresent([VoicemailToolMessagesItem].self, forKey: .messages) self.beepDetectionEnabled = try container.decodeIfPresent(Bool.self, forKey: .beepDetectionEnabled) self.id = try container.decode(String.self, forKey: .id) @@ -134,6 +137,7 @@ public struct VoicemailTool: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeNullableIfPresent(self.latestVersion, forKey: .latestVersion) try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.beepDetectionEnabled, forKey: .beepDetectionEnabled) try container.encode(self.id, forKey: .id) @@ -145,6 +149,7 @@ public struct VoicemailTool: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case latestVersion case messages case beepDetectionEnabled case id diff --git a/Sources/Schemas/VonagePhoneNumber.swift b/Sources/Schemas/VonagePhoneNumber.swift index e40cb3df..5fc22b43 100644 --- a/Sources/Schemas/VonagePhoneNumber.swift +++ b/Sources/Schemas/VonagePhoneNumber.swift @@ -1,5 +1,6 @@ import Foundation +/// A Vonage phone number connected to Vapi, including its credential, routing, hooks, server settings, and lifecycle metadata. public struct VonagePhoneNumber: Codable, Hashable, Sendable { /// This is the fallback destination an inbound call will be transferred to if: /// 1. `assistantId` is not set diff --git a/Sources/Schemas/VonageTransport.swift b/Sources/Schemas/VonageTransport.swift new file mode 100644 index 00000000..4800b474 --- /dev/null +++ b/Sources/Schemas/VonageTransport.swift @@ -0,0 +1,47 @@ +import Foundation + +public struct VonageTransport: Codable, Hashable, Sendable { + /// This is the conversation type of the call (ie, voice or chat). + public let conversationType: VonageTransportConversationType? + /// This is the conversation UUID of the Vonage call. + public let conversationUuid: String? + /// This is the call ID of the Vonage call. + public let callUuid: String? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + conversationType: VonageTransportConversationType? = nil, + conversationUuid: String? = nil, + callUuid: String? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.conversationType = conversationType + self.conversationUuid = conversationUuid + self.callUuid = callUuid + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.conversationType = try container.decodeIfPresent(VonageTransportConversationType.self, forKey: .conversationType) + self.conversationUuid = try container.decodeIfPresent(String.self, forKey: .conversationUuid) + self.callUuid = try container.decodeIfPresent(String.self, forKey: .callUuid) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.conversationType, forKey: .conversationType) + try container.encodeIfPresent(self.conversationUuid, forKey: .conversationUuid) + try container.encodeIfPresent(self.callUuid, forKey: .callUuid) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case conversationType + case conversationUuid = "conversationUUID" + case callUuid = "callUUID" + } +} \ No newline at end of file diff --git a/Sources/Schemas/VonageTransportConversationType.swift b/Sources/Schemas/VonageTransportConversationType.swift new file mode 100644 index 00000000..bc63e1d7 --- /dev/null +++ b/Sources/Schemas/VonageTransportConversationType.swift @@ -0,0 +1,6 @@ +import Foundation + +/// This is the conversation type of the call (ie, voice or chat). +public enum VonageTransportConversationType: String, Codable, Hashable, CaseIterable, Sendable { + case voice +} \ No newline at end of file diff --git a/Sources/Schemas/WellSaidVoice.swift b/Sources/Schemas/WellSaidVoice.swift index dd9ade53..6f271504 100644 --- a/Sources/Schemas/WellSaidVoice.swift +++ b/Sources/Schemas/WellSaidVoice.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for synthesizing assistant speech with WellSaid, including voice and model selection, Speech Synthesis Markup Language support, voice libraries, chunking, caching, and fallback settings. public struct WellSaidVoice: Codable, Hashable, Sendable { /// This is the flag to toggle voice caching for the assistant. public let cachingEnabled: Bool? diff --git a/Sources/Schemas/WorkflowAnthropicBedrockModel.swift b/Sources/Schemas/WorkflowAnthropicBedrockModel.swift index 0bc28f38..38f57c6b 100644 --- a/Sources/Schemas/WorkflowAnthropicBedrockModel.swift +++ b/Sources/Schemas/WorkflowAnthropicBedrockModel.swift @@ -1,6 +1,18 @@ import Foundation +/// Workflow model configuration for Anthropic through Amazon Bedrock, including model selection, thinking, temperature, and maximum output tokens. public struct WorkflowAnthropicBedrockModel: Codable, Hashable, Sendable { + /// These are the messages used to customize the prompt used for structured output extraction. + /// + /// When provided, these messages replace the default prompts. Message contents support LiquidJS templating with the following variables: + /// - `{{transcript}}` or `{{messages}}` to reference the conversation (one is required) + /// - `{{structuredOutput.name}}`, `{{structuredOutput.description}}`, or `{{structuredOutput.schema}}` to reference the structured output definition (one is required) + /// - `{{systemPrompt}}`, `{{callEndedReason}}`, `{{duration}}`, `{{startedAt}}`, `{{endedAt}}`, and any `assistantOverrides.variableValues` + /// + /// `{{messages}}` is the full message history including tool calls; `{{transcript}}` is the spoken text only, which uses significantly fewer tokens. + /// + /// If not provided, default system and user prompts are used. + public let messages: [OpenAiMessage]? /// This is the specific model that will be used. public let model: WorkflowAnthropicBedrockModelModel /// This is the optional configuration for Anthropic's thinking feature. @@ -15,12 +27,14 @@ public struct WorkflowAnthropicBedrockModel: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + messages: [OpenAiMessage]? = nil, model: WorkflowAnthropicBedrockModelModel, thinking: AnthropicThinkingConfig? = nil, temperature: Double? = nil, maxTokens: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.messages = messages self.model = model self.thinking = thinking self.temperature = temperature @@ -30,6 +44,7 @@ public struct WorkflowAnthropicBedrockModel: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.model = try container.decode(WorkflowAnthropicBedrockModelModel.self, forKey: .model) self.thinking = try container.decodeIfPresent(AnthropicThinkingConfig.self, forKey: .thinking) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -40,6 +55,7 @@ public struct WorkflowAnthropicBedrockModel: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.thinking, forKey: .thinking) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -48,6 +64,7 @@ public struct WorkflowAnthropicBedrockModel: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case messages case model case thinking case temperature diff --git a/Sources/Schemas/WorkflowAnthropicBedrockModelModel.swift b/Sources/Schemas/WorkflowAnthropicBedrockModelModel.swift index 7b041ec4..5e3dc362 100644 --- a/Sources/Schemas/WorkflowAnthropicBedrockModelModel.swift +++ b/Sources/Schemas/WorkflowAnthropicBedrockModelModel.swift @@ -16,4 +16,5 @@ public enum WorkflowAnthropicBedrockModelModel: String, Codable, Hashable, CaseI case claudeSonnet4520250929 = "claude-sonnet-4-5-20250929" case claudeSonnet46 = "claude-sonnet-4-6" case claudeHaiku4520251001 = "claude-haiku-4-5-20251001" + case globalAnthropicClaudeHaiku4520251001V10 = "global.anthropic.claude-haiku-4-5-20251001-v1:0" } \ No newline at end of file diff --git a/Sources/Schemas/WorkflowAnthropicModel.swift b/Sources/Schemas/WorkflowAnthropicModel.swift index e84463cd..70afa970 100644 --- a/Sources/Schemas/WorkflowAnthropicModel.swift +++ b/Sources/Schemas/WorkflowAnthropicModel.swift @@ -1,6 +1,18 @@ import Foundation +/// Workflow model configuration for Anthropic, including model selection, thinking, temperature, and maximum output tokens. public struct WorkflowAnthropicModel: Codable, Hashable, Sendable { + /// These are the messages used to customize the prompt used for structured output extraction. + /// + /// When provided, these messages replace the default prompts. Message contents support LiquidJS templating with the following variables: + /// - `{{transcript}}` or `{{messages}}` to reference the conversation (one is required) + /// - `{{structuredOutput.name}}`, `{{structuredOutput.description}}`, or `{{structuredOutput.schema}}` to reference the structured output definition (one is required) + /// - `{{systemPrompt}}`, `{{callEndedReason}}`, `{{duration}}`, `{{startedAt}}`, `{{endedAt}}`, and any `assistantOverrides.variableValues` + /// + /// `{{messages}}` is the full message history including tool calls; `{{transcript}}` is the spoken text only, which uses significantly fewer tokens. + /// + /// If not provided, default system and user prompts are used. + public let messages: [OpenAiMessage]? /// This is the specific model that will be used. public let model: WorkflowAnthropicModelModel /// This is the optional configuration for Anthropic's thinking feature. @@ -15,12 +27,14 @@ public struct WorkflowAnthropicModel: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + messages: [OpenAiMessage]? = nil, model: WorkflowAnthropicModelModel, thinking: AnthropicThinkingConfig? = nil, temperature: Double? = nil, maxTokens: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.messages = messages self.model = model self.thinking = thinking self.temperature = temperature @@ -30,6 +44,7 @@ public struct WorkflowAnthropicModel: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.model = try container.decode(WorkflowAnthropicModelModel.self, forKey: .model) self.thinking = try container.decodeIfPresent(AnthropicThinkingConfig.self, forKey: .thinking) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -40,6 +55,7 @@ public struct WorkflowAnthropicModel: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.thinking, forKey: .thinking) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -48,6 +64,7 @@ public struct WorkflowAnthropicModel: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case messages case model case thinking case temperature diff --git a/Sources/Schemas/WorkflowAnthropicModelModel.swift b/Sources/Schemas/WorkflowAnthropicModelModel.swift index 1ab25cd4..2f28df9e 100644 --- a/Sources/Schemas/WorkflowAnthropicModelModel.swift +++ b/Sources/Schemas/WorkflowAnthropicModelModel.swift @@ -15,5 +15,6 @@ public enum WorkflowAnthropicModelModel: String, Codable, Hashable, CaseIterable case claudeSonnet420250514 = "claude-sonnet-4-20250514" case claudeSonnet4520250929 = "claude-sonnet-4-5-20250929" case claudeSonnet46 = "claude-sonnet-4-6" + case claudeSonnet5 = "claude-sonnet-5" case claudeHaiku4520251001 = "claude-haiku-4-5-20251001" } \ No newline at end of file diff --git a/Sources/Schemas/WorkflowCredentialsItem.swift b/Sources/Schemas/WorkflowCredentialsItem.swift index 4855f523..1e4dc4f2 100644 --- a/Sources/Schemas/WorkflowCredentialsItem.swift +++ b/Sources/Schemas/WorkflowCredentialsItem.swift @@ -33,6 +33,7 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum WorkflowCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/WorkflowCustomModel.swift b/Sources/Schemas/WorkflowCustomModel.swift index 0228bd81..4698da82 100644 --- a/Sources/Schemas/WorkflowCustomModel.swift +++ b/Sources/Schemas/WorkflowCustomModel.swift @@ -1,6 +1,18 @@ import Foundation +/// Workflow model configuration for a custom language model endpoint, including URL, headers, metadata delivery, timeout, model, temperature, and maximum output tokens. public struct WorkflowCustomModel: Codable, Hashable, Sendable { + /// These are the messages used to customize the prompt used for structured output extraction. + /// + /// When provided, these messages replace the default prompts. Message contents support LiquidJS templating with the following variables: + /// - `{{transcript}}` or `{{messages}}` to reference the conversation (one is required) + /// - `{{structuredOutput.name}}`, `{{structuredOutput.description}}`, or `{{structuredOutput.schema}}` to reference the structured output definition (one is required) + /// - `{{systemPrompt}}`, `{{callEndedReason}}`, `{{duration}}`, `{{startedAt}}`, `{{endedAt}}`, and any `assistantOverrides.variableValues` + /// + /// `{{messages}}` is the full message history including tool calls; `{{transcript}}` is the spoken text only, which uses significantly fewer tokens. + /// + /// If not provided, default system and user prompts are used. + public let messages: [OpenAiMessage]? /// This determines whether metadata is sent in requests to the custom provider. /// /// - `off` will not send any metadata. payload will look like `{ messages }` @@ -27,6 +39,7 @@ public struct WorkflowCustomModel: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + messages: [OpenAiMessage]? = nil, metadataSendMode: WorkflowCustomModelMetadataSendMode? = nil, url: String, headers: [String: JSONValue]? = nil, @@ -36,6 +49,7 @@ public struct WorkflowCustomModel: Codable, Hashable, Sendable { maxTokens: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.messages = messages self.metadataSendMode = metadataSendMode self.url = url self.headers = headers @@ -48,6 +62,7 @@ public struct WorkflowCustomModel: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.metadataSendMode = try container.decodeIfPresent(WorkflowCustomModelMetadataSendMode.self, forKey: .metadataSendMode) self.url = try container.decode(String.self, forKey: .url) self.headers = try container.decodeIfPresent([String: JSONValue].self, forKey: .headers) @@ -61,6 +76,7 @@ public struct WorkflowCustomModel: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.metadataSendMode, forKey: .metadataSendMode) try container.encode(self.url, forKey: .url) try container.encodeIfPresent(self.headers, forKey: .headers) @@ -72,6 +88,7 @@ public struct WorkflowCustomModel: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case messages case metadataSendMode case url case headers diff --git a/Sources/Schemas/WorkflowGoogleModel.swift b/Sources/Schemas/WorkflowGoogleModel.swift index ec877395..82da3824 100644 --- a/Sources/Schemas/WorkflowGoogleModel.swift +++ b/Sources/Schemas/WorkflowGoogleModel.swift @@ -1,6 +1,18 @@ import Foundation +/// Workflow model configuration for Google, including model selection, temperature, and maximum output tokens. public struct WorkflowGoogleModel: Codable, Hashable, Sendable { + /// These are the messages used to customize the prompt used for structured output extraction. + /// + /// When provided, these messages replace the default prompts. Message contents support LiquidJS templating with the following variables: + /// - `{{transcript}}` or `{{messages}}` to reference the conversation (one is required) + /// - `{{structuredOutput.name}}`, `{{structuredOutput.description}}`, or `{{structuredOutput.schema}}` to reference the structured output definition (one is required) + /// - `{{systemPrompt}}`, `{{callEndedReason}}`, `{{duration}}`, `{{startedAt}}`, `{{endedAt}}`, and any `assistantOverrides.variableValues` + /// + /// `{{messages}}` is the full message history including tool calls; `{{transcript}}` is the spoken text only, which uses significantly fewer tokens. + /// + /// If not provided, default system and user prompts are used. + public let messages: [OpenAiMessage]? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: WorkflowGoogleModelModel /// This is the temperature of the model. @@ -11,11 +23,13 @@ public struct WorkflowGoogleModel: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + messages: [OpenAiMessage]? = nil, model: WorkflowGoogleModelModel, temperature: Double? = nil, maxTokens: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.messages = messages self.model = model self.temperature = temperature self.maxTokens = maxTokens @@ -24,6 +38,7 @@ public struct WorkflowGoogleModel: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.model = try container.decode(WorkflowGoogleModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) self.maxTokens = try container.decodeIfPresent(Double.self, forKey: .maxTokens) @@ -33,6 +48,7 @@ public struct WorkflowGoogleModel: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) try container.encodeIfPresent(self.maxTokens, forKey: .maxTokens) @@ -40,6 +56,7 @@ public struct WorkflowGoogleModel: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case messages case model case temperature case maxTokens diff --git a/Sources/Schemas/WorkflowGoogleModelModel.swift b/Sources/Schemas/WorkflowGoogleModelModel.swift index c9a80d8a..cf2da385 100644 --- a/Sources/Schemas/WorkflowGoogleModelModel.swift +++ b/Sources/Schemas/WorkflowGoogleModelModel.swift @@ -2,6 +2,8 @@ import Foundation /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public enum WorkflowGoogleModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gemini35Flash = "gemini-3.5-flash" + case gemini31FlashLite = "gemini-3.1-flash-lite" case gemini3FlashPreview = "gemini-3-flash-preview" case gemini25Pro = "gemini-2.5-pro" case gemini25Flash = "gemini-2.5-flash" diff --git a/Sources/Schemas/WorkflowOpenAiModel.swift b/Sources/Schemas/WorkflowOpenAiModel.swift index bc924a7e..53f828b1 100644 --- a/Sources/Schemas/WorkflowOpenAiModel.swift +++ b/Sources/Schemas/WorkflowOpenAiModel.swift @@ -1,6 +1,18 @@ import Foundation +/// Workflow model configuration for OpenAI, including model selection, temperature, and maximum output tokens. public struct WorkflowOpenAiModel: Codable, Hashable, Sendable { + /// These are the messages used to customize the prompt used for structured output extraction. + /// + /// When provided, these messages replace the default prompts. Message contents support LiquidJS templating with the following variables: + /// - `{{transcript}}` or `{{messages}}` to reference the conversation (one is required) + /// - `{{structuredOutput.name}}`, `{{structuredOutput.description}}`, or `{{structuredOutput.schema}}` to reference the structured output definition (one is required) + /// - `{{systemPrompt}}`, `{{callEndedReason}}`, `{{duration}}`, `{{startedAt}}`, `{{endedAt}}`, and any `assistantOverrides.variableValues` + /// + /// `{{messages}}` is the full message history including tool calls; `{{transcript}}` is the spoken text only, which uses significantly fewer tokens. + /// + /// If not provided, default system and user prompts are used. + public let messages: [OpenAiMessage]? /// This is the OpenAI model that will be used. /// /// When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. @@ -14,11 +26,13 @@ public struct WorkflowOpenAiModel: Codable, Hashable, Sendable { public let additionalProperties: [String: JSONValue] public init( + messages: [OpenAiMessage]? = nil, model: WorkflowOpenAiModelModel, temperature: Double? = nil, maxTokens: Double? = nil, additionalProperties: [String: JSONValue] = .init() ) { + self.messages = messages self.model = model self.temperature = temperature self.maxTokens = maxTokens @@ -27,6 +41,7 @@ public struct WorkflowOpenAiModel: Codable, Hashable, Sendable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.model = try container.decode(WorkflowOpenAiModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) self.maxTokens = try container.decodeIfPresent(Double.self, forKey: .maxTokens) @@ -36,6 +51,7 @@ public struct WorkflowOpenAiModel: Codable, Hashable, Sendable { public func encode(to encoder: Encoder) throws -> Void { var container = encoder.container(keyedBy: CodingKeys.self) try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.messages, forKey: .messages) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) try container.encodeIfPresent(self.maxTokens, forKey: .maxTokens) @@ -43,6 +59,7 @@ public struct WorkflowOpenAiModel: Codable, Hashable, Sendable { /// Keys for encoding/decoding struct properties. enum CodingKeys: String, CodingKey, CaseIterable { + case messages case model case temperature case maxTokens diff --git a/Sources/Schemas/WorkflowOpenAiModelModel.swift b/Sources/Schemas/WorkflowOpenAiModelModel.swift index 034dd66a..bdfb96a8 100644 --- a/Sources/Schemas/WorkflowOpenAiModelModel.swift +++ b/Sources/Schemas/WorkflowOpenAiModelModel.swift @@ -5,6 +5,11 @@ import Foundation /// When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. /// This is helpful when you are required to comply with Data Residency rules. Learn more about Azure regions here https://azure.microsoft.com/en-us/explore/global-infrastructure/data-residency/. public enum WorkflowOpenAiModelModel: String, Codable, Hashable, CaseIterable, Sendable { + case gpt56Sol = "gpt-5.6-sol" + case gpt56Terra = "gpt-5.6-terra" + case gpt56Luna = "gpt-5.6-luna" + case gpt55 = "gpt-5.5" + case chatLatest = "chat-latest" case gpt54 = "gpt-5.4" case gpt54Mini = "gpt-5.4-mini" case gpt54Nano = "gpt-5.4-nano" @@ -118,4 +123,7 @@ public enum WorkflowOpenAiModelModel: String, Codable, Hashable, CaseIterable, S case gpt35Turbo0125Southcentralus = "gpt-3.5-turbo-0125:southcentralus" case gpt35Turbo1106Canadaeast = "gpt-3.5-turbo-1106:canadaeast" case gpt35Turbo1106Westus = "gpt-3.5-turbo-1106:westus" + case gpt41Australiaeast = "gpt-4.1:australiaeast" + case gpt4OAustraliaeast = "gpt-4o:australiaeast" + case gpt54MiniAustraliaeast = "gpt-5.4-mini:australiaeast" } \ No newline at end of file diff --git a/Sources/Schemas/WorkflowOverrides.swift b/Sources/Schemas/WorkflowOverrides.swift index 798244d1..149afbd7 100644 --- a/Sources/Schemas/WorkflowOverrides.swift +++ b/Sources/Schemas/WorkflowOverrides.swift @@ -1,5 +1,6 @@ import Foundation +/// Per-call overrides for values used in workflow template variables. public struct WorkflowOverrides: Codable, Hashable, Sendable { /// These are values that will be used to replace the template variables in the workflow messages and other text-based fields. /// This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html diff --git a/Sources/Schemas/WorkflowTranscriber.swift b/Sources/Schemas/WorkflowTranscriber.swift index ff0f4d4a..0d87821a 100644 --- a/Sources/Schemas/WorkflowTranscriber.swift +++ b/Sources/Schemas/WorkflowTranscriber.swift @@ -16,6 +16,8 @@ public enum WorkflowTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -45,6 +47,10 @@ public enum WorkflowTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,12 @@ public enum WorkflowTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/WorkflowUserEditableCredentialsItem.swift b/Sources/Schemas/WorkflowUserEditableCredentialsItem.swift index 589be597..789a71a9 100644 --- a/Sources/Schemas/WorkflowUserEditableCredentialsItem.swift +++ b/Sources/Schemas/WorkflowUserEditableCredentialsItem.swift @@ -33,6 +33,7 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case langfuse(CreateLangfuseCredentialDto) case lmnt(CreateLmntCredentialDto) case make(CreateMakeCredentialDto) + case microsoft(CreateMicrosoftCredentialDto) case minimax(CreateMinimaxCredentialDto) case mistral(CreateMistralCredentialDto) case neuphonic(CreateNeuphonicCredentialDto) @@ -43,6 +44,7 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case rimeAi(CreateRimeAiCredentialDto) case runpod(CreateRunpodCredentialDto) case s3(CreateS3CredentialDto) + case s3Compatible(CreateS3CompatibleCredentialDto) case slackOauth2Authorization(CreateSlackOAuth2AuthorizationCredentialDto) case slackWebhook(CreateSlackWebhookCredentialDto) case smallestAi(CreateSmallestAiCredentialDto) @@ -51,7 +53,6 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case supabase(CreateSupabaseCredentialDto) case tavus(CreateTavusCredentialDto) case togetherAi(CreateTogetherAiCredentialDto) - case trieve(CreateTrieveCredentialDto) case twilio(CreateTwilioCredentialDto) case vonage(CreateVonageCredentialDto) case webhook(CreateWebhookCredentialDto) @@ -126,6 +127,8 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { self = .lmnt(try CreateLmntCredentialDto(from: decoder)) case "make": self = .make(try CreateMakeCredentialDto(from: decoder)) + case "microsoft": + self = .microsoft(try CreateMicrosoftCredentialDto(from: decoder)) case "minimax": self = .minimax(try CreateMinimaxCredentialDto(from: decoder)) case "mistral": @@ -146,6 +149,8 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { self = .runpod(try CreateRunpodCredentialDto(from: decoder)) case "s3": self = .s3(try CreateS3CredentialDto(from: decoder)) + case "s3-compatible": + self = .s3Compatible(try CreateS3CompatibleCredentialDto(from: decoder)) case "slack.oauth2-authorization": self = .slackOauth2Authorization(try CreateSlackOAuth2AuthorizationCredentialDto(from: decoder)) case "slack-webhook": @@ -162,8 +167,6 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { self = .tavus(try CreateTavusCredentialDto(from: decoder)) case "together-ai": self = .togetherAi(try CreateTogetherAiCredentialDto(from: decoder)) - case "trieve": - self = .trieve(try CreateTrieveCredentialDto(from: decoder)) case "twilio": self = .twilio(try CreateTwilioCredentialDto(from: decoder)) case "vonage": @@ -283,6 +286,9 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case .make(let data): try container.encode("make", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -313,6 +319,9 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case .s3(let data): try container.encode("s3", forKey: .provider) try data.encode(to: encoder) + case .s3Compatible(let data): + try container.encode("s3-compatible", forKey: .provider) + try data.encode(to: encoder) case .slackOauth2Authorization(let data): try container.encode("slack.oauth2-authorization", forKey: .provider) try data.encode(to: encoder) @@ -337,9 +346,6 @@ public enum WorkflowUserEditableCredentialsItem: Codable, Hashable, Sendable { case .togetherAi(let data): try container.encode("together-ai", forKey: .provider) try data.encode(to: encoder) - case .trieve(let data): - try container.encode("trieve", forKey: .provider) - try data.encode(to: encoder) case .twilio(let data): try container.encode("twilio", forKey: .provider) try data.encode(to: encoder) diff --git a/Sources/Schemas/WorkflowUserEditableHooksItem.swift b/Sources/Schemas/WorkflowUserEditableHooksItem.swift index 5b34d152..384cb863 100644 --- a/Sources/Schemas/WorkflowUserEditableHooksItem.swift +++ b/Sources/Schemas/WorkflowUserEditableHooksItem.swift @@ -1,6 +1,6 @@ import Foundation -public enum WorkflowUserEditableHooksItem: Codable, Hashable, Sendable { +public indirect enum WorkflowUserEditableHooksItem: Codable, Hashable, Sendable { case callHookAssistantSpeechInterrupted(CallHookAssistantSpeechInterrupted) case callHookCallEnding(CallHookCallEnding) case callHookCustomerSpeechInterrupted(CallHookCustomerSpeechInterrupted) diff --git a/Sources/Schemas/WorkflowUserEditableNodesItem.swift b/Sources/Schemas/WorkflowUserEditableNodesItem.swift index 3509b186..756de61e 100644 --- a/Sources/Schemas/WorkflowUserEditableNodesItem.swift +++ b/Sources/Schemas/WorkflowUserEditableNodesItem.swift @@ -1,6 +1,6 @@ import Foundation -public enum WorkflowUserEditableNodesItem: Codable, Hashable, Sendable { +public indirect enum WorkflowUserEditableNodesItem: Codable, Hashable, Sendable { case conversation(ConversationNode) case tool(ToolNode) diff --git a/Sources/Schemas/WorkflowUserEditableTranscriber.swift b/Sources/Schemas/WorkflowUserEditableTranscriber.swift index bc416333..b4029e55 100644 --- a/Sources/Schemas/WorkflowUserEditableTranscriber.swift +++ b/Sources/Schemas/WorkflowUserEditableTranscriber.swift @@ -16,6 +16,8 @@ public enum WorkflowUserEditableTranscriber: Codable, Hashable, Sendable { case soniox(SonioxTranscriber) case speechmatics(SpeechmaticsTranscriber) case talkscriber(TalkscriberTranscriber) + case vapi(VapiTranscriber) + case xai(XaiTranscriber) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -45,6 +47,10 @@ public enum WorkflowUserEditableTranscriber: Codable, Hashable, Sendable { self = .speechmatics(try SpeechmaticsTranscriber(from: decoder)) case "talkscriber": self = .talkscriber(try TalkscriberTranscriber(from: decoder)) + case "vapi": + self = .vapi(try VapiTranscriber(from: decoder)) + case "xai": + self = .xai(try XaiTranscriber(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -94,6 +100,12 @@ public enum WorkflowUserEditableTranscriber: Codable, Hashable, Sendable { case .talkscriber(let data): try container.encode("talkscriber", forKey: .provider) try data.encode(to: encoder) + case .vapi(let data): + try container.encode("vapi", forKey: .provider) + try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/WorkflowUserEditableVoice.swift b/Sources/Schemas/WorkflowUserEditableVoice.swift index f1dd320f..d9727ff6 100644 --- a/Sources/Schemas/WorkflowUserEditableVoice.swift +++ b/Sources/Schemas/WorkflowUserEditableVoice.swift @@ -12,6 +12,7 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -22,6 +23,7 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,8 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -63,6 +67,8 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -100,6 +106,9 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -130,6 +139,9 @@ public enum WorkflowUserEditableVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/WorkflowVoice.swift b/Sources/Schemas/WorkflowVoice.swift index b5edfd04..bad1cc84 100644 --- a/Sources/Schemas/WorkflowVoice.swift +++ b/Sources/Schemas/WorkflowVoice.swift @@ -12,6 +12,7 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { case hume(HumeVoice) case inworld(InworldVoice) case lmnt(LmntVoice) + case microsoft(MicrosoftVoice) case minimax(MinimaxVoice) case neuphonic(NeuphonicVoice) case openai(OpenAiVoice) @@ -22,6 +23,7 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { case tavus(TavusVoice) case vapi(VapiVoice) case wellsaid(WellSaidVoice) + case xai(XaiVoice) public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) @@ -43,6 +45,8 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { self = .inworld(try InworldVoice(from: decoder)) case "lmnt": self = .lmnt(try LmntVoice(from: decoder)) + case "microsoft": + self = .microsoft(try MicrosoftVoice(from: decoder)) case "minimax": self = .minimax(try MinimaxVoice(from: decoder)) case "neuphonic": @@ -63,6 +67,8 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { self = .vapi(try VapiVoice(from: decoder)) case "wellsaid": self = .wellsaid(try WellSaidVoice(from: decoder)) + case "xai": + self = .xai(try XaiVoice(from: decoder)) default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -100,6 +106,9 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { case .lmnt(let data): try container.encode("lmnt", forKey: .provider) try data.encode(to: encoder) + case .microsoft(let data): + try container.encode("microsoft", forKey: .provider) + try data.encode(to: encoder) case .minimax(let data): try container.encode("minimax", forKey: .provider) try data.encode(to: encoder) @@ -130,6 +139,9 @@ public enum WorkflowVoice: Codable, Hashable, Sendable { case .wellsaid(let data): try container.encode("wellsaid", forKey: .provider) try data.encode(to: encoder) + case .xai(let data): + try container.encode("xai", forKey: .provider) + try data.encode(to: encoder) } } diff --git a/Sources/Schemas/XaiModel.swift b/Sources/Schemas/XaiModel.swift index f3546536..9c5b6ca1 100644 --- a/Sources/Schemas/XaiModel.swift +++ b/Sources/Schemas/XaiModel.swift @@ -1,5 +1,6 @@ import Foundation +/// Configuration for generating assistant responses with xAI, including model, prompts, tools, knowledge-base access, and generation settings. public struct XaiModel: Codable, Hashable, Sendable { /// This is the starting state for the conversation. public let messages: [OpenAiMessage]? @@ -11,11 +12,16 @@ public struct XaiModel: Codable, Hashable, Sendable { /// /// Both `tools` and `toolIds` can be used together. public let toolIds: [String]? + /// These are version-pinned references to tools. Each entry pins a specific + /// version of a tool by `(toolId, version)`. When the same `toolId` appears + /// in both `toolIds` and `toolRefs[]`, the `toolRefs` pin wins (the + /// `toolIds` entry is dropped at write time). + public let toolRefs: [ToolRef]? /// These are the options for the knowledge base. public let knowledgeBase: CreateCustomKnowledgeBaseDto? /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b public let model: XaiModelModel - /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + /// This is the temperature that will be used for calls. Default is 0.5. public let temperature: Double? /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. public let maxTokens: Double? @@ -38,6 +44,7 @@ public struct XaiModel: Codable, Hashable, Sendable { messages: [OpenAiMessage]? = nil, tools: [XaiModelToolsItem]? = nil, toolIds: [String]? = nil, + toolRefs: [ToolRef]? = nil, knowledgeBase: CreateCustomKnowledgeBaseDto? = nil, model: XaiModelModel, temperature: Double? = nil, @@ -49,6 +56,7 @@ public struct XaiModel: Codable, Hashable, Sendable { self.messages = messages self.tools = tools self.toolIds = toolIds + self.toolRefs = toolRefs self.knowledgeBase = knowledgeBase self.model = model self.temperature = temperature @@ -63,6 +71,7 @@ public struct XaiModel: Codable, Hashable, Sendable { self.messages = try container.decodeIfPresent([OpenAiMessage].self, forKey: .messages) self.tools = try container.decodeIfPresent([XaiModelToolsItem].self, forKey: .tools) self.toolIds = try container.decodeIfPresent([String].self, forKey: .toolIds) + self.toolRefs = try container.decodeIfPresent([ToolRef].self, forKey: .toolRefs) self.knowledgeBase = try container.decodeIfPresent(CreateCustomKnowledgeBaseDto.self, forKey: .knowledgeBase) self.model = try container.decode(XaiModelModel.self, forKey: .model) self.temperature = try container.decodeIfPresent(Double.self, forKey: .temperature) @@ -78,6 +87,7 @@ public struct XaiModel: Codable, Hashable, Sendable { try container.encodeIfPresent(self.messages, forKey: .messages) try container.encodeIfPresent(self.tools, forKey: .tools) try container.encodeIfPresent(self.toolIds, forKey: .toolIds) + try container.encodeIfPresent(self.toolRefs, forKey: .toolRefs) try container.encodeIfPresent(self.knowledgeBase, forKey: .knowledgeBase) try container.encode(self.model, forKey: .model) try container.encodeIfPresent(self.temperature, forKey: .temperature) @@ -91,6 +101,7 @@ public struct XaiModel: Codable, Hashable, Sendable { case messages case tools case toolIds + case toolRefs case knowledgeBase case model case temperature diff --git a/Sources/Schemas/XaiModelModel.swift b/Sources/Schemas/XaiModelModel.swift index 2f05dcaf..04232d4a 100644 --- a/Sources/Schemas/XaiModelModel.swift +++ b/Sources/Schemas/XaiModelModel.swift @@ -7,4 +7,7 @@ public enum XaiModelModel: String, Codable, Hashable, CaseIterable, Sendable { case grok3 = "grok-3" case grok4FastReasoning = "grok-4-fast-reasoning" case grok4FastNonReasoning = "grok-4-fast-non-reasoning" + case grok4200309Reasoning = "grok-4.20-0309-reasoning" + case grok4200309NonReasoning = "grok-4.20-0309-non-reasoning" + case grok43 = "grok-4.3" } \ No newline at end of file diff --git a/Sources/Schemas/XaiTranscriber.swift b/Sources/Schemas/XaiTranscriber.swift new file mode 100644 index 00000000..0a4031a8 --- /dev/null +++ b/Sources/Schemas/XaiTranscriber.swift @@ -0,0 +1,47 @@ +import Foundation + +public struct XaiTranscriber: Codable, Hashable, Sendable { + /// The xAI speech-to-text model to use. xAI currently exposes a single STT model — placeholder for future model selection. + public let model: XaiTranscriberModel? + /// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). Defaults to `en` if not set. xAI auto-detects when omitted via the API but Vapi defaults to English for deterministic behavior. + public let language: XaiTranscriberLanguage? + /// This is the plan for transcriber provider fallbacks in the event that the primary transcriber provider fails. + public let fallbackPlan: FallbackTranscriberPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + model: XaiTranscriberModel? = nil, + language: XaiTranscriberLanguage? = nil, + fallbackPlan: FallbackTranscriberPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.model = model + self.language = language + self.fallbackPlan = fallbackPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.model = try container.decodeIfPresent(XaiTranscriberModel.self, forKey: .model) + self.language = try container.decodeIfPresent(XaiTranscriberLanguage.self, forKey: .language) + self.fallbackPlan = try container.decodeIfPresent(FallbackTranscriberPlan.self, forKey: .fallbackPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.model, forKey: .model) + try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.fallbackPlan, forKey: .fallbackPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case model + case language + case fallbackPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/XaiTranscriberLanguage.swift b/Sources/Schemas/XaiTranscriberLanguage.swift new file mode 100644 index 00000000..1dbaa481 --- /dev/null +++ b/Sources/Schemas/XaiTranscriberLanguage.swift @@ -0,0 +1,30 @@ +import Foundation + +/// Single language for transcription as an ISO 639-1 code (e.g., `en`, `es`). Defaults to `en` if not set. xAI auto-detects when omitted via the API but Vapi defaults to English for deterministic behavior. +public enum XaiTranscriberLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case ar + case cs + case da + case nl + case en + case fil + case fr + case de + case hi + case id + case it + case ja + case ko + case mk + case ms + case fa + case pl + case pt + case ro + case ru + case es + case sv + case th + case tr + case vi +} \ No newline at end of file diff --git a/Sources/Schemas/XaiTranscriberModel.swift b/Sources/Schemas/XaiTranscriberModel.swift new file mode 100644 index 00000000..37b1c95d --- /dev/null +++ b/Sources/Schemas/XaiTranscriberModel.swift @@ -0,0 +1,6 @@ +import Foundation + +/// The xAI speech-to-text model to use. xAI currently exposes a single STT model — placeholder for future model selection. +public enum XaiTranscriberModel: String, Codable, Hashable, CaseIterable, Sendable { + case `default` +} \ No newline at end of file diff --git a/Sources/Schemas/XaiVoice.swift b/Sources/Schemas/XaiVoice.swift new file mode 100644 index 00000000..1c2de7d2 --- /dev/null +++ b/Sources/Schemas/XaiVoice.swift @@ -0,0 +1,68 @@ +import Foundation + +public struct XaiVoice: Codable, Hashable, Sendable { + /// This is the flag to toggle voice caching for the assistant. + public let cachingEnabled: Bool? + /// Built-in voices: eve, ara, rex, sal, leo. Cloned voice IDs are also accepted. + public let voiceId: XaiVoiceVoiceId + /// BCP-47 language code for xAI TTS synthesis. + public let language: XaiVoiceLanguage? + /// Speed multiplier for xAI TTS synthesis. + public let speed: Double? + /// This is the plan for chunking the model output before it is sent to the voice provider. + public let chunkPlan: ChunkPlan? + /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails. + public let fallbackPlan: FallbackPlan? + /// Additional properties that are not explicitly defined in the schema + public let additionalProperties: [String: JSONValue] + + public init( + cachingEnabled: Bool? = nil, + voiceId: XaiVoiceVoiceId, + language: XaiVoiceLanguage? = nil, + speed: Double? = nil, + chunkPlan: ChunkPlan? = nil, + fallbackPlan: FallbackPlan? = nil, + additionalProperties: [String: JSONValue] = .init() + ) { + self.cachingEnabled = cachingEnabled + self.voiceId = voiceId + self.language = language + self.speed = speed + self.chunkPlan = chunkPlan + self.fallbackPlan = fallbackPlan + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cachingEnabled = try container.decodeIfPresent(Bool.self, forKey: .cachingEnabled) + self.voiceId = try container.decode(XaiVoiceVoiceId.self, forKey: .voiceId) + self.language = try container.decodeIfPresent(XaiVoiceLanguage.self, forKey: .language) + self.speed = try container.decodeIfPresent(Double.self, forKey: .speed) + self.chunkPlan = try container.decodeIfPresent(ChunkPlan.self, forKey: .chunkPlan) + self.fallbackPlan = try container.decodeIfPresent(FallbackPlan.self, forKey: .fallbackPlan) + self.additionalProperties = try decoder.decodeAdditionalProperties(using: CodingKeys.self) + } + + public func encode(to encoder: Encoder) throws -> Void { + var container = encoder.container(keyedBy: CodingKeys.self) + try encoder.encodeAdditionalProperties(self.additionalProperties) + try container.encodeIfPresent(self.cachingEnabled, forKey: .cachingEnabled) + try container.encode(self.voiceId, forKey: .voiceId) + try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.speed, forKey: .speed) + try container.encodeIfPresent(self.chunkPlan, forKey: .chunkPlan) + try container.encodeIfPresent(self.fallbackPlan, forKey: .fallbackPlan) + } + + /// Keys for encoding/decoding struct properties. + enum CodingKeys: String, CodingKey, CaseIterable { + case cachingEnabled + case voiceId + case language + case speed + case chunkPlan + case fallbackPlan + } +} \ No newline at end of file diff --git a/Sources/Schemas/XaiVoiceLanguage.swift b/Sources/Schemas/XaiVoiceLanguage.swift new file mode 100644 index 00000000..1b183d52 --- /dev/null +++ b/Sources/Schemas/XaiVoiceLanguage.swift @@ -0,0 +1,26 @@ +import Foundation + +/// BCP-47 language code for xAI TTS synthesis. +public enum XaiVoiceLanguage: String, Codable, Hashable, CaseIterable, Sendable { + case auto + case en + case arEg = "ar-EG" + case arSa = "ar-SA" + case arAe = "ar-AE" + case bn + case zh + case fr + case de + case hi + case id + case it + case ja + case ko + case ptBr = "pt-BR" + case ptPt = "pt-PT" + case ru + case esMx = "es-MX" + case esEs = "es-ES" + case tr + case vi +} \ No newline at end of file diff --git a/Sources/Schemas/XaiVoiceVoiceId.swift b/Sources/Schemas/XaiVoiceVoiceId.swift new file mode 100644 index 00000000..aded9a2d --- /dev/null +++ b/Sources/Schemas/XaiVoiceVoiceId.swift @@ -0,0 +1,10 @@ +import Foundation + +/// Built-in voices: eve, ara, rex, sal, leo. Cloned voice IDs are also accepted. +public enum XaiVoiceVoiceId: String, Codable, Hashable, CaseIterable, Sendable { + case eve + case ara + case rex + case sal + case leo +} \ No newline at end of file diff --git a/Sources/Schemas/XssSecurityFilter.swift b/Sources/Schemas/XssSecurityFilter.swift index fce6ecd3..2ffaa261 100644 --- a/Sources/Schemas/XssSecurityFilter.swift +++ b/Sources/Schemas/XssSecurityFilter.swift @@ -1,5 +1,6 @@ import Foundation +/// Filters potential cross-site scripting (XSS) patterns from transcripts. public struct XssSecurityFilter: Codable, Hashable, Sendable { /// The type of security threat to filter. public let type: XssSecurityFilterType diff --git a/Sources/VapiClient.swift b/Sources/VapiClient.swift index 51f1b391..57c12dea 100644 --- a/Sources/VapiClient.swift +++ b/Sources/VapiClient.swift @@ -13,6 +13,7 @@ public final class VapiClient: Sendable { public let files: FilesClient public let structuredOutputs: StructuredOutputsClient public let insight: InsightClient + public let board: BoardClient public let eval: EvalClient public let observabilityScorecard: ObservabilityScorecardClient public let providerResources: ProviderResourcesClient @@ -106,6 +107,7 @@ public final class VapiClient: Sendable { self.files = FilesClient(config: config) self.structuredOutputs = StructuredOutputsClient(config: config) self.insight = InsightClient(config: config) + self.board = BoardClient(config: config) self.eval = EvalClient(config: config) self.observabilityScorecard = ObservabilityScorecardClient(config: config) self.providerResources = ProviderResourcesClient(config: config) diff --git a/Sources/Version.swift b/Sources/Version.swift index 1b834a4a..980ac078 100644 --- a/Sources/Version.swift +++ b/Sources/Version.swift @@ -1 +1 @@ -public let sdkVersion = "1.0.0" +public let sdkVersion = "1.0.1" diff --git a/Tests/Wire/Resources/Board/BoardClientWireTests.swift b/Tests/Wire/Resources/Board/BoardClientWireTests.swift new file mode 100644 index 00000000..05813bd1 --- /dev/null +++ b/Tests/Wire/Resources/Board/BoardClientWireTests.swift @@ -0,0 +1,6 @@ +import Foundation +import Testing +import Vapi + +@Suite("BoardClient Wire Tests") struct BoardClientWireTests { +} \ No newline at end of file diff --git a/changelog.md b/changelog.md index 47b003eb..c3f9d3b2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +## [1.0.1] - 2026-07-31 + ## 1.0.0 - 2026-06-24 ### Breaking Changes * **`CartesiaExperimentalControlsSpeedZero`** has been removed and replaced by **`CartesiaSpeedControlZero`**. Update any references to this type and rename pattern matches on `CartesiaSpeedControl.cartesiaExperimentalControlsSpeedZero` to `.cartesiaSpeedControlZero`. diff --git a/reference.md b/reference.md index 5642a1d8..39e65f25 100644 --- a/reference.md +++ b/reference.md @@ -10,6 +10,7 @@ ## Files ## StructuredOutputs ## Insight +## Board ## Eval ## ObservabilityScorecard ## ProviderResources