@ridi/cms-sdk
Advanced tools
Comparing version 2.1.0 to 2.2.6
# Ridibooks CMS SDK | ||
## 2.2.6 (2018-04-04) | ||
- [PHP, JS, Python] Add new tag APIs, `getAdminTag` and `getAdminTags`. | ||
## 2.2.5 (2018-04-03) | ||
- [PHP] `/token-refresh` does not redirect to CMS-RPC-URL (#43) | ||
## 2.2.4 (2018-04-02) | ||
- [PHP] Add cookie header to Thrift request for debugger (#42) | ||
## 2.2.3 (2018-03-27) | ||
- [PHP] Fix token-refresh failure due to domain mismatch | ||
## 2.2.2 (2018-03-26) | ||
- [PHP] Redirect to /token-refresh on token expired | ||
- [PHP] Handle 400 error on token introspect | ||
## 2.2.1 (2018-03-12) | ||
- [PHP] Fix `MiniRouter` compatiblitiy issue | ||
## 2.2.0 (2018-03-09) | ||
- [PHP] CmsApplication accepts config variables by the constructor | ||
- [PHP] Remove PHP warning if a cookie is not set | ||
- [PHP] Add `setLoginContext()` for test | ||
## 2.1.1 (2018-02-14) | ||
- [PHP] Fix compatibility error with Config class | ||
## 2.1 (2018-02-13) | ||
@@ -9,3 +44,3 @@ | ||
- Use token-based Login | ||
- Remove session server depenency | ||
- Remove session server dependency | ||
@@ -12,0 +47,0 @@ ## 2.0 (2017-08-17) |
@@ -555,2 +555,338 @@ // | ||
var AdminTagService_getAdminTag_args = function(args) { | ||
this.tag_id = null; | ||
if (args) { | ||
if (args.tag_id !== undefined && args.tag_id !== null) { | ||
this.tag_id = args.tag_id; | ||
} | ||
} | ||
}; | ||
AdminTagService_getAdminTag_args.prototype = {}; | ||
AdminTagService_getAdminTag_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.tag_id = input.readI32(); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 0: | ||
input.skip(ftype); | ||
break; | ||
default: | ||
input.skip(ftype); | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return; | ||
}; | ||
AdminTagService_getAdminTag_args.prototype.write = function(output) { | ||
output.writeStructBegin('AdminTagService_getAdminTag_args'); | ||
if (this.tag_id !== null && this.tag_id !== undefined) { | ||
output.writeFieldBegin('tag_id', Thrift.Type.I32, 1); | ||
output.writeI32(this.tag_id); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}; | ||
var AdminTagService_getAdminTag_result = function(args) { | ||
this.success = null; | ||
this.userException = null; | ||
this.systemException = null; | ||
if (args instanceof Errors_ttypes.UserException) { | ||
this.userException = args; | ||
return; | ||
} | ||
if (args instanceof Errors_ttypes.SystemException) { | ||
this.systemException = args; | ||
return; | ||
} | ||
if (args) { | ||
if (args.success !== undefined && args.success !== null) { | ||
this.success = new ttypes.AdminTag(args.success); | ||
} | ||
if (args.userException !== undefined && args.userException !== null) { | ||
this.userException = args.userException; | ||
} | ||
if (args.systemException !== undefined && args.systemException !== null) { | ||
this.systemException = args.systemException; | ||
} | ||
} | ||
}; | ||
AdminTagService_getAdminTag_result.prototype = {}; | ||
AdminTagService_getAdminTag_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.AdminTag(); | ||
this.success.read(input); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 1: | ||
if (ftype == Thrift.Type.STRUCT) { | ||
this.userException = new Errors_ttypes.UserException(); | ||
this.userException.read(input); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 2: | ||
if (ftype == Thrift.Type.STRUCT) { | ||
this.systemException = new Errors_ttypes.SystemException(); | ||
this.systemException.read(input); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
default: | ||
input.skip(ftype); | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return; | ||
}; | ||
AdminTagService_getAdminTag_result.prototype.write = function(output) { | ||
output.writeStructBegin('AdminTagService_getAdminTag_result'); | ||
if (this.success !== null && this.success !== undefined) { | ||
output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); | ||
this.success.write(output); | ||
output.writeFieldEnd(); | ||
} | ||
if (this.userException !== null && this.userException !== undefined) { | ||
output.writeFieldBegin('userException', Thrift.Type.STRUCT, 1); | ||
this.userException.write(output); | ||
output.writeFieldEnd(); | ||
} | ||
if (this.systemException !== null && this.systemException !== undefined) { | ||
output.writeFieldBegin('systemException', Thrift.Type.STRUCT, 2); | ||
this.systemException.write(output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}; | ||
var AdminTagService_getAdminTags_args = function(args) { | ||
this.tag_ids = null; | ||
if (args) { | ||
if (args.tag_ids !== undefined && args.tag_ids !== null) { | ||
this.tag_ids = Thrift.copyList(args.tag_ids, [null]); | ||
} | ||
} | ||
}; | ||
AdminTagService_getAdminTags_args.prototype = {}; | ||
AdminTagService_getAdminTags_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.LIST) { | ||
var _size32 = 0; | ||
var _rtmp336; | ||
this.tag_ids = []; | ||
var _etype35 = 0; | ||
_rtmp336 = input.readListBegin(); | ||
_etype35 = _rtmp336.etype; | ||
_size32 = _rtmp336.size; | ||
for (var _i37 = 0; _i37 < _size32; ++_i37) | ||
{ | ||
var elem38 = null; | ||
elem38 = input.readI32(); | ||
this.tag_ids.push(elem38); | ||
} | ||
input.readListEnd(); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 0: | ||
input.skip(ftype); | ||
break; | ||
default: | ||
input.skip(ftype); | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return; | ||
}; | ||
AdminTagService_getAdminTags_args.prototype.write = function(output) { | ||
output.writeStructBegin('AdminTagService_getAdminTags_args'); | ||
if (this.tag_ids !== null && this.tag_ids !== undefined) { | ||
output.writeFieldBegin('tag_ids', Thrift.Type.LIST, 1); | ||
output.writeListBegin(Thrift.Type.I32, this.tag_ids.length); | ||
for (var iter39 in this.tag_ids) | ||
{ | ||
if (this.tag_ids.hasOwnProperty(iter39)) | ||
{ | ||
iter39 = this.tag_ids[iter39]; | ||
output.writeI32(iter39); | ||
} | ||
} | ||
output.writeListEnd(); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}; | ||
var AdminTagService_getAdminTags_result = function(args) { | ||
this.success = null; | ||
this.userException = null; | ||
this.systemException = null; | ||
if (args instanceof Errors_ttypes.UserException) { | ||
this.userException = args; | ||
return; | ||
} | ||
if (args instanceof Errors_ttypes.SystemException) { | ||
this.systemException = args; | ||
return; | ||
} | ||
if (args) { | ||
if (args.success !== undefined && args.success !== null) { | ||
this.success = Thrift.copyList(args.success, [ttypes.AdminTag]); | ||
} | ||
if (args.userException !== undefined && args.userException !== null) { | ||
this.userException = args.userException; | ||
} | ||
if (args.systemException !== undefined && args.systemException !== null) { | ||
this.systemException = args.systemException; | ||
} | ||
} | ||
}; | ||
AdminTagService_getAdminTags_result.prototype = {}; | ||
AdminTagService_getAdminTags_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 _size40 = 0; | ||
var _rtmp344; | ||
this.success = []; | ||
var _etype43 = 0; | ||
_rtmp344 = input.readListBegin(); | ||
_etype43 = _rtmp344.etype; | ||
_size40 = _rtmp344.size; | ||
for (var _i45 = 0; _i45 < _size40; ++_i45) | ||
{ | ||
var elem46 = null; | ||
elem46 = new ttypes.AdminTag(); | ||
elem46.read(input); | ||
this.success.push(elem46); | ||
} | ||
input.readListEnd(); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 1: | ||
if (ftype == Thrift.Type.STRUCT) { | ||
this.userException = new Errors_ttypes.UserException(); | ||
this.userException.read(input); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
case 2: | ||
if (ftype == Thrift.Type.STRUCT) { | ||
this.systemException = new Errors_ttypes.SystemException(); | ||
this.systemException.read(input); | ||
} else { | ||
input.skip(ftype); | ||
} | ||
break; | ||
default: | ||
input.skip(ftype); | ||
} | ||
input.readFieldEnd(); | ||
} | ||
input.readStructEnd(); | ||
return; | ||
}; | ||
AdminTagService_getAdminTags_result.prototype.write = function(output) { | ||
output.writeStructBegin('AdminTagService_getAdminTags_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 iter47 in this.success) | ||
{ | ||
if (this.success.hasOwnProperty(iter47)) | ||
{ | ||
iter47 = this.success[iter47]; | ||
iter47.write(output); | ||
} | ||
} | ||
output.writeListEnd(); | ||
output.writeFieldEnd(); | ||
} | ||
if (this.userException !== null && this.userException !== undefined) { | ||
output.writeFieldBegin('userException', Thrift.Type.STRUCT, 1); | ||
this.userException.write(output); | ||
output.writeFieldEnd(); | ||
} | ||
if (this.systemException !== null && this.systemException !== undefined) { | ||
output.writeFieldBegin('systemException', Thrift.Type.STRUCT, 2); | ||
this.systemException.write(output); | ||
output.writeFieldEnd(); | ||
} | ||
output.writeFieldStop(); | ||
output.writeStructEnd(); | ||
return; | ||
}; | ||
var AdminTagServiceClient = exports.Client = function(output, pClass) { | ||
@@ -725,2 +1061,108 @@ this.output = output; | ||
}; | ||
AdminTagServiceClient.prototype.getAdminTag = function(tag_id, 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_getAdminTag(tag_id); | ||
return _defer.promise; | ||
} else { | ||
this._reqs[this.seqid()] = callback; | ||
this.send_getAdminTag(tag_id); | ||
} | ||
}; | ||
AdminTagServiceClient.prototype.send_getAdminTag = function(tag_id) { | ||
var output = new this.pClass(this.output); | ||
output.writeMessageBegin('getAdminTag', Thrift.MessageType.CALL, this.seqid()); | ||
var args = new AdminTagService_getAdminTag_args(); | ||
args.tag_id = tag_id; | ||
args.write(output); | ||
output.writeMessageEnd(); | ||
return this.output.flush(); | ||
}; | ||
AdminTagServiceClient.prototype.recv_getAdminTag = 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 AdminTagService_getAdminTag_result(); | ||
result.read(input); | ||
input.readMessageEnd(); | ||
if (null !== result.userException) { | ||
return callback(result.userException); | ||
} | ||
if (null !== result.systemException) { | ||
return callback(result.systemException); | ||
} | ||
if (null !== result.success) { | ||
return callback(null, result.success); | ||
} | ||
return callback('getAdminTag failed: unknown result'); | ||
}; | ||
AdminTagServiceClient.prototype.getAdminTags = function(tag_ids, 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_getAdminTags(tag_ids); | ||
return _defer.promise; | ||
} else { | ||
this._reqs[this.seqid()] = callback; | ||
this.send_getAdminTags(tag_ids); | ||
} | ||
}; | ||
AdminTagServiceClient.prototype.send_getAdminTags = function(tag_ids) { | ||
var output = new this.pClass(this.output); | ||
output.writeMessageBegin('getAdminTags', Thrift.MessageType.CALL, this.seqid()); | ||
var args = new AdminTagService_getAdminTags_args(); | ||
args.tag_ids = tag_ids; | ||
args.write(output); | ||
output.writeMessageEnd(); | ||
return this.output.flush(); | ||
}; | ||
AdminTagServiceClient.prototype.recv_getAdminTags = 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 AdminTagService_getAdminTags_result(); | ||
result.read(input); | ||
input.readMessageEnd(); | ||
if (null !== result.userException) { | ||
return callback(result.userException); | ||
} | ||
if (null !== result.systemException) { | ||
return callback(result.systemException); | ||
} | ||
if (null !== result.success) { | ||
return callback(null, result.success); | ||
} | ||
return callback('getAdminTags failed: unknown result'); | ||
}; | ||
var AdminTagServiceProcessor = exports.Processor = function(handler) { | ||
@@ -868,1 +1310,83 @@ this._handler = handler; | ||
}; | ||
AdminTagServiceProcessor.prototype.process_getAdminTag = function(seqid, input, output) { | ||
var args = new AdminTagService_getAdminTag_args(); | ||
args.read(input); | ||
input.readMessageEnd(); | ||
if (this._handler.getAdminTag.length === 1) { | ||
Q.fcall(this._handler.getAdminTag, args.tag_id) | ||
.then(function(result) { | ||
var result_obj = new AdminTagService_getAdminTag_result({success: result}); | ||
output.writeMessageBegin("getAdminTag", Thrift.MessageType.REPLY, seqid); | ||
result_obj.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}, function (err) { | ||
var result; | ||
if (err instanceof Errors_ttypes.UserException || err instanceof Errors_ttypes.SystemException) { | ||
result = new AdminTagService_getAdminTag_result(err); | ||
output.writeMessageBegin("getAdminTag", Thrift.MessageType.REPLY, seqid); | ||
} else { | ||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("getAdminTag", Thrift.MessageType.EXCEPTION, seqid); | ||
} | ||
result.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}); | ||
} else { | ||
this._handler.getAdminTag(args.tag_id, function (err, result) { | ||
var result_obj; | ||
if ((err === null || typeof err === 'undefined') || err instanceof Errors_ttypes.UserException || err instanceof Errors_ttypes.SystemException) { | ||
result_obj = new AdminTagService_getAdminTag_result((err !== null || typeof err === 'undefined') ? err : {success: result}); | ||
output.writeMessageBegin("getAdminTag", Thrift.MessageType.REPLY, seqid); | ||
} else { | ||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("getAdminTag", Thrift.MessageType.EXCEPTION, seqid); | ||
} | ||
result_obj.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}); | ||
} | ||
}; | ||
AdminTagServiceProcessor.prototype.process_getAdminTags = function(seqid, input, output) { | ||
var args = new AdminTagService_getAdminTags_args(); | ||
args.read(input); | ||
input.readMessageEnd(); | ||
if (this._handler.getAdminTags.length === 1) { | ||
Q.fcall(this._handler.getAdminTags, args.tag_ids) | ||
.then(function(result) { | ||
var result_obj = new AdminTagService_getAdminTags_result({success: result}); | ||
output.writeMessageBegin("getAdminTags", Thrift.MessageType.REPLY, seqid); | ||
result_obj.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}, function (err) { | ||
var result; | ||
if (err instanceof Errors_ttypes.UserException || err instanceof Errors_ttypes.SystemException) { | ||
result = new AdminTagService_getAdminTags_result(err); | ||
output.writeMessageBegin("getAdminTags", Thrift.MessageType.REPLY, seqid); | ||
} else { | ||
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("getAdminTags", Thrift.MessageType.EXCEPTION, seqid); | ||
} | ||
result.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}); | ||
} else { | ||
this._handler.getAdminTags(args.tag_ids, function (err, result) { | ||
var result_obj; | ||
if ((err === null || typeof err === 'undefined') || err instanceof Errors_ttypes.UserException || err instanceof Errors_ttypes.SystemException) { | ||
result_obj = new AdminTagService_getAdminTags_result((err !== null || typeof err === 'undefined') ? err : {success: result}); | ||
output.writeMessageBegin("getAdminTags", Thrift.MessageType.REPLY, seqid); | ||
} else { | ||
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); | ||
output.writeMessageBegin("getAdminTags", Thrift.MessageType.EXCEPTION, seqid); | ||
} | ||
result_obj.write(output); | ||
output.writeMessageEnd(); | ||
output.flush(); | ||
}); | ||
} | ||
}; |
{ | ||
"name": "@ridi/cms-sdk", | ||
"version": "2.1.0", | ||
"version": "2.2.6", | ||
"description": "Ridibooks CMS SDK", | ||
@@ -5,0 +5,0 @@ "main": "./lib/js/dist/index.js", |
@@ -23,3 +23,3 @@ # Ridibooks CMS SDK | ||
``` sh | ||
# In OSX, you can install easily with homebrew. | ||
# In macOS, you can install easily with homebrew. | ||
brew install thrift | ||
@@ -26,0 +26,0 @@ ``` |
418900
12536