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