// // Autogenerated by Thrift Compiler (0.16.0) // // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // "use strict"; const thrift = require('thrift'); const Thrift = thrift.Thrift; const Int64 = require('node-int64'); const structs_ttypes = require('./structs_types'); const exceptions_ttypes = require('./exceptions_types'); const ttypes = require('./service_types'); //HELPER FUNCTIONS AND STRUCTURES const CoreService_login_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.LoginRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.LoginRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_login_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_login_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.LoginResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.LoginResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_login_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; } }; const CoreService_getProfile_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.GetProfileRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.GetProfileRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getProfile_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_getProfile_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.GetProfileResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.GetProfileResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getProfile_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; } }; const CoreService_logout_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.LogoutRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.LogoutRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_logout_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_logout_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.LogoutResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.LogoutResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_logout_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; } }; const CoreService_getUserList_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.GetUserListRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.GetUserListRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getUserList_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_getUserList_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.GetUserListResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.GetUserListResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getUserList_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; } }; const CoreService_createUser_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.CreateUserRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.CreateUserRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_createUser_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_createUser_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.CreateUserResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.CreateUserResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_createUser_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; } }; const CoreService_deleteUsers_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.DeleteUsersRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.DeleteUsersRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_deleteUsers_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_deleteUsers_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.DeleteUsersResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.DeleteUsersResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_deleteUsers_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; } }; const CoreService_getWajibPajakList_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.GetWajibPajakListRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.GetWajibPajakListRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getWajibPajakList_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_getWajibPajakList_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.GetWajibPajakListResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.GetWajibPajakListResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_getWajibPajakList_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; } }; const CoreService_createWajibPajak_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.CreateWajibPajakRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.CreateWajibPajakRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_createWajibPajak_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_createWajibPajak_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.CreateWajibPajakResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.CreateWajibPajakResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_createWajibPajak_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; } }; const CoreService_deleteWajibPajakList_args = class { constructor(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new structs_ttypes.DeleteWajibpajakListRequest(args.request); } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.request = new structs_ttypes.DeleteWajibpajakListRequest(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_deleteWajibPajakList_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } }; const CoreService_deleteWajibPajakList_result = class { constructor(args) { this.success = null; this.e = null; if (args instanceof exceptions_ttypes.CoreServicesException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new structs_ttypes.DeleteWajibpajakListResponse(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } } read (input) { input.readStructBegin(); while (true) { const ret = input.readFieldBegin(); const ftype = ret.ftype; const fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new structs_ttypes.DeleteWajibpajakListResponse(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new exceptions_ttypes.CoreServicesException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; } write (output) { output.writeStructBegin('CoreService_deleteWajibPajakList_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; } }; const CoreServiceClient = exports.Client = class CoreServiceClient { constructor(output, pClass) { this.output = output; this.pClass = pClass; this._seqid = 0; this._reqs = {}; } seqid () { return this._seqid; } new_seqid () { return this._seqid += 1; } login (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_login(request); }); } send_login (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_login_args(params); try { output.writeMessageBegin('login', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_login (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_login_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('login failed: unknown result'); } getProfile (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_getProfile(request); }); } send_getProfile (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_getProfile_args(params); try { output.writeMessageBegin('getProfile', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_getProfile (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_getProfile_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('getProfile failed: unknown result'); } logout (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_logout(request); }); } send_logout (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_logout_args(params); try { output.writeMessageBegin('logout', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_logout (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_logout_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('logout failed: unknown result'); } getUserList (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_getUserList(request); }); } send_getUserList (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_getUserList_args(params); try { output.writeMessageBegin('getUserList', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_getUserList (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_getUserList_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('getUserList failed: unknown result'); } createUser (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_createUser(request); }); } send_createUser (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_createUser_args(params); try { output.writeMessageBegin('createUser', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_createUser (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_createUser_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('createUser failed: unknown result'); } deleteUsers (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_deleteUsers(request); }); } send_deleteUsers (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_deleteUsers_args(params); try { output.writeMessageBegin('deleteUsers', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_deleteUsers (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_deleteUsers_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('deleteUsers failed: unknown result'); } getWajibPajakList (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_getWajibPajakList(request); }); } send_getWajibPajakList (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_getWajibPajakList_args(params); try { output.writeMessageBegin('getWajibPajakList', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_getWajibPajakList (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_getWajibPajakList_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('getWajibPajakList failed: unknown result'); } createWajibPajak (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_createWajibPajak(request); }); } send_createWajibPajak (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_createWajibPajak_args(params); try { output.writeMessageBegin('createWajibPajak', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_createWajibPajak (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_createWajibPajak_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('createWajibPajak failed: unknown result'); } deleteWajibPajakList (request) { this._seqid = this.new_seqid(); const self = this; return new Promise((resolve, reject) => { self._reqs[self.seqid()] = (error, result) => { return error ? reject(error) : resolve(result); }; self.send_deleteWajibPajakList(request); }); } send_deleteWajibPajakList (request) { const output = new this.pClass(this.output); const params = { request: request }; const args = new CoreService_deleteWajibPajakList_args(params); try { output.writeMessageBegin('deleteWajibPajakList', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } } recv_deleteWajibPajakList (input, mtype, rseqid) { const callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { const x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } const result = new CoreService_deleteWajibPajakList_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('deleteWajibPajakList failed: unknown result'); } }; const CoreServiceProcessor = exports.Processor = class CoreServiceProcessor { constructor(handler) { this._handler = handler; } process (input, output) { const 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(); const 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(); } } process_login (seqid, input, output) { const args = new CoreService_login_args(); args.read(input); input.readMessageEnd(); if (this._handler.login.length === 1) { Promise.resolve(this._handler.login.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_login_result({success: result}); output.writeMessageBegin("login", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_login_result(err); output.writeMessageBegin("login", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("login", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.login(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_login_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("login", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("login", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_getProfile (seqid, input, output) { const args = new CoreService_getProfile_args(); args.read(input); input.readMessageEnd(); if (this._handler.getProfile.length === 1) { Promise.resolve(this._handler.getProfile.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_getProfile_result({success: result}); output.writeMessageBegin("getProfile", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_getProfile_result(err); output.writeMessageBegin("getProfile", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getProfile", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.getProfile(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_getProfile_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("getProfile", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getProfile", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_logout (seqid, input, output) { const args = new CoreService_logout_args(); args.read(input); input.readMessageEnd(); if (this._handler.logout.length === 1) { Promise.resolve(this._handler.logout.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_logout_result({success: result}); output.writeMessageBegin("logout", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_logout_result(err); output.writeMessageBegin("logout", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("logout", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.logout(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_logout_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("logout", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("logout", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_getUserList (seqid, input, output) { const args = new CoreService_getUserList_args(); args.read(input); input.readMessageEnd(); if (this._handler.getUserList.length === 1) { Promise.resolve(this._handler.getUserList.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_getUserList_result({success: result}); output.writeMessageBegin("getUserList", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_getUserList_result(err); output.writeMessageBegin("getUserList", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getUserList", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.getUserList(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_getUserList_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("getUserList", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getUserList", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_createUser (seqid, input, output) { const args = new CoreService_createUser_args(); args.read(input); input.readMessageEnd(); if (this._handler.createUser.length === 1) { Promise.resolve(this._handler.createUser.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_createUser_result({success: result}); output.writeMessageBegin("createUser", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_createUser_result(err); output.writeMessageBegin("createUser", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("createUser", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.createUser(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_createUser_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("createUser", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("createUser", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_deleteUsers (seqid, input, output) { const args = new CoreService_deleteUsers_args(); args.read(input); input.readMessageEnd(); if (this._handler.deleteUsers.length === 1) { Promise.resolve(this._handler.deleteUsers.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_deleteUsers_result({success: result}); output.writeMessageBegin("deleteUsers", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_deleteUsers_result(err); output.writeMessageBegin("deleteUsers", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("deleteUsers", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.deleteUsers(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_deleteUsers_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("deleteUsers", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("deleteUsers", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_getWajibPajakList (seqid, input, output) { const args = new CoreService_getWajibPajakList_args(); args.read(input); input.readMessageEnd(); if (this._handler.getWajibPajakList.length === 1) { Promise.resolve(this._handler.getWajibPajakList.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_getWajibPajakList_result({success: result}); output.writeMessageBegin("getWajibPajakList", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_getWajibPajakList_result(err); output.writeMessageBegin("getWajibPajakList", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getWajibPajakList", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.getWajibPajakList(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_getWajibPajakList_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("getWajibPajakList", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("getWajibPajakList", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_createWajibPajak (seqid, input, output) { const args = new CoreService_createWajibPajak_args(); args.read(input); input.readMessageEnd(); if (this._handler.createWajibPajak.length === 1) { Promise.resolve(this._handler.createWajibPajak.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_createWajibPajak_result({success: result}); output.writeMessageBegin("createWajibPajak", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_createWajibPajak_result(err); output.writeMessageBegin("createWajibPajak", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("createWajibPajak", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.createWajibPajak(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_createWajibPajak_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("createWajibPajak", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("createWajibPajak", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } process_deleteWajibPajakList (seqid, input, output) { const args = new CoreService_deleteWajibPajakList_args(); args.read(input); input.readMessageEnd(); if (this._handler.deleteWajibPajakList.length === 1) { Promise.resolve(this._handler.deleteWajibPajakList.bind(this._handler)( args.request )).then(result => { const result_obj = new CoreService_deleteWajibPajakList_result({success: result}); output.writeMessageBegin("deleteWajibPajakList", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(err => { let result; if (err instanceof exceptions_ttypes.CoreServicesException) { result = new CoreService_deleteWajibPajakList_result(err); output.writeMessageBegin("deleteWajibPajakList", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("deleteWajibPajakList", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.deleteWajibPajakList(args.request, (err, result) => { let result_obj; if ((err === null || typeof err === 'undefined') || err instanceof exceptions_ttypes.CoreServicesException) { result_obj = new CoreService_deleteWajibPajakList_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("deleteWajibPajakList", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("deleteWajibPajakList", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } } };