How to use the thrift.Thrift.Type function in thrift

To help you get started, we’ve selected a few thrift examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChatPlug / libfb-js / src / mqtt / payloads / ReadReceiptPayload.ts View on Github external
encode (proto: TCompactProtocol): Promise {
    /////////////////////
    // thrift header?
    /////////////////////

    // Always completely empty.
    proto.writeByte(0)

    // Note lack of end-of-object null

    /////////////////////
    // Typing presence
    /////////////////////

    proto.writeFieldBegin('mark', Thrift.Type.STRING, 1)
    proto.writeString('read')

    proto.writeFieldBegin('state', Thrift.Type.BOOL, 2)
    proto.writeBool(true)

    if (this.threadFbId != null) {
      proto.writeFieldBegin('threadFbId', Thrift.Type.I64, 6)
      proto.writeI64(new Int64(Buffer.from(Long.fromString(this.threadFbId).toBytes())))
    } else if (this.otherUserFbId != null) {
      proto.writeFieldBegin('otherUserFbId', Thrift.Type.I64, 7)
      proto.writeI64(new Int64(Buffer.from(Long.fromString(this.otherUserFbId).toBytes())))
    } else {
        // Throw?
    }

    proto.writeFieldBegin('watermarkTimestamp', Thrift.Type.I64, 9)
github cdapio / cdap / web-cloud-app / server / common / thrift_bindings / metricsservice_types.js View on Github external
TLogResult.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRING) {
        this.logLine = input.readString();
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.I64) {
        this.offset = input.readI64();
      } else {
        input.skip(ftype);
github yodasan / evernode / lib / evernote-thrift / gen-nodejs / NoteStore_types.js View on Github external
NoteMetadata.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRING) {
        this.guid = input.readString();
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.STRING) {
        this.title = input.readString();
      } else {
        input.skip(ftype);
github cdapio / cdap / web-cloud-app / server / common / thrift_bindings / MetricsFrontendService.js View on Github external
if (this.success) {
    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
    output.writeListBegin(Thrift.Type.STRING, this.success.length);
    for (var iter59 in this.success)
    {
      if (this.success.hasOwnProperty(iter59))
      {
        iter59 = this.success[iter59];
        output.writeString(iter59);
      }
    }
    output.writeListEnd();
    output.writeFieldEnd();
  }
  if (this.e) {
    output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
    this.e.write(output);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};
github racker / node-rproxy / node_modules / cassandra-client / lib / gen-nodejs / cassandra_types.js View on Github external
InvalidRequestException.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRING) {
        this.why = input.readString();
      } else {
        input.skip(ftype);
      }
      break;
      case 0:
        input.skip(ftype);
        break;
      default:
        input.skip(ftype);
github tryfer / node-tryfer / lib / _thrift / zipkinCore / zipkinCore_types.js View on Github external
output.writeFieldBegin('trace_id', Thrift.Type.I64, 1);
    output.writeI64(this.trace_id);
    output.writeFieldEnd();
  }
  if (this.name) {
    output.writeFieldBegin('name', Thrift.Type.STRING, 3);
    output.writeString(this.name);
    output.writeFieldEnd();
  }
  if (this.id) {
    output.writeFieldBegin('id', Thrift.Type.I64, 4);
    output.writeI64(this.id);
    output.writeFieldEnd();
  }
  if (this.parent_id) {
    output.writeFieldBegin('parent_id', Thrift.Type.I64, 5);
    output.writeI64(this.parent_id);
    output.writeFieldEnd();
  }
  if (this.annotations) {
    output.writeFieldBegin('annotations', Thrift.Type.LIST, 6);
    output.writeListBegin(Thrift.Type.STRUCT, this.annotations.length);
    for (var iter14 in this.annotations)
    {
      if (this.annotations.hasOwnProperty(iter14))
      {
        iter14 = this.annotations[iter14];
        iter14.write(output);
      }
    }
    output.writeListEnd();
    output.writeFieldEnd();
github cdapio / cdap / server / thrift_bindings / metadataservice_types.js View on Github external
output.writeFieldBegin('id', Thrift.Type.STRING, 1);
    output.writeString(this.id);
    output.writeFieldEnd();
  }
  if (this.name) {
    output.writeFieldBegin('name', Thrift.Type.STRING, 2);
    output.writeString(this.name);
    output.writeFieldEnd();
  }
  if (this.description) {
    output.writeFieldBegin('description', Thrift.Type.STRING, 3);
    output.writeString(this.description);
    output.writeFieldEnd();
  }
  if (this.type) {
    output.writeFieldBegin('type', Thrift.Type.STRING, 4);
    output.writeString(this.type);
    output.writeFieldEnd();
  }
  if (this.exists) {
    output.writeFieldBegin('exists', Thrift.Type.BOOL, 5);
    output.writeBool(this.exists);
    output.writeFieldEnd();
  }
  output.writeFieldStop();
  output.writeStructEnd();
  return;
};
github yodasan / evernode / lib / evernote-thrift / gen-nodejs / Types_types.js View on Github external
NotebookRestrictions.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.BOOL) {
        this.noReadNotes = input.readBool();
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.BOOL) {
        this.noCreateNotes = input.readBool();
      } else {
        input.skip(ftype);
github cdapio / cdap / server / thrift_bindings / FlowService.js View on Github external
FlowService_flowletstatus_args.prototype.read = function(input) {
  input.readStructBegin();
  while (true)
  {
    var ret = input.readFieldBegin();
    var fname = ret.fname;
    var ftype = ret.ftype;
    var fid = ret.fid;
    if (ftype == Thrift.Type.STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
      if (ftype == Thrift.Type.STRUCT) {
        this.token = new ttypes.DelegationToken();
        this.token.read(input);
      } else {
        input.skip(ftype);
      }
      break;
      case 2:
      if (ftype == Thrift.Type.STRUCT) {
        this.identifier = new ttypes.FlowIdentifier();
        this.identifier.read(input);
github yodasan / evernode / lib / evernote-thrift / gen-nodejs / NoteStore_types.js View on Github external
output.writeFieldBegin('order', Thrift.Type.I32, 1);
    output.writeI32(this.order);
    output.writeFieldEnd();
  }
  if (this.ascending !== null && this.ascending !== undefined) {
    output.writeFieldBegin('ascending', Thrift.Type.BOOL, 2);
    output.writeBool(this.ascending);
    output.writeFieldEnd();
  }
  if (this.words !== null && this.words !== undefined) {
    output.writeFieldBegin('words', Thrift.Type.STRING, 3);
    output.writeString(this.words);
    output.writeFieldEnd();
  }
  if (this.notebookGuid !== null && this.notebookGuid !== undefined) {
    output.writeFieldBegin('notebookGuid', Thrift.Type.STRING, 4);
    output.writeString(this.notebookGuid);
    output.writeFieldEnd();
  }
  if (this.tagGuids !== null && this.tagGuids !== undefined) {
    output.writeFieldBegin('tagGuids', Thrift.Type.LIST, 5);
    output.writeListBegin(Thrift.Type.STRING, this.tagGuids.length);
    for (var iter95 in this.tagGuids)
    {
      if (this.tagGuids.hasOwnProperty(iter95))
      {
        iter95 = this.tagGuids[iter95];
        output.writeString(iter95);
      }
    }
    output.writeListEnd();
    output.writeFieldEnd();