LINE-KickBot1/curve-thrift/BotService.js
2019-07-13 09:41:46 +08:00

905 lines
27 KiB
JavaScript

//
// Autogenerated by Thrift Compiler (0.10.0)
//
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
//
"use strict";
var thrift = require('thrift');
var Thrift = thrift.Thrift;
var Q = thrift.Q;
var ttypes = require('./line_types');
//HELPER FUNCTIONS AND STRUCTURES
var BotService_notifyLeaveGroup_args = function(args) {
this.groupMid = null;
if (args) {
if (args.groupMid !== undefined && args.groupMid !== null) {
this.groupMid = args.groupMid;
}
}
};
BotService_notifyLeaveGroup_args.prototype = {};
BotService_notifyLeaveGroup_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.STRING) {
this.groupMid = input.readString();
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_notifyLeaveGroup_args.prototype.write = function(output) {
output.writeStructBegin('BotService_notifyLeaveGroup_args');
if (this.groupMid !== null && this.groupMid !== undefined) {
output.writeFieldBegin('groupMid', Thrift.Type.STRING, 1);
output.writeString(this.groupMid);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_notifyLeaveGroup_result = function(args) {
this.e = null;
if (args instanceof ttypes.TalkException) {
this.e = args;
return;
}
if (args) {
if (args.e !== undefined && args.e !== null) {
this.e = args.e;
}
}
};
BotService_notifyLeaveGroup_result.prototype = {};
BotService_notifyLeaveGroup_result.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.e = new ttypes.TalkException();
this.e.read(input);
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_notifyLeaveGroup_result.prototype.write = function(output) {
output.writeStructBegin('BotService_notifyLeaveGroup_result');
if (this.e !== null && this.e !== undefined) {
output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
this.e.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_notifyLeaveRoom_args = function(args) {
this.roomMid = null;
if (args) {
if (args.roomMid !== undefined && args.roomMid !== null) {
this.roomMid = args.roomMid;
}
}
};
BotService_notifyLeaveRoom_args.prototype = {};
BotService_notifyLeaveRoom_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.STRING) {
this.roomMid = input.readString();
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_notifyLeaveRoom_args.prototype.write = function(output) {
output.writeStructBegin('BotService_notifyLeaveRoom_args');
if (this.roomMid !== null && this.roomMid !== undefined) {
output.writeFieldBegin('roomMid', Thrift.Type.STRING, 1);
output.writeString(this.roomMid);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_notifyLeaveRoom_result = function(args) {
this.e = null;
if (args instanceof ttypes.TalkException) {
this.e = args;
return;
}
if (args) {
if (args.e !== undefined && args.e !== null) {
this.e = args.e;
}
}
};
BotService_notifyLeaveRoom_result.prototype = {};
BotService_notifyLeaveRoom_result.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.e = new ttypes.TalkException();
this.e.read(input);
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_notifyLeaveRoom_result.prototype.write = function(output) {
output.writeStructBegin('BotService_notifyLeaveRoom_result');
if (this.e !== null && this.e !== undefined) {
output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
this.e.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_getBotUseInfo_args = function(args) {
this.botMid = null;
if (args) {
if (args.botMid !== undefined && args.botMid !== null) {
this.botMid = args.botMid;
}
}
};
BotService_getBotUseInfo_args.prototype = {};
BotService_getBotUseInfo_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 2:
if (ftype == Thrift.Type.STRING) {
this.botMid = input.readString();
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_getBotUseInfo_args.prototype.write = function(output) {
output.writeStructBegin('BotService_getBotUseInfo_args');
if (this.botMid !== null && this.botMid !== undefined) {
output.writeFieldBegin('botMid', Thrift.Type.STRING, 2);
output.writeString(this.botMid);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_getBotUseInfo_result = function(args) {
this.success = null;
this.e = null;
if (args instanceof ttypes.TalkException) {
this.e = args;
return;
}
if (args) {
if (args.success !== undefined && args.success !== null) {
this.success = new ttypes.BotUseInfo(args.success);
}
if (args.e !== undefined && args.e !== null) {
this.e = args.e;
}
}
};
BotService_getBotUseInfo_result.prototype = {};
BotService_getBotUseInfo_result.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 0:
if (ftype == Thrift.Type.STRUCT) {
this.success = new ttypes.BotUseInfo();
this.success.read(input);
} else {
input.skip(ftype);
}
break;
case 1:
if (ftype == Thrift.Type.STRUCT) {
this.e = new ttypes.TalkException();
this.e.read(input);
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_getBotUseInfo_result.prototype.write = function(output) {
output.writeStructBegin('BotService_getBotUseInfo_result');
if (this.success !== null && this.success !== undefined) {
output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
this.success.write(output);
output.writeFieldEnd();
}
if (this.e !== null && this.e !== undefined) {
output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
this.e.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_sendChatCheckedByWatermark_args = function(args) {
this.seq = null;
this.mid = null;
this.watermark = null;
this.sessionId = null;
if (args) {
if (args.seq !== undefined && args.seq !== null) {
this.seq = args.seq;
}
if (args.mid !== undefined && args.mid !== null) {
this.mid = args.mid;
}
if (args.watermark !== undefined && args.watermark !== null) {
this.watermark = args.watermark;
}
if (args.sessionId !== undefined && args.sessionId !== null) {
this.sessionId = args.sessionId;
}
}
};
BotService_sendChatCheckedByWatermark_args.prototype = {};
BotService_sendChatCheckedByWatermark_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.I32) {
this.seq = input.readI32();
} else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRING) {
this.mid = input.readString();
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.I64) {
this.watermark = input.readI64();
} else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.BYTE) {
this.sessionId = input.readByte();
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_sendChatCheckedByWatermark_args.prototype.write = function(output) {
output.writeStructBegin('BotService_sendChatCheckedByWatermark_args');
if (this.seq !== null && this.seq !== undefined) {
output.writeFieldBegin('seq', Thrift.Type.I32, 1);
output.writeI32(this.seq);
output.writeFieldEnd();
}
if (this.mid !== null && this.mid !== undefined) {
output.writeFieldBegin('mid', Thrift.Type.STRING, 2);
output.writeString(this.mid);
output.writeFieldEnd();
}
if (this.watermark !== null && this.watermark !== undefined) {
output.writeFieldBegin('watermark', Thrift.Type.I64, 3);
output.writeI64(this.watermark);
output.writeFieldEnd();
}
if (this.sessionId !== null && this.sessionId !== undefined) {
output.writeFieldBegin('sessionId', Thrift.Type.BYTE, 4);
output.writeByte(this.sessionId);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotService_sendChatCheckedByWatermark_result = function(args) {
this.e = null;
if (args instanceof ttypes.TalkException) {
this.e = args;
return;
}
if (args) {
if (args.e !== undefined && args.e !== null) {
this.e = args.e;
}
}
};
BotService_sendChatCheckedByWatermark_result.prototype = {};
BotService_sendChatCheckedByWatermark_result.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.e = new ttypes.TalkException();
this.e.read(input);
} else {
input.skip(ftype);
}
break;
case 0:
input.skip(ftype);
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BotService_sendChatCheckedByWatermark_result.prototype.write = function(output) {
output.writeStructBegin('BotService_sendChatCheckedByWatermark_result');
if (this.e !== null && this.e !== undefined) {
output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
this.e.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BotServiceClient = exports.Client = function(output, pClass) {
this.output = output;
this.pClass = pClass;
this._seqid = 0;
this._reqs = {};
};
BotServiceClient.prototype = {};
BotServiceClient.prototype.seqid = function() { return this._seqid; };
BotServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
BotServiceClient.prototype.notifyLeaveGroup = function(groupMid, callback) {
this._seqid = this.new_seqid();
if (callback === undefined) {
var _defer = Q.defer();
this._reqs[this.seqid()] = function(error, result) {
if (error) {
_defer.reject(error);
} else {
_defer.resolve(result);
}
};
this.send_notifyLeaveGroup(groupMid);
return _defer.promise;
} else {
this._reqs[this.seqid()] = callback;
this.send_notifyLeaveGroup(groupMid);
}
};
BotServiceClient.prototype.send_notifyLeaveGroup = function(groupMid) {
var output = new this.pClass(this.output);
output.writeMessageBegin('notifyLeaveGroup', Thrift.MessageType.CALL, this.seqid());
var args = new BotService_notifyLeaveGroup_args();
args.groupMid = groupMid;
args.write(output);
output.writeMessageEnd();
return this.output.flush();
};
BotServiceClient.prototype.recv_notifyLeaveGroup = function(input,mtype,rseqid) {
var callback = this._reqs[rseqid] || function() {};
delete this._reqs[rseqid];
if (mtype == Thrift.MessageType.EXCEPTION) {
var x = new Thrift.TApplicationException();
x.read(input);
input.readMessageEnd();
return callback(x);
}
var result = new BotService_notifyLeaveGroup_result();
result.read(input);
input.readMessageEnd();
if (null !== result.e) {
return callback(result.e);
}
callback(null);
};
BotServiceClient.prototype.notifyLeaveRoom = function(roomMid, callback) {
this._seqid = this.new_seqid();
if (callback === undefined) {
var _defer = Q.defer();
this._reqs[this.seqid()] = function(error, result) {
if (error) {
_defer.reject(error);
} else {
_defer.resolve(result);
}
};
this.send_notifyLeaveRoom(roomMid);
return _defer.promise;
} else {
this._reqs[this.seqid()] = callback;
this.send_notifyLeaveRoom(roomMid);
}
};
BotServiceClient.prototype.send_notifyLeaveRoom = function(roomMid) {
var output = new this.pClass(this.output);
output.writeMessageBegin('notifyLeaveRoom', Thrift.MessageType.CALL, this.seqid());
var args = new BotService_notifyLeaveRoom_args();
args.roomMid = roomMid;
args.write(output);
output.writeMessageEnd();
return this.output.flush();
};
BotServiceClient.prototype.recv_notifyLeaveRoom = function(input,mtype,rseqid) {
var callback = this._reqs[rseqid] || function() {};
delete this._reqs[rseqid];
if (mtype == Thrift.MessageType.EXCEPTION) {
var x = new Thrift.TApplicationException();
x.read(input);
input.readMessageEnd();
return callback(x);
}
var result = new BotService_notifyLeaveRoom_result();
result.read(input);
input.readMessageEnd();
if (null !== result.e) {
return callback(result.e);
}
callback(null);
};
BotServiceClient.prototype.getBotUseInfo = function(botMid, callback) {
this._seqid = this.new_seqid();
if (callback === undefined) {
var _defer = Q.defer();
this._reqs[this.seqid()] = function(error, result) {
if (error) {
_defer.reject(error);
} else {
_defer.resolve(result);
}
};
this.send_getBotUseInfo(botMid);
return _defer.promise;
} else {
this._reqs[this.seqid()] = callback;
this.send_getBotUseInfo(botMid);
}
};
BotServiceClient.prototype.send_getBotUseInfo = function(botMid) {
var output = new this.pClass(this.output);
output.writeMessageBegin('getBotUseInfo', Thrift.MessageType.CALL, this.seqid());
var args = new BotService_getBotUseInfo_args();
args.botMid = botMid;
args.write(output);
output.writeMessageEnd();
return this.output.flush();
};
BotServiceClient.prototype.recv_getBotUseInfo = function(input,mtype,rseqid) {
var callback = this._reqs[rseqid] || function() {};
delete this._reqs[rseqid];
if (mtype == Thrift.MessageType.EXCEPTION) {
var x = new Thrift.TApplicationException();
x.read(input);
input.readMessageEnd();
return callback(x);
}
var result = new BotService_getBotUseInfo_result();
result.read(input);
input.readMessageEnd();
if (null !== result.e) {
return callback(result.e);
}
if (null !== result.success) {
return callback(null, result.success);
}
return callback('getBotUseInfo failed: unknown result');
};
BotServiceClient.prototype.sendChatCheckedByWatermark = function(seq, mid, watermark, sessionId, callback) {
this._seqid = this.new_seqid();
if (callback === undefined) {
var _defer = Q.defer();
this._reqs[this.seqid()] = function(error, result) {
if (error) {
_defer.reject(error);
} else {
_defer.resolve(result);
}
};
this.send_sendChatCheckedByWatermark(seq, mid, watermark, sessionId);
return _defer.promise;
} else {
this._reqs[this.seqid()] = callback;
this.send_sendChatCheckedByWatermark(seq, mid, watermark, sessionId);
}
};
BotServiceClient.prototype.send_sendChatCheckedByWatermark = function(seq, mid, watermark, sessionId) {
var output = new this.pClass(this.output);
output.writeMessageBegin('sendChatCheckedByWatermark', Thrift.MessageType.CALL, this.seqid());
var args = new BotService_sendChatCheckedByWatermark_args();
args.seq = seq;
args.mid = mid;
args.watermark = watermark;
args.sessionId = sessionId;
args.write(output);
output.writeMessageEnd();
return this.output.flush();
};
BotServiceClient.prototype.recv_sendChatCheckedByWatermark = function(input,mtype,rseqid) {
var callback = this._reqs[rseqid] || function() {};
delete this._reqs[rseqid];
if (mtype == Thrift.MessageType.EXCEPTION) {
var x = new Thrift.TApplicationException();
x.read(input);
input.readMessageEnd();
return callback(x);
}
var result = new BotService_sendChatCheckedByWatermark_result();
result.read(input);
input.readMessageEnd();
if (null !== result.e) {
return callback(result.e);
}
callback(null);
};
var BotServiceProcessor = exports.Processor = function(handler) {
this._handler = handler;
}
;
BotServiceProcessor.prototype.process = function(input, output) {
var r = input.readMessageBegin();
if (this['process_' + r.fname]) {
return this['process_' + r.fname].call(this, r.rseqid, input, output);
} else {
input.skip(Thrift.Type.STRUCT);
input.readMessageEnd();
var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
x.write(output);
output.writeMessageEnd();
output.flush();
}
}
;
BotServiceProcessor.prototype.process_notifyLeaveGroup = function(seqid, input, output) {
var args = new BotService_notifyLeaveGroup_args();
args.read(input);
input.readMessageEnd();
if (this._handler.notifyLeaveGroup.length === 1) {
Q.fcall(this._handler.notifyLeaveGroup, args.groupMid)
.then(function(result) {
var result_obj = new BotService_notifyLeaveGroup_result({success: result});
output.writeMessageBegin("notifyLeaveGroup", Thrift.MessageType.REPLY, seqid);
result_obj.write(output);
output.writeMessageEnd();
output.flush();
}, function (err) {
var result;
if (err instanceof ttypes.TalkException) {
result = new BotService_notifyLeaveGroup_result(err);
output.writeMessageBegin("notifyLeaveGroup", Thrift.MessageType.REPLY, seqid);
} else {
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("notifyLeaveGroup", Thrift.MessageType.EXCEPTION, seqid);
}
result.write(output);
output.writeMessageEnd();
output.flush();
});
} else {
this._handler.notifyLeaveGroup(args.groupMid, function (err, result) {
var result_obj;
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
result_obj = new BotService_notifyLeaveGroup_result((err !== null || typeof err === 'undefined') ? err : {success: result});
output.writeMessageBegin("notifyLeaveGroup", Thrift.MessageType.REPLY, seqid);
} else {
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("notifyLeaveGroup", Thrift.MessageType.EXCEPTION, seqid);
}
result_obj.write(output);
output.writeMessageEnd();
output.flush();
});
}
};
BotServiceProcessor.prototype.process_notifyLeaveRoom = function(seqid, input, output) {
var args = new BotService_notifyLeaveRoom_args();
args.read(input);
input.readMessageEnd();
if (this._handler.notifyLeaveRoom.length === 1) {
Q.fcall(this._handler.notifyLeaveRoom, args.roomMid)
.then(function(result) {
var result_obj = new BotService_notifyLeaveRoom_result({success: result});
output.writeMessageBegin("notifyLeaveRoom", Thrift.MessageType.REPLY, seqid);
result_obj.write(output);
output.writeMessageEnd();
output.flush();
}, function (err) {
var result;
if (err instanceof ttypes.TalkException) {
result = new BotService_notifyLeaveRoom_result(err);
output.writeMessageBegin("notifyLeaveRoom", Thrift.MessageType.REPLY, seqid);
} else {
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("notifyLeaveRoom", Thrift.MessageType.EXCEPTION, seqid);
}
result.write(output);
output.writeMessageEnd();
output.flush();
});
} else {
this._handler.notifyLeaveRoom(args.roomMid, function (err, result) {
var result_obj;
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
result_obj = new BotService_notifyLeaveRoom_result((err !== null || typeof err === 'undefined') ? err : {success: result});
output.writeMessageBegin("notifyLeaveRoom", Thrift.MessageType.REPLY, seqid);
} else {
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("notifyLeaveRoom", Thrift.MessageType.EXCEPTION, seqid);
}
result_obj.write(output);
output.writeMessageEnd();
output.flush();
});
}
};
BotServiceProcessor.prototype.process_getBotUseInfo = function(seqid, input, output) {
var args = new BotService_getBotUseInfo_args();
args.read(input);
input.readMessageEnd();
if (this._handler.getBotUseInfo.length === 1) {
Q.fcall(this._handler.getBotUseInfo, args.botMid)
.then(function(result) {
var result_obj = new BotService_getBotUseInfo_result({success: result});
output.writeMessageBegin("getBotUseInfo", Thrift.MessageType.REPLY, seqid);
result_obj.write(output);
output.writeMessageEnd();
output.flush();
}, function (err) {
var result;
if (err instanceof ttypes.TalkException) {
result = new BotService_getBotUseInfo_result(err);
output.writeMessageBegin("getBotUseInfo", Thrift.MessageType.REPLY, seqid);
} else {
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("getBotUseInfo", Thrift.MessageType.EXCEPTION, seqid);
}
result.write(output);
output.writeMessageEnd();
output.flush();
});
} else {
this._handler.getBotUseInfo(args.botMid, function (err, result) {
var result_obj;
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
result_obj = new BotService_getBotUseInfo_result((err !== null || typeof err === 'undefined') ? err : {success: result});
output.writeMessageBegin("getBotUseInfo", Thrift.MessageType.REPLY, seqid);
} else {
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("getBotUseInfo", Thrift.MessageType.EXCEPTION, seqid);
}
result_obj.write(output);
output.writeMessageEnd();
output.flush();
});
}
};
BotServiceProcessor.prototype.process_sendChatCheckedByWatermark = function(seqid, input, output) {
var args = new BotService_sendChatCheckedByWatermark_args();
args.read(input);
input.readMessageEnd();
if (this._handler.sendChatCheckedByWatermark.length === 4) {
Q.fcall(this._handler.sendChatCheckedByWatermark, args.seq, args.mid, args.watermark, args.sessionId)
.then(function(result) {
var result_obj = new BotService_sendChatCheckedByWatermark_result({success: result});
output.writeMessageBegin("sendChatCheckedByWatermark", Thrift.MessageType.REPLY, seqid);
result_obj.write(output);
output.writeMessageEnd();
output.flush();
}, function (err) {
var result;
if (err instanceof ttypes.TalkException) {
result = new BotService_sendChatCheckedByWatermark_result(err);
output.writeMessageBegin("sendChatCheckedByWatermark", Thrift.MessageType.REPLY, seqid);
} else {
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("sendChatCheckedByWatermark", Thrift.MessageType.EXCEPTION, seqid);
}
result.write(output);
output.writeMessageEnd();
output.flush();
});
} else {
this._handler.sendChatCheckedByWatermark(args.seq, args.mid, args.watermark, args.sessionId, function (err, result) {
var result_obj;
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
result_obj = new BotService_sendChatCheckedByWatermark_result((err !== null || typeof err === 'undefined') ? err : {success: result});
output.writeMessageBegin("sendChatCheckedByWatermark", Thrift.MessageType.REPLY, seqid);
} else {
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
output.writeMessageBegin("sendChatCheckedByWatermark", Thrift.MessageType.EXCEPTION, seqid);
}
result_obj.write(output);
output.writeMessageEnd();
output.flush();
});
}
};