- Add Vision framework integration for image analysis (OCR, classification) - Add image attachment support in chat UI with drag & drop - Add recent images sidebar from Downloads/Desktop - Add copy to clipboard button for assistant responses - Add gRPC reflection service with toggle in settings - Create proper .proto file and generate Swift code - Add server restart when toggling reflection setting - Fix port number formatting in settings (remove comma grouping) - Update gRPC dependencies to v2.x 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
799 lines
38 KiB
Swift
799 lines
38 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"
|
|
)
|
|
}
|
|
/// 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<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>
|
|
}
|
|
|
|
/// 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>
|
|
}
|
|
|
|
/// 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
|
|
}
|
|
}
|
|
|
|
// 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
|
|
)
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
// 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)
|
|
}
|
|
}
|
|
|
|
// 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: [:]
|
|
)
|
|
}
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
/// 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
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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
|
|
)
|
|
}
|
|
}
|
|
|
|
// 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
|
|
)
|
|
}
|
|
} |