@baiducloud/sdk
Advanced tools
Comparing version 1.0.0-rc.9 to 1.0.0-rc.10
@@ -44,2 +44,3 @@ /** | ||
exports.CfcClient = require('./src/cfc_client'); | ||
exports.BtsClient = require('./src/bts_client'); | ||
// exports.BtsClient = require('./src/bts_client'); | ||
exports.IoTClient = require('./src/iot_client'); |
{ | ||
"name": "@baiducloud/sdk", | ||
"version": "1.0.0-rc.9", | ||
"version": "1.0.0-rc.10", | ||
"description": "Baidu Cloud Engine JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,3 +20,3 @@ Baidu Cloud Engine JavaScript SDK | ||
```html | ||
<script src="https://bce.bdstatic.com/lib/@baiducloud/sdk/1.0.0-rc.9/baidubce-sdk.bundle.min.js" ></script> | ||
<script src="https://bce.bdstatic.com/lib/@baiducloud/sdk/1.0.0-rc.10/baidubce-sdk.bundle.min.js" ></script> | ||
``` |
@@ -251,2 +251,43 @@ /** | ||
BosClient.prototype.getObjectAcl = function (bucketName, key, options) { | ||
options = options || {}; | ||
return this.sendRequest('GET', { | ||
bucketName: bucketName, | ||
key: key, | ||
params: {acl: ''}, | ||
config: options.config | ||
}); | ||
}; | ||
BosClient.prototype.putObjectAcl = function (bucketName, key, acl, options) { | ||
options = options || {}; | ||
var headers = {}; | ||
headers[H.CONTENT_TYPE] = 'application/json; charset=UTF-8'; | ||
return this.sendRequest('PUT', { | ||
bucketName: bucketName, | ||
key: key, | ||
body: JSON.stringify({accessControlList: acl}), | ||
headers: headers, | ||
params: {acl: ''}, | ||
config: options.config | ||
}); | ||
}; | ||
BosClient.prototype.putObjectCannedAcl = function (bucketName, key, cannedAcl, options) { | ||
options = options || {}; | ||
var headers = {}; | ||
headers[H.X_BCE_ACL] = cannedAcl; | ||
return this.sendRequest('PUT', { | ||
bucketName: bucketName, | ||
key: key, | ||
headers: headers, | ||
params: {acl: ''}, | ||
config: options.config | ||
}); | ||
}; | ||
BosClient.prototype.getBucketLocation = function (bucketName, options) { | ||
@@ -974,2 +1015,5 @@ options = options || {}; | ||
H.EXPIRES, | ||
H.X_BCE_ACL, | ||
H.X_BCE_GRANT_READ, | ||
H.X_BCE_GRANT_FULL_CONTROL, | ||
H.X_BCE_OBJECT_ACL, | ||
@@ -976,0 +1020,0 @@ H.X_BCE_OBJECT_GRANT_READ |
@@ -15,6 +15,14 @@ /* | ||
var util = require('util'); | ||
var debug = require('debug')('bce-sdk:BtsClient'); | ||
var models = require('./bts/models'); | ||
var BceBaseClient = require('./bce_base_client'); | ||
var PutRowRequest = models.PutRowRequest; | ||
var BatchPutRowRequest = models.BatchPutRowRequest; | ||
var DeleteRowRequest = models.DeleteRowRequest; | ||
var BatchDeleteRowRequest = models.BatchDeleteRowRequest; | ||
var GetRowRequest = models.GetRowRequest; | ||
var BatchGetRowRequest = models.BatchGetRowRequest; | ||
var ScanRequest = models.ScanRequest; | ||
/** | ||
@@ -34,61 +42,114 @@ * Bts service api | ||
} | ||
util.inherits(BtsClient, BceBaseClient); | ||
BtsClient.prototype.putRow = function (body) { | ||
debug('putRow, body = %j', body); | ||
return this.sendRequest('PUT', '/v1/instance/test_whx/table/table1/row', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 单条写入 PutRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param putRowRequest PutRow请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.putRow = function (instanceName, tableName, putRowRequest) { | ||
putRowRequest.rowkey = putRowRequest.encode(putRowRequest.rowkey); | ||
return this.sendRequest('PUT', '/v1/instance/' + instanceName + '/table/' + tableName + '/row', { | ||
body: JSON.stringify(putRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.batchPutRow = function (body) { | ||
debug('batchPutRow, body = %j', body); | ||
return this.sendRequest('PUT', '/v1/instance/test_whx/table/table1/rows', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 批量写入 BatchPutRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param batchPutRowRequest batchPutRow 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.batchPutRow = function (instanceName, tableName, batchPutRowRequest) { | ||
return this.sendRequest('PUT', '/v1/instance/' + instanceName + '/table/' + tableName + '/rows', { | ||
body: JSON.stringify(batchPutRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.deleteRow = function (body) { | ||
debug('deleteRow, body = %j', body); | ||
return this.sendRequest('DELETE', '/v1/instance/test_whx/table/table1/row', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 单条删除 DeleteRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param deleteRowRequest deleteRow 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.deleteRow = function (instanceName, tableName, deleteRowRequest) { | ||
deleteRowRequest.rowkey = deleteRowRequest.encode(deleteRowRequest.rowkey); | ||
return this.sendRequest('DELETE', '/v1/instance/' + instanceName + '/table/' + tableName + '/row', { | ||
body: JSON.stringify(deleteRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.batchDeleteRow = function (body) { | ||
debug('batchDeleteRow, body = %j', body); | ||
return this.sendRequest('DELETE', '/v1/instance/test_whx/table/table1/rows', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
}) | ||
/** | ||
* 批量删除 BatchDeleteRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param batchDeleteRowRequest BatchDeleteRow 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.batchDeleteRow = function (instanceName, tableName, batchDeleteRowRequest) { | ||
return this.sendRequest('DELETE', '/v1/instance/' + instanceName + '/table/' + tableName + '/rows', { | ||
body: JSON.stringify(batchDeleteRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.getRow = function (body) { | ||
debug('putRow, body = %j', body); | ||
return this.sendRequest('GET', '/v1/instance/test_whx/table/table1/row', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 单条随机读 GetRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param getRowRequest GetRow 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.getRow = function (instanceName, tableName, getRowRequest) { | ||
getRowRequest.rowkey = getRowRequest.encode(getRowRequest.rowkey); | ||
return this.sendRequest('GET', '/v1/instance/' + instanceName + '/table/' + tableName + '/row', { | ||
body: JSON.stringify(getRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.batchGetRow = function (body) { | ||
debug('batchGetRow, body = %j', body); | ||
return this.sendRequest('GET', '/v1/instance/test_whx/table/table1/rows', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 批量读 BatchGetRow | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param batchGetRowRequest BatchGetRow 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.batchGetRow = function (instanceName, tableName, batchGetRowRequest) { | ||
return this.sendRequest('GET', '/v1/instance/' + instanceName + '/table/' + tableName + '/rows', { | ||
body: JSON.stringify(batchGetRowRequest) | ||
}); | ||
}; | ||
BtsClient.prototype.scan = function (body) { | ||
debug('scan, body = %j', body); | ||
return this.sendRequest('GET', '/v1/instance/test_whx/table/table1/rows', { | ||
params: {}, | ||
body: JSON.stringify(body) | ||
/** | ||
* 区间读 Scan | ||
* @param instanceName 实例名 | ||
* @param tableName 表名 | ||
* @param scanRowRequest Scan 请求体 | ||
* @returns {*} | ||
*/ | ||
BtsClient.prototype.scan = function (instanceName, tableName, scanRowRequest) { | ||
if (scanRowRequest.startRowkey !== null) { | ||
scanRowRequest.startRowkey = scanRowRequest.encode(scanRowRequest.startRowkey); | ||
} | ||
if (scanRowRequest.stopRowkey !== null) { | ||
scanRowRequest.stopRowkey = scanRowRequest.encode(scanRowRequest.stopRowkey); | ||
} | ||
return this.sendRequest('GET', '/v1/instance/' + instanceName + '/table/' + tableName + '/rows', { | ||
body: JSON.stringify(scanRowRequest) | ||
}); | ||
}; | ||
module.exports = BtsClient; | ||
module.exports = { | ||
BtsClient: BtsClient, | ||
PutRowRequest: PutRowRequest, | ||
BatchPutRowRequest: BatchPutRowRequest, | ||
DeleteRowRequest: DeleteRowRequest, | ||
BatchDeleteRowRequest: BatchDeleteRowRequest, | ||
GetRowRequest: GetRowRequest, | ||
BatchGetRowRequest: BatchGetRowRequest, | ||
ScanRequest: ScanRequest, | ||
}; |
@@ -34,2 +34,4 @@ /** | ||
exports.X_BCE_ACL = 'x-bce-acl'; | ||
exports.X_BCE_GRANT_READ = 'x-bce-grant-read'; | ||
exports.X_BCE_GRANT_FULL_CONTROL = 'x-bce-grant-full-control'; | ||
exports.X_BCE_REQUEST_ID = 'x-bce-request-id'; | ||
@@ -36,0 +38,0 @@ exports.X_BCE_CONTENT_SHA256 = 'x-bce-content-sha256'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2249648
43
51486