1// automatically generated by the FlatBuffers compiler, do not modify 2 3/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ 4 5import * as flatbuffers from 'flatbuffers'; 6 7import { KeyValue, KeyValueT } from '../reflection/key-value.js'; 8import { Object_, Object_T } from '../reflection/object.js'; 9 10 11export class RPCCall implements flatbuffers.IUnpackableObject<RPCCallT> { 12 bb: flatbuffers.ByteBuffer|null = null; 13 bb_pos = 0; 14 __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall { 15 this.bb_pos = i; 16 this.bb = bb; 17 return this; 18} 19 20static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall { 21 return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 22} 23 24static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall { 25 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 26 return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 27} 28 29name():string|null 30name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 31name(optionalEncoding?:any):string|Uint8Array|null { 32 const offset = this.bb!.__offset(this.bb_pos, 4); 33 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 34} 35 36request(obj?:Object_):Object_|null { 37 const offset = this.bb!.__offset(this.bb_pos, 6); 38 return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 39} 40 41response(obj?:Object_):Object_|null { 42 const offset = this.bb!.__offset(this.bb_pos, 8); 43 return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 44} 45 46attributes(index: number, obj?:KeyValue):KeyValue|null { 47 const offset = this.bb!.__offset(this.bb_pos, 10); 48 return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 49} 50 51attributesLength():number { 52 const offset = this.bb!.__offset(this.bb_pos, 10); 53 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 54} 55 56documentation(index: number):string 57documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 58documentation(index: number,optionalEncoding?:any):string|Uint8Array|null { 59 const offset = this.bb!.__offset(this.bb_pos, 12); 60 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 61} 62 63documentationLength():number { 64 const offset = this.bb!.__offset(this.bb_pos, 12); 65 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 66} 67 68static getFullyQualifiedName():string { 69 return 'reflection.RPCCall'; 70} 71 72static startRPCCall(builder:flatbuffers.Builder) { 73 builder.startObject(5); 74} 75 76static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { 77 builder.addFieldOffset(0, nameOffset, 0); 78} 79 80static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) { 81 builder.addFieldOffset(1, requestOffset, 0); 82} 83 84static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) { 85 builder.addFieldOffset(2, responseOffset, 0); 86} 87 88static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) { 89 builder.addFieldOffset(3, attributesOffset, 0); 90} 91 92static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 93 builder.startVector(4, data.length, 4); 94 for (let i = data.length - 1; i >= 0; i--) { 95 builder.addOffset(data[i]!); 96 } 97 return builder.endVector(); 98} 99 100static startAttributesVector(builder:flatbuffers.Builder, numElems:number) { 101 builder.startVector(4, numElems, 4); 102} 103 104static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) { 105 builder.addFieldOffset(4, documentationOffset, 0); 106} 107 108static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 109 builder.startVector(4, data.length, 4); 110 for (let i = data.length - 1; i >= 0; i--) { 111 builder.addOffset(data[i]!); 112 } 113 return builder.endVector(); 114} 115 116static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) { 117 builder.startVector(4, numElems, 4); 118} 119 120static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset { 121 const offset = builder.endObject(); 122 builder.requiredField(offset, 4) // name 123 builder.requiredField(offset, 6) // request 124 builder.requiredField(offset, 8) // response 125 return offset; 126} 127 128 129unpack(): RPCCallT { 130 return new RPCCallT( 131 this.name(), 132 (this.request() !== null ? this.request()!.unpack() : null), 133 (this.response() !== null ? this.response()!.unpack() : null), 134 this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()), 135 this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()) 136 ); 137} 138 139 140unpackTo(_o: RPCCallT): void { 141 _o.name = this.name(); 142 _o.request = (this.request() !== null ? this.request()!.unpack() : null); 143 _o.response = (this.response() !== null ? this.response()!.unpack() : null); 144 _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()); 145 _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()); 146} 147} 148 149export class RPCCallT implements flatbuffers.IGeneratedObject { 150constructor( 151 public name: string|Uint8Array|null = null, 152 public request: Object_T|null = null, 153 public response: Object_T|null = null, 154 public attributes: (KeyValueT)[] = [], 155 public documentation: (string)[] = [] 156){} 157 158 159pack(builder:flatbuffers.Builder): flatbuffers.Offset { 160 const name = (this.name !== null ? builder.createString(this.name!) : 0); 161 const request = (this.request !== null ? this.request!.pack(builder) : 0); 162 const response = (this.response !== null ? this.response!.pack(builder) : 0); 163 const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes)); 164 const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation)); 165 166 RPCCall.startRPCCall(builder); 167 RPCCall.addName(builder, name); 168 RPCCall.addRequest(builder, request); 169 RPCCall.addResponse(builder, response); 170 RPCCall.addAttributes(builder, attributes); 171 RPCCall.addDocumentation(builder, documentation); 172 173 return RPCCall.endRPCCall(builder); 174} 175} 176