mediasoup
Version:
Cutting Edge WebRTC Video Conferencing
130 lines (129 loc) • 4.76 kB
JavaScript
"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponseT = exports.Response = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
const body_1 = require("../../fbs/response/body");
class Response {
bb = null;
bb_pos = 0;
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsResponse(bb, obj) {
return (obj || new Response()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsResponse(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Response()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
}
accepted() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
bodyType() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint8(this.bb_pos + offset) : body_1.Body.NONE;
}
body(obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
}
error(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
reason(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
static startResponse(builder) {
builder.startObject(6);
}
static addId(builder, id) {
builder.addFieldInt32(0, id, 0);
}
static addAccepted(builder, accepted) {
builder.addFieldInt8(1, +accepted, +false);
}
static addBodyType(builder, bodyType) {
builder.addFieldInt8(2, bodyType, body_1.Body.NONE);
}
static addBody(builder, bodyOffset) {
builder.addFieldOffset(3, bodyOffset, 0);
}
static addError(builder, errorOffset) {
builder.addFieldOffset(4, errorOffset, 0);
}
static addReason(builder, reasonOffset) {
builder.addFieldOffset(5, reasonOffset, 0);
}
static endResponse(builder) {
const offset = builder.endObject();
return offset;
}
static createResponse(builder, id, accepted, bodyType, bodyOffset, errorOffset, reasonOffset) {
Response.startResponse(builder);
Response.addId(builder, id);
Response.addAccepted(builder, accepted);
Response.addBodyType(builder, bodyType);
Response.addBody(builder, bodyOffset);
Response.addError(builder, errorOffset);
Response.addReason(builder, reasonOffset);
return Response.endResponse(builder);
}
unpack() {
return new ResponseT(this.id(), this.accepted(), this.bodyType(), (() => {
const temp = (0, body_1.unionToBody)(this.bodyType(), this.body.bind(this));
if (temp === null) {
return null;
}
return temp.unpack();
})(), this.error(), this.reason());
}
unpackTo(_o) {
_o.id = this.id();
_o.accepted = this.accepted();
_o.bodyType = this.bodyType();
_o.body = (() => {
const temp = (0, body_1.unionToBody)(this.bodyType(), this.body.bind(this));
if (temp === null) {
return null;
}
return temp.unpack();
})();
_o.error = this.error();
_o.reason = this.reason();
}
}
exports.Response = Response;
class ResponseT {
id;
accepted;
bodyType;
body;
error;
reason;
constructor(id = 0, accepted = false, bodyType = body_1.Body.NONE, body = null, error = null, reason = null) {
this.id = id;
this.accepted = accepted;
this.bodyType = bodyType;
this.body = body;
this.error = error;
this.reason = reason;
}
pack(builder) {
const body = builder.createObjectOffset(this.body);
const error = (this.error !== null ? builder.createString(this.error) : 0);
const reason = (this.reason !== null ? builder.createString(this.reason) : 0);
return Response.createResponse(builder, this.id, this.accepted, this.bodyType, body, error, reason);
}
}
exports.ResponseT = ResponseT;