swift-apple-intelligence-grpc/Sources/AppleIntelligenceCore/Generated/apple_intelligence.grpc.swift
Mathias Beaulieu-Duncan b754945923 Add Text-to-Speech and Speech-to-Text features
- Add TTS service using AVSpeechSynthesizer for voice output
- Add STT service using SpeechAnalyzer (macOS 26) for transcription
- Add voice input (microphone) button in chat with recording level indicator
- Add speak button on assistant messages for TTS playback
- Add language toggle (EN-CA/FR-CA) for bilingual speech recognition
- Fix Swift 6 strict concurrency issues in audio callbacks
- Update proto schema with TTS/STT message types and RPCs
- Update gRPC provider with speech service endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 02:57:30 -05:00

1616 lines
79 KiB
Swift

// DO NOT EDIT.
// swift-format-ignore-file
// swiftlint:disable all
//
// Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
// Source: apple_intelligence.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/grpc/grpc-swift
import GRPCCore
import GRPCProtobuf
// MARK: - appleintelligence.AppleIntelligenceService
/// Namespace containing generated types for the "appleintelligence.AppleIntelligenceService" service.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
public enum Appleintelligence_AppleIntelligenceService: Sendable {
/// Service descriptor for the "appleintelligence.AppleIntelligenceService" service.
public static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService")
/// Namespace for method metadata.
public enum Method: Sendable {
/// Namespace for "Complete" metadata.
public enum Complete: Sendable {
/// Request type for "Complete".
public typealias Input = Appleintelligence_CompletionRequest
/// Response type for "Complete".
public typealias Output = Appleintelligence_CompletionResponse
/// Descriptor for "Complete".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "Complete"
)
}
/// Namespace for "StreamComplete" metadata.
public enum StreamComplete: Sendable {
/// Request type for "StreamComplete".
public typealias Input = Appleintelligence_CompletionRequest
/// Response type for "StreamComplete".
public typealias Output = Appleintelligence_CompletionChunk
/// Descriptor for "StreamComplete".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "StreamComplete"
)
}
/// Namespace for "Health" metadata.
public enum Health: Sendable {
/// Request type for "Health".
public typealias Input = Appleintelligence_HealthRequest
/// Response type for "Health".
public typealias Output = Appleintelligence_HealthResponse
/// Descriptor for "Health".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "Health"
)
}
/// Namespace for "TextToSpeech" metadata.
public enum TextToSpeech: Sendable {
/// Request type for "TextToSpeech".
public typealias Input = Appleintelligence_TextToSpeechRequest
/// Response type for "TextToSpeech".
public typealias Output = Appleintelligence_TextToSpeechResponse
/// Descriptor for "TextToSpeech".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "TextToSpeech"
)
}
/// Namespace for "ListVoices" metadata.
public enum ListVoices: Sendable {
/// Request type for "ListVoices".
public typealias Input = Appleintelligence_ListVoicesRequest
/// Response type for "ListVoices".
public typealias Output = Appleintelligence_ListVoicesResponse
/// Descriptor for "ListVoices".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "ListVoices"
)
}
/// Namespace for "Transcribe" metadata.
public enum Transcribe: Sendable {
/// Request type for "Transcribe".
public typealias Input = Appleintelligence_TranscribeRequest
/// Response type for "Transcribe".
public typealias Output = Appleintelligence_TranscribeResponse
/// Descriptor for "Transcribe".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "Transcribe"
)
}
/// Namespace for "StreamTranscribe" metadata.
public enum StreamTranscribe: Sendable {
/// Request type for "StreamTranscribe".
public typealias Input = Appleintelligence_StreamingTranscribeRequest
/// Response type for "StreamTranscribe".
public typealias Output = Appleintelligence_StreamingTranscribeResponse
/// Descriptor for "StreamTranscribe".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "StreamTranscribe"
)
}
/// Descriptors for all methods in the "appleintelligence.AppleIntelligenceService" service.
public static let descriptors: [GRPCCore.MethodDescriptor] = [
Complete.descriptor,
StreamComplete.descriptor,
Health.descriptor,
TextToSpeech.descriptor,
ListVoices.descriptor,
Transcribe.descriptor,
StreamTranscribe.descriptor
]
}
}
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCCore.ServiceDescriptor {
/// Service descriptor for the "appleintelligence.AppleIntelligenceService" service.
public static let appleintelligence_AppleIntelligenceService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService")
}
// MARK: appleintelligence.AppleIntelligenceService (server)
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService {
/// Streaming variant of the service protocol for the "appleintelligence.AppleIntelligenceService" service.
///
/// This protocol is the lowest-level of the service protocols generated for this service
/// giving you the most flexibility over the implementation of your service. This comes at
/// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in
/// terms of a request stream and response stream. Where only a single request or response
/// message is expected, you are responsible for enforcing this invariant is maintained.
///
/// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol``
/// or ``SimpleServiceProtocol`` instead.
///
/// > Source IDL Documentation:
/// >
/// > Apple Intelligence Service
public protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
/// Handle the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_CompletionRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_CompletionResponse` messages.
func complete(
request: GRPCCore.StreamingServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionResponse>
/// Handle the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_CompletionRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_CompletionChunk` messages.
func streamComplete(
request: GRPCCore.StreamingServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionChunk>
/// Handle the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_HealthRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_HealthResponse` messages.
func health(
request: GRPCCore.StreamingServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_HealthResponse>
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_TextToSpeechRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_TextToSpeechResponse` messages.
func textToSpeech(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TextToSpeechResponse>
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_ListVoicesRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_ListVoicesResponse` messages.
func listVoices(
request: GRPCCore.StreamingServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_ListVoicesResponse>
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_TranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_TranscribeResponse` messages.
func transcribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TranscribeResponse>
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_StreamingTranscribeResponse` messages.
func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>
}
/// Service protocol for the "appleintelligence.AppleIntelligenceService" service.
///
/// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than
/// the ``SimpleServiceProtocol``, it provides access to request and response metadata and
/// trailing response metadata. If you don't need these then consider using
/// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then
/// use ``StreamingServiceProtocol``.
///
/// > Source IDL Documentation:
/// >
/// > Apple Intelligence Service
public protocol ServiceProtocol: Appleintelligence_AppleIntelligenceService.StreamingServiceProtocol {
/// Handle the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_CompletionResponse` message.
func complete(
request: GRPCCore.ServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_CompletionResponse>
/// Handle the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_CompletionChunk` messages.
func streamComplete(
request: GRPCCore.ServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionChunk>
/// Handle the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_HealthRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_HealthResponse` message.
func health(
request: GRPCCore.ServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_HealthResponse>
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_TextToSpeechResponse` message.
func textToSpeech(
request: GRPCCore.ServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse>
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_ListVoicesResponse` message.
func listVoices(
request: GRPCCore.ServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse>
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_TranscribeResponse` message.
func transcribe(
request: GRPCCore.ServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse>
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_StreamingTranscribeResponse` messages.
func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>
}
/// Simple service protocol for the "appleintelligence.AppleIntelligenceService" service.
///
/// This is the highest level protocol for the service. The API is the easiest to use but
/// doesn't provide access to request or response metadata. If you need access to these
/// then use ``ServiceProtocol`` instead.
///
/// > Source IDL Documentation:
/// >
/// > Apple Intelligence Service
public protocol SimpleServiceProtocol: Appleintelligence_AppleIntelligenceService.ServiceProtocol {
/// Handle the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A `Appleintelligence_CompletionRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_CompletionResponse` to respond with.
func complete(
request: Appleintelligence_CompletionRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_CompletionResponse
/// Handle the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A `Appleintelligence_CompletionRequest` message.
/// - response: A response stream of `Appleintelligence_CompletionChunk` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
func streamComplete(
request: Appleintelligence_CompletionRequest,
response: GRPCCore.RPCWriter<Appleintelligence_CompletionChunk>,
context: GRPCCore.ServerContext
) async throws
/// Handle the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A `Appleintelligence_HealthRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_HealthResponse` to respond with.
func health(
request: Appleintelligence_HealthRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_HealthResponse
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A `Appleintelligence_TextToSpeechRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_TextToSpeechResponse` to respond with.
func textToSpeech(
request: Appleintelligence_TextToSpeechRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_TextToSpeechResponse
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A `Appleintelligence_ListVoicesRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_ListVoicesResponse` to respond with.
func listVoices(
request: Appleintelligence_ListVoicesRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_ListVoicesResponse
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A `Appleintelligence_TranscribeRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_TranscribeResponse` to respond with.
func transcribe(
request: Appleintelligence_TranscribeRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_TranscribeResponse
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A stream of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - response: A response stream of `Appleintelligence_StreamingTranscribeResponse` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
func streamTranscribe(
request: GRPCCore.RPCAsyncSequence<Appleintelligence_StreamingTranscribeRequest, any Swift.Error>,
response: GRPCCore.RPCWriter<Appleintelligence_StreamingTranscribeResponse>,
context: GRPCCore.ServerContext
) async throws
}
}
// Default implementation of 'registerMethods(with:)'.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService.StreamingServiceProtocol {
public func registerMethods<Transport>(with router: inout GRPCCore.RPCRouter<Transport>) where Transport: GRPCCore.ServerTransport {
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.Complete.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_CompletionRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_CompletionResponse>(),
handler: { request, context in
try await self.complete(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.StreamComplete.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_CompletionRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_CompletionChunk>(),
handler: { request, context in
try await self.streamComplete(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.Health.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_HealthRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_HealthResponse>(),
handler: { request, context in
try await self.health(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.TextToSpeech.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TextToSpeechRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TextToSpeechResponse>(),
handler: { request, context in
try await self.textToSpeech(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.ListVoices.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_ListVoicesRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_ListVoicesResponse>(),
handler: { request, context in
try await self.listVoices(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.Transcribe.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TranscribeRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TranscribeResponse>(),
handler: { request, context in
try await self.transcribe(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.StreamTranscribe.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_StreamingTranscribeRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_StreamingTranscribeResponse>(),
handler: { request, context in
try await self.streamTranscribe(
request: request,
context: context
)
}
)
}
}
// Default implementation of streaming methods from 'StreamingServiceProtocol'.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService.ServiceProtocol {
public func complete(
request: GRPCCore.StreamingServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionResponse> {
let response = try await self.complete(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func streamComplete(
request: GRPCCore.StreamingServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionChunk> {
let response = try await self.streamComplete(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return response
}
public func health(
request: GRPCCore.StreamingServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_HealthResponse> {
let response = try await self.health(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func textToSpeech(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TextToSpeechResponse> {
let response = try await self.textToSpeech(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func listVoices(
request: GRPCCore.StreamingServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_ListVoicesResponse> {
let response = try await self.listVoices(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func transcribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TranscribeResponse> {
let response = try await self.transcribe(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
}
// Default implementation of methods from 'ServiceProtocol'.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService.SimpleServiceProtocol {
public func complete(
request: GRPCCore.ServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_CompletionResponse> {
return GRPCCore.ServerResponse<Appleintelligence_CompletionResponse>(
message: try await self.complete(
request: request.message,
context: context
),
metadata: [:]
)
}
public func streamComplete(
request: GRPCCore.ServerRequest<Appleintelligence_CompletionRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_CompletionChunk> {
return GRPCCore.StreamingServerResponse<Appleintelligence_CompletionChunk>(
metadata: [:],
producer: { writer in
try await self.streamComplete(
request: request.message,
response: writer,
context: context
)
return [:]
}
)
}
public func health(
request: GRPCCore.ServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_HealthResponse> {
return GRPCCore.ServerResponse<Appleintelligence_HealthResponse>(
message: try await self.health(
request: request.message,
context: context
),
metadata: [:]
)
}
public func textToSpeech(
request: GRPCCore.ServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse> {
return GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse>(
message: try await self.textToSpeech(
request: request.message,
context: context
),
metadata: [:]
)
}
public func listVoices(
request: GRPCCore.ServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse> {
return GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse>(
message: try await self.listVoices(
request: request.message,
context: context
),
metadata: [:]
)
}
public func transcribe(
request: GRPCCore.ServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse> {
return GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse>(
message: try await self.transcribe(
request: request.message,
context: context
),
metadata: [:]
)
}
public func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse> {
return GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>(
metadata: [:],
producer: { writer in
try await self.streamTranscribe(
request: request.messages,
response: writer,
context: context
)
return [:]
}
)
}
}
// MARK: appleintelligence.AppleIntelligenceService (client)
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService {
/// Generated client protocol for the "appleintelligence.AppleIntelligenceService" service.
///
/// You don't need to implement this protocol directly, use the generated
/// implementation, ``Client``.
///
/// > Source IDL Documentation:
/// >
/// > Apple Intelligence Service
public protocol ClientProtocol: Sendable {
/// Call the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - serializer: A serializer for `Appleintelligence_CompletionRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_CompletionResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func complete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_CompletionRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_CompletionResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_CompletionResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - serializer: A serializer for `Appleintelligence_CompletionRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_CompletionChunk` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func streamComplete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_CompletionRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_CompletionChunk>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_CompletionChunk>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_HealthRequest` message.
/// - serializer: A serializer for `Appleintelligence_HealthRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_HealthResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func health<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_HealthRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_HealthRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_HealthResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_HealthResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - serializer: A serializer for `Appleintelligence_TextToSpeechRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TextToSpeechResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TextToSpeechRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TextToSpeechResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - serializer: A serializer for `Appleintelligence_ListVoicesRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_ListVoicesResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_ListVoicesRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_ListVoicesResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - serializer: A serializer for `Appleintelligence_TranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TranscribeResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - serializer: A serializer for `Appleintelligence_StreamingTranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_StreamingTranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_StreamingTranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_StreamingTranscribeResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
}
/// Generated client for the "appleintelligence.AppleIntelligenceService" service.
///
/// The ``Client`` provides an implementation of ``ClientProtocol`` which wraps
/// a `GRPCCore.GRPCCClient`. The underlying `GRPCClient` provides the long-lived
/// means of communication with the remote peer.
///
/// > Source IDL Documentation:
/// >
/// > Apple Intelligence Service
public struct Client<Transport>: ClientProtocol where Transport: GRPCCore.ClientTransport {
private let client: GRPCCore.GRPCClient<Transport>
/// Creates a new client wrapping the provided `GRPCCore.GRPCClient`.
///
/// - Parameters:
/// - client: A `GRPCCore.GRPCClient` providing a communication channel to the service.
public init(wrapping client: GRPCCore.GRPCClient<Transport>) {
self.client = client
}
/// Call the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - serializer: A serializer for `Appleintelligence_CompletionRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_CompletionResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func complete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_CompletionRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_CompletionResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_CompletionResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.Complete.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - serializer: A serializer for `Appleintelligence_CompletionRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_CompletionChunk` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamComplete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_CompletionRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_CompletionChunk>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_CompletionChunk>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.client.serverStreaming(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.StreamComplete.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_HealthRequest` message.
/// - serializer: A serializer for `Appleintelligence_HealthRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_HealthResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func health<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_HealthRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_HealthRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_HealthResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_HealthResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.Health.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - serializer: A serializer for `Appleintelligence_TextToSpeechRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TextToSpeechResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TextToSpeechRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TextToSpeechResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.TextToSpeech.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - serializer: A serializer for `Appleintelligence_ListVoicesRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_ListVoicesResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_ListVoicesRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_ListVoicesResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.ListVoices.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - serializer: A serializer for `Appleintelligence_TranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TranscribeResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.Transcribe.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - serializer: A serializer for `Appleintelligence_StreamingTranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_StreamingTranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_StreamingTranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_StreamingTranscribeResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.client.bidirectionalStreaming(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.StreamTranscribe.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
}
}
// Helpers providing default arguments to 'ClientProtocol' methods.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService.ClientProtocol {
/// Call the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func complete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_CompletionResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.complete(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_CompletionRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_CompletionResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_CompletionRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamComplete<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_CompletionChunk>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.streamComplete(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_CompletionRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_CompletionChunk>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_HealthRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func health<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_HealthRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_HealthResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.health(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_HealthRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_HealthResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.textToSpeech(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TextToSpeechRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TextToSpeechResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.listVoices(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_ListVoicesRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_ListVoicesResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.transcribe(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TranscribeRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TranscribeResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.streamTranscribe(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_StreamingTranscribeRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_StreamingTranscribeResponse>(),
options: options,
onResponse: handleResponse
)
}
}
// Helpers providing sugared APIs for 'ClientProtocol' methods.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Appleintelligence_AppleIntelligenceService.ClientProtocol {
/// Call the "Complete" method.
///
/// > Source IDL Documentation:
/// >
/// > Single completion request
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func complete<Result>(
_ message: Appleintelligence_CompletionRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_CompletionResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>(
message: message,
metadata: metadata
)
return try await self.complete(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamComplete" method.
///
/// > Source IDL Documentation:
/// >
/// > Streaming completion request
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamComplete<Result>(
_ message: Appleintelligence_CompletionRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_CompletionChunk>) async throws -> Result
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_CompletionRequest>(
message: message,
metadata: metadata
)
return try await self.streamComplete(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "Health" method.
///
/// > Source IDL Documentation:
/// >
/// > Health check
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func health<Result>(
_ message: Appleintelligence_HealthRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_HealthResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_HealthRequest>(
message: message,
metadata: metadata
)
return try await self.health(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
_ message: Appleintelligence_TextToSpeechRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>(
message: message,
metadata: metadata
)
return try await self.textToSpeech(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
_ message: Appleintelligence_ListVoicesRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>(
message: message,
metadata: metadata
)
return try await self.listVoices(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
_ message: Appleintelligence_TranscribeRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>(
message: message,
metadata: metadata
)
return try await self.transcribe(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - producer: A closure producing request messages to send to the server. The request
/// stream is closed when the closure returns.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Appleintelligence_StreamingTranscribeRequest>) async throws -> Void,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
let request = GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>(
metadata: metadata,
producer: producer
)
return try await self.streamTranscribe(
request: request,
options: options,
onResponse: handleResponse
)
}
}