// 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" ) } /// Descriptors for all methods in the "appleintelligence.AppleIntelligenceService" service. public static let descriptors: [GRPCCore.MethodDescriptor] = [ Complete.descriptor, StreamComplete.descriptor, Health.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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse } /// 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse /// 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse } /// 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, 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 } } // 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(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { router.registerHandler( forMethod: Appleintelligence_AppleIntelligenceService.Method.Complete.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.complete( request: request, context: context ) } ) router.registerHandler( forMethod: Appleintelligence_AppleIntelligenceService.Method.StreamComplete.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.streamComplete( request: request, context: context ) } ) router.registerHandler( forMethod: Appleintelligence_AppleIntelligenceService.Method.Health.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.health( 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.complete( request: GRPCCore.ServerRequest(stream: request), context: context ) return GRPCCore.StreamingServerResponse(single: response) } public func streamComplete( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.streamComplete( request: GRPCCore.ServerRequest(stream: request), context: context ) return response } public func health( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.health( 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, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse { return GRPCCore.ServerResponse( message: try await self.complete( request: request.message, context: context ), metadata: [:] ) } public func streamComplete( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { return GRPCCore.StreamingServerResponse( metadata: [:], producer: { writer in try await self.streamComplete( request: request.message, response: writer, context: context ) return [:] } ) } public func health( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse { return GRPCCore.ServerResponse( message: try await self.health( request: request.message, context: context ), metadata: [:] ) } } // 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) 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: ClientProtocol where Transport: GRPCCore.ClientTransport { private let client: GRPCCore.GRPCClient /// 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) { 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) 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( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) 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 ) } } } // 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( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.complete( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), 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( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { try await self.streamComplete( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), 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( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { try await self.health( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), 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( _ message: Appleintelligence_CompletionRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( 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( _ message: Appleintelligence_CompletionRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( 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( _ message: Appleintelligence_HealthRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { response in try response.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) return try await self.health( request: request, options: options, onResponse: handleResponse ) } }