status.pb.swift 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: status.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright 2024 Google LLC
  11. //
  12. // Licensed under the Apache License, Version 2.0 (the "License");
  13. // you may not use this file except in compliance with the License.
  14. // You may obtain a copy of the License at
  15. //
  16. // http://www.apache.org/licenses/LICENSE-2.0
  17. //
  18. // Unless required by applicable law or agreed to in writing, software
  19. // distributed under the License is distributed on an "AS IS" BASIS,
  20. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. // See the License for the specific language governing permissions and
  22. // limitations under the License.
  23. internal import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. /// The `Status` type defines a logical error model that is suitable for
  34. /// different programming environments, including REST APIs and RPC APIs. It is
  35. /// used by [gRPC](https://github.com/grpc). Each `Status` message contains
  36. /// three pieces of data: error code, error message, and error details.
  37. ///
  38. /// You can find out more about this error model and how to work with it in the
  39. /// [API Design Guide](https://cloud.google.com/apis/design/errors).
  40. struct Google_Rpc_Status: Sendable {
  41. // SwiftProtobuf.Message conformance is added in an extension below. See the
  42. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  43. // methods supported on all messages.
  44. /// The status code, which should be an enum value of
  45. /// [google.rpc.Code][google.rpc.Code].
  46. var code: Int32 = 0
  47. /// A developer-facing error message, which should be in English. Any
  48. /// user-facing error message should be localized and sent in the
  49. /// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
  50. /// by the client.
  51. var message: String = String()
  52. /// A list of messages that carry the error details. There is a common set of
  53. /// message types for APIs to use.
  54. var details: [SwiftProtobuf.Google_Protobuf_Any] = []
  55. var unknownFields = SwiftProtobuf.UnknownStorage()
  56. init() {}
  57. }
  58. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  59. fileprivate let _protobuf_package = "google.rpc"
  60. extension Google_Rpc_Status: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  61. static let protoMessageName: String = _protobuf_package + ".Status"
  62. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  63. 1: .same(proto: "code"),
  64. 2: .same(proto: "message"),
  65. 3: .same(proto: "details"),
  66. ]
  67. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  68. while let fieldNumber = try decoder.nextFieldNumber() {
  69. // The use of inline closures is to circumvent an issue where the compiler
  70. // allocates stack space for every case branch when no optimizations are
  71. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  72. switch fieldNumber {
  73. case 1: try { try decoder.decodeSingularInt32Field(value: &self.code) }()
  74. case 2: try { try decoder.decodeSingularStringField(value: &self.message) }()
  75. case 3: try { try decoder.decodeRepeatedMessageField(value: &self.details) }()
  76. default: break
  77. }
  78. }
  79. }
  80. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  81. if self.code != 0 {
  82. try visitor.visitSingularInt32Field(value: self.code, fieldNumber: 1)
  83. }
  84. if !self.message.isEmpty {
  85. try visitor.visitSingularStringField(value: self.message, fieldNumber: 2)
  86. }
  87. if !self.details.isEmpty {
  88. try visitor.visitRepeatedMessageField(value: self.details, fieldNumber: 3)
  89. }
  90. try unknownFields.traverse(visitor: &visitor)
  91. }
  92. static func ==(lhs: Google_Rpc_Status, rhs: Google_Rpc_Status) -> Bool {
  93. if lhs.code != rhs.code {return false}
  94. if lhs.message != rhs.message {return false}
  95. if lhs.details != rhs.details {return false}
  96. if lhs.unknownFields != rhs.unknownFields {return false}
  97. return true
  98. }
  99. }