Add vision support, gRPC reflection toggle, and chat improvements
- 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>
This commit is contained in:
@@ -1,238 +0,0 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated protocol buffer code for apple_intelligence.proto
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// MARK: - Messages
|
||||
|
||||
struct Appleintelligence_CompletionRequest: Sendable, SwiftProtobuf.Message {
|
||||
static let protoMessageName: String = "appleintelligence.CompletionRequest"
|
||||
|
||||
var prompt: String = ""
|
||||
var temperature: Float = 0
|
||||
var maxTokens: Int32 = 0
|
||||
|
||||
var hasTemperature: Bool = false
|
||||
var hasMaxTokens: Bool = false
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
init(prompt: String, temperature: Float? = nil, maxTokens: Int32? = nil) {
|
||||
self.prompt = prompt
|
||||
if let temp = temperature {
|
||||
self.temperature = temp
|
||||
self.hasTemperature = true
|
||||
}
|
||||
if let tokens = maxTokens {
|
||||
self.maxTokens = tokens
|
||||
self.hasMaxTokens = true
|
||||
}
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularStringField(value: &prompt)
|
||||
case 2:
|
||||
try decoder.decodeSingularFloatField(value: &temperature)
|
||||
hasTemperature = true
|
||||
case 3:
|
||||
try decoder.decodeSingularInt32Field(value: &maxTokens)
|
||||
hasMaxTokens = true
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !prompt.isEmpty {
|
||||
try visitor.visitSingularStringField(value: prompt, fieldNumber: 1)
|
||||
}
|
||||
if hasTemperature {
|
||||
try visitor.visitSingularFloatField(value: temperature, fieldNumber: 2)
|
||||
}
|
||||
if hasMaxTokens {
|
||||
try visitor.visitSingularInt32Field(value: maxTokens, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.prompt == rhs.prompt && lhs.temperature == rhs.temperature && lhs.maxTokens == rhs.maxTokens && lhs.unknownFields == rhs.unknownFields
|
||||
}
|
||||
|
||||
func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
|
||||
guard let other = message as? Self else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
|
||||
struct Appleintelligence_CompletionResponse: Sendable, SwiftProtobuf.Message {
|
||||
static let protoMessageName: String = "appleintelligence.CompletionResponse"
|
||||
|
||||
var id: String = ""
|
||||
var text: String = ""
|
||||
var finishReason: String = ""
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularStringField(value: &id)
|
||||
case 2: try decoder.decodeSingularStringField(value: &text)
|
||||
case 3: try decoder.decodeSingularStringField(value: &finishReason)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !id.isEmpty {
|
||||
try visitor.visitSingularStringField(value: id, fieldNumber: 1)
|
||||
}
|
||||
if !text.isEmpty {
|
||||
try visitor.visitSingularStringField(value: text, fieldNumber: 2)
|
||||
}
|
||||
if !finishReason.isEmpty {
|
||||
try visitor.visitSingularStringField(value: finishReason, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.id == rhs.id && lhs.text == rhs.text && lhs.finishReason == rhs.finishReason && lhs.unknownFields == rhs.unknownFields
|
||||
}
|
||||
|
||||
func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
|
||||
guard let other = message as? Self else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
|
||||
struct Appleintelligence_CompletionChunk: Sendable, SwiftProtobuf.Message {
|
||||
static let protoMessageName: String = "appleintelligence.CompletionChunk"
|
||||
|
||||
var id: String = ""
|
||||
var delta: String = ""
|
||||
var isFinal: Bool = false
|
||||
var finishReason: String = ""
|
||||
|
||||
var hasFinishReason: Bool {
|
||||
!finishReason.isEmpty
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularStringField(value: &id)
|
||||
case 2: try decoder.decodeSingularStringField(value: &delta)
|
||||
case 3: try decoder.decodeSingularBoolField(value: &isFinal)
|
||||
case 4: try decoder.decodeSingularStringField(value: &finishReason)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !id.isEmpty {
|
||||
try visitor.visitSingularStringField(value: id, fieldNumber: 1)
|
||||
}
|
||||
if !delta.isEmpty {
|
||||
try visitor.visitSingularStringField(value: delta, fieldNumber: 2)
|
||||
}
|
||||
if isFinal {
|
||||
try visitor.visitSingularBoolField(value: isFinal, fieldNumber: 3)
|
||||
}
|
||||
if !finishReason.isEmpty {
|
||||
try visitor.visitSingularStringField(value: finishReason, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.id == rhs.id && lhs.delta == rhs.delta && lhs.isFinal == rhs.isFinal && lhs.finishReason == rhs.finishReason && lhs.unknownFields == rhs.unknownFields
|
||||
}
|
||||
|
||||
func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
|
||||
guard let other = message as? Self else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
|
||||
struct Appleintelligence_HealthRequest: Sendable, SwiftProtobuf.Message {
|
||||
static let protoMessageName: String = "appleintelligence.HealthRequest"
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let _ = try decoder.nextFieldNumber() {}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.unknownFields == rhs.unknownFields
|
||||
}
|
||||
|
||||
func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
|
||||
guard let other = message as? Self else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
|
||||
struct Appleintelligence_HealthResponse: Sendable, SwiftProtobuf.Message {
|
||||
static let protoMessageName: String = "appleintelligence.HealthResponse"
|
||||
|
||||
var healthy: Bool = false
|
||||
var modelStatus: String = ""
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularBoolField(value: &healthy)
|
||||
case 2: try decoder.decodeSingularStringField(value: &modelStatus)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if healthy {
|
||||
try visitor.visitSingularBoolField(value: healthy, fieldNumber: 1)
|
||||
}
|
||||
if !modelStatus.isEmpty {
|
||||
try visitor.visitSingularStringField(value: modelStatus, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.healthy == rhs.healthy && lhs.modelStatus == rhs.modelStatus && lhs.unknownFields == rhs.unknownFields
|
||||
}
|
||||
|
||||
func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
|
||||
guard let other = message as? Self else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,799 @@
|
||||
// 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
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,447 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the 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/apple/swift-protobuf/
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
/// Image data for vision requests
|
||||
public struct Appleintelligence_ImageData: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var data: Data = Data()
|
||||
|
||||
public var filename: String = String()
|
||||
|
||||
public var mimeType: String = String()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Vision analysis results
|
||||
public struct Appleintelligence_ImageAnalysis: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var textContent: String = String()
|
||||
|
||||
public var labels: [String] = []
|
||||
|
||||
public var description_p: String = String()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Completion request
|
||||
public struct Appleintelligence_CompletionRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var prompt: String = String()
|
||||
|
||||
public var temperature: Float {
|
||||
get {return _temperature ?? 0}
|
||||
set {_temperature = newValue}
|
||||
}
|
||||
/// Returns true if `temperature` has been explicitly set.
|
||||
public var hasTemperature: Bool {return self._temperature != nil}
|
||||
/// Clears the value of `temperature`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearTemperature() {self._temperature = nil}
|
||||
|
||||
public var maxTokens: Int32 {
|
||||
get {return _maxTokens ?? 0}
|
||||
set {_maxTokens = newValue}
|
||||
}
|
||||
/// Returns true if `maxTokens` has been explicitly set.
|
||||
public var hasMaxTokens: Bool {return self._maxTokens != nil}
|
||||
/// Clears the value of `maxTokens`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearMaxTokens() {self._maxTokens = nil}
|
||||
|
||||
public var images: [Appleintelligence_ImageData] = []
|
||||
|
||||
public var includeAnalysis: Bool = false
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _temperature: Float? = nil
|
||||
fileprivate var _maxTokens: Int32? = nil
|
||||
}
|
||||
|
||||
/// Completion response (non-streaming)
|
||||
public struct Appleintelligence_CompletionResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var id: String = String()
|
||||
|
||||
public var text: String = String()
|
||||
|
||||
public var finishReason: String = String()
|
||||
|
||||
public var imageAnalyses: [Appleintelligence_ImageAnalysis] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Streaming completion chunk
|
||||
public struct Appleintelligence_CompletionChunk: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var id: String = String()
|
||||
|
||||
public var delta: String = String()
|
||||
|
||||
public var isFinal: Bool = false
|
||||
|
||||
public var finishReason: String = String()
|
||||
|
||||
public var imageAnalyses: [Appleintelligence_ImageAnalysis] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Health check request
|
||||
public struct Appleintelligence_HealthRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Health check response
|
||||
public struct Appleintelligence_HealthResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var healthy: Bool = false
|
||||
|
||||
public var modelStatus: String = String()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "appleintelligence"
|
||||
|
||||
extension Appleintelligence_ImageData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ImageData"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}data\0\u{1}filename\0\u{3}mime_type\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.filename) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.mimeType) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1)
|
||||
}
|
||||
if !self.filename.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.filename, fieldNumber: 2)
|
||||
}
|
||||
if !self.mimeType.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.mimeType, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_ImageData, rhs: Appleintelligence_ImageData) -> Bool {
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.filename != rhs.filename {return false}
|
||||
if lhs.mimeType != rhs.mimeType {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_ImageAnalysis: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ImageAnalysis"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}text_content\0\u{1}labels\0\u{1}description\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.textContent) }()
|
||||
case 2: try { try decoder.decodeRepeatedStringField(value: &self.labels) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.description_p) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.textContent.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.textContent, fieldNumber: 1)
|
||||
}
|
||||
if !self.labels.isEmpty {
|
||||
try visitor.visitRepeatedStringField(value: self.labels, fieldNumber: 2)
|
||||
}
|
||||
if !self.description_p.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_ImageAnalysis, rhs: Appleintelligence_ImageAnalysis) -> Bool {
|
||||
if lhs.textContent != rhs.textContent {return false}
|
||||
if lhs.labels != rhs.labels {return false}
|
||||
if lhs.description_p != rhs.description_p {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_CompletionRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".CompletionRequest"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}prompt\0\u{1}temperature\0\u{3}max_tokens\0\u{1}images\0\u{3}include_analysis\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.prompt) }()
|
||||
case 2: try { try decoder.decodeSingularFloatField(value: &self._temperature) }()
|
||||
case 3: try { try decoder.decodeSingularInt32Field(value: &self._maxTokens) }()
|
||||
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.images) }()
|
||||
case 5: try { try decoder.decodeSingularBoolField(value: &self.includeAnalysis) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
if !self.prompt.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.prompt, fieldNumber: 1)
|
||||
}
|
||||
try { if let v = self._temperature {
|
||||
try visitor.visitSingularFloatField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = self._maxTokens {
|
||||
try visitor.visitSingularInt32Field(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
if !self.images.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.images, fieldNumber: 4)
|
||||
}
|
||||
if self.includeAnalysis != false {
|
||||
try visitor.visitSingularBoolField(value: self.includeAnalysis, fieldNumber: 5)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_CompletionRequest, rhs: Appleintelligence_CompletionRequest) -> Bool {
|
||||
if lhs.prompt != rhs.prompt {return false}
|
||||
if lhs._temperature != rhs._temperature {return false}
|
||||
if lhs._maxTokens != rhs._maxTokens {return false}
|
||||
if lhs.images != rhs.images {return false}
|
||||
if lhs.includeAnalysis != rhs.includeAnalysis {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_CompletionResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".CompletionResponse"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}text\0\u{3}finish_reason\0\u{3}image_analyses\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.text) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.finishReason) }()
|
||||
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.imageAnalyses) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.id.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||
}
|
||||
if !self.text.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.text, fieldNumber: 2)
|
||||
}
|
||||
if !self.finishReason.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.finishReason, fieldNumber: 3)
|
||||
}
|
||||
if !self.imageAnalyses.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.imageAnalyses, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_CompletionResponse, rhs: Appleintelligence_CompletionResponse) -> Bool {
|
||||
if lhs.id != rhs.id {return false}
|
||||
if lhs.text != rhs.text {return false}
|
||||
if lhs.finishReason != rhs.finishReason {return false}
|
||||
if lhs.imageAnalyses != rhs.imageAnalyses {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_CompletionChunk: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".CompletionChunk"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}delta\0\u{3}is_final\0\u{3}finish_reason\0\u{3}image_analyses\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.delta) }()
|
||||
case 3: try { try decoder.decodeSingularBoolField(value: &self.isFinal) }()
|
||||
case 4: try { try decoder.decodeSingularStringField(value: &self.finishReason) }()
|
||||
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.imageAnalyses) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.id.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||
}
|
||||
if !self.delta.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.delta, fieldNumber: 2)
|
||||
}
|
||||
if self.isFinal != false {
|
||||
try visitor.visitSingularBoolField(value: self.isFinal, fieldNumber: 3)
|
||||
}
|
||||
if !self.finishReason.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.finishReason, fieldNumber: 4)
|
||||
}
|
||||
if !self.imageAnalyses.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.imageAnalyses, fieldNumber: 5)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_CompletionChunk, rhs: Appleintelligence_CompletionChunk) -> Bool {
|
||||
if lhs.id != rhs.id {return false}
|
||||
if lhs.delta != rhs.delta {return false}
|
||||
if lhs.isFinal != rhs.isFinal {return false}
|
||||
if lhs.finishReason != rhs.finishReason {return false}
|
||||
if lhs.imageAnalyses != rhs.imageAnalyses {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_HealthRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".HealthRequest"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
// Load everything into unknown fields
|
||||
while try decoder.nextFieldNumber() != nil {}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_HealthRequest, rhs: Appleintelligence_HealthRequest) -> Bool {
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Appleintelligence_HealthResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".HealthResponse"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}healthy\0\u{3}model_status\0")
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBoolField(value: &self.healthy) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.modelStatus) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.healthy != false {
|
||||
try visitor.visitSingularBoolField(value: self.healthy, fieldNumber: 1)
|
||||
}
|
||||
if !self.modelStatus.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.modelStatus, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Appleintelligence_HealthResponse, rhs: Appleintelligence_HealthResponse) -> Bool {
|
||||
if lhs.healthy != rhs.healthy {return false}
|
||||
if lhs.modelStatus != rhs.modelStatus {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user