mirror of
https://github.com/liberliber/LINE-KickBot1.git
synced 2024-09-20 06:46:01 +08:00
Add files via upload
This commit is contained in:
parent
9fe2baba3f
commit
50325feebc
1381
curve-thrift/AccountSupervisorService.js
Normal file
1381
curve-thrift/AccountSupervisorService.js
Normal file
File diff suppressed because it is too large
Load diff
958
curve-thrift/AgeCheckService.js
Normal file
958
curve-thrift/AgeCheckService.js
Normal file
|
@ -0,0 +1,958 @@
|
|||
//
|
||||
// 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 AgeCheckService_checkUserAge_args = function(args) {
|
||||
this.carrier = null;
|
||||
this.sessionId = null;
|
||||
this.verifier = null;
|
||||
this.standardAge = null;
|
||||
if (args) {
|
||||
if (args.carrier !== undefined && args.carrier !== null) {
|
||||
this.carrier = args.carrier;
|
||||
}
|
||||
if (args.sessionId !== undefined && args.sessionId !== null) {
|
||||
this.sessionId = args.sessionId;
|
||||
}
|
||||
if (args.verifier !== undefined && args.verifier !== null) {
|
||||
this.verifier = args.verifier;
|
||||
}
|
||||
if (args.standardAge !== undefined && args.standardAge !== null) {
|
||||
this.standardAge = args.standardAge;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_checkUserAge_args.prototype = {};
|
||||
AgeCheckService_checkUserAge_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.I32) {
|
||||
this.carrier = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.sessionId = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.verifier = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.standardAge = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
AgeCheckService_checkUserAge_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_checkUserAge_args');
|
||||
if (this.carrier !== null && this.carrier !== undefined) {
|
||||
output.writeFieldBegin('carrier', Thrift.Type.I32, 2);
|
||||
output.writeI32(this.carrier);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.sessionId !== null && this.sessionId !== undefined) {
|
||||
output.writeFieldBegin('sessionId', Thrift.Type.STRING, 3);
|
||||
output.writeString(this.sessionId);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.verifier !== null && this.verifier !== undefined) {
|
||||
output.writeFieldBegin('verifier', Thrift.Type.STRING, 4);
|
||||
output.writeString(this.verifier);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.standardAge !== null && this.standardAge !== undefined) {
|
||||
output.writeFieldBegin('standardAge', Thrift.Type.I32, 5);
|
||||
output.writeI32(this.standardAge);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var AgeCheckService_checkUserAge_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 = args.success;
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_checkUserAge_result.prototype = {};
|
||||
AgeCheckService_checkUserAge_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.I32) {
|
||||
this.success = input.readI32();
|
||||
} 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;
|
||||
};
|
||||
|
||||
AgeCheckService_checkUserAge_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_checkUserAge_result');
|
||||
if (this.success !== null && this.success !== undefined) {
|
||||
output.writeFieldBegin('success', Thrift.Type.I32, 0);
|
||||
output.writeI32(this.success);
|
||||
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 AgeCheckService_checkUserAgeWithDocomo_args = function(args) {
|
||||
this.openIdRedirectUrl = null;
|
||||
this.standardAge = null;
|
||||
this.verifier = null;
|
||||
if (args) {
|
||||
if (args.openIdRedirectUrl !== undefined && args.openIdRedirectUrl !== null) {
|
||||
this.openIdRedirectUrl = args.openIdRedirectUrl;
|
||||
}
|
||||
if (args.standardAge !== undefined && args.standardAge !== null) {
|
||||
this.standardAge = args.standardAge;
|
||||
}
|
||||
if (args.verifier !== undefined && args.verifier !== null) {
|
||||
this.verifier = args.verifier;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_checkUserAgeWithDocomo_args.prototype = {};
|
||||
AgeCheckService_checkUserAgeWithDocomo_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.openIdRedirectUrl = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.standardAge = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.verifier = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
AgeCheckService_checkUserAgeWithDocomo_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_checkUserAgeWithDocomo_args');
|
||||
if (this.openIdRedirectUrl !== null && this.openIdRedirectUrl !== undefined) {
|
||||
output.writeFieldBegin('openIdRedirectUrl', Thrift.Type.STRING, 2);
|
||||
output.writeString(this.openIdRedirectUrl);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.standardAge !== null && this.standardAge !== undefined) {
|
||||
output.writeFieldBegin('standardAge', Thrift.Type.I32, 3);
|
||||
output.writeI32(this.standardAge);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.verifier !== null && this.verifier !== undefined) {
|
||||
output.writeFieldBegin('verifier', Thrift.Type.STRING, 4);
|
||||
output.writeString(this.verifier);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var AgeCheckService_checkUserAgeWithDocomo_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.AgeCheckDocomoResult(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_checkUserAgeWithDocomo_result.prototype = {};
|
||||
AgeCheckService_checkUserAgeWithDocomo_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.AgeCheckDocomoResult();
|
||||
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;
|
||||
};
|
||||
|
||||
AgeCheckService_checkUserAgeWithDocomo_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_checkUserAgeWithDocomo_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 AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args = function(args) {
|
||||
};
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args.prototype = {};
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_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;
|
||||
}
|
||||
input.skip(ftype);
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args');
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_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 = args.success;
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result.prototype = {};
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_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.STRING) {
|
||||
this.success = input.readString();
|
||||
} 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;
|
||||
};
|
||||
|
||||
AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result');
|
||||
if (this.success !== null && this.success !== undefined) {
|
||||
output.writeFieldBegin('success', Thrift.Type.STRING, 0);
|
||||
output.writeString(this.success);
|
||||
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 AgeCheckService_retrieveRequestToken_args = function(args) {
|
||||
this.carrier = null;
|
||||
if (args) {
|
||||
if (args.carrier !== undefined && args.carrier !== null) {
|
||||
this.carrier = args.carrier;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_retrieveRequestToken_args.prototype = {};
|
||||
AgeCheckService_retrieveRequestToken_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.I32) {
|
||||
this.carrier = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
AgeCheckService_retrieveRequestToken_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_retrieveRequestToken_args');
|
||||
if (this.carrier !== null && this.carrier !== undefined) {
|
||||
output.writeFieldBegin('carrier', Thrift.Type.I32, 2);
|
||||
output.writeI32(this.carrier);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var AgeCheckService_retrieveRequestToken_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.AgeCheckRequestResult(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
AgeCheckService_retrieveRequestToken_result.prototype = {};
|
||||
AgeCheckService_retrieveRequestToken_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.AgeCheckRequestResult();
|
||||
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;
|
||||
};
|
||||
|
||||
AgeCheckService_retrieveRequestToken_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('AgeCheckService_retrieveRequestToken_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 AgeCheckServiceClient = exports.Client = function(output, pClass) {
|
||||
this.output = output;
|
||||
this.pClass = pClass;
|
||||
this._seqid = 0;
|
||||
this._reqs = {};
|
||||
};
|
||||
AgeCheckServiceClient.prototype = {};
|
||||
AgeCheckServiceClient.prototype.seqid = function() { return this._seqid; };
|
||||
AgeCheckServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
|
||||
AgeCheckServiceClient.prototype.checkUserAge = function(carrier, sessionId, verifier, standardAge, 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_checkUserAge(carrier, sessionId, verifier, standardAge);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_checkUserAge(carrier, sessionId, verifier, standardAge);
|
||||
}
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.send_checkUserAge = function(carrier, sessionId, verifier, standardAge) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('checkUserAge', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new AgeCheckService_checkUserAge_args();
|
||||
args.carrier = carrier;
|
||||
args.sessionId = sessionId;
|
||||
args.verifier = verifier;
|
||||
args.standardAge = standardAge;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.recv_checkUserAge = 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 AgeCheckService_checkUserAge_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('checkUserAge failed: unknown result');
|
||||
};
|
||||
AgeCheckServiceClient.prototype.checkUserAgeWithDocomo = function(openIdRedirectUrl, standardAge, verifier, 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_checkUserAgeWithDocomo(openIdRedirectUrl, standardAge, verifier);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_checkUserAgeWithDocomo(openIdRedirectUrl, standardAge, verifier);
|
||||
}
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.send_checkUserAgeWithDocomo = function(openIdRedirectUrl, standardAge, verifier) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('checkUserAgeWithDocomo', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new AgeCheckService_checkUserAgeWithDocomo_args();
|
||||
args.openIdRedirectUrl = openIdRedirectUrl;
|
||||
args.standardAge = standardAge;
|
||||
args.verifier = verifier;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.recv_checkUserAgeWithDocomo = 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 AgeCheckService_checkUserAgeWithDocomo_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('checkUserAgeWithDocomo failed: unknown result');
|
||||
};
|
||||
AgeCheckServiceClient.prototype.retrieveOpenIdAuthUrlWithDocomo = function(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_retrieveOpenIdAuthUrlWithDocomo();
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_retrieveOpenIdAuthUrlWithDocomo();
|
||||
}
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.send_retrieveOpenIdAuthUrlWithDocomo = function() {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('retrieveOpenIdAuthUrlWithDocomo', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args();
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.recv_retrieveOpenIdAuthUrlWithDocomo = 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 AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_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('retrieveOpenIdAuthUrlWithDocomo failed: unknown result');
|
||||
};
|
||||
AgeCheckServiceClient.prototype.retrieveRequestToken = function(carrier, 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_retrieveRequestToken(carrier);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_retrieveRequestToken(carrier);
|
||||
}
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.send_retrieveRequestToken = function(carrier) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('retrieveRequestToken', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new AgeCheckService_retrieveRequestToken_args();
|
||||
args.carrier = carrier;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
AgeCheckServiceClient.prototype.recv_retrieveRequestToken = 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 AgeCheckService_retrieveRequestToken_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('retrieveRequestToken failed: unknown result');
|
||||
};
|
||||
var AgeCheckServiceProcessor = exports.Processor = function(handler) {
|
||||
this._handler = handler;
|
||||
}
|
||||
;
|
||||
AgeCheckServiceProcessor.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();
|
||||
}
|
||||
}
|
||||
;
|
||||
AgeCheckServiceProcessor.prototype.process_checkUserAge = function(seqid, input, output) {
|
||||
var args = new AgeCheckService_checkUserAge_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.checkUserAge.length === 4) {
|
||||
Q.fcall(this._handler.checkUserAge, args.carrier, args.sessionId, args.verifier, args.standardAge)
|
||||
.then(function(result) {
|
||||
var result_obj = new AgeCheckService_checkUserAge_result({success: result});
|
||||
output.writeMessageBegin("checkUserAge", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new AgeCheckService_checkUserAge_result(err);
|
||||
output.writeMessageBegin("checkUserAge", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("checkUserAge", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.checkUserAge(args.carrier, args.sessionId, args.verifier, args.standardAge, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new AgeCheckService_checkUserAge_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("checkUserAge", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("checkUserAge", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
AgeCheckServiceProcessor.prototype.process_checkUserAgeWithDocomo = function(seqid, input, output) {
|
||||
var args = new AgeCheckService_checkUserAgeWithDocomo_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.checkUserAgeWithDocomo.length === 3) {
|
||||
Q.fcall(this._handler.checkUserAgeWithDocomo, args.openIdRedirectUrl, args.standardAge, args.verifier)
|
||||
.then(function(result) {
|
||||
var result_obj = new AgeCheckService_checkUserAgeWithDocomo_result({success: result});
|
||||
output.writeMessageBegin("checkUserAgeWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new AgeCheckService_checkUserAgeWithDocomo_result(err);
|
||||
output.writeMessageBegin("checkUserAgeWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("checkUserAgeWithDocomo", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.checkUserAgeWithDocomo(args.openIdRedirectUrl, args.standardAge, args.verifier, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new AgeCheckService_checkUserAgeWithDocomo_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("checkUserAgeWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("checkUserAgeWithDocomo", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
AgeCheckServiceProcessor.prototype.process_retrieveOpenIdAuthUrlWithDocomo = function(seqid, input, output) {
|
||||
var args = new AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.retrieveOpenIdAuthUrlWithDocomo.length === 0) {
|
||||
Q.fcall(this._handler.retrieveOpenIdAuthUrlWithDocomo)
|
||||
.then(function(result) {
|
||||
var result_obj = new AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result({success: result});
|
||||
output.writeMessageBegin("retrieveOpenIdAuthUrlWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result(err);
|
||||
output.writeMessageBegin("retrieveOpenIdAuthUrlWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("retrieveOpenIdAuthUrlWithDocomo", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.retrieveOpenIdAuthUrlWithDocomo(function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new AgeCheckService_retrieveOpenIdAuthUrlWithDocomo_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("retrieveOpenIdAuthUrlWithDocomo", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("retrieveOpenIdAuthUrlWithDocomo", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
AgeCheckServiceProcessor.prototype.process_retrieveRequestToken = function(seqid, input, output) {
|
||||
var args = new AgeCheckService_retrieveRequestToken_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.retrieveRequestToken.length === 1) {
|
||||
Q.fcall(this._handler.retrieveRequestToken, args.carrier)
|
||||
.then(function(result) {
|
||||
var result_obj = new AgeCheckService_retrieveRequestToken_result({success: result});
|
||||
output.writeMessageBegin("retrieveRequestToken", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new AgeCheckService_retrieveRequestToken_result(err);
|
||||
output.writeMessageBegin("retrieveRequestToken", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("retrieveRequestToken", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.retrieveRequestToken(args.carrier, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new AgeCheckService_retrieveRequestToken_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("retrieveRequestToken", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("retrieveRequestToken", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
1903
curve-thrift/AuthService.js
Normal file
1903
curve-thrift/AuthService.js
Normal file
File diff suppressed because it is too large
Load diff
904
curve-thrift/BotService.js
Normal file
904
curve-thrift/BotService.js
Normal file
|
@ -0,0 +1,904 @@
|
|||
//
|
||||
// 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();
|
||||
});
|
||||
}
|
||||
};
|
13073
curve-thrift/BuddyManagementService.js
Normal file
13073
curve-thrift/BuddyManagementService.js
Normal file
File diff suppressed because it is too large
Load diff
2319
curve-thrift/BuddyService.js
Normal file
2319
curve-thrift/BuddyService.js
Normal file
File diff suppressed because it is too large
Load diff
16383
curve-thrift/CallService.js
Normal file
16383
curve-thrift/CallService.js
Normal file
File diff suppressed because it is too large
Load diff
6668
curve-thrift/ChannelApplicationProvidedService.js
Normal file
6668
curve-thrift/ChannelApplicationProvidedService.js
Normal file
File diff suppressed because it is too large
Load diff
5297
curve-thrift/ChannelService.js
Normal file
5297
curve-thrift/ChannelService.js
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
766
curve-thrift/MessageService.js
Normal file
766
curve-thrift/MessageService.js
Normal file
|
@ -0,0 +1,766 @@
|
|||
//
|
||||
// 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 MessageService_fetchMessageOperations_args = function(args) {
|
||||
this.localRevision = null;
|
||||
this.lastOpTimestamp = null;
|
||||
this.count = null;
|
||||
if (args) {
|
||||
if (args.localRevision !== undefined && args.localRevision !== null) {
|
||||
this.localRevision = args.localRevision;
|
||||
}
|
||||
if (args.lastOpTimestamp !== undefined && args.lastOpTimestamp !== null) {
|
||||
this.lastOpTimestamp = args.lastOpTimestamp;
|
||||
}
|
||||
if (args.count !== undefined && args.count !== null) {
|
||||
this.count = args.count;
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_fetchMessageOperations_args.prototype = {};
|
||||
MessageService_fetchMessageOperations_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.I64) {
|
||||
this.localRevision = input.readI64();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.I64) {
|
||||
this.lastOpTimestamp = input.readI64();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.count = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
MessageService_fetchMessageOperations_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_fetchMessageOperations_args');
|
||||
if (this.localRevision !== null && this.localRevision !== undefined) {
|
||||
output.writeFieldBegin('localRevision', Thrift.Type.I64, 2);
|
||||
output.writeI64(this.localRevision);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.lastOpTimestamp !== null && this.lastOpTimestamp !== undefined) {
|
||||
output.writeFieldBegin('lastOpTimestamp', Thrift.Type.I64, 3);
|
||||
output.writeI64(this.lastOpTimestamp);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.count !== null && this.count !== undefined) {
|
||||
output.writeFieldBegin('count', Thrift.Type.I32, 4);
|
||||
output.writeI32(this.count);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var MessageService_fetchMessageOperations_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.MessageOperations(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_fetchMessageOperations_result.prototype = {};
|
||||
MessageService_fetchMessageOperations_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.MessageOperations();
|
||||
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;
|
||||
};
|
||||
|
||||
MessageService_fetchMessageOperations_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_fetchMessageOperations_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 MessageService_getLastReadMessageIds_args = function(args) {
|
||||
this.chatId = null;
|
||||
if (args) {
|
||||
if (args.chatId !== undefined && args.chatId !== null) {
|
||||
this.chatId = args.chatId;
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_getLastReadMessageIds_args.prototype = {};
|
||||
MessageService_getLastReadMessageIds_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.chatId = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
MessageService_getLastReadMessageIds_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_getLastReadMessageIds_args');
|
||||
if (this.chatId !== null && this.chatId !== undefined) {
|
||||
output.writeFieldBegin('chatId', Thrift.Type.STRING, 2);
|
||||
output.writeString(this.chatId);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var MessageService_getLastReadMessageIds_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.LastReadMessageIds(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_getLastReadMessageIds_result.prototype = {};
|
||||
MessageService_getLastReadMessageIds_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.LastReadMessageIds();
|
||||
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;
|
||||
};
|
||||
|
||||
MessageService_getLastReadMessageIds_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_getLastReadMessageIds_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 MessageService_multiGetLastReadMessageIds_args = function(args) {
|
||||
this.chatIds = null;
|
||||
if (args) {
|
||||
if (args.chatIds !== undefined && args.chatIds !== null) {
|
||||
this.chatIds = Thrift.copyList(args.chatIds, [null]);
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_multiGetLastReadMessageIds_args.prototype = {};
|
||||
MessageService_multiGetLastReadMessageIds_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.LIST) {
|
||||
var _size1482 = 0;
|
||||
var _rtmp31486;
|
||||
this.chatIds = [];
|
||||
var _etype1485 = 0;
|
||||
_rtmp31486 = input.readListBegin();
|
||||
_etype1485 = _rtmp31486.etype;
|
||||
_size1482 = _rtmp31486.size;
|
||||
for (var _i1487 = 0; _i1487 < _size1482; ++_i1487)
|
||||
{
|
||||
var elem1488 = null;
|
||||
elem1488 = input.readString();
|
||||
this.chatIds.push(elem1488);
|
||||
}
|
||||
input.readListEnd();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
MessageService_multiGetLastReadMessageIds_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_multiGetLastReadMessageIds_args');
|
||||
if (this.chatIds !== null && this.chatIds !== undefined) {
|
||||
output.writeFieldBegin('chatIds', Thrift.Type.LIST, 2);
|
||||
output.writeListBegin(Thrift.Type.STRING, this.chatIds.length);
|
||||
for (var iter1489 in this.chatIds)
|
||||
{
|
||||
if (this.chatIds.hasOwnProperty(iter1489))
|
||||
{
|
||||
iter1489 = this.chatIds[iter1489];
|
||||
output.writeString(iter1489);
|
||||
}
|
||||
}
|
||||
output.writeListEnd();
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var MessageService_multiGetLastReadMessageIds_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 = Thrift.copyList(args.success, [ttypes.LastReadMessageIds]);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageService_multiGetLastReadMessageIds_result.prototype = {};
|
||||
MessageService_multiGetLastReadMessageIds_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.LIST) {
|
||||
var _size1490 = 0;
|
||||
var _rtmp31494;
|
||||
this.success = [];
|
||||
var _etype1493 = 0;
|
||||
_rtmp31494 = input.readListBegin();
|
||||
_etype1493 = _rtmp31494.etype;
|
||||
_size1490 = _rtmp31494.size;
|
||||
for (var _i1495 = 0; _i1495 < _size1490; ++_i1495)
|
||||
{
|
||||
var elem1496 = null;
|
||||
elem1496 = new ttypes.LastReadMessageIds();
|
||||
elem1496.read(input);
|
||||
this.success.push(elem1496);
|
||||
}
|
||||
input.readListEnd();
|
||||
} 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;
|
||||
};
|
||||
|
||||
MessageService_multiGetLastReadMessageIds_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('MessageService_multiGetLastReadMessageIds_result');
|
||||
if (this.success !== null && this.success !== undefined) {
|
||||
output.writeFieldBegin('success', Thrift.Type.LIST, 0);
|
||||
output.writeListBegin(Thrift.Type.STRUCT, this.success.length);
|
||||
for (var iter1497 in this.success)
|
||||
{
|
||||
if (this.success.hasOwnProperty(iter1497))
|
||||
{
|
||||
iter1497 = this.success[iter1497];
|
||||
iter1497.write(output);
|
||||
}
|
||||
}
|
||||
output.writeListEnd();
|
||||
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 MessageServiceClient = exports.Client = function(output, pClass) {
|
||||
this.output = output;
|
||||
this.pClass = pClass;
|
||||
this._seqid = 0;
|
||||
this._reqs = {};
|
||||
};
|
||||
MessageServiceClient.prototype = {};
|
||||
MessageServiceClient.prototype.seqid = function() { return this._seqid; };
|
||||
MessageServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
|
||||
MessageServiceClient.prototype.fetchMessageOperations = function(localRevision, lastOpTimestamp, count, 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_fetchMessageOperations(localRevision, lastOpTimestamp, count);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_fetchMessageOperations(localRevision, lastOpTimestamp, count);
|
||||
}
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.send_fetchMessageOperations = function(localRevision, lastOpTimestamp, count) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('fetchMessageOperations', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new MessageService_fetchMessageOperations_args();
|
||||
args.localRevision = localRevision;
|
||||
args.lastOpTimestamp = lastOpTimestamp;
|
||||
args.count = count;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.recv_fetchMessageOperations = 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 MessageService_fetchMessageOperations_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('fetchMessageOperations failed: unknown result');
|
||||
};
|
||||
MessageServiceClient.prototype.getLastReadMessageIds = function(chatId, 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_getLastReadMessageIds(chatId);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_getLastReadMessageIds(chatId);
|
||||
}
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.send_getLastReadMessageIds = function(chatId) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('getLastReadMessageIds', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new MessageService_getLastReadMessageIds_args();
|
||||
args.chatId = chatId;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.recv_getLastReadMessageIds = 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 MessageService_getLastReadMessageIds_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('getLastReadMessageIds failed: unknown result');
|
||||
};
|
||||
MessageServiceClient.prototype.multiGetLastReadMessageIds = function(chatIds, 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_multiGetLastReadMessageIds(chatIds);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_multiGetLastReadMessageIds(chatIds);
|
||||
}
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.send_multiGetLastReadMessageIds = function(chatIds) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('multiGetLastReadMessageIds', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new MessageService_multiGetLastReadMessageIds_args();
|
||||
args.chatIds = chatIds;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
MessageServiceClient.prototype.recv_multiGetLastReadMessageIds = 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 MessageService_multiGetLastReadMessageIds_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('multiGetLastReadMessageIds failed: unknown result');
|
||||
};
|
||||
var MessageServiceProcessor = exports.Processor = function(handler) {
|
||||
this._handler = handler;
|
||||
}
|
||||
;
|
||||
MessageServiceProcessor.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();
|
||||
}
|
||||
}
|
||||
;
|
||||
MessageServiceProcessor.prototype.process_fetchMessageOperations = function(seqid, input, output) {
|
||||
var args = new MessageService_fetchMessageOperations_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.fetchMessageOperations.length === 3) {
|
||||
Q.fcall(this._handler.fetchMessageOperations, args.localRevision, args.lastOpTimestamp, args.count)
|
||||
.then(function(result) {
|
||||
var result_obj = new MessageService_fetchMessageOperations_result({success: result});
|
||||
output.writeMessageBegin("fetchMessageOperations", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new MessageService_fetchMessageOperations_result(err);
|
||||
output.writeMessageBegin("fetchMessageOperations", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("fetchMessageOperations", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.fetchMessageOperations(args.localRevision, args.lastOpTimestamp, args.count, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new MessageService_fetchMessageOperations_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("fetchMessageOperations", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("fetchMessageOperations", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
MessageServiceProcessor.prototype.process_getLastReadMessageIds = function(seqid, input, output) {
|
||||
var args = new MessageService_getLastReadMessageIds_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.getLastReadMessageIds.length === 1) {
|
||||
Q.fcall(this._handler.getLastReadMessageIds, args.chatId)
|
||||
.then(function(result) {
|
||||
var result_obj = new MessageService_getLastReadMessageIds_result({success: result});
|
||||
output.writeMessageBegin("getLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new MessageService_getLastReadMessageIds_result(err);
|
||||
output.writeMessageBegin("getLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getLastReadMessageIds", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.getLastReadMessageIds(args.chatId, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new MessageService_getLastReadMessageIds_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("getLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getLastReadMessageIds", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
MessageServiceProcessor.prototype.process_multiGetLastReadMessageIds = function(seqid, input, output) {
|
||||
var args = new MessageService_multiGetLastReadMessageIds_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.multiGetLastReadMessageIds.length === 1) {
|
||||
Q.fcall(this._handler.multiGetLastReadMessageIds, args.chatIds)
|
||||
.then(function(result) {
|
||||
var result_obj = new MessageService_multiGetLastReadMessageIds_result({success: result});
|
||||
output.writeMessageBegin("multiGetLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new MessageService_multiGetLastReadMessageIds_result(err);
|
||||
output.writeMessageBegin("multiGetLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("multiGetLastReadMessageIds", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.multiGetLastReadMessageIds(args.chatIds, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new MessageService_multiGetLastReadMessageIds_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("multiGetLastReadMessageIds", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("multiGetLastReadMessageIds", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
6379
curve-thrift/ShopService.js
Normal file
6379
curve-thrift/ShopService.js
Normal file
File diff suppressed because it is too large
Load diff
767
curve-thrift/SnsAdaptorService.js
Normal file
767
curve-thrift/SnsAdaptorService.js
Normal file
|
@ -0,0 +1,767 @@
|
|||
//
|
||||
// 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 SnsAdaptorService_getSnsFriends_args = function(args) {
|
||||
this.snsIdType = null;
|
||||
this.snsAccessToken = null;
|
||||
this.startIdx = null;
|
||||
this.limit = null;
|
||||
if (args) {
|
||||
if (args.snsIdType !== undefined && args.snsIdType !== null) {
|
||||
this.snsIdType = args.snsIdType;
|
||||
}
|
||||
if (args.snsAccessToken !== undefined && args.snsAccessToken !== null) {
|
||||
this.snsAccessToken = args.snsAccessToken;
|
||||
}
|
||||
if (args.startIdx !== undefined && args.startIdx !== null) {
|
||||
this.startIdx = args.startIdx;
|
||||
}
|
||||
if (args.limit !== undefined && args.limit !== null) {
|
||||
this.limit = args.limit;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_getSnsFriends_args.prototype = {};
|
||||
SnsAdaptorService_getSnsFriends_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.I32) {
|
||||
this.snsIdType = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.snsAccessToken = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.startIdx = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.limit = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
SnsAdaptorService_getSnsFriends_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_getSnsFriends_args');
|
||||
if (this.snsIdType !== null && this.snsIdType !== undefined) {
|
||||
output.writeFieldBegin('snsIdType', Thrift.Type.I32, 2);
|
||||
output.writeI32(this.snsIdType);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.snsAccessToken !== null && this.snsAccessToken !== undefined) {
|
||||
output.writeFieldBegin('snsAccessToken', Thrift.Type.STRING, 3);
|
||||
output.writeString(this.snsAccessToken);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.startIdx !== null && this.startIdx !== undefined) {
|
||||
output.writeFieldBegin('startIdx', Thrift.Type.I32, 4);
|
||||
output.writeI32(this.startIdx);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.limit !== null && this.limit !== undefined) {
|
||||
output.writeFieldBegin('limit', Thrift.Type.I32, 5);
|
||||
output.writeI32(this.limit);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var SnsAdaptorService_getSnsFriends_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.SnsFriends(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_getSnsFriends_result.prototype = {};
|
||||
SnsAdaptorService_getSnsFriends_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.SnsFriends();
|
||||
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;
|
||||
};
|
||||
|
||||
SnsAdaptorService_getSnsFriends_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_getSnsFriends_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 SnsAdaptorService_getSnsMyProfile_args = function(args) {
|
||||
this.snsIdType = null;
|
||||
this.snsAccessToken = null;
|
||||
if (args) {
|
||||
if (args.snsIdType !== undefined && args.snsIdType !== null) {
|
||||
this.snsIdType = args.snsIdType;
|
||||
}
|
||||
if (args.snsAccessToken !== undefined && args.snsAccessToken !== null) {
|
||||
this.snsAccessToken = args.snsAccessToken;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_getSnsMyProfile_args.prototype = {};
|
||||
SnsAdaptorService_getSnsMyProfile_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.I32) {
|
||||
this.snsIdType = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.snsAccessToken = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
SnsAdaptorService_getSnsMyProfile_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_getSnsMyProfile_args');
|
||||
if (this.snsIdType !== null && this.snsIdType !== undefined) {
|
||||
output.writeFieldBegin('snsIdType', Thrift.Type.I32, 2);
|
||||
output.writeI32(this.snsIdType);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.snsAccessToken !== null && this.snsAccessToken !== undefined) {
|
||||
output.writeFieldBegin('snsAccessToken', Thrift.Type.STRING, 3);
|
||||
output.writeString(this.snsAccessToken);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var SnsAdaptorService_getSnsMyProfile_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.SnsProfile(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_getSnsMyProfile_result.prototype = {};
|
||||
SnsAdaptorService_getSnsMyProfile_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.SnsProfile();
|
||||
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;
|
||||
};
|
||||
|
||||
SnsAdaptorService_getSnsMyProfile_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_getSnsMyProfile_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 SnsAdaptorService_postSnsInvitationMessage_args = function(args) {
|
||||
this.snsIdType = null;
|
||||
this.snsAccessToken = null;
|
||||
this.toSnsUserId = null;
|
||||
if (args) {
|
||||
if (args.snsIdType !== undefined && args.snsIdType !== null) {
|
||||
this.snsIdType = args.snsIdType;
|
||||
}
|
||||
if (args.snsAccessToken !== undefined && args.snsAccessToken !== null) {
|
||||
this.snsAccessToken = args.snsAccessToken;
|
||||
}
|
||||
if (args.toSnsUserId !== undefined && args.toSnsUserId !== null) {
|
||||
this.toSnsUserId = args.toSnsUserId;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_postSnsInvitationMessage_args.prototype = {};
|
||||
SnsAdaptorService_postSnsInvitationMessage_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.I32) {
|
||||
this.snsIdType = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.snsAccessToken = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.toSnsUserId = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
SnsAdaptorService_postSnsInvitationMessage_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_postSnsInvitationMessage_args');
|
||||
if (this.snsIdType !== null && this.snsIdType !== undefined) {
|
||||
output.writeFieldBegin('snsIdType', Thrift.Type.I32, 2);
|
||||
output.writeI32(this.snsIdType);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.snsAccessToken !== null && this.snsAccessToken !== undefined) {
|
||||
output.writeFieldBegin('snsAccessToken', Thrift.Type.STRING, 3);
|
||||
output.writeString(this.snsAccessToken);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.toSnsUserId !== null && this.toSnsUserId !== undefined) {
|
||||
output.writeFieldBegin('toSnsUserId', Thrift.Type.STRING, 4);
|
||||
output.writeString(this.toSnsUserId);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var SnsAdaptorService_postSnsInvitationMessage_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;
|
||||
}
|
||||
}
|
||||
};
|
||||
SnsAdaptorService_postSnsInvitationMessage_result.prototype = {};
|
||||
SnsAdaptorService_postSnsInvitationMessage_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;
|
||||
};
|
||||
|
||||
SnsAdaptorService_postSnsInvitationMessage_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('SnsAdaptorService_postSnsInvitationMessage_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 SnsAdaptorServiceClient = exports.Client = function(output, pClass) {
|
||||
this.output = output;
|
||||
this.pClass = pClass;
|
||||
this._seqid = 0;
|
||||
this._reqs = {};
|
||||
};
|
||||
SnsAdaptorServiceClient.prototype = {};
|
||||
SnsAdaptorServiceClient.prototype.seqid = function() { return this._seqid; };
|
||||
SnsAdaptorServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
|
||||
SnsAdaptorServiceClient.prototype.getSnsFriends = function(snsIdType, snsAccessToken, startIdx, limit, 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_getSnsFriends(snsIdType, snsAccessToken, startIdx, limit);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_getSnsFriends(snsIdType, snsAccessToken, startIdx, limit);
|
||||
}
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.send_getSnsFriends = function(snsIdType, snsAccessToken, startIdx, limit) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('getSnsFriends', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new SnsAdaptorService_getSnsFriends_args();
|
||||
args.snsIdType = snsIdType;
|
||||
args.snsAccessToken = snsAccessToken;
|
||||
args.startIdx = startIdx;
|
||||
args.limit = limit;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.recv_getSnsFriends = 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 SnsAdaptorService_getSnsFriends_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('getSnsFriends failed: unknown result');
|
||||
};
|
||||
SnsAdaptorServiceClient.prototype.getSnsMyProfile = function(snsIdType, snsAccessToken, 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_getSnsMyProfile(snsIdType, snsAccessToken);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_getSnsMyProfile(snsIdType, snsAccessToken);
|
||||
}
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.send_getSnsMyProfile = function(snsIdType, snsAccessToken) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('getSnsMyProfile', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new SnsAdaptorService_getSnsMyProfile_args();
|
||||
args.snsIdType = snsIdType;
|
||||
args.snsAccessToken = snsAccessToken;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.recv_getSnsMyProfile = 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 SnsAdaptorService_getSnsMyProfile_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('getSnsMyProfile failed: unknown result');
|
||||
};
|
||||
SnsAdaptorServiceClient.prototype.postSnsInvitationMessage = function(snsIdType, snsAccessToken, toSnsUserId, 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_postSnsInvitationMessage(snsIdType, snsAccessToken, toSnsUserId);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_postSnsInvitationMessage(snsIdType, snsAccessToken, toSnsUserId);
|
||||
}
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.send_postSnsInvitationMessage = function(snsIdType, snsAccessToken, toSnsUserId) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('postSnsInvitationMessage', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new SnsAdaptorService_postSnsInvitationMessage_args();
|
||||
args.snsIdType = snsIdType;
|
||||
args.snsAccessToken = snsAccessToken;
|
||||
args.toSnsUserId = toSnsUserId;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
SnsAdaptorServiceClient.prototype.recv_postSnsInvitationMessage = 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 SnsAdaptorService_postSnsInvitationMessage_result();
|
||||
result.read(input);
|
||||
input.readMessageEnd();
|
||||
|
||||
if (null !== result.e) {
|
||||
return callback(result.e);
|
||||
}
|
||||
callback(null);
|
||||
};
|
||||
var SnsAdaptorServiceProcessor = exports.Processor = function(handler) {
|
||||
this._handler = handler;
|
||||
}
|
||||
;
|
||||
SnsAdaptorServiceProcessor.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();
|
||||
}
|
||||
}
|
||||
;
|
||||
SnsAdaptorServiceProcessor.prototype.process_getSnsFriends = function(seqid, input, output) {
|
||||
var args = new SnsAdaptorService_getSnsFriends_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.getSnsFriends.length === 4) {
|
||||
Q.fcall(this._handler.getSnsFriends, args.snsIdType, args.snsAccessToken, args.startIdx, args.limit)
|
||||
.then(function(result) {
|
||||
var result_obj = new SnsAdaptorService_getSnsFriends_result({success: result});
|
||||
output.writeMessageBegin("getSnsFriends", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new SnsAdaptorService_getSnsFriends_result(err);
|
||||
output.writeMessageBegin("getSnsFriends", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getSnsFriends", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.getSnsFriends(args.snsIdType, args.snsAccessToken, args.startIdx, args.limit, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new SnsAdaptorService_getSnsFriends_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("getSnsFriends", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getSnsFriends", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
SnsAdaptorServiceProcessor.prototype.process_getSnsMyProfile = function(seqid, input, output) {
|
||||
var args = new SnsAdaptorService_getSnsMyProfile_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.getSnsMyProfile.length === 2) {
|
||||
Q.fcall(this._handler.getSnsMyProfile, args.snsIdType, args.snsAccessToken)
|
||||
.then(function(result) {
|
||||
var result_obj = new SnsAdaptorService_getSnsMyProfile_result({success: result});
|
||||
output.writeMessageBegin("getSnsMyProfile", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new SnsAdaptorService_getSnsMyProfile_result(err);
|
||||
output.writeMessageBegin("getSnsMyProfile", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getSnsMyProfile", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.getSnsMyProfile(args.snsIdType, args.snsAccessToken, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new SnsAdaptorService_getSnsMyProfile_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("getSnsMyProfile", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("getSnsMyProfile", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
SnsAdaptorServiceProcessor.prototype.process_postSnsInvitationMessage = function(seqid, input, output) {
|
||||
var args = new SnsAdaptorService_postSnsInvitationMessage_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.postSnsInvitationMessage.length === 3) {
|
||||
Q.fcall(this._handler.postSnsInvitationMessage, args.snsIdType, args.snsAccessToken, args.toSnsUserId)
|
||||
.then(function(result) {
|
||||
var result_obj = new SnsAdaptorService_postSnsInvitationMessage_result({success: result});
|
||||
output.writeMessageBegin("postSnsInvitationMessage", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new SnsAdaptorService_postSnsInvitationMessage_result(err);
|
||||
output.writeMessageBegin("postSnsInvitationMessage", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("postSnsInvitationMessage", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.postSnsInvitationMessage(args.snsIdType, args.snsAccessToken, args.toSnsUserId, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new SnsAdaptorService_postSnsInvitationMessage_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("postSnsInvitationMessage", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("postSnsInvitationMessage", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
538
curve-thrift/SpotService.js
Normal file
538
curve-thrift/SpotService.js
Normal file
|
@ -0,0 +1,538 @@
|
|||
//
|
||||
// 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 SpotService_lookupByPhoneNumber_args = function(args) {
|
||||
this.countryAreaCode = null;
|
||||
this.phoneNumber = null;
|
||||
if (args) {
|
||||
if (args.countryAreaCode !== undefined && args.countryAreaCode !== null) {
|
||||
this.countryAreaCode = args.countryAreaCode;
|
||||
}
|
||||
if (args.phoneNumber !== undefined && args.phoneNumber !== null) {
|
||||
this.phoneNumber = args.phoneNumber;
|
||||
}
|
||||
}
|
||||
};
|
||||
SpotService_lookupByPhoneNumber_args.prototype = {};
|
||||
SpotService_lookupByPhoneNumber_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.countryAreaCode = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.phoneNumber = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
SpotService_lookupByPhoneNumber_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('SpotService_lookupByPhoneNumber_args');
|
||||
if (this.countryAreaCode !== null && this.countryAreaCode !== undefined) {
|
||||
output.writeFieldBegin('countryAreaCode', Thrift.Type.STRING, 2);
|
||||
output.writeString(this.countryAreaCode);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.phoneNumber !== null && this.phoneNumber !== undefined) {
|
||||
output.writeFieldBegin('phoneNumber', Thrift.Type.STRING, 3);
|
||||
output.writeString(this.phoneNumber);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var SpotService_lookupByPhoneNumber_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.SpotPhoneNumberResponse(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
SpotService_lookupByPhoneNumber_result.prototype = {};
|
||||
SpotService_lookupByPhoneNumber_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.SpotPhoneNumberResponse();
|
||||
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;
|
||||
};
|
||||
|
||||
SpotService_lookupByPhoneNumber_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('SpotService_lookupByPhoneNumber_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 SpotService_lookupNearby_args = function(args) {
|
||||
this.location = null;
|
||||
this.category = null;
|
||||
this.query = null;
|
||||
this.countryAreaCode = null;
|
||||
if (args) {
|
||||
if (args.location !== undefined && args.location !== null) {
|
||||
this.location = new ttypes.Location(args.location);
|
||||
}
|
||||
if (args.category !== undefined && args.category !== null) {
|
||||
this.category = args.category;
|
||||
}
|
||||
if (args.query !== undefined && args.query !== null) {
|
||||
this.query = args.query;
|
||||
}
|
||||
if (args.countryAreaCode !== undefined && args.countryAreaCode !== null) {
|
||||
this.countryAreaCode = args.countryAreaCode;
|
||||
}
|
||||
}
|
||||
};
|
||||
SpotService_lookupNearby_args.prototype = {};
|
||||
SpotService_lookupNearby_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.STRUCT) {
|
||||
this.location = new ttypes.Location();
|
||||
this.location.read(input);
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (ftype == Thrift.Type.I32) {
|
||||
this.category = input.readI32();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.query = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.countryAreaCode = input.readString();
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
SpotService_lookupNearby_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('SpotService_lookupNearby_args');
|
||||
if (this.location !== null && this.location !== undefined) {
|
||||
output.writeFieldBegin('location', Thrift.Type.STRUCT, 2);
|
||||
this.location.write(output);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.category !== null && this.category !== undefined) {
|
||||
output.writeFieldBegin('category', Thrift.Type.I32, 3);
|
||||
output.writeI32(this.category);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.query !== null && this.query !== undefined) {
|
||||
output.writeFieldBegin('query', Thrift.Type.STRING, 4);
|
||||
output.writeString(this.query);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
if (this.countryAreaCode !== null && this.countryAreaCode !== undefined) {
|
||||
output.writeFieldBegin('countryAreaCode', Thrift.Type.STRING, 5);
|
||||
output.writeString(this.countryAreaCode);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var SpotService_lookupNearby_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.SpotNearbyResponse(args.success);
|
||||
}
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
SpotService_lookupNearby_result.prototype = {};
|
||||
SpotService_lookupNearby_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.SpotNearbyResponse();
|
||||
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;
|
||||
};
|
||||
|
||||
SpotService_lookupNearby_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('SpotService_lookupNearby_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 SpotServiceClient = exports.Client = function(output, pClass) {
|
||||
this.output = output;
|
||||
this.pClass = pClass;
|
||||
this._seqid = 0;
|
||||
this._reqs = {};
|
||||
};
|
||||
SpotServiceClient.prototype = {};
|
||||
SpotServiceClient.prototype.seqid = function() { return this._seqid; };
|
||||
SpotServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
|
||||
SpotServiceClient.prototype.lookupByPhoneNumber = function(countryAreaCode, phoneNumber, 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_lookupByPhoneNumber(countryAreaCode, phoneNumber);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_lookupByPhoneNumber(countryAreaCode, phoneNumber);
|
||||
}
|
||||
};
|
||||
|
||||
SpotServiceClient.prototype.send_lookupByPhoneNumber = function(countryAreaCode, phoneNumber) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('lookupByPhoneNumber', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new SpotService_lookupByPhoneNumber_args();
|
||||
args.countryAreaCode = countryAreaCode;
|
||||
args.phoneNumber = phoneNumber;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
SpotServiceClient.prototype.recv_lookupByPhoneNumber = 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 SpotService_lookupByPhoneNumber_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('lookupByPhoneNumber failed: unknown result');
|
||||
};
|
||||
SpotServiceClient.prototype.lookupNearby = function(location, category, query, countryAreaCode, 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_lookupNearby(location, category, query, countryAreaCode);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_lookupNearby(location, category, query, countryAreaCode);
|
||||
}
|
||||
};
|
||||
|
||||
SpotServiceClient.prototype.send_lookupNearby = function(location, category, query, countryAreaCode) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('lookupNearby', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new SpotService_lookupNearby_args();
|
||||
args.location = location;
|
||||
args.category = category;
|
||||
args.query = query;
|
||||
args.countryAreaCode = countryAreaCode;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
SpotServiceClient.prototype.recv_lookupNearby = 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 SpotService_lookupNearby_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('lookupNearby failed: unknown result');
|
||||
};
|
||||
var SpotServiceProcessor = exports.Processor = function(handler) {
|
||||
this._handler = handler;
|
||||
}
|
||||
;
|
||||
SpotServiceProcessor.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();
|
||||
}
|
||||
}
|
||||
;
|
||||
SpotServiceProcessor.prototype.process_lookupByPhoneNumber = function(seqid, input, output) {
|
||||
var args = new SpotService_lookupByPhoneNumber_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.lookupByPhoneNumber.length === 2) {
|
||||
Q.fcall(this._handler.lookupByPhoneNumber, args.countryAreaCode, args.phoneNumber)
|
||||
.then(function(result) {
|
||||
var result_obj = new SpotService_lookupByPhoneNumber_result({success: result});
|
||||
output.writeMessageBegin("lookupByPhoneNumber", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new SpotService_lookupByPhoneNumber_result(err);
|
||||
output.writeMessageBegin("lookupByPhoneNumber", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("lookupByPhoneNumber", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.lookupByPhoneNumber(args.countryAreaCode, args.phoneNumber, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new SpotService_lookupByPhoneNumber_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("lookupByPhoneNumber", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("lookupByPhoneNumber", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
||||
SpotServiceProcessor.prototype.process_lookupNearby = function(seqid, input, output) {
|
||||
var args = new SpotService_lookupNearby_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.lookupNearby.length === 4) {
|
||||
Q.fcall(this._handler.lookupNearby, args.location, args.category, args.query, args.countryAreaCode)
|
||||
.then(function(result) {
|
||||
var result_obj = new SpotService_lookupNearby_result({success: result});
|
||||
output.writeMessageBegin("lookupNearby", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.TalkException) {
|
||||
result = new SpotService_lookupNearby_result(err);
|
||||
output.writeMessageBegin("lookupNearby", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("lookupNearby", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.lookupNearby(args.location, args.category, args.query, args.countryAreaCode, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) {
|
||||
result_obj = new SpotService_lookupNearby_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("lookupNearby", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("lookupNearby", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
11761
curve-thrift/SquareService.js
Normal file
11761
curve-thrift/SquareService.js
Normal file
File diff suppressed because it is too large
Load diff
243
curve-thrift/UniversalNotificationService.js
Normal file
243
curve-thrift/UniversalNotificationService.js
Normal file
|
@ -0,0 +1,243 @@
|
|||
//
|
||||
// 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 UniversalNotificationService_notify_args = function(args) {
|
||||
this.event = null;
|
||||
if (args) {
|
||||
if (args.event !== undefined && args.event !== null) {
|
||||
this.event = new ttypes.GlobalEvent(args.event);
|
||||
}
|
||||
}
|
||||
};
|
||||
UniversalNotificationService_notify_args.prototype = {};
|
||||
UniversalNotificationService_notify_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.STRUCT) {
|
||||
this.event = new ttypes.GlobalEvent();
|
||||
this.event.read(input);
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
UniversalNotificationService_notify_args.prototype.write = function(output) {
|
||||
output.writeStructBegin('UniversalNotificationService_notify_args');
|
||||
if (this.event !== null && this.event !== undefined) {
|
||||
output.writeFieldBegin('event', Thrift.Type.STRUCT, 2);
|
||||
this.event.write(output);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
var UniversalNotificationService_notify_result = function(args) {
|
||||
this.e = null;
|
||||
if (args instanceof ttypes.UniversalNotificationServiceException) {
|
||||
this.e = args;
|
||||
return;
|
||||
}
|
||||
if (args) {
|
||||
if (args.e !== undefined && args.e !== null) {
|
||||
this.e = args.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
UniversalNotificationService_notify_result.prototype = {};
|
||||
UniversalNotificationService_notify_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.UniversalNotificationServiceException();
|
||||
this.e.read(input);
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
UniversalNotificationService_notify_result.prototype.write = function(output) {
|
||||
output.writeStructBegin('UniversalNotificationService_notify_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 UniversalNotificationServiceClient = exports.Client = function(output, pClass) {
|
||||
this.output = output;
|
||||
this.pClass = pClass;
|
||||
this._seqid = 0;
|
||||
this._reqs = {};
|
||||
};
|
||||
UniversalNotificationServiceClient.prototype = {};
|
||||
UniversalNotificationServiceClient.prototype.seqid = function() { return this._seqid; };
|
||||
UniversalNotificationServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
|
||||
UniversalNotificationServiceClient.prototype.notify = function(event, 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_notify(event);
|
||||
return _defer.promise;
|
||||
} else {
|
||||
this._reqs[this.seqid()] = callback;
|
||||
this.send_notify(event);
|
||||
}
|
||||
};
|
||||
|
||||
UniversalNotificationServiceClient.prototype.send_notify = function(event) {
|
||||
var output = new this.pClass(this.output);
|
||||
output.writeMessageBegin('notify', Thrift.MessageType.CALL, this.seqid());
|
||||
var args = new UniversalNotificationService_notify_args();
|
||||
args.event = event;
|
||||
args.write(output);
|
||||
output.writeMessageEnd();
|
||||
return this.output.flush();
|
||||
};
|
||||
|
||||
UniversalNotificationServiceClient.prototype.recv_notify = 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 UniversalNotificationService_notify_result();
|
||||
result.read(input);
|
||||
input.readMessageEnd();
|
||||
|
||||
if (null !== result.e) {
|
||||
return callback(result.e);
|
||||
}
|
||||
callback(null);
|
||||
};
|
||||
var UniversalNotificationServiceProcessor = exports.Processor = function(handler) {
|
||||
this._handler = handler;
|
||||
}
|
||||
;
|
||||
UniversalNotificationServiceProcessor.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();
|
||||
}
|
||||
}
|
||||
;
|
||||
UniversalNotificationServiceProcessor.prototype.process_notify = function(seqid, input, output) {
|
||||
var args = new UniversalNotificationService_notify_args();
|
||||
args.read(input);
|
||||
input.readMessageEnd();
|
||||
if (this._handler.notify.length === 1) {
|
||||
Q.fcall(this._handler.notify, args.event)
|
||||
.then(function(result) {
|
||||
var result_obj = new UniversalNotificationService_notify_result({success: result});
|
||||
output.writeMessageBegin("notify", Thrift.MessageType.REPLY, seqid);
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
}, function (err) {
|
||||
var result;
|
||||
if (err instanceof ttypes.UniversalNotificationServiceException) {
|
||||
result = new UniversalNotificationService_notify_result(err);
|
||||
output.writeMessageBegin("notify", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("notify", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
} else {
|
||||
this._handler.notify(args.event, function (err, result) {
|
||||
var result_obj;
|
||||
if ((err === null || typeof err === 'undefined') || err instanceof ttypes.UniversalNotificationServiceException) {
|
||||
result_obj = new UniversalNotificationService_notify_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
||||
output.writeMessageBegin("notify", Thrift.MessageType.REPLY, seqid);
|
||||
} else {
|
||||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
||||
output.writeMessageBegin("notify", Thrift.MessageType.EXCEPTION, seqid);
|
||||
}
|
||||
result_obj.write(output);
|
||||
output.writeMessageEnd();
|
||||
output.flush();
|
||||
});
|
||||
}
|
||||
};
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue