|
| 1 | +/* tslint:disable */ |
| 2 | +/* eslint-disable */ |
| 3 | +// @ts-nocheck |
| 4 | +// |
| 5 | +// THIS IS A GENERATED FILE |
| 6 | +// DO NOT MODIFY IT! YOUR CHANGES WILL BE LOST |
| 7 | +import { |
| 8 | + GrpcMessage, |
| 9 | + RecursivePartial, |
| 10 | + ToProtobufJSONOptions |
| 11 | +} from '@ngx-grpc/common'; |
| 12 | +import { BinaryReader, BinaryWriter, ByteSource } from 'google-protobuf'; |
| 13 | + |
| 14 | +/** |
| 15 | + * Message implementation for google.type.Date |
| 16 | + */ |
| 17 | +export class Date implements GrpcMessage { |
| 18 | + static id = 'google.type.Date'; |
| 19 | + |
| 20 | + /** |
| 21 | + * Deserialize binary data to message |
| 22 | + * @param instance message instance |
| 23 | + */ |
| 24 | + static deserializeBinary(bytes: ByteSource) { |
| 25 | + const instance = new Date(); |
| 26 | + Date.deserializeBinaryFromReader(instance, new BinaryReader(bytes)); |
| 27 | + return instance; |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Check all the properties and set default protobuf values if necessary |
| 32 | + * @param _instance message instance |
| 33 | + */ |
| 34 | + static refineValues(_instance: Date) { |
| 35 | + _instance.year = _instance.year || 0; |
| 36 | + _instance.month = _instance.month || 0; |
| 37 | + _instance.day = _instance.day || 0; |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Deserializes / reads binary message into message instance using provided binary reader |
| 42 | + * @param _instance message instance |
| 43 | + * @param _reader binary reader instance |
| 44 | + */ |
| 45 | + static deserializeBinaryFromReader(_instance: Date, _reader: BinaryReader) { |
| 46 | + while (_reader.nextField()) { |
| 47 | + if (_reader.isEndGroup()) break; |
| 48 | + |
| 49 | + switch (_reader.getFieldNumber()) { |
| 50 | + case 1: |
| 51 | + _instance.year = _reader.readInt32(); |
| 52 | + break; |
| 53 | + case 2: |
| 54 | + _instance.month = _reader.readInt32(); |
| 55 | + break; |
| 56 | + case 3: |
| 57 | + _instance.day = _reader.readInt32(); |
| 58 | + break; |
| 59 | + default: |
| 60 | + _reader.skipField(); |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + Date.refineValues(_instance); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Serializes a message to binary format using provided binary reader |
| 69 | + * @param _instance message instance |
| 70 | + * @param _writer binary writer instance |
| 71 | + */ |
| 72 | + static serializeBinaryToWriter(_instance: Date, _writer: BinaryWriter) { |
| 73 | + if (_instance.year) { |
| 74 | + _writer.writeInt32(1, _instance.year); |
| 75 | + } |
| 76 | + if (_instance.month) { |
| 77 | + _writer.writeInt32(2, _instance.month); |
| 78 | + } |
| 79 | + if (_instance.day) { |
| 80 | + _writer.writeInt32(3, _instance.day); |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + private _year: number; |
| 85 | + private _month: number; |
| 86 | + private _day: number; |
| 87 | + |
| 88 | + /** |
| 89 | + * Message constructor. Initializes the properties and applies default Protobuf values if necessary |
| 90 | + * @param _value initial values object or instance of Date to deeply clone from |
| 91 | + */ |
| 92 | + constructor(_value?: RecursivePartial<Date.AsObject>) { |
| 93 | + _value = _value || {}; |
| 94 | + this.year = _value.year; |
| 95 | + this.month = _value.month; |
| 96 | + this.day = _value.day; |
| 97 | + Date.refineValues(this); |
| 98 | + } |
| 99 | + get year(): number { |
| 100 | + return this._year; |
| 101 | + } |
| 102 | + set year(value: number) { |
| 103 | + this._year = value; |
| 104 | + } |
| 105 | + get month(): number { |
| 106 | + return this._month; |
| 107 | + } |
| 108 | + set month(value: number) { |
| 109 | + this._month = value; |
| 110 | + } |
| 111 | + get day(): number { |
| 112 | + return this._day; |
| 113 | + } |
| 114 | + set day(value: number) { |
| 115 | + this._day = value; |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * Serialize message to binary data |
| 120 | + * @param instance message instance |
| 121 | + */ |
| 122 | + serializeBinary() { |
| 123 | + const writer = new BinaryWriter(); |
| 124 | + Date.serializeBinaryToWriter(this, writer); |
| 125 | + return writer.getResultBuffer(); |
| 126 | + } |
| 127 | + |
| 128 | + /** |
| 129 | + * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) |
| 130 | + */ |
| 131 | + toObject(): Date.AsObject { |
| 132 | + return { |
| 133 | + year: this.year, |
| 134 | + month: this.month, |
| 135 | + day: this.day |
| 136 | + }; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Convenience method to support JSON.stringify(message), replicates the structure of toObject() |
| 141 | + */ |
| 142 | + toJSON() { |
| 143 | + return this.toObject(); |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json |
| 148 | + * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. |
| 149 | + * If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required |
| 150 | + */ |
| 151 | + toProtobufJSON( |
| 152 | + // @ts-ignore |
| 153 | + options?: ToProtobufJSONOptions |
| 154 | + ): Date.AsProtobufJSON { |
| 155 | + return { |
| 156 | + year: this.year, |
| 157 | + month: this.month, |
| 158 | + day: this.day |
| 159 | + }; |
| 160 | + } |
| 161 | +} |
| 162 | +export module Date { |
| 163 | + /** |
| 164 | + * Standard JavaScript object representation for Date |
| 165 | + */ |
| 166 | + export interface AsObject { |
| 167 | + year: number; |
| 168 | + month: number; |
| 169 | + day: number; |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * Protobuf JSON representation for Date |
| 174 | + */ |
| 175 | + export interface AsProtobufJSON { |
| 176 | + year: number; |
| 177 | + month: number; |
| 178 | + day: number; |
| 179 | + } |
| 180 | +} |
0 commit comments