Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.1.0 — Unreleased

### Added

- Allowing the transports to transform `StartBotResult` into `TransportConnectionParams` when using startBotAndConnect.

# 1.1.0 — 2025-10-14

### Added
Expand Down
4 changes: 2 additions & 2 deletions PipecatClientIOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PipecatClientIOS'
s.version = '1.1.0'
s.version = '1.1.1'
s.summary = 'Pipecat iOS client library.'
s.description = <<-DESC
Pipecat iOS client library that implements the RTVI-AI standard.
Expand All @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.documentation_url = "https://docs.pipecat.ai/client/ios/introduction"
s.license = { :type => 'BSD-2', :file => 'LICENSE' }
s.author = { "Daily.co" => "[email protected]" }
s.source = { :git => 'https://github.com/pipecat-ai/pipecat-client-ios.git', :tag => "1.1.0" }
s.source = { :git => 'https://github.com/pipecat-ai/pipecat-client-ios.git', :tag => "1.1.1" }
s.ios.deployment_target = '13.0'
s.source_files = 'Sources/**/*.{swift,h,m}'
s.exclude_files = 'Sources/Exclude'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The base class has no out-of-the-box bindings included.
To depend on the client package, you can add this package via Xcode's package manager using the URL of this git repository directly, or you can declare your dependency in your `Package.swift`:

```swift
.package(url: "https://github.com/pipecat-ai/pipecat-client-ios.git", from: "1.1.0"),
.package(url: "https://github.com/pipecat-ai/pipecat-client-ios.git", from: "1.1.1"),
```

and add `"PipecatClientIOS"` to your application/library target, `dependencies`, e.g. like this:
Expand Down
27 changes: 16 additions & 11 deletions Sources/PipecatClientIOS/PipecatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,12 @@ open class PipecatClient {
}
do {
self.transport.setState(state: .authenticating)

// Send POST request to start the bot
let transportParams: T = try await fetchStartBot(startBotParams: startBotParams)
let startBotResult: T = try await fetchStartBot(startBotParams: startBotParams)
self.transport.setState(state: .authenticated)
self.delegate?.onBotStarted(botResponse: transportParams)
return transportParams
self.delegate?.onBotStarted(botResponse: startBotResult)
return startBotResult
} catch {
self.disconnect(completion: nil)
self.transport.setState(state: .disconnected)
Expand All @@ -328,8 +329,8 @@ open class PipecatClient {
) {
Task {
do {
let transportParams: T = try await self.startBot(startBotParams: startBotParams)
completion?(.success((transportParams)))
let startBotResult: T = try await self.startBot(startBotParams: startBotParams)
completion?(.success((startBotResult)))
} catch {
completion?(.failure(AsyncExecutionError(functionName: "start", underlyingError: error)))
}
Expand Down Expand Up @@ -390,7 +391,7 @@ open class PipecatClient {
try await self.connect(transportParams: transportParams)
completion?(.success(()))
} catch {
completion?(.failure(AsyncExecutionError(functionName: "start", underlyingError: error)))
completion?(.failure(AsyncExecutionError(functionName: "connect", underlyingError: error)))
}
}
}
Expand All @@ -403,10 +404,14 @@ open class PipecatClient {
/// - Parameter startBotParams: API request configuration for bot authentication.
/// - Returns: The transport connection parameters used for the connection.
/// - Throws: Various errors related to authentication or connection failures.
public func startBotAndConnect<T: TransportConnectionParams>(startBotParams: APIRequest) async throws -> T {
let transportParams: T = await try self.startBot(startBotParams: startBotParams)
public func startBotAndConnect<T: StartBotResult>(startBotParams: APIRequest) async throws -> T {
let startBotResult: T = await try self.startBot(startBotParams: startBotParams)
let transportParams = try self.transport.transformStartBotResultToConnectionParams(
startBotParams: startBotParams,
startBotResult: startBotResult
)
await try self.connect(transportParams: transportParams)
return transportParams
return startBotResult
}

/// Performs bot start request and connection in a single operation (completion-based).
Expand All @@ -417,7 +422,7 @@ open class PipecatClient {
/// - Parameters:
/// - startBotParams: API request configuration for bot authentication.
/// - completion: A closure called when the operation completes with the result.
public func startBotAndConnect<T: TransportConnectionParams>(
public func startBotAndConnect<T: StartBotResult>(
startBotParams: APIRequest,
completion: ((Result<T, AsyncExecutionError>) -> Void)?
) {
Expand Down Expand Up @@ -827,7 +832,7 @@ open class PipecatClient {
/// - Important: The bot must be in a `.ready` state for this method to succeed.
/// - Note: Context messages persist only for the current session and are cleared when disconnecting.
@available(*, deprecated, message: "Use sendText() instead. This method will be removed in a future version.")
public func appendToContext(message: LLMContextMessage) async throws -> Void {
public func appendToContext(message: LLMContextMessage) async throws {
try self.assertReady()
try self.sendMessage(msg: .appendToContext(msg: message))
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/PipecatClientIOS/PipecatClientVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Foundation
extension PipecatClient {

public static let library = "pipecat-client-ios"
public static let libraryVersion = "1.1.0"
public static let libraryVersion = "1.1.1"

}
2 changes: 2 additions & 0 deletions Sources/PipecatClientIOS/transport/Transport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public protocol Transport {
func state() -> TransportState
func setState(state: TransportState)
func tracks() -> Tracks?
func transformStartBotResultToConnectionParams(startBotParams: APIRequest, startBotResult: StartBotResult) throws
-> TransportConnectionParams
}
3 changes: 3 additions & 0 deletions Sources/PipecatClientIOS/types/StartBotResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

public protocol StartBotResult: Decodable {}