Skip to content

Commit a9acbb1

Browse files
akshaywadiaAkshay Wadia
andauthored
Update protos for error API (#220)
Co-authored-by: Akshay Wadia <awadia@apple.com>
1 parent 7a03d54 commit a9acbb1

File tree

3 files changed

+647
-1
lines changed

3 files changed

+647
-1
lines changed

Sources/PrivateInformationRetrievalProtobuf/generated/apple_swift_homomorphic_encryption_api_pir_v1_api.pb.swift

Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,130 @@ public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Response: Sendable {
219219
public init() {}
220220
}
221221

222+
/// Error returned by failed API calls.
223+
public struct Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error: Sendable {
224+
// SwiftProtobuf.Message conformance is added in an extension below. See the
225+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
226+
// methods supported on all messages.
227+
228+
/// Type of error encountered while processing request.
229+
public var errorType: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.OneOf_ErrorType? = nil
230+
231+
/// Client configuration not found.
232+
public var configVersionNotFound: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound {
233+
get {
234+
if case .configVersionNotFound(let v)? = errorType {return v}
235+
return Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound()
236+
}
237+
set {errorType = .configVersionNotFound(newValue)}
238+
}
239+
240+
/// Client evaluation key not found.
241+
public var evaluationKeyNotFound: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound {
242+
get {
243+
if case .evaluationKeyNotFound(let v)? = errorType {return v}
244+
return Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound()
245+
}
246+
set {errorType = .evaluationKeyNotFound(newValue)}
247+
}
248+
249+
/// Request can not be parsed.
250+
public var invalidRequest: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest {
251+
get {
252+
if case .invalidRequest(let v)? = errorType {return v}
253+
return Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest()
254+
}
255+
set {errorType = .invalidRequest(newValue)}
256+
}
257+
258+
/// Internal error.
259+
public var internalError: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError {
260+
get {
261+
if case .internalError(let v)? = errorType {return v}
262+
return Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError()
263+
}
264+
set {errorType = .internalError(newValue)}
265+
}
266+
267+
public var unknownFields = SwiftProtobuf.UnknownStorage()
268+
269+
/// Type of error encountered while processing request.
270+
public enum OneOf_ErrorType: Equatable, Sendable {
271+
/// Client configuration not found.
272+
case configVersionNotFound(Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound)
273+
/// Client evaluation key not found.
274+
case evaluationKeyNotFound(Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound)
275+
/// Request can not be parsed.
276+
case invalidRequest(Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest)
277+
/// Internal error.
278+
case internalError(Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError)
279+
280+
}
281+
282+
/// Client configuration not found.
283+
///
284+
/// Client should retry after fetching new configuration. May include new configuration
285+
/// in `config_response`. In this case, client should use this returned configuration and retry.
286+
public struct ConfigVersionNotFound: Sendable {
287+
// SwiftProtobuf.Message conformance is added in an extension below. See the
288+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
289+
// methods supported on all messages.
290+
291+
/// ConfigResponse that client should use for subsequent requests.
292+
public var configResponse: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_ConfigResponse {
293+
get {return _configResponse ?? Apple_SwiftHomomorphicEncryption_Api_Pir_V1_ConfigResponse()}
294+
set {_configResponse = newValue}
295+
}
296+
/// Returns true if `configResponse` has been explicitly set.
297+
public var hasConfigResponse: Bool {return self._configResponse != nil}
298+
/// Clears the value of `configResponse`. Subsequent reads from it will return its default value.
299+
public mutating func clearConfigResponse() {self._configResponse = nil}
300+
301+
public var unknownFields = SwiftProtobuf.UnknownStorage()
302+
303+
public init() {}
304+
305+
fileprivate var _configResponse: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_ConfigResponse? = nil
306+
}
307+
308+
/// Evaluation key not found.
309+
///
310+
/// Client should upload evaluation key and retry.
311+
public struct EvaluationKeyNotFound: Sendable {
312+
// SwiftProtobuf.Message conformance is added in an extension below. See the
313+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
314+
// methods supported on all messages.
315+
316+
public var unknownFields = SwiftProtobuf.UnknownStorage()
317+
318+
public init() {}
319+
}
320+
321+
/// Request can not be parsed successfully.
322+
public struct InvalidRequest: Sendable {
323+
// SwiftProtobuf.Message conformance is added in an extension below. See the
324+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
325+
// methods supported on all messages.
326+
327+
public var unknownFields = SwiftProtobuf.UnknownStorage()
328+
329+
public init() {}
330+
}
331+
332+
/// Internal error.
333+
public struct InternalError: Sendable {
334+
// SwiftProtobuf.Message conformance is added in an extension below. See the
335+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
336+
// methods supported on all messages.
337+
338+
public var unknownFields = SwiftProtobuf.UnknownStorage()
339+
340+
public init() {}
341+
}
342+
343+
public init() {}
344+
}
345+
222346
// MARK: - Code below here is support for the SwiftProtobuf runtime.
223347

224348
fileprivate let _protobuf_package = "apple.swift_homomorphic_encryption.api.pir.v1"
@@ -568,3 +692,202 @@ extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Response: SwiftProtobuf.Me
568692
return true
569693
}
570694
}
695+
696+
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
697+
public static let protoMessageName: String = _protobuf_package + ".Error"
698+
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
699+
1: .standard(proto: "config_version_not_found"),
700+
2: .standard(proto: "evaluation_key_not_found"),
701+
3: .standard(proto: "invalid_request"),
702+
4: .standard(proto: "internal_error"),
703+
]
704+
705+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
706+
while let fieldNumber = try decoder.nextFieldNumber() {
707+
// The use of inline closures is to circumvent an issue where the compiler
708+
// allocates stack space for every case branch when no optimizations are
709+
// enabled. https://github.com/apple/swift-protobuf/issues/1034
710+
switch fieldNumber {
711+
case 1: try {
712+
var v: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound?
713+
var hadOneofValue = false
714+
if let current = self.errorType {
715+
hadOneofValue = true
716+
if case .configVersionNotFound(let m) = current {v = m}
717+
}
718+
try decoder.decodeSingularMessageField(value: &v)
719+
if let v = v {
720+
if hadOneofValue {try decoder.handleConflictingOneOf()}
721+
self.errorType = .configVersionNotFound(v)
722+
}
723+
}()
724+
case 2: try {
725+
var v: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound?
726+
var hadOneofValue = false
727+
if let current = self.errorType {
728+
hadOneofValue = true
729+
if case .evaluationKeyNotFound(let m) = current {v = m}
730+
}
731+
try decoder.decodeSingularMessageField(value: &v)
732+
if let v = v {
733+
if hadOneofValue {try decoder.handleConflictingOneOf()}
734+
self.errorType = .evaluationKeyNotFound(v)
735+
}
736+
}()
737+
case 3: try {
738+
var v: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest?
739+
var hadOneofValue = false
740+
if let current = self.errorType {
741+
hadOneofValue = true
742+
if case .invalidRequest(let m) = current {v = m}
743+
}
744+
try decoder.decodeSingularMessageField(value: &v)
745+
if let v = v {
746+
if hadOneofValue {try decoder.handleConflictingOneOf()}
747+
self.errorType = .invalidRequest(v)
748+
}
749+
}()
750+
case 4: try {
751+
var v: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError?
752+
var hadOneofValue = false
753+
if let current = self.errorType {
754+
hadOneofValue = true
755+
if case .internalError(let m) = current {v = m}
756+
}
757+
try decoder.decodeSingularMessageField(value: &v)
758+
if let v = v {
759+
if hadOneofValue {try decoder.handleConflictingOneOf()}
760+
self.errorType = .internalError(v)
761+
}
762+
}()
763+
default: break
764+
}
765+
}
766+
}
767+
768+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
769+
// The use of inline closures is to circumvent an issue where the compiler
770+
// allocates stack space for every if/case branch local when no optimizations
771+
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
772+
// https://github.com/apple/swift-protobuf/issues/1182
773+
switch self.errorType {
774+
case .configVersionNotFound?: try {
775+
guard case .configVersionNotFound(let v)? = self.errorType else { preconditionFailure() }
776+
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
777+
}()
778+
case .evaluationKeyNotFound?: try {
779+
guard case .evaluationKeyNotFound(let v)? = self.errorType else { preconditionFailure() }
780+
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
781+
}()
782+
case .invalidRequest?: try {
783+
guard case .invalidRequest(let v)? = self.errorType else { preconditionFailure() }
784+
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
785+
}()
786+
case .internalError?: try {
787+
guard case .internalError(let v)? = self.errorType else { preconditionFailure() }
788+
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
789+
}()
790+
case nil: break
791+
}
792+
try unknownFields.traverse(visitor: &visitor)
793+
}
794+
795+
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error) -> Bool {
796+
if lhs.errorType != rhs.errorType {return false}
797+
if lhs.unknownFields != rhs.unknownFields {return false}
798+
return true
799+
}
800+
}
801+
802+
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
803+
public static let protoMessageName: String = Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.protoMessageName + ".ConfigVersionNotFound"
804+
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
805+
1: .standard(proto: "config_response"),
806+
]
807+
808+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
809+
while let fieldNumber = try decoder.nextFieldNumber() {
810+
// The use of inline closures is to circumvent an issue where the compiler
811+
// allocates stack space for every case branch when no optimizations are
812+
// enabled. https://github.com/apple/swift-protobuf/issues/1034
813+
switch fieldNumber {
814+
case 1: try { try decoder.decodeSingularMessageField(value: &self._configResponse) }()
815+
default: break
816+
}
817+
}
818+
}
819+
820+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
821+
// The use of inline closures is to circumvent an issue where the compiler
822+
// allocates stack space for every if/case branch local when no optimizations
823+
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
824+
// https://github.com/apple/swift-protobuf/issues/1182
825+
try { if let v = self._configResponse {
826+
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
827+
} }()
828+
try unknownFields.traverse(visitor: &visitor)
829+
}
830+
831+
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.ConfigVersionNotFound) -> Bool {
832+
if lhs._configResponse != rhs._configResponse {return false}
833+
if lhs.unknownFields != rhs.unknownFields {return false}
834+
return true
835+
}
836+
}
837+
838+
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
839+
public static let protoMessageName: String = Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.protoMessageName + ".EvaluationKeyNotFound"
840+
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
841+
842+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
843+
// Load everything into unknown fields
844+
while try decoder.nextFieldNumber() != nil {}
845+
}
846+
847+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
848+
try unknownFields.traverse(visitor: &visitor)
849+
}
850+
851+
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.EvaluationKeyNotFound) -> Bool {
852+
if lhs.unknownFields != rhs.unknownFields {return false}
853+
return true
854+
}
855+
}
856+
857+
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
858+
public static let protoMessageName: String = Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.protoMessageName + ".InvalidRequest"
859+
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
860+
861+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
862+
// Load everything into unknown fields
863+
while try decoder.nextFieldNumber() != nil {}
864+
}
865+
866+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
867+
try unknownFields.traverse(visitor: &visitor)
868+
}
869+
870+
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InvalidRequest) -> Bool {
871+
if lhs.unknownFields != rhs.unknownFields {return false}
872+
return true
873+
}
874+
}
875+
876+
extension Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
877+
public static let protoMessageName: String = Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.protoMessageName + ".InternalError"
878+
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
879+
880+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
881+
// Load everything into unknown fields
882+
while try decoder.nextFieldNumber() != nil {}
883+
}
884+
885+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
886+
try unknownFields.traverse(visitor: &visitor)
887+
}
888+
889+
public static func ==(lhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError, rhs: Apple_SwiftHomomorphicEncryption_Api_Pir_V1_Error.InternalError) -> Bool {
890+
if lhs.unknownFields != rhs.unknownFields {return false}
891+
return true
892+
}
893+
}

0 commit comments

Comments
 (0)