|
| 1 | +// @generated by protobuf-ts 2.9.0 with parameter long_type_string,generate_dependencies,ts_nocheck |
| 2 | +// @generated from protobuf file "test/fixtures/grpc-test.proto" (package "pkg_test", syntax proto3) |
| 3 | +// tslint:disable |
| 4 | +// @ts-nocheck |
| 5 | +import { ServiceType } from "@protobuf-ts/runtime-rpc"; |
| 6 | +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; |
| 7 | +import type { IBinaryWriter } from "@protobuf-ts/runtime"; |
| 8 | +import { WireType } from "@protobuf-ts/runtime"; |
| 9 | +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; |
| 10 | +import type { IBinaryReader } from "@protobuf-ts/runtime"; |
| 11 | +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; |
| 12 | +import type { PartialMessage } from "@protobuf-ts/runtime"; |
| 13 | +import { reflectionMergePartial } from "@protobuf-ts/runtime"; |
| 14 | +import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; |
| 15 | +import { MessageType } from "@protobuf-ts/runtime"; |
| 16 | +/** |
| 17 | + * @generated from protobuf message pkg_test.TestRequest |
| 18 | + */ |
| 19 | +export interface TestRequest { |
| 20 | + /** |
| 21 | + * @generated from protobuf field: int32 num = 1; |
| 22 | + */ |
| 23 | + num: number; |
| 24 | +} |
| 25 | +/** |
| 26 | + * @generated from protobuf message pkg_test.TestReply |
| 27 | + */ |
| 28 | +export interface TestReply { |
| 29 | + /** |
| 30 | + * @generated from protobuf field: int32 num = 1; |
| 31 | + */ |
| 32 | + num: number; |
| 33 | +} |
| 34 | +// @generated message type with reflection information, may provide speed optimized methods |
| 35 | +class TestRequest$Type extends MessageType<TestRequest> { |
| 36 | + constructor() { |
| 37 | + super("pkg_test.TestRequest", [ |
| 38 | + { no: 1, name: "num", kind: "scalar", T: 5 /*ScalarType.INT32*/ } |
| 39 | + ]); |
| 40 | + } |
| 41 | + create(value?: PartialMessage<TestRequest>): TestRequest { |
| 42 | + const message = { num: 0 }; |
| 43 | + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); |
| 44 | + if (value !== undefined) |
| 45 | + reflectionMergePartial<TestRequest>(this, message, value); |
| 46 | + return message; |
| 47 | + } |
| 48 | + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestRequest): TestRequest { |
| 49 | + let message = target ?? this.create(), end = reader.pos + length; |
| 50 | + while (reader.pos < end) { |
| 51 | + let [fieldNo, wireType] = reader.tag(); |
| 52 | + switch (fieldNo) { |
| 53 | + case /* int32 num */ 1: |
| 54 | + message.num = reader.int32(); |
| 55 | + break; |
| 56 | + default: |
| 57 | + let u = options.readUnknownField; |
| 58 | + if (u === "throw") |
| 59 | + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); |
| 60 | + let d = reader.skip(wireType); |
| 61 | + if (u !== false) |
| 62 | + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); |
| 63 | + } |
| 64 | + } |
| 65 | + return message; |
| 66 | + } |
| 67 | + internalBinaryWrite(message: TestRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { |
| 68 | + /* int32 num = 1; */ |
| 69 | + if (message.num !== 0) |
| 70 | + writer.tag(1, WireType.Varint).int32(message.num); |
| 71 | + let u = options.writeUnknownFields; |
| 72 | + if (u !== false) |
| 73 | + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); |
| 74 | + return writer; |
| 75 | + } |
| 76 | +} |
| 77 | +/** |
| 78 | + * @generated MessageType for protobuf message pkg_test.TestRequest |
| 79 | + */ |
| 80 | +export const TestRequest = new TestRequest$Type(); |
| 81 | +// @generated message type with reflection information, may provide speed optimized methods |
| 82 | +class TestReply$Type extends MessageType<TestReply> { |
| 83 | + constructor() { |
| 84 | + super("pkg_test.TestReply", [ |
| 85 | + { no: 1, name: "num", kind: "scalar", T: 5 /*ScalarType.INT32*/ } |
| 86 | + ]); |
| 87 | + } |
| 88 | + create(value?: PartialMessage<TestReply>): TestReply { |
| 89 | + const message = { num: 0 }; |
| 90 | + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); |
| 91 | + if (value !== undefined) |
| 92 | + reflectionMergePartial<TestReply>(this, message, value); |
| 93 | + return message; |
| 94 | + } |
| 95 | + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestReply): TestReply { |
| 96 | + let message = target ?? this.create(), end = reader.pos + length; |
| 97 | + while (reader.pos < end) { |
| 98 | + let [fieldNo, wireType] = reader.tag(); |
| 99 | + switch (fieldNo) { |
| 100 | + case /* int32 num */ 1: |
| 101 | + message.num = reader.int32(); |
| 102 | + break; |
| 103 | + default: |
| 104 | + let u = options.readUnknownField; |
| 105 | + if (u === "throw") |
| 106 | + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); |
| 107 | + let d = reader.skip(wireType); |
| 108 | + if (u !== false) |
| 109 | + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); |
| 110 | + } |
| 111 | + } |
| 112 | + return message; |
| 113 | + } |
| 114 | + internalBinaryWrite(message: TestReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { |
| 115 | + /* int32 num = 1; */ |
| 116 | + if (message.num !== 0) |
| 117 | + writer.tag(1, WireType.Varint).int32(message.num); |
| 118 | + let u = options.writeUnknownFields; |
| 119 | + if (u !== false) |
| 120 | + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); |
| 121 | + return writer; |
| 122 | + } |
| 123 | +} |
| 124 | +/** |
| 125 | + * @generated MessageType for protobuf message pkg_test.TestReply |
| 126 | + */ |
| 127 | +export const TestReply = new TestReply$Type(); |
| 128 | +/** |
| 129 | + * @generated ServiceType for protobuf service pkg_test.GrpcTester |
| 130 | + */ |
| 131 | +export const GrpcTester = new ServiceType("pkg_test.GrpcTester", [ |
| 132 | + { name: "unaryMethodWithMetadata", options: {}, I: TestRequest, O: TestReply }, |
| 133 | + { name: "UnaryMethod", options: {}, I: TestRequest, O: TestReply }, |
| 134 | + { name: "camelCaseMethod", options: {}, I: TestRequest, O: TestReply }, |
| 135 | + { name: "ClientStreamMethod", clientStreaming: true, options: {}, I: TestRequest, O: TestReply }, |
| 136 | + { name: "ServerStreamMethod", serverStreaming: true, options: {}, I: TestRequest, O: TestReply }, |
| 137 | + { name: "BidiStreamMethod", serverStreaming: true, clientStreaming: true, options: {}, I: TestRequest, O: TestReply } |
| 138 | +]); |
0 commit comments