Debian Codegraph @

plugins/gnostic-swift-generator/Sources/Gnostic/surface.pb.swift

raw
1 // DO NOT EDIT.
2 //
3 // Generated by the Swift generator plugin for the protocol buffer compiler.
4 // Source: github.com/googleapis/gnostic/surface/surface.proto
5 //
6 // For information on using the generated types, please see the documenation:
7 // https://github.com/apple/swift-protobuf/
8
9 // Copyright 2017 Google Inc. All Rights Reserved.
10 //
11 // Licensed under the Apache License, Version 2.0 (the "License");
12 // you may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at
14 //
15 // http://www.apache.org/licenses/LICENSE-2.0
16 //
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the License is distributed on an "AS IS" BASIS,
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 // See the License for the specific language governing permissions and
21 // limitations under the License.
22
23 // Model an API surface for code generation.
24
25 import Foundation
26 import SwiftProtobuf
27
28 // If the compiler emits an error on this type, it is because this file
29 // was generated by a version of the `protoc` Swift plug-in that is
30 // incompatible with the version of SwiftProtobuf to which you are linking.
31 // Please ensure that your are building against the same version of the API
32 // that was used to generate this file.
33 fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
34 struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
35 typealias Version = _2
36 }
37
38 public enum Surface_V1_FieldKind: SwiftProtobuf.Enum {
39 public typealias RawValue = Int
40 case scalar // = 0
41 case map // = 1
42 case array // = 2
43 case reference // = 3
44 case UNRECOGNIZED(Int)
45
46 public init() {
47 self = .scalar
48 }
49
50 public init?(rawValue: Int) {
51 switch rawValue {
52 case 0: self = .scalar
53 case 1: self = .map
54 case 2: self = .array
55 case 3: self = .reference
56 default: self = .UNRECOGNIZED(rawValue)
57 }
58 }
59
60 public var rawValue: Int {
61 switch self {
62 case .scalar: return 0
63 case .map: return 1
64 case .array: return 2
65 case .reference: return 3
66 case .UNRECOGNIZED(let i): return i
67 }
68 }
69
70 }
71
72 public enum Surface_V1_TypeKind: SwiftProtobuf.Enum {
73 public typealias RawValue = Int
74
75 /// implement with named fields
76 case `struct` // = 0
77
78 /// implement with a map
79 case object // = 1
80 case UNRECOGNIZED(Int)
81
82 public init() {
83 self = .struct
84 }
85
86 public init?(rawValue: Int) {
87 switch rawValue {
88 case 0: self = .struct
89 case 1: self = .object
90 default: self = .UNRECOGNIZED(rawValue)
91 }
92 }
93
94 public var rawValue: Int {
95 switch self {
96 case .struct: return 0
97 case .object: return 1
98 case .UNRECOGNIZED(let i): return i
99 }
100 }
101
102 }
103
104 public enum Surface_V1_Position: SwiftProtobuf.Enum {
105 public typealias RawValue = Int
106 case body // = 0
107 case header // = 1
108 case formdata // = 2
109 case query // = 3
110 case path // = 4
111 case UNRECOGNIZED(Int)
112
113 public init() {
114 self = .body
115 }
116
117 public init?(rawValue: Int) {
118 switch rawValue {
119 case 0: self = .body
120 case 1: self = .header
121 case 2: self = .formdata
122 case 3: self = .query
123 case 4: self = .path
124 default: self = .UNRECOGNIZED(rawValue)
125 }
126 }
127
128 public var rawValue: Int {
129 switch self {
130 case .body: return 0
131 case .header: return 1
132 case .formdata: return 2
133 case .query: return 3
134 case .path: return 4
135 case .UNRECOGNIZED(let i): return i
136 }
137 }
138
139 }
140
141 /// Field is a field in a definition and can be associated with
142 /// a position in a request structure.
143 public struct Surface_V1_Field: SwiftProtobuf.Message {
144 public static let protoMessageName: String = _protobuf_package + ".Field"
145
146 /// the name as specified in the API description
147 public var name: String = String()
148
149 /// the specified content type of the field
150 public var type: String = String()
151
152 /// what kind of thing is this field? scalar, reference, array, map of strings to the specified type
153 public var kind: Surface_V1_FieldKind = .scalar
154
155 /// the specified format of the field
156 public var format: String = String()
157
158 /// "body", "header", "formdata", "query", or "path"
159 public var position: Surface_V1_Position = .body
160
161 /// the programming-language native type of the field
162 public var nativeType: String = String()
163
164 /// the name to use for a data structure field
165 public var fieldName: String = String()
166
167 /// the name to use for a function parameter
168 public var parameterName: String = String()
169
170 /// true if this field should be serialized (to JSON, etc)
171 public var serialize: Bool = false
172
173 public var unknownFields = SwiftProtobuf.UnknownStorage()
174
175 public init() {}
176
177 /// Used by the decoding initializers in the SwiftProtobuf library, not generally
178 /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
179 /// initializers are defined in the SwiftProtobuf library. See the Message and
180 /// Message+*Additions` files.
181 public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
182 while let fieldNumber = try decoder.nextFieldNumber() {
183 switch fieldNumber {
184 case 1: try decoder.decodeSingularStringField(value: &self.name)
185 case 2: try decoder.decodeSingularStringField(value: &self.type)
186 case 3: try decoder.decodeSingularEnumField(value: &self.kind)
187 case 4: try decoder.decodeSingularStringField(value: &self.format)
188 case 5: try decoder.decodeSingularEnumField(value: &self.position)
189 case 6: try decoder.decodeSingularStringField(value: &self.nativeType)
190 case 7: try decoder.decodeSingularStringField(value: &self.fieldName)
191 case 8: try decoder.decodeSingularStringField(value: &self.parameterName)
192 case 9: try decoder.decodeSingularBoolField(value: &self.serialize)
193 default: break
194 }
195 }
196 }
197
198 /// Used by the encoding methods of the SwiftProtobuf library, not generally
199 /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
200 /// other serializer methods are defined in the SwiftProtobuf library. See the
201 /// `Message` and `Message+*Additions` files.
202 public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
203 if !self.name.isEmpty {
204 try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
205 }
206 if !self.type.isEmpty {
207 try visitor.visitSingularStringField(value: self.type, fieldNumber: 2)
208 }
209 if self.kind != .scalar {
210 try visitor.visitSingularEnumField(value: self.kind, fieldNumber: 3)
211 }
212 if !self.format.isEmpty {
213 try visitor.visitSingularStringField(value: self.format, fieldNumber: 4)
214 }
215 if self.position != .body {
216 try visitor.visitSingularEnumField(value: self.position, fieldNumber: 5)
217 }
218 if !self.nativeType.isEmpty {
219 try visitor.visitSingularStringField(value: self.nativeType, fieldNumber: 6)
220 }
221 if !self.fieldName.isEmpty {
222 try visitor.visitSingularStringField(value: self.fieldName, fieldNumber: 7)
223 }
224 if !self.parameterName.isEmpty {
225 try visitor.visitSingularStringField(value: self.parameterName, fieldNumber: 8)
226 }
227 if self.serialize != false {
228 try visitor.visitSingularBoolField(value: self.serialize, fieldNumber: 9)
229 }
230 try unknownFields.traverse(visitor: &visitor)
231 }
232 }
233
234 /// Type typically corresponds to a definition, parameter, or response
235 /// in an API and is represented by a type in generated code.
236 public struct Surface_V1_Type: SwiftProtobuf.Message {
237 public static let protoMessageName: String = _protobuf_package + ".Type"
238
239 /// the name to use for the type
240 public var name: String = String()
241
242 /// a meta-description of the type (struct, map, etc)
243 public var kind: Surface_V1_TypeKind = .struct
244
245 /// a comment describing the type
246 public var description_p: String = String()
247
248 /// if the type is a map, this is its content type
249 public var contentType: String = String()
250
251 /// the fields of the type
252 public var fields: [Surface_V1_Field] = []
253
254 /// language-specific type name
255 public var typeName: String = String()
256
257 public var unknownFields = SwiftProtobuf.UnknownStorage()
258
259 public init() {}
260
261 /// Used by the decoding initializers in the SwiftProtobuf library, not generally
262 /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
263 /// initializers are defined in the SwiftProtobuf library. See the Message and
264 /// Message+*Additions` files.
265 public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
266 while let fieldNumber = try decoder.nextFieldNumber() {
267 switch fieldNumber {
268 case 1: try decoder.decodeSingularStringField(value: &self.name)
269 case 2: try decoder.decodeSingularEnumField(value: &self.kind)
270 case 3: try decoder.decodeSingularStringField(value: &self.description_p)
271 case 4: try decoder.decodeSingularStringField(value: &self.contentType)
272 case 5: try decoder.decodeRepeatedMessageField(value: &self.fields)
273 case 6: try decoder.decodeSingularStringField(value: &self.typeName)
274 default: break
275 }
276 }
277 }
278
279 /// Used by the encoding methods of the SwiftProtobuf library, not generally
280 /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
281 /// other serializer methods are defined in the SwiftProtobuf library. See the
282 /// `Message` and `Message+*Additions` files.
283 public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
284 if !self.name.isEmpty {
285 try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
286 }
287 if self.kind != .struct {
288 try visitor.visitSingularEnumField(value: self.kind, fieldNumber: 2)
289 }
290 if !self.description_p.isEmpty {
291 try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 3)
292 }
293 if !self.contentType.isEmpty {
294 try visitor.visitSingularStringField(value: self.contentType, fieldNumber: 4)
295 }
296 if !self.fields.isEmpty {
297 try visitor.visitRepeatedMessageField(value: self.fields, fieldNumber: 5)
298 }
299 if !self.typeName.isEmpty {
300 try visitor.visitSingularStringField(value: self.typeName, fieldNumber: 6)
301 }
302 try unknownFields.traverse(visitor: &visitor)
303 }
304 }
305
306 /// Method is an operation of an API and typically has associated client and server code.
307 public struct Surface_V1_Method: SwiftProtobuf.Message {
308 public static let protoMessageName: String = _protobuf_package + ".Method"
309
310 /// Operation ID
311 public var operation: String = String()
312
313 /// HTTP path
314 public var path: String = String()
315
316 /// HTTP method name
317 public var method: String = String()
318
319 /// description of method
320 public var description_p: String = String()
321
322 /// Operation name, possibly generated from method and path
323 public var name: String = String()
324
325 /// name of the generated handler
326 public var handlerName: String = String()
327
328 /// name of the processing function in the service interface
329 public var processorName: String = String()
330
331 /// name of client
332 public var clientName: String = String()
333
334 /// parameters (input), with fields corresponding to input parameters
335 public var parametersTypeName: String = String()
336
337 /// responses (output), with fields corresponding to possible response values
338 public var responsesTypeName: String = String()
339
340 public var unknownFields = SwiftProtobuf.UnknownStorage()
341
342 public init() {}
343
344 /// Used by the decoding initializers in the SwiftProtobuf library, not generally
345 /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
346 /// initializers are defined in the SwiftProtobuf library. See the Message and
347 /// Message+*Additions` files.
348 public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
349 while let fieldNumber = try decoder.nextFieldNumber() {
350 switch fieldNumber {
351 case 1: try decoder.decodeSingularStringField(value: &self.operation)
352 case 2: try decoder.decodeSingularStringField(value: &self.path)
353 case 3: try decoder.decodeSingularStringField(value: &self.method)
354 case 4: try decoder.decodeSingularStringField(value: &self.description_p)
355 case 5: try decoder.decodeSingularStringField(value: &self.name)
356 case 6: try decoder.decodeSingularStringField(value: &self.handlerName)
357 case 7: try decoder.decodeSingularStringField(value: &self.processorName)
358 case 8: try decoder.decodeSingularStringField(value: &self.clientName)
359 case 9: try decoder.decodeSingularStringField(value: &self.parametersTypeName)
360 case 10: try decoder.decodeSingularStringField(value: &self.responsesTypeName)
361 default: break
362 }
363 }
364 }
365
366 /// Used by the encoding methods of the SwiftProtobuf library, not generally
367 /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
368 /// other serializer methods are defined in the SwiftProtobuf library. See the
369 /// `Message` and `Message+*Additions` files.
370 public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
371 if !self.operation.isEmpty {
372 try visitor.visitSingularStringField(value: self.operation, fieldNumber: 1)
373 }
374 if !self.path.isEmpty {
375 try visitor.visitSingularStringField(value: self.path, fieldNumber: 2)
376 }
377 if !self.method.isEmpty {
378 try visitor.visitSingularStringField(value: self.method, fieldNumber: 3)
379 }
380 if !self.description_p.isEmpty {
381 try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 4)
382 }
383 if !self.name.isEmpty {
384 try visitor.visitSingularStringField(value: self.name, fieldNumber: 5)
385 }
386 if !self.handlerName.isEmpty {
387 try visitor.visitSingularStringField(value: self.handlerName, fieldNumber: 6)
388 }
389 if !self.processorName.isEmpty {
390 try visitor.visitSingularStringField(value: self.processorName, fieldNumber: 7)
391 }
392 if !self.clientName.isEmpty {
393 try visitor.visitSingularStringField(value: self.clientName, fieldNumber: 8)
394 }
395 if !self.parametersTypeName.isEmpty {
396 try visitor.visitSingularStringField(value: self.parametersTypeName, fieldNumber: 9)
397 }
398 if !self.responsesTypeName.isEmpty {
399 try visitor.visitSingularStringField(value: self.responsesTypeName, fieldNumber: 10)
400 }
401 try unknownFields.traverse(visitor: &visitor)
402 }
403 }
404
405 /// Model represents an API for code generation.
406 public struct Surface_V1_Model: SwiftProtobuf.Message {
407 public static let protoMessageName: String = _protobuf_package + ".Model"
408
409 /// a free-form title for the API
410 public var name: String = String()
411
412 /// the types used by the API
413 public var types: [Surface_V1_Type] = []
414
415 /// the methods (functions) of the API
416 public var methods: [Surface_V1_Method] = []
417
418 public var unknownFields = SwiftProtobuf.UnknownStorage()
419
420 public init() {}
421
422 /// Used by the decoding initializers in the SwiftProtobuf library, not generally
423 /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
424 /// initializers are defined in the SwiftProtobuf library. See the Message and
425 /// Message+*Additions` files.
426 public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
427 while let fieldNumber = try decoder.nextFieldNumber() {
428 switch fieldNumber {
429 case 1: try decoder.decodeSingularStringField(value: &self.name)
430 case 2: try decoder.decodeRepeatedMessageField(value: &self.types)
431 case 3: try decoder.decodeRepeatedMessageField(value: &self.methods)
432 default: break
433 }
434 }
435 }
436
437 /// Used by the encoding methods of the SwiftProtobuf library, not generally
438 /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
439 /// other serializer methods are defined in the SwiftProtobuf library. See the
440 /// `Message` and `Message+*Additions` files.
441 public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
442 if !self.name.isEmpty {
443 try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
444 }
445 if !self.types.isEmpty {
446 try visitor.visitRepeatedMessageField(value: self.types, fieldNumber: 2)
447 }
448 if !self.methods.isEmpty {
449 try visitor.visitRepeatedMessageField(value: self.methods, fieldNumber: 3)
450 }
451 try unknownFields.traverse(visitor: &visitor)
452 }
453 }
454
455 // MARK: - Code below here is support for the SwiftProtobuf runtime.
456
457 fileprivate let _protobuf_package = "surface.v1"
458
459 extension Surface_V1_FieldKind: SwiftProtobuf._ProtoNameProviding {
460 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
461 0: .same(proto: "SCALAR"),
462 1: .same(proto: "MAP"),
463 2: .same(proto: "ARRAY"),
464 3: .same(proto: "REFERENCE"),
465 ]
466 }
467
468 extension Surface_V1_TypeKind: SwiftProtobuf._ProtoNameProviding {
469 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
470 0: .same(proto: "STRUCT"),
471 1: .same(proto: "OBJECT"),
472 ]
473 }
474
475 extension Surface_V1_Position: SwiftProtobuf._ProtoNameProviding {
476 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
477 0: .same(proto: "BODY"),
478 1: .same(proto: "HEADER"),
479 2: .same(proto: "FORMDATA"),
480 3: .same(proto: "QUERY"),
481 4: .same(proto: "PATH"),
482 ]
483 }
484
485 extension Surface_V1_Field: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
486 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
487 1: .same(proto: "name"),
488 2: .same(proto: "type"),
489 3: .same(proto: "kind"),
490 4: .same(proto: "format"),
491 5: .same(proto: "position"),
492 6: .same(proto: "nativeType"),
493 7: .same(proto: "fieldName"),
494 8: .same(proto: "parameterName"),
495 9: .same(proto: "serialize"),
496 ]
497
498 public func _protobuf_generated_isEqualTo(other: Surface_V1_Field) -> Bool {
499 if self.name != other.name {return false}
500 if self.type != other.type {return false}
501 if self.kind != other.kind {return false}
502 if self.format != other.format {return false}
503 if self.position != other.position {return false}
504 if self.nativeType != other.nativeType {return false}
505 if self.fieldName != other.fieldName {return false}
506 if self.parameterName != other.parameterName {return false}
507 if self.serialize != other.serialize {return false}
508 if unknownFields != other.unknownFields {return false}
509 return true
510 }
511 }
512
513 extension Surface_V1_Type: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
514 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
515 1: .same(proto: "name"),
516 2: .same(proto: "kind"),
517 3: .same(proto: "description"),
518 4: .same(proto: "contentType"),
519 5: .same(proto: "fields"),
520 6: .same(proto: "typeName"),
521 ]
522
523 public func _protobuf_generated_isEqualTo(other: Surface_V1_Type) -> Bool {
524 if self.name != other.name {return false}
525 if self.kind != other.kind {return false}
526 if self.description_p != other.description_p {return false}
527 if self.contentType != other.contentType {return false}
528 if self.fields != other.fields {return false}
529 if self.typeName != other.typeName {return false}
530 if unknownFields != other.unknownFields {return false}
531 return true
532 }
533 }
534
535 extension Surface_V1_Method: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
536 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
537 1: .same(proto: "operation"),
538 2: .same(proto: "path"),
539 3: .same(proto: "method"),
540 4: .same(proto: "description"),
541 5: .same(proto: "name"),
542 6: .same(proto: "handlerName"),
543 7: .same(proto: "processorName"),
544 8: .same(proto: "clientName"),
545 9: .same(proto: "parametersTypeName"),
546 10: .same(proto: "responsesTypeName"),
547 ]
548
549 public func _protobuf_generated_isEqualTo(other: Surface_V1_Method) -> Bool {
550 if self.operation != other.operation {return false}
551 if self.path != other.path {return false}
552 if self.method != other.method {return false}
553 if self.description_p != other.description_p {return false}
554 if self.name != other.name {return false}
555 if self.handlerName != other.handlerName {return false}
556 if self.processorName != other.processorName {return false}
557 if self.clientName != other.clientName {return false}
558 if self.parametersTypeName != other.parametersTypeName {return false}
559 if self.responsesTypeName != other.responsesTypeName {return false}
560 if unknownFields != other.unknownFields {return false}
561 return true
562 }
563 }
564
565 extension Surface_V1_Model: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
566 public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
567 1: .same(proto: "name"),
568 2: .same(proto: "types"),
569 3: .same(proto: "methods"),
570 ]
571
572 public func _protobuf_generated_isEqualTo(other: Surface_V1_Model) -> Bool {
573 if self.name != other.name {return false}
574 if self.types != other.types {return false}
575 if self.methods != other.methods {return false}
576 if unknownFields != other.unknownFields {return false}
577 return true
578 }
579 }