|
| 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.LatLng |
| 16 | + */ |
| 17 | +export class LatLng implements GrpcMessage { |
| 18 | + static id = 'google.type.LatLng'; |
| 19 | + |
| 20 | + /** |
| 21 | + * Deserialize binary data to message |
| 22 | + * @param instance message instance |
| 23 | + */ |
| 24 | + static deserializeBinary(bytes: ByteSource) { |
| 25 | + const instance = new LatLng(); |
| 26 | + LatLng.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: LatLng) { |
| 35 | + _instance.latitude = _instance.latitude || 0; |
| 36 | + _instance.longitude = _instance.longitude || 0; |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * Deserializes / reads binary message into message instance using provided binary reader |
| 41 | + * @param _instance message instance |
| 42 | + * @param _reader binary reader instance |
| 43 | + */ |
| 44 | + static deserializeBinaryFromReader(_instance: LatLng, _reader: BinaryReader) { |
| 45 | + while (_reader.nextField()) { |
| 46 | + if (_reader.isEndGroup()) break; |
| 47 | + |
| 48 | + switch (_reader.getFieldNumber()) { |
| 49 | + case 1: |
| 50 | + _instance.latitude = _reader.readDouble(); |
| 51 | + break; |
| 52 | + case 2: |
| 53 | + _instance.longitude = _reader.readDouble(); |
| 54 | + break; |
| 55 | + default: |
| 56 | + _reader.skipField(); |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + LatLng.refineValues(_instance); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Serializes a message to binary format using provided binary reader |
| 65 | + * @param _instance message instance |
| 66 | + * @param _writer binary writer instance |
| 67 | + */ |
| 68 | + static serializeBinaryToWriter(_instance: LatLng, _writer: BinaryWriter) { |
| 69 | + if (_instance.latitude) { |
| 70 | + _writer.writeDouble(1, _instance.latitude); |
| 71 | + } |
| 72 | + if (_instance.longitude) { |
| 73 | + _writer.writeDouble(2, _instance.longitude); |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + private _latitude: number; |
| 78 | + private _longitude: number; |
| 79 | + |
| 80 | + /** |
| 81 | + * Message constructor. Initializes the properties and applies default Protobuf values if necessary |
| 82 | + * @param _value initial values object or instance of LatLng to deeply clone from |
| 83 | + */ |
| 84 | + constructor(_value?: RecursivePartial<LatLng.AsObject>) { |
| 85 | + _value = _value || {}; |
| 86 | + this.latitude = _value.latitude; |
| 87 | + this.longitude = _value.longitude; |
| 88 | + LatLng.refineValues(this); |
| 89 | + } |
| 90 | + get latitude(): number { |
| 91 | + return this._latitude; |
| 92 | + } |
| 93 | + set latitude(value: number) { |
| 94 | + this._latitude = value; |
| 95 | + } |
| 96 | + get longitude(): number { |
| 97 | + return this._longitude; |
| 98 | + } |
| 99 | + set longitude(value: number) { |
| 100 | + this._longitude = value; |
| 101 | + } |
| 102 | + |
| 103 | + /** |
| 104 | + * Serialize message to binary data |
| 105 | + * @param instance message instance |
| 106 | + */ |
| 107 | + serializeBinary() { |
| 108 | + const writer = new BinaryWriter(); |
| 109 | + LatLng.serializeBinaryToWriter(this, writer); |
| 110 | + return writer.getResultBuffer(); |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Cast message to standard JavaScript object (all non-primitive values are deeply cloned) |
| 115 | + */ |
| 116 | + toObject(): LatLng.AsObject { |
| 117 | + return { |
| 118 | + latitude: this.latitude, |
| 119 | + longitude: this.longitude |
| 120 | + }; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Convenience method to support JSON.stringify(message), replicates the structure of toObject() |
| 125 | + */ |
| 126 | + toJSON() { |
| 127 | + return this.toObject(); |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json |
| 132 | + * Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc. |
| 133 | + * 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 |
| 134 | + */ |
| 135 | + toProtobufJSON( |
| 136 | + // @ts-ignore |
| 137 | + options?: ToProtobufJSONOptions |
| 138 | + ): LatLng.AsProtobufJSON { |
| 139 | + return { |
| 140 | + latitude: this.latitude, |
| 141 | + longitude: this.longitude |
| 142 | + }; |
| 143 | + } |
| 144 | +} |
| 145 | +export module LatLng { |
| 146 | + /** |
| 147 | + * Standard JavaScript object representation for LatLng |
| 148 | + */ |
| 149 | + export interface AsObject { |
| 150 | + latitude: number; |
| 151 | + longitude: number; |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Protobuf JSON representation for LatLng |
| 156 | + */ |
| 157 | + export interface AsProtobufJSON { |
| 158 | + latitude: number; |
| 159 | + longitude: number; |
| 160 | + } |
| 161 | +} |
0 commit comments