提交 0fb741f8 编写于 作者: A Annie_wang

Update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 defcde70
...@@ -102,8 +102,13 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu ...@@ -102,8 +102,13 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | -------------------------- | | -------- | ----------------------------- | ---- | -------------------------- |
| inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. | | inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. |
| callback | AsyncCallback\<X509Cert> | Yes | Callback invoked to return the result. **X509Cer** instance created.| | callback | AsyncCallback\<X509Cert> | Yes | Callback invoked to return the result. **X509Cert** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
...@@ -115,7 +120,7 @@ let encodingData = null; ...@@ -115,7 +120,7 @@ let encodingData = null;
let encodingBlob = { let encodingBlob = {
data: encodingData, data: encodingData,
// Set the encoding format, which can be FORMAT_PEM or FORMAT_DER. // Set the encoding format, which can be FORMAT_PEM or FORMAT_DER.
encodingFormat: cryptoFramework.EncodingFormat.FORMAT_PEM encodingFormat: cryptoCert.EncodingFormat.FORMAT_PEM
}; };
cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) { cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
if (error != null) { if (error != null) {
...@@ -144,7 +149,13 @@ Creates an **X509Cert** instance. This API uses a promise to return the result. ...@@ -144,7 +149,13 @@ Creates an **X509Cert** instance. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ------- | ---------------- | | ------- | ---------------- |
| Promise\<X509Cert> | **X509Cer** instance created.| | Promise\<X509Cert> | **X509Cert** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
...@@ -184,12 +195,16 @@ Verifies the certificate signature. This API uses an asynchronous callback to re ...@@ -184,12 +195,16 @@ Verifies the certificate signature. This API uses an asynchronous callback to re
| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.|
**Error codes**
| ID| Error Message |
| -------- | ------------------ |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
import cryptoCert from '@ohos.security.cert'; import cryptoCert from '@ohos.security.cert';
import cryptoFramework from "@ohos.security.cryptoFramework"
// Certificate binary data, which must be set based on the service. // Certificate binary data, which must be set based on the service.
let encodingData = null; let encodingData = null;
...@@ -236,6 +251,12 @@ Verifies the certificate signature. This API uses a promise to return the result ...@@ -236,6 +251,12 @@ Verifies the certificate signature. This API uses a promise to return the result
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ------------------ |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -250,7 +271,7 @@ let encodingBlob = { ...@@ -250,7 +271,7 @@ let encodingBlob = {
}; };
cryptoCert.createX509Cert(encodingBlob).then(x509Cert => { cryptoCert.createX509Cert(encodingBlob).then(x509Cert => {
console.log("createX509Cert success"); console.log("createX509Cert success");
// Generate a public key by AsyKeyGenerator or obtain the public key by using getPublicKey() of the X509Cert instance. // The service can call getPublicKey() of the upper-level X509Cert object to obtain the public key.
let pubKey = null; let pubKey = null;
x509Cert.verify(pubKey).then(result => { x509Cert.verify(pubKey).then(result => {
console.log("verify success"); console.log("verify success");
...@@ -276,6 +297,13 @@ Obtains the serialized X.509 certificate data. This API uses an asynchronous cal ...@@ -276,6 +297,13 @@ Obtains the serialized X.509 certificate data. This API uses an asynchronous cal
| -------- | --------------------------------------------- | ---- | -------------------------------- | | -------- | --------------------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized X.509 certificate data obtained.| | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized X.509 certificate data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
...@@ -319,6 +347,14 @@ Obtains the serialized X.509 certificate data. This API uses a promise to return ...@@ -319,6 +347,14 @@ Obtains the serialized X.509 certificate data. This API uses a promise to return
| --------------------------------------- | ---------------------- | | --------------------------------------- | ---------------------- |
| Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized X.509 certificate data obtained.| | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized X.509 certificate data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -357,6 +393,13 @@ Obtains the public key of this X.509 certificate. This API uses an asynchronous ...@@ -357,6 +393,13 @@ Obtains the public key of this X.509 certificate. This API uses an asynchronous
| ------ | ---------------- | | ------ | ---------------- |
| cryptoFramework.PubKey | Public key of the X509 certificate obtained. This object is used only for **verify()** of **X509Cert**.| | cryptoFramework.PubKey | Public key of the X509 certificate obtained. This object is used only for **verify()** of **X509Cert**.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -399,6 +442,15 @@ Checks the validity period of this X.509 certificate. This API uses an asynchron ...@@ -399,6 +442,15 @@ Checks the validity period of this X.509 certificate. This API uses an asynchron
| -------- | -------------- | ---- | ---------- | | -------- | -------------- | ---- | ---------- |
| date | string | Yes | Date in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The date must end with **Z**, which indicates the UTC.| | date | string | Yes | Date in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The date must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired.|
**Example** **Example**
```js ```js
...@@ -514,6 +566,14 @@ Obtains the X.509 certificate issuer. ...@@ -514,6 +566,14 @@ Obtains the X.509 certificate issuer.
| --------------------- | ---------------------- | | --------------------- | ---------------------- |
| [DataBlob](#datablob) | X.509 certificate issuer obtained.| | [DataBlob](#datablob) | X.509 certificate issuer obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -550,6 +610,14 @@ Obtains the subject of this X.509 certificate. ...@@ -550,6 +610,14 @@ Obtains the subject of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Subject name obtained.| | [DataBlob](#datablob) | Subject name obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -586,6 +654,14 @@ Obtains the start time of this X.509 certificate. ...@@ -586,6 +654,14 @@ Obtains the start time of this X.509 certificate.
| ------ | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ |
| string | Start time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| | string | Start time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -622,6 +698,14 @@ Obtains the expiration time of this X.509 certificate. ...@@ -622,6 +698,14 @@ Obtains the expiration time of this X.509 certificate.
| ------ | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ |
| string | Expiration time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| | string | Expiration time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -658,6 +742,14 @@ Obtains the signature data of this X.509 certificate. ...@@ -658,6 +742,14 @@ Obtains the signature data of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Signature data obtained.| | [DataBlob](#datablob) | Signature data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -694,6 +786,14 @@ Obtains the signing algorithm of this X.509 certificate. ...@@ -694,6 +786,14 @@ Obtains the signing algorithm of this X.509 certificate.
| ------ | ------------------------ | | ------ | ------------------------ |
| string | X.509 certificate signing algorithm obtained.| | string | X.509 certificate signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -730,6 +830,14 @@ Obtains the object identifier (OID) of the X.509 certificate signing algorithm. ...@@ -730,6 +830,14 @@ Obtains the object identifier (OID) of the X.509 certificate signing algorithm.
| ------ | --------------------------------- | | ------ | --------------------------------- |
| string | OID obtained.| | string | OID obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -766,6 +874,14 @@ Obtains the signing algorithm parameters of this X.509 certificate. ...@@ -766,6 +874,14 @@ Obtains the signing algorithm parameters of this X.509 certificate.
| --------------------- | ------------------------ | | --------------------- | ------------------------ |
| [DataBlob](#datablob) | X.509 certificate signing algorithm parameters obtained.| | [DataBlob](#datablob) | X.509 certificate signing algorithm parameters obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -802,6 +918,13 @@ Obtains the key usage of this X.509 certificate. ...@@ -802,6 +918,13 @@ Obtains the key usage of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Key usage of the X.509 certificate obtained.| | [DataBlob](#datablob) | Key usage of the X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -838,6 +961,14 @@ Obtains the usage of the extended key of this X.509 certificate. ...@@ -838,6 +961,14 @@ Obtains the usage of the extended key of this X.509 certificate.
| ----------------------- | ------------------------ | | ----------------------- | ------------------------ |
| [DataArray](#dataarray) | Usage of the extended key obtained.| | [DataArray](#dataarray) | Usage of the extended key obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -910,6 +1041,14 @@ Obtains the Subject Alternative Names (SANs) of this X.509 certificate. ...@@ -910,6 +1041,14 @@ Obtains the Subject Alternative Names (SANs) of this X.509 certificate.
| ----------------------- | ------------------------ | | ----------------------- | ------------------------ |
| [DataArray](#dataarray) | SANs obtained.| | [DataArray](#dataarray) | SANs obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -946,6 +1085,14 @@ Obtains the Issuer Alternative Names (IANs) of this X.509 certificate. ...@@ -946,6 +1085,14 @@ Obtains the Issuer Alternative Names (IANs) of this X.509 certificate.
| ----------------------- | -------------------------- | | ----------------------- | -------------------------- |
| [DataArray](#dataarray) | IANs obtained.| | [DataArray](#dataarray) | IANs obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -983,6 +1130,11 @@ Creates an **X509Crl** instance. This API uses an asynchronous callback to retur ...@@ -983,6 +1130,11 @@ Creates an **X509Crl** instance. This API uses an asynchronous callback to retur
| inStream | [EncodingBlob](#encodingblob) | Yes | Serialized certificate revocation list (CRL) data. | | inStream | [EncodingBlob](#encodingblob) | Yes | Serialized certificate revocation list (CRL) data. |
| callback | AsyncCallback\<X509Crl> | Yes | Callback invoked to return the result. Promise used to return the **X509Crl** instance created.| | callback | AsyncCallback\<X509Crl> | Yes | Callback invoked to return the result. Promise used to return the **X509Crl** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
...@@ -1025,6 +1177,12 @@ Creates an **X509Crl** instance. This API uses a promise to return the result. ...@@ -1025,6 +1177,12 @@ Creates an **X509Crl** instance. This API uses a promise to return the result.
| ----------------- | -------------------- | | ----------------- | -------------------- |
| Promise\<X509Crl> | Promise used to return the **X509Crl** instance created.| | Promise\<X509Crl> | Promise used to return the **X509Crl** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
```js ```js
...@@ -1146,6 +1304,13 @@ Obtains the serialized X.509 CRL data. This API uses an asynchronous callback to ...@@ -1146,6 +1304,13 @@ Obtains the serialized X.509 CRL data. This API uses an asynchronous callback to
| -------- | ---------------------------- | ---- | ------------------------------------------ | | -------- | ---------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<EncodingBlob> | Yes | Callback invoked to return the serialized X.509 CRL data obtained.| | callback | AsyncCallback\<EncodingBlob> | Yes | Callback invoked to return the serialized X.509 CRL data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1189,6 +1354,14 @@ Obtains the serialized X.509 CRL data. This API uses a promise to return the res ...@@ -1189,6 +1354,14 @@ Obtains the serialized X.509 CRL data. This API uses a promise to return the res
| ---------------------- | -------------------------------- | | ---------------------- | -------------------------------- |
| Promise\<EncodingBlob> | Promise used to return the serialized X.509 CRL data obtained.| | Promise\<EncodingBlob> | Promise used to return the serialized X.509 CRL data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1217,7 +1390,7 @@ cryptoCert.createX509Crl(encodingBlob).then(x509Crl => { ...@@ -1217,7 +1390,7 @@ cryptoCert.createX509Crl(encodingBlob).then(x509Crl => {
verify(key : cryptoFramework.PubKey, callback : AsyncCallback\<void>) : void verify(key : cryptoFramework.PubKey, callback : AsyncCallback\<void>) : void
Verifies the signature of the X.509 CRL. This API uses an asynchronous callback to return the result. Verifies the signature of the X.509 CRL. This API uses an asynchronous callback to return the result. The RSA algorithm is supported.
**System capability**: SystemCapability.Security.Cert **System capability**: SystemCapability.Security.Cert
...@@ -1225,9 +1398,14 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback ...@@ -1225,9 +1398,14 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1264,7 +1442,7 @@ cryptoCert.createX509Crl(encodingBlob, function (error, x509Crl) { ...@@ -1264,7 +1442,7 @@ cryptoCert.createX509Crl(encodingBlob, function (error, x509Crl) {
verify(key : cryptoFramework.PubKey) : Promise\<void> verify(key : cryptoFramework.PubKey) : Promise\<void>
Verifies the signature of the X.509 CRL. This API uses a promise to return the result. Verifies the signature of the X.509 CRL. This API uses a promise to return the result. The RSA algorithm is supported.
**System capability**: SystemCapability.Security.Cert **System capability**: SystemCapability.Security.Cert
...@@ -1280,6 +1458,12 @@ Verifies the signature of the X.509 CRL. This API uses a promise to return the r ...@@ -1280,6 +1458,12 @@ Verifies the signature of the X.509 CRL. This API uses a promise to return the r
| ---- | ------------------------------------------------------------ | | ---- | ------------------------------------------------------------ |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1357,6 +1541,14 @@ Obtains the issuer of the X.509 CRL. ...@@ -1357,6 +1541,14 @@ Obtains the issuer of the X.509 CRL.
| --------------------- | ------------------------------ | | --------------------- | ------------------------------ |
| [DataBlob](#datablob) | Issuer of the X.509 CRL obtained.| | [DataBlob](#datablob) | Issuer of the X.509 CRL obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1393,6 +1585,14 @@ Obtains the date when the X.509 CRL was last updated. ...@@ -1393,6 +1585,14 @@ Obtains the date when the X.509 CRL was last updated.
| ------ | ------------------------------------ | | ------ | ------------------------------------ |
| string | Last update date of the X.509 CRL.| | string | Last update date of the X.509 CRL.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1429,6 +1629,14 @@ Obtains the date when the CRL will be updated the next time. ...@@ -1429,6 +1629,14 @@ Obtains the date when the CRL will be updated the next time.
| ------ | ------------------------------------ | | ------ | ------------------------------------ |
| string | Next update date obtained.| | string | Next update date obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1471,6 +1679,13 @@ Obtains the revoked X.509 certificate based on the specified serial number of th ...@@ -1471,6 +1679,13 @@ Obtains the revoked X.509 certificate based on the specified serial number of th
| ---------------------- | --------------------- | | ---------------------- | --------------------- |
| X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1519,6 +1734,13 @@ Obtains the revoked X.509 certificate based on the specified certificate. This A ...@@ -1519,6 +1734,13 @@ Obtains the revoked X.509 certificate based on the specified certificate. This A
| ------------ | -------------------- | | ------------ | -------------------- |
| X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1561,6 +1783,12 @@ Obtains all the revoked X.509 certificates. This API uses an asynchronous callba ...@@ -1561,6 +1783,12 @@ Obtains all the revoked X.509 certificates. This API uses an asynchronous callba
| -------- | ----------------------------------- | ---- | -------------------------------- | | -------- | ----------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback<Array\<X509CrlEntry>> | Yes | Callback invoked to return the result. Promise used to return a list of revoked X.509 certificates.| | callback | AsyncCallback<Array\<X509CrlEntry>> | Yes | Callback invoked to return the result. Promise used to return a list of revoked X.509 certificates.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1604,6 +1832,13 @@ Obtains all the revoked X.509 certificates. This API uses a promise to return th ...@@ -1604,6 +1832,13 @@ Obtains all the revoked X.509 certificates. This API uses a promise to return th
| ----------------------------- | ---------------------- | | ----------------------------- | ---------------------- |
| Promise<Array\<X509CrlEntry>> | Promise used to return a list of revoked X.509 certificates.| | Promise<Array\<X509CrlEntry>> | Promise used to return a list of revoked X.509 certificates.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1642,6 +1877,14 @@ Obtains the DER-encoded CRL information, the **tbsCertList** from this CRL. This ...@@ -1642,6 +1877,14 @@ Obtains the DER-encoded CRL information, the **tbsCertList** from this CRL. This
| --------------------- | ------------------------------- | | --------------------- | ------------------------------- |
| [DataBlob](#datablob) | Promise used to return the **tbsCertList** information obtained.| | [DataBlob](#datablob) | Promise used to return the **tbsCertList** information obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1682,6 +1925,14 @@ Obtains the signature data of the X.509 CRL. ...@@ -1682,6 +1925,14 @@ Obtains the signature data of the X.509 CRL.
| --------------------- | ------------------------------ | | --------------------- | ------------------------------ |
| [DataBlob](#datablob) | Signature data of the X.509 CRL obtained.| | [DataBlob](#datablob) | Signature data of the X.509 CRL obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1718,6 +1969,14 @@ Obtains the signing algorithm of the X.509 CRL. ...@@ -1718,6 +1969,14 @@ Obtains the signing algorithm of the X.509 CRL.
| ------ | -------------------------------- | | ------ | -------------------------------- |
| string | Signing algorithm obtained.| | string | Signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1754,6 +2013,14 @@ Obtains the OID of the X.509 CRL signing algorithm. OIDs are allocated by the In ...@@ -1754,6 +2013,14 @@ Obtains the OID of the X.509 CRL signing algorithm. OIDs are allocated by the In
| ------ | --------------------------------------------- | | ------ | --------------------------------------------- |
| string | OID of the X.509 CRL signing algorithm obtained.| | string | OID of the X.509 CRL signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1790,6 +2057,14 @@ Obtains the parameters of the X.509 CRL signing algorithm. ...@@ -1790,6 +2057,14 @@ Obtains the parameters of the X.509 CRL signing algorithm.
| --------------------- | ---------------------------------- | | --------------------- | ---------------------------------- |
| [DataBlob](#datablob) | Algorithm parameters obtained.| | [DataBlob](#datablob) | Algorithm parameters obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1832,6 +2107,14 @@ Creates a **CertChainValidator** object. ...@@ -1832,6 +2107,14 @@ Creates a **CertChainValidator** object.
| ------------------ | -------------------- | | ------------------ | -------------------- |
| CertChainValidator | **CertChainValidator** object created.| | CertChainValidator | **CertChainValidator** object created.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1847,7 +2130,7 @@ Provides APIs for certificate chain validator operations. ...@@ -1847,7 +2130,7 @@ Provides APIs for certificate chain validator operations.
### Attributes ### Attributes
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.Cert
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------- | ------ | ---- | ---- | -------------------------- | | ------- | ------ | ---- | ---- | -------------------------- |
...@@ -1870,6 +2153,19 @@ The certificate chain validator does not verify the certificate validity period ...@@ -1870,6 +2153,19 @@ The certificate chain validator does not verify the certificate validity period
| certChain | [CertChainData](#certchaindata) | Yes | Serialized X.509 certificate chain data. | | certChain | [CertChainData](#certchaindata) | Yes | Serialized X.509 certificate chain data. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the X.509 certificate chain is valid. If **error** is not **null**, the X.509 certificate chain is not valid.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the X.509 certificate chain is valid. If **error** is not **null**, the X.509 certificate chain is not valid.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
| 19030002 | The certificate signature verification failed. |
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired. |
| 19030005 | Failed to obtain the certificate issuer. |
| 19030006 | The key cannot be used for signing a certificate. |
| 19030007 | The key cannot be used for digital signature. |
**Example** **Example**
...@@ -1917,6 +2213,20 @@ The certificate chain validator does not verify the certificate validity period ...@@ -1917,6 +2213,20 @@ The certificate chain validator does not verify the certificate validity period
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
| 19030002 | The certificate signature verification failed. |
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired. |
| 19030005 | Failed to obtain the certificate issuer. |
| 19030006 | The key cannot be used for signing a certificate. |
| 19030007 | The key cannot be used for digital signature. |
**Example** **Example**
```js ```js
...@@ -1981,6 +2291,13 @@ Obtains the serialized data of this revoked certificate. This API uses an asynch ...@@ -1981,6 +2291,13 @@ Obtains the serialized data of this revoked certificate. This API uses an asynch
| -------- | --------------------------------------------- | ---- | ------------------------------------ | | -------- | --------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized data of the revoked certificate obtained.| | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized data of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -2012,6 +2329,14 @@ Obtains the serialized data of this revoked certificate. This API uses a promise ...@@ -2012,6 +2329,14 @@ Obtains the serialized data of this revoked certificate. This API uses a promise
| --------------------------------------- | -------------------------- | | --------------------------------------- | -------------------------- |
| Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized data of the revoked certificate obtained.| | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized data of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -2061,9 +2386,16 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca ...@@ -2061,9 +2386,16 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ---------------------- - | | --------------------- | ----------------------- |
| [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.| | [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | -------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
**Example** **Example**
```js ```js
...@@ -2092,6 +2424,14 @@ Obtains the date when the certificate was revoked. This API uses an asynchronous ...@@ -2092,6 +2424,14 @@ Obtains the date when the certificate was revoked. This API uses an asynchronous
| ------ | ------------------ | | ------ | ------------------ |
| string | Promise used to return the certificate revocation date obtained.| | string | Promise used to return the certificate revocation date obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
......
...@@ -28,7 +28,7 @@ Provides the **KVManager** instance configuration, including the bundle name of ...@@ -28,7 +28,7 @@ Provides the **KVManager** instance configuration, including the bundle name of
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | --------------------- | ---- | ------------------------------------------------------------ | | ---------- | --------------------- | ---- | ------------------------------------------------------------ |
| context | Context | Yes |Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For the application context of the stage model, see [Context](js-apis-ability-context.md).| | context | Context | Yes |Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name. |
## Constants ## Constants
...@@ -272,7 +272,6 @@ Stage model: ...@@ -272,7 +272,6 @@ Stage model:
```js ```js
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let kvManager; let kvManager;
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
onCreate() { onCreate() {
...@@ -358,7 +357,7 @@ try { ...@@ -358,7 +357,7 @@ try {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Obtained the KVStore successfully."); console.log("Succeeded in getting KVStore");
kvStore = store; kvStore = store;
}); });
} catch (e) { } catch (e) {
...@@ -411,7 +410,7 @@ try { ...@@ -411,7 +410,7 @@ try {
securityLevel: distributedKVStore.SecurityLevel.S2, securityLevel: distributedKVStore.SecurityLevel.S2,
}; };
kvManager.getKVStore('storeId', options).then((store) => { kvManager.getKVStore('storeId', options).then((store) => {
console.log("Obtained the KVStore successfully."); console.log("Succeeded in getting KVStore");
kvStore = store; kvStore = store;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
...@@ -453,14 +452,14 @@ const options = { ...@@ -453,14 +452,14 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options, async function (err, store) { kvManager.getKVStore('storeId', options, async function (err, store) {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.closeKVStore('appId', 'storeId', function (err, data) { kvManager.closeKVStore('appId', 'storeId', function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the KVStore successfully.'); console.log('Succeeded in closing KVStore');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -505,10 +504,10 @@ const options = { ...@@ -505,10 +504,10 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options).then(async (store) => { kvManager.getKVStore('storeId', options).then(async (store) => {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.closeKVStore('appId', 'storeId').then(() => { kvManager.closeKVStore('appId', 'storeId').then(() => {
console.log('Closed the KVStore successfully.'); console.log('Succeeded in closing KVStore');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -564,14 +563,14 @@ try { ...@@ -564,14 +563,14 @@ try {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.deleteKVStore('appId', 'storeId', function (err, data) { kvManager.deleteKVStore('appId', 'storeId', function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Deleted the KVStore successfully.`); console.log(`Succeeded in deleting KVStore`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -624,10 +623,10 @@ const options = { ...@@ -624,10 +623,10 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options).then(async (store) => { kvManager.getKVStore('storeId', options).then(async (store) => {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.deleteKVStore('appId', 'storeId').then(() => { kvManager.deleteKVStore('appId', 'storeId').then(() => {
console.log('Deleted the KVStore successfully.'); console.log('Succeeded in deleting KVStore');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -664,7 +663,7 @@ try { ...@@ -664,7 +663,7 @@ try {
console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained all KV store IDs successfully.'); console.log('Succeeded in getting AllKVStoreId');
console.log(`GetAllKVStoreId size = ${data.length}`); console.log(`GetAllKVStoreId size = ${data.length}`);
}); });
} catch (e) { } catch (e) {
...@@ -699,7 +698,7 @@ let kvManager; ...@@ -699,7 +698,7 @@ let kvManager;
try { try {
console.log('GetAllKVStoreId'); console.log('GetAllKVStoreId');
kvManager.getAllKVStoreId('appId').then((data) => { kvManager.getAllKVStoreId('appId').then((data) => {
console.log('Obtained all KV store IDs successfully.'); console.log('Succeeded in getting AllKVStoreId');
console.log(`GetAllKVStoreId size = ${data.length}`); console.log(`GetAllKVStoreId size = ${data.length}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`);
...@@ -829,7 +828,7 @@ let kvStore; ...@@ -829,7 +828,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('getResultSet succeeded.');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.log('getResultSet failed: ' + err); console.log('getResultSet failed: ' + err);
...@@ -1000,7 +999,7 @@ let kvStore; ...@@ -1000,7 +999,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -1039,7 +1038,7 @@ let kvStore; ...@@ -1039,7 +1038,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -1242,7 +1241,7 @@ Resets the **Query** object. ...@@ -1242,7 +1241,7 @@ Resets the **Query** object.
| Type | Description | | Type | Description |
| -------------- | --------------------- | | -------------- | --------------------- |
| [Query](query) | **Query** object reset.| | [Query](#query) | **Query** object reset.|
**Example** **Example**
...@@ -1278,7 +1277,7 @@ Creates a **Query** object to match the specified field whose value is equal to ...@@ -1278,7 +1277,7 @@ Creates a **Query** object to match the specified field whose value is equal to
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1312,7 +1311,7 @@ Creates a **Query** object to match the specified field whose value is not equal ...@@ -1312,7 +1311,7 @@ Creates a **Query** object to match the specified field whose value is not equal
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1345,7 +1344,7 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1345,7 +1344,7 @@ Creates a **Query** object to match the specified field whose value is greater t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1380,7 +1379,7 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1380,7 +1379,7 @@ Creates a **Query** object to match the specified field whose value is less than
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1415,7 +1414,7 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1415,7 +1414,7 @@ Creates a **Query** object to match the specified field whose value is greater t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1450,7 +1449,7 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1450,7 +1449,7 @@ Creates a **Query** object to match the specified field whose value is less than
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1483,7 +1482,7 @@ Creates a **Query** object to match the specified field whose value is **null**. ...@@ -1483,7 +1482,7 @@ Creates a **Query** object to match the specified field whose value is **null**.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1517,7 +1516,7 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1517,7 +1516,7 @@ Creates a **Query** object to match the specified field whose value is within th
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1551,7 +1550,7 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1551,7 +1550,7 @@ Creates a **Query** object to match the specified field whose value is within th
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1585,7 +1584,7 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1585,7 +1584,7 @@ Creates a **Query** object to match the specified field whose value is not withi
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1619,7 +1618,7 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1619,7 +1618,7 @@ Creates a **Query** object to match the specified field whose value is not withi
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1653,7 +1652,7 @@ Creates a **Query** object to match the specified field whose value is similar t ...@@ -1653,7 +1652,7 @@ Creates a **Query** object to match the specified field whose value is similar t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1687,7 +1686,7 @@ Creates a **Query** object to match the specified field whose value is not simil ...@@ -1687,7 +1686,7 @@ Creates a **Query** object to match the specified field whose value is not simil
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1714,7 +1713,7 @@ Creates a **Query** object with the AND condition. ...@@ -1714,7 +1713,7 @@ Creates a **Query** object with the AND condition.
| Type | Description | | Type | Description |
| -------------- | -------------- | | -------------- | -------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1743,7 +1742,7 @@ Creates a **Query** object with the OR condition. ...@@ -1743,7 +1742,7 @@ Creates a **Query** object with the OR condition.
| Type | Description | | Type | Description |
| -------------- | -------------- | | -------------- | -------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1778,7 +1777,7 @@ Creates a **Query** object to sort the query results in ascending order. ...@@ -1778,7 +1777,7 @@ Creates a **Query** object to sort the query results in ascending order.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1812,7 +1811,7 @@ Creates a **Query** object to sort the query results in descending order. ...@@ -1812,7 +1811,7 @@ Creates a **Query** object to sort the query results in descending order.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1847,7 +1846,7 @@ Creates a **Query** object to specify the number of results and where to start. ...@@ -1847,7 +1846,7 @@ Creates a **Query** object to specify the number of results and where to start.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1883,7 +1882,7 @@ Creates a **Query** object to match the specified field whose value is not **nul ...@@ -1883,7 +1882,7 @@ Creates a **Query** object to match the specified field whose value is not **nul
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1910,7 +1909,7 @@ Creates a **Query** object for a query condition group with a left parenthesis. ...@@ -1910,7 +1909,7 @@ Creates a **Query** object for a query condition group with a left parenthesis.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1939,7 +1938,7 @@ Creates a **Query** object for a query condition group with a right parenthesis. ...@@ -1939,7 +1938,7 @@ Creates a **Query** object for a query condition group with a right parenthesis.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1974,7 +1973,7 @@ Creates a **Query** object with a specified key prefix. ...@@ -1974,7 +1973,7 @@ Creates a **Query** object with a specified key prefix.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2008,7 +2007,7 @@ Creates a **Query** object with an index preferentially used for query. ...@@ -2008,7 +2007,7 @@ Creates a **Query** object with an index preferentially used for query.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2042,7 +2041,7 @@ Creates a **Query** object with the device ID as the key prefix. ...@@ -2042,7 +2041,7 @@ Creates a **Query** object with the device ID as the key prefix.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2125,7 +2124,7 @@ try { ...@@ -2125,7 +2124,7 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`);
...@@ -2170,7 +2169,7 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2170,7 +2169,7 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2226,12 +2225,12 @@ try { ...@@ -2226,12 +2225,12 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -2289,9 +2288,9 @@ try { ...@@ -2289,9 +2288,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -2349,7 +2348,7 @@ try { ...@@ -2349,7 +2348,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}) })
} catch (e) { } catch (e) {
console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`);
...@@ -2402,7 +2401,7 @@ try { ...@@ -2402,7 +2401,7 @@ try {
v8Arr.push(vb2); v8Arr.push(vb2);
v8Arr.push(vb3); v8Arr.push(vb3);
kvStore.putBatch(v8Arr).then(async (data) => { kvStore.putBatch(v8Arr).then(async (data) => {
console.log(`Batch put data successfully.`); console.log(`Succeeded in putting patch`);
}).catch((err) => { }).catch((err) => {
console.error(`putBatch fail.code is ${err.code},message is ${err.message}`); console.error(`putBatch fail.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2447,13 +2446,13 @@ try { ...@@ -2447,13 +2446,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2498,9 +2497,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2498,9 +2497,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully: ${data}`); console.log(`Succeeded in putting: ${data}`);
kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2547,7 +2546,7 @@ try { ...@@ -2547,7 +2546,7 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
kvStore.delete(predicates, function (err, data) { kvStore.delete(predicates, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
} else { } else {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
} }
...@@ -2599,9 +2598,9 @@ try { ...@@ -2599,9 +2598,9 @@ try {
let arr = ["name"]; let arr = ["name"];
predicates.inKeys(arr); predicates.inKeys(arr);
kvStore.put("name", "bob").then((data) => { kvStore.put("name", "bob").then((data) => {
console.log(`Put data successfully: ${data}`); console.log(`Succeeded in putting: ${data}`);
kvStore.delete(predicates).then((data) => { kvStore.delete(predicates).then((data) => {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2662,13 +2661,13 @@ try { ...@@ -2662,13 +2661,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.deleteBatch(keys, async function (err, data) { kvStore.deleteBatch(keys, async function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch deleted data successfully.'); console.log('Succeeded in deleting Batch');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2726,9 +2725,9 @@ try { ...@@ -2726,9 +2725,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (data) => { kvStore.putBatch(entries).then(async (data) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.deleteBatch(keys).then((err) => { kvStore.deleteBatch(keys).then((err) => {
console.log('Batch deleted data successfully.'); console.log('Succeeded in deleting Batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2771,15 +2770,15 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -2771,15 +2770,15 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) {
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const deviceid = 'no_exist_device_id'; const deviceid = 'no_exist_device_id';
kvStore.removeDeviceData(deviceid, async function (err, data) { kvStore.removeDeviceData(deviceid, async function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Removed device data successfully.'); console.log('succeeded in removing device data');
} else { } else {
console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `);
kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) {
console.log('Obtained data successfully.'); console.log('Succeeded in getting data');
}); });
} }
}); });
...@@ -2825,18 +2824,18 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -2825,18 +2824,18 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => {
console.log('Put data successfully.'); console.log('Succeeded in putting data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put data.code is ${err.code},message is ${err.message} `); console.error(`Fail to put data.code is ${err.code},message is ${err.message} `);
}); });
const deviceid = 'no_exist_device_id'; const deviceid = 'no_exist_device_id';
kvStore.removeDeviceData(deviceid).then((err) => { kvStore.removeDeviceData(deviceid).then((err) => {
console.log('Removed device data successfully.'); console.log('succeeded in removing device data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `);
}); });
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Obtained data successfully.'); console.log('Succeeded in getting data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get data.code is ${err.code},message is ${err.message} `); console.error(`Fail to get data.code is ${err.code},message is ${err.message} `);
}); });
...@@ -2882,13 +2881,13 @@ try { ...@@ -2882,13 +2881,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2934,9 +2933,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2934,9 +2933,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting data.data=${data}`);
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2995,13 +2994,13 @@ try { ...@@ -2995,13 +2994,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -3059,9 +3058,9 @@ try { ...@@ -3059,9 +3058,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -3086,7 +3085,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an ...@@ -3086,7 +3085,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------- | | -------- | -------------------------------------- | ---- | ----------------------------------------------- |
| query | [Query](query) | Yes | Key prefix to match. | | query | [Query](#query) | Yes | Key prefix to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -3118,7 +3117,7 @@ try { ...@@ -3118,7 +3117,7 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query, function (err, entries) { kvStore.getEntries(query, function (err, entries) {
...@@ -3126,7 +3125,7 @@ try { ...@@ -3126,7 +3125,7 @@ try {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -3148,7 +3147,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a ...@@ -3148,7 +3147,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3185,18 +3184,18 @@ try { ...@@ -3185,18 +3184,18 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entries) => { kvStore.getEntries(query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`)
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
} catch (e) { } catch (e) {
console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -3249,20 +3248,20 @@ try { ...@@ -3249,20 +3248,20 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getResultSet('batch_test_string_key', async function (err, result) { kvStore.getResultSet('batch_test_string_key', async function (err, result) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
}); });
...@@ -3319,18 +3318,18 @@ try { ...@@ -3319,18 +3318,18 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3386,7 +3385,7 @@ try { ...@@ -3386,7 +3385,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query, async function (err, result) { kvStore.getResultSet(query, async function (err, result) {
...@@ -3394,7 +3393,7 @@ try { ...@@ -3394,7 +3393,7 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -3414,7 +3413,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec ...@@ -3414,7 +3413,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3450,14 +3449,14 @@ try { ...@@ -3450,14 +3449,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query).then((result) => { kvStore.getResultSet(query).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
...@@ -3508,14 +3507,14 @@ try { ...@@ -3508,14 +3507,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -3565,13 +3564,13 @@ try { ...@@ -3565,13 +3564,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet(predicates).then((result) => { kvStore.getResultSet(predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3603,7 +3602,7 @@ try { ...@@ -3603,7 +3602,7 @@ try {
let resultSet = null; let resultSet = null;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
} else { } else {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
} }
...@@ -3640,7 +3639,7 @@ let kvStore; ...@@ -3640,7 +3639,7 @@ let kvStore;
try { try {
let resultSet = null; let resultSet = null;
kvStore.closeResultSet(resultSet).then(() => { kvStore.closeResultSet(resultSet).then(() => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3661,7 +3660,7 @@ Obtains the number of results that matches the specified **Query** object. This ...@@ -3661,7 +3660,7 @@ Obtains the number of results that matches the specified **Query** object. This
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------------------- |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.|
**Error codes** **Error codes**
...@@ -3691,7 +3690,7 @@ try { ...@@ -3691,7 +3690,7 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query, async function (err, resultSize) { kvStore.getResultSize(query, async function (err, resultSize) {
...@@ -3699,7 +3698,7 @@ try { ...@@ -3699,7 +3698,7 @@ try {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -3719,7 +3718,7 @@ Obtains the number of results that matches the specified **Query** object. This ...@@ -3719,7 +3718,7 @@ Obtains the number of results that matches the specified **Query** object. This
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3754,14 +3753,14 @@ try { ...@@ -3754,14 +3753,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query).then((resultSize) => { kvStore.getResultSize(query).then((resultSize) => {
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3803,7 +3802,7 @@ try { ...@@ -3803,7 +3802,7 @@ try {
if (err) { if (err) {
console.error(`Fail to backup.code is ${err.code},message is ${err.message} `); console.error(`Fail to backup.code is ${err.code},message is ${err.message} `);
} else { } else {
console.info(`Backed up data successfully. data=${data}`); console.info(`Succeeded in backupping data.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -3846,7 +3845,7 @@ let kvStore; ...@@ -3846,7 +3845,7 @@ let kvStore;
let file = "BK001"; let file = "BK001";
try { try {
kvStore.backup(file).then((data) => { kvStore.backup(file).then((data) => {
console.info(`Backed up data successfully. data=${data}`); console.info(`Succeeded in backupping data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to backup.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3888,7 +3887,7 @@ try { ...@@ -3888,7 +3887,7 @@ try {
if (err) { if (err) {
console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); console.error(`Fail to restore.code is ${err.code},message is ${err.message}`);
} else { } else {
console.info(`Restored data successfully. data=${data}`); console.info(`Succeeded in restoring data.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -3931,7 +3930,7 @@ let kvStore; ...@@ -3931,7 +3930,7 @@ let kvStore;
let file = "BK001"; let file = "BK001";
try { try {
kvStore.restore(file).then((data) => { kvStore.restore(file).then((data) => {
console.info(`Restored data successfully. data=${data}`); console.info(`Succeeded in restoring data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); console.error(`Fail to restore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3965,7 +3964,7 @@ try { ...@@ -3965,7 +3964,7 @@ try {
if (err) { if (err) {
console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`);
} else { } else {
console.info(`Deleted the backup file successfully. data=${data}`); console.info(`Succeed in deleting Backup.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -4000,7 +3999,7 @@ let kvStore; ...@@ -4000,7 +3999,7 @@ let kvStore;
let files = ["BK001", "BK002"]; let files = ["BK001", "BK002"];
try { try {
kvStore.deleteBackup(files).then((data) => { kvStore.deleteBackup(files).then((data) => {
console.info(`Deleted the backup file successfully. data=${data}`); console.info(`Succeed in deleting Backup.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`);
}) })
...@@ -4061,7 +4060,7 @@ try { ...@@ -4061,7 +4060,7 @@ try {
console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Started the transaction successfully.'); console.log('Succeeded in starting Transaction');
let entries = putBatchString(10, 'batch_test_string_key'); let entries = putBatchString(10, 'batch_test_string_key');
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
...@@ -4069,7 +4068,7 @@ try { ...@@ -4069,7 +4068,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -4110,7 +4109,7 @@ try { ...@@ -4110,7 +4109,7 @@ try {
count++; count++;
}); });
kvStore.startTransaction().then(async (err) => { kvStore.startTransaction().then(async (err) => {
console.log('Started the transaction successfully.'); console.log('Succeeded in starting Transaction');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4148,7 +4147,7 @@ let kvStore; ...@@ -4148,7 +4147,7 @@ let kvStore;
try { try {
kvStore.commit(function (err, data) { kvStore.commit(function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Committed the transaction successfully.'); console.log('Succeeded in committing');
} else { } else {
console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); console.error(`Fail to commit.code is ${err.code},message is ${err.message}`);
} }
...@@ -4186,7 +4185,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4186,7 +4185,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.commit().then(async (err) => { kvStore.commit().then(async (err) => {
console.log('Committed the transaction successfully.'); console.log('Succeeded in committing');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); console.error(`Fail to commit.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4224,7 +4223,7 @@ let kvStore; ...@@ -4224,7 +4223,7 @@ let kvStore;
try { try {
kvStore.rollback(function (err,data) { kvStore.rollback(function (err,data) {
if (err == undefined) { if (err == undefined) {
console.log('Rolled back the transaction successfully'); console.log('Succeeded in rolling back');
} else { } else {
console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`);
} }
...@@ -4262,7 +4261,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4262,7 +4261,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.rollback().then(async (err) => { kvStore.rollback().then(async (err) => {
console.log('Rolled back the transaction successfully'); console.log('Succeeded in rolling back');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4293,7 +4292,7 @@ let kvStore; ...@@ -4293,7 +4292,7 @@ let kvStore;
try { try {
kvStore.enableSync(true, function (err, data) { kvStore.enableSync(true, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Enabled sync successfully.'); console.log('Succeeded in enabling sync');
} else { } else {
console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`);
} }
...@@ -4329,7 +4328,7 @@ Sets data synchronization, which can be enabled or disabled. This API uses a pro ...@@ -4329,7 +4328,7 @@ Sets data synchronization, which can be enabled or disabled. This API uses a pro
let kvStore; let kvStore;
try { try {
kvStore.enableSync(true).then((err) => { kvStore.enableSync(true).then((err) => {
console.log('Enabled sync successfully.'); console.log('Succeeded in enabling sync');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4366,7 +4365,7 @@ try { ...@@ -4366,7 +4365,7 @@ try {
console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Set syncRange successfully.'); console.log('Succeeded in setting syncRange');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4402,7 +4401,7 @@ try { ...@@ -4402,7 +4401,7 @@ try {
const localLabels = ['A', 'B']; const localLabels = ['A', 'B'];
const remoteSupportLabels = ['C', 'D']; const remoteSupportLabels = ['C', 'D'];
kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => { kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => {
console.log('Set syncRange successfully.'); console.log('Succeeded in setting syncRange');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4437,7 +4436,7 @@ try { ...@@ -4437,7 +4436,7 @@ try {
console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Set syncParam successfully'); console.log('Succeeded in setting syncParam');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4471,7 +4470,7 @@ let kvStore; ...@@ -4471,7 +4470,7 @@ let kvStore;
try { try {
const defaultAllowedDelayMs = 500; const defaultAllowedDelayMs = 500;
kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => { kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => {
console.log('Set syncParam successfully'); console.log('Succeeded in setting syncParam');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4522,7 +4521,7 @@ try { ...@@ -4522,7 +4521,7 @@ try {
console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const devices = ['deviceList']; const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY; const mode = distributedKVStore.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode, 1000); kvStore.sync(devices, mode, 1000);
...@@ -4548,7 +4547,7 @@ Synchronizes the KV store manually. This API returns the result synchronously. F ...@@ -4548,7 +4547,7 @@ Synchronizes the KV store manually. This API returns the result synchronously. F
| --------- | --------------------- | ---- | ---------------------------------------------- | | --------- | --------------------- | ---- | ---------------------------------------------- |
| deviceIds | string[] | Yes | List of IDs of the devices in the same networking environment to be synchronized.| | deviceIds | string[] | Yes | List of IDs of the devices in the same networking environment to be synchronized.|
| mode | [SyncMode](#syncmode) | Yes | Synchronization mode. | | mode | [SyncMode](#syncmode) | Yes | Synchronization mode. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| delayMs | number | No | Allowed synchronization delay time, in ms. | | delayMs | number | No | Allowed synchronization delay time, in ms. |
**Error codes** **Error codes**
...@@ -4575,7 +4574,7 @@ try { ...@@ -4575,7 +4574,7 @@ try {
console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const devices = ['deviceList']; const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY; const mode = distributedKVStore.SyncMode.PULL_ONLY;
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
...@@ -4652,7 +4651,7 @@ try { ...@@ -4652,7 +4651,7 @@ try {
console.log(`syncComplete ${data}`); console.log(`syncComplete ${data}`);
}); });
kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => { kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => {
console.log('Put data successfully.'); console.log('succeeded in putting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4793,7 +4792,7 @@ try { ...@@ -4793,7 +4792,7 @@ try {
console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained securityLevel successfully'); console.log('Succeeded in getting securityLevel');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4828,7 +4827,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4828,7 +4827,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.getSecurityLevel().then((data) => { kvStore.getSecurityLevel().then((data) => {
console.log('Obtained securityLevel successfully'); console.log('Succeeded in getting securityLevel');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4884,13 +4883,13 @@ try { ...@@ -4884,13 +4883,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -4936,9 +4935,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -4936,9 +4935,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting data.data=${data}`);
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4988,13 +4987,13 @@ try { ...@@ -4988,13 +4987,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained data successfully'); console.log('Succeeded in getting');
}); });
}) })
} catch (e) { } catch (e) {
...@@ -5041,9 +5040,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -5041,9 +5040,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => {
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Obtained data successfully'); console.log('Succeeded in getting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5102,13 +5101,13 @@ try { ...@@ -5102,13 +5101,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5166,9 +5165,9 @@ try { ...@@ -5166,9 +5165,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -5229,13 +5228,13 @@ try { ...@@ -5229,13 +5228,13 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) { kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5294,9 +5293,9 @@ try { ...@@ -5294,9 +5293,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
console.log(`entries[0].value: ${entries[0].value}`); console.log(`entries[0].value: ${entries[0].value}`);
...@@ -5324,7 +5323,7 @@ Obtains all KV pairs that match the specified **Query** object for this device. ...@@ -5324,7 +5323,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------------- | | -------- | -------------------------------------- | ---- | ----------------------------------------------------- |
| query | [Query](query) | Yes | Key prefix to match. | | query | [Query](#query) | Yes | Key prefix to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -5356,7 +5355,7 @@ try { ...@@ -5356,7 +5355,7 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query, function (err, entries) { kvStore.getEntries(query, function (err, entries) {
...@@ -5364,7 +5363,7 @@ try { ...@@ -5364,7 +5363,7 @@ try {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5386,7 +5385,7 @@ Obtains all KV pairs that match the specified **Query** object for this device. ...@@ -5386,7 +5385,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -5423,18 +5422,18 @@ try { ...@@ -5423,18 +5422,18 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entries) => { kvStore.getEntries(query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`)
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
} catch (e) { } catch (e) {
console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5453,7 +5452,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th ...@@ -5453,7 +5452,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------- | | -------- | -------------------------------------- | ---- | ------------------------------------------------------- |
| deviceId | string | Yes | ID of the target device. | | deviceId | string | Yes | ID of the target device. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -5489,7 +5488,7 @@ try { ...@@ -5489,7 +5488,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
...@@ -5498,12 +5497,12 @@ try { ...@@ -5498,12 +5497,12 @@ try {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}) })
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
} catch (e) { } catch (e) {
console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5522,7 +5521,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th ...@@ -5522,7 +5521,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | -------------------- | | -------- | -------------- | ---- | -------------------- |
| deviceId | string | Yes | ID of the target device.| | deviceId | string | Yes | ID of the target device.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -5559,19 +5558,19 @@ try { ...@@ -5559,19 +5558,19 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries('localDeviceId', query).then((entries) => { kvStore.getEntries('localDeviceId', query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
} catch (e) { } catch (e) {
console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5624,20 +5623,20 @@ try { ...@@ -5624,20 +5623,20 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getResultSet('batch_test_string_key', async function (err, result) { kvStore.getResultSet('batch_test_string_key', async function (err, result) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
}); });
...@@ -5694,18 +5693,18 @@ try { ...@@ -5694,18 +5693,18 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5750,14 +5749,14 @@ try { ...@@ -5750,14 +5749,14 @@ try {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -5802,13 +5801,13 @@ let kvStore; ...@@ -5802,13 +5801,13 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => { kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5830,7 +5829,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -5830,7 +5829,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;[KVStoreResultSet](#kvstoreresultset)&gt; | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.| | callback | AsyncCallback&lt;[KVStoreResultSet](#kvstoreresultset)&gt; | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.|
**Error codes** **Error codes**
...@@ -5865,7 +5864,7 @@ try { ...@@ -5865,7 +5864,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query, async function (err, result) { kvStore.getResultSet('localDeviceId', query, async function (err, result) {
...@@ -5873,14 +5872,14 @@ try { ...@@ -5873,14 +5872,14 @@ try {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}) })
}); });
}); });
...@@ -5902,7 +5901,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -5902,7 +5901,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -5938,14 +5937,14 @@ try { ...@@ -5938,14 +5937,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query).then((result) => { kvStore.getResultSet('localDeviceId', query).then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -5953,7 +5952,7 @@ try { ...@@ -5953,7 +5952,7 @@ try {
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
console.log("GetResultSet " + query.getSqlLike()); console.log("GetResultSet " + query.getSqlLike());
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5975,7 +5974,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec ...@@ -5975,7 +5974,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -6011,14 +6010,14 @@ try { ...@@ -6011,14 +6010,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query).then((result) => { kvStore.getResultSet(query).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
...@@ -6041,7 +6040,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -6041,7 +6040,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -6077,14 +6076,14 @@ try { ...@@ -6077,14 +6076,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query).then((result) => { kvStore.getResultSet('localDeviceId', query).then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -6092,7 +6091,7 @@ try { ...@@ -6092,7 +6091,7 @@ try {
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
console.log("GetResultSet " + query.getSqlLike()); console.log("GetResultSet " + query.getSqlLike());
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6143,14 +6142,14 @@ try { ...@@ -6143,14 +6142,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -6200,13 +6199,13 @@ try { ...@@ -6200,13 +6199,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet(predicates).then((result) => { kvStore.getResultSet(predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6257,14 +6256,14 @@ try { ...@@ -6257,14 +6256,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -6314,13 +6313,13 @@ try { ...@@ -6314,13 +6313,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet('localDeviceId', predicates).then((result) => { kvStore.getResultSet('localDeviceId', predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6341,7 +6340,7 @@ Obtains the number of results that match the specified **Query** object for this ...@@ -6341,7 +6340,7 @@ Obtains the number of results that match the specified **Query** object for this
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------------------------- |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results that match the specified **Query** object.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results that match the specified **Query** object.|
**Error codes** **Error codes**
...@@ -6371,7 +6370,7 @@ try { ...@@ -6371,7 +6370,7 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query, async function (err, resultSize) { kvStore.getResultSize(query, async function (err, resultSize) {
...@@ -6379,7 +6378,7 @@ try { ...@@ -6379,7 +6378,7 @@ try {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -6399,7 +6398,7 @@ Obtains the number of results that match the specified **Query** object for this ...@@ -6399,7 +6398,7 @@ Obtains the number of results that match the specified **Query** object for this
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -6434,14 +6433,14 @@ try { ...@@ -6434,14 +6433,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query).then((resultSize) => { kvStore.getResultSize(query).then((resultSize) => {
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6463,7 +6462,7 @@ Obtains the number of results that matches the specified device ID and **Query** ...@@ -6463,7 +6462,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | --------------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.|
**Error codes** **Error codes**
...@@ -6497,7 +6496,7 @@ try { ...@@ -6497,7 +6496,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) { kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) {
...@@ -6505,7 +6504,7 @@ try { ...@@ -6505,7 +6504,7 @@ try {
console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained resultSize successfully'); console.log('Succeeded in getting resultSize');
; ;
}); });
}); });
...@@ -6527,7 +6526,7 @@ Obtains the number of results that matches the specified device ID and **Query** ...@@ -6527,7 +6526,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -6562,14 +6561,14 @@ try { ...@@ -6562,14 +6561,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize('localDeviceId', query).then((resultSize) => { kvStore.getResultSize('localDeviceId', query).then((resultSize) => {
console.log('Obtained resultSize successfully'); console.log('Succeeded in getting resultSize');
; ;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`);
......
...@@ -6,6 +6,7 @@ The **fileAccess** module is a framework for accessing and operating user files ...@@ -6,6 +6,7 @@ The **fileAccess** module is a framework for accessing and operating user files
> >
>- The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. >- The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs provided by this module are system APIs and cannot be called by third-party applications. Currently, the APIs can be called only by **FilePicker** and **Files**. >- The APIs provided by this module are system APIs and cannot be called by third-party applications. Currently, the APIs can be called only by **FilePicker** and **Files**.
>- The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
## Modules to Import ## Modules to Import
...@@ -25,9 +26,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in ...@@ -25,9 +26,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise&lt;Array&lt;Want&gt;&gt; | Promise used to return the **want** information obtained.| | Promise&lt;Array&lt;Want&gt;&gt; | Promise used to return the **want** information obtained.|
**Example** **Example**
...@@ -55,9 +56,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in ...@@ -55,9 +56,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| callback | AsyncCallback&lt;Array&lt;Want&gt;&gt; | Yes| Promise used to return the **want** information obtained.| | callback | AsyncCallback&lt;Array&lt;Want&gt;&gt; | Yes| Promise used to return the **want** information obtained.|
**Example** **Example**
...@@ -89,16 +90,16 @@ Synchronously creates a **Helper** object to connect to the specified wants. The ...@@ -89,16 +90,16 @@ Synchronously creates a **Helper** object to connect to the specified wants. The
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| context | Context | Yes| Context of the ability.| | context | Context | Yes| Context of the ability.|
| wants | Array&lt;Want&gt; | Yes| Wants to connect.| | wants | Array&lt;Want&gt; | Yes| Wants to connect.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileAccessHelper | **Helper** object created.| | FileAccessHelper | **Helper** object created.|
**Example** **Example**
...@@ -136,15 +137,15 @@ Synchronously creates a **Helper** object to connect to all file management serv ...@@ -136,15 +137,15 @@ Synchronously creates a **Helper** object to connect to all file management serv
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| context | Context | Yes| Context of the ability.| | context | Context | Yes| Context of the ability.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileAccessHelper | **Helper** object created.| | FileAccessHelper | **Helper** object created.|
**Example** **Example**
...@@ -175,9 +176,9 @@ Obtains information about the device root nodes of the file management service t ...@@ -175,9 +176,9 @@ Obtains information about the device root nodes of the file management service t
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise&lt;RootIterator&gt; | Promise used to return the **RootIterator** object obtained.| | Promise&lt;RootIterator&gt; | Promise used to return the **RootIterator** object obtained.|
**Example** **Example**
...@@ -220,9 +221,9 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) ...@@ -220,9 +221,9 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo)
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| callback | AsyncCallback&lt;RootIterator&gt; | Yes| Promise used to return the **RootIterator** object obtained.| | callback | AsyncCallback&lt;RootIterator&gt; | Yes| Promise used to return the **RootIterator** object obtained.|
**Example** **Example**
...@@ -263,16 +264,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (dire ...@@ -263,16 +264,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (dire
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -314,15 +315,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit ...@@ -314,15 +315,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -364,15 +365,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (direc ...@@ -364,15 +365,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (direc
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -414,16 +415,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit ...@@ -414,16 +415,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -465,10 +466,10 @@ Creates a file in a directory. This API uses a promise to return the result. ...@@ -465,10 +466,10 @@ Creates a file in a directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the parent directory for the file to create.| | uri | string | Yes| URI of the parent directory for the file to create.|
| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.|
**Return value** **Return value**
...@@ -510,11 +511,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return ...@@ -510,11 +511,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the parent directory for the file to create.| | uri | string | Yes| URI of the parent directory for the file to create.|
| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.|
| callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the file created.| | callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the file created.|
**Example** **Example**
...@@ -550,10 +551,10 @@ Creates a directory. This API uses a promise to return the result. ...@@ -550,10 +551,10 @@ Creates a directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| parentUri | string | Yes| URI of the parent directory for the directory to create.| | parentUri | string | Yes| URI of the parent directory for the directory to create.|
| displayName | string | Yes| Name of the directory to create.| | displayName | string | Yes| Name of the directory to create.|
**Return value** **Return value**
...@@ -595,11 +596,11 @@ Creates a directory. This API uses an asynchronous callback to return the result ...@@ -595,11 +596,11 @@ Creates a directory. This API uses an asynchronous callback to return the result
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| parentUri | string | Yes| URI of the parent directory for the directory to create.| | parentUri | string | Yes| URI of the parent directory for the directory to create.|
| displayName | string | Yes| Name of the directory to create.| | displayName | string | Yes| Name of the directory to create.|
| callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the directory created.| | callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the directory created.|
**Example** **Example**
...@@ -635,10 +636,10 @@ Opens a file. This API uses a promise to return the result. ...@@ -635,10 +636,10 @@ Opens a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file to open.| | uri | string | Yes| URI of the file to open.|
| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| | flags | [OPENFLAGS](#openflags) | Yes| File open mode.|
**Return value** **Return value**
...@@ -673,11 +674,11 @@ Opens a file. This API uses an asynchronous callback to return the result. ...@@ -673,11 +674,11 @@ Opens a file. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file to open.| | uri | string | Yes| URI of the file to open.|
| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| | flags | [OPENFLAGS](#openflags) | Yes| File open mode.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the file descriptor of the file opened.| | callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the file descriptor of the file opened.|
**Example** **Example**
...@@ -712,9 +713,9 @@ Deletes a file or directory. This API uses a promise to return the result. ...@@ -712,9 +713,9 @@ Deletes a file or directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or directory to delete.| | uri | string | Yes| URI of the file or directory to delete.|
**Return value** **Return value**
...@@ -751,10 +752,10 @@ Deletes a file or directory. This API uses an asynchronous callback to return th ...@@ -751,10 +752,10 @@ Deletes a file or directory. This API uses an asynchronous callback to return th
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or directory to delete.| | uri | string | Yes| URI of the file or directory to delete.|
| callback | AsyncCallback&lt;number&gt; | Yes| Promise used to return the result.| | callback | AsyncCallback&lt;number&gt; | Yes| Promise used to return the result.|
**Example** **Example**
...@@ -781,7 +782,7 @@ Deletes a file or directory. This API uses an asynchronous callback to return th ...@@ -781,7 +782,7 @@ Deletes a file or directory. This API uses an asynchronous callback to return th
move(sourceFile: string, destFile: string) : Promise&lt;string&gt; move(sourceFile: string, destFile: string) : Promise&lt;string&gt;
Moves a file or directory. This API uses a promise to return the result. Moves a file or directory. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -789,22 +790,22 @@ Moves a file or directory. This API uses a promise to return the result. ...@@ -789,22 +790,22 @@ Moves a file or directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFile | string | Yes| URI of the file or directory to move.| | sourceFile | string | Yes| URI of the file or directory to move.|
| destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| ----- | ------ | | ----- | ------ |
| Promise&lt;string&gt; | Promise used to return the URI of the file or directory in the destination directory.| | Promise&lt;string&gt; | Promise used to return the URI of the file or directory in the destination directory.|
**Example** **Example**
```js ```js
// The media library URI is used as an example. // The media library URI is used as an example.
//In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo.
// You can use the URI obtained. // You can use the URI obtained.
let sourceFile = "datashare:///media/file/102"; let sourceFile = "datashare:///media/file/102";
let destFile = "datashare:///media/file/101"; let destFile = "datashare:///media/file/101";
...@@ -821,7 +822,7 @@ Moves a file or directory. This API uses a promise to return the result. ...@@ -821,7 +822,7 @@ Moves a file or directory. This API uses a promise to return the result.
move(sourceFile: string, destFile: string, callback: AsyncCallback&lt;string&gt;) : void; move(sourceFile: string, destFile: string, callback: AsyncCallback&lt;string&gt;) : void;
Moves a file or directory. This API uses an asynchronous callback to return the result. Moves a file or directory. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -829,17 +830,17 @@ Moves a file or directory. This API uses an asynchronous callback to return the ...@@ -829,17 +830,17 @@ Moves a file or directory. This API uses an asynchronous callback to return the
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFile | string | Yes| URI of the file or directory to move.| | sourceFile | string | Yes| URI of the file or directory to move.|
| destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.|
| callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the file or directory in the destination directory.| | callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the file or directory in the destination directory.|
**Example** **Example**
```js ```js
// The media library URI is used as an example. // The media library URI is used as an example.
//In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo.
// You can use the URI obtained. // You can use the URI obtained.
let sourceFile = "datashare:///media/file/102"; let sourceFile = "datashare:///media/file/102";
let destFile = "datashare:///media/file/101"; let destFile = "datashare:///media/file/101";
...@@ -861,7 +862,7 @@ Moves a file or directory. This API uses an asynchronous callback to return the ...@@ -861,7 +862,7 @@ Moves a file or directory. This API uses an asynchronous callback to return the
rename(uri: string, displayName: string) : Promise&lt;string&gt; rename(uri: string, displayName: string) : Promise&lt;string&gt;
Renames a file or directory. This API uses a promise to return the result. Renames a file or directory. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -869,16 +870,16 @@ Renames a file or directory. This API uses a promise to return the result. ...@@ -869,16 +870,16 @@ Renames a file or directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or directory to rename.| | uri | string | Yes| URI of the file or directory to rename.|
| displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise&lt;string&gt; | Promise used to return the URI of the renamed file or directory.| | Promise&lt;string&gt; | Promise used to return the URI of the renamed file or directory.|
**Example** **Example**
...@@ -900,7 +901,7 @@ Renames a file or directory. This API uses a promise to return the result. ...@@ -900,7 +901,7 @@ Renames a file or directory. This API uses a promise to return the result.
rename(uri: string, displayName: string, callback: AsyncCallback&lt;string&gt;) : void; rename(uri: string, displayName: string, callback: AsyncCallback&lt;string&gt;) : void;
Renames a file or directory. This API uses an asynchronous callback to return the result. Renames a file or directory. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -908,11 +909,11 @@ Renames a file or directory. This API uses an asynchronous callback to return t ...@@ -908,11 +909,11 @@ Renames a file or directory. This API uses an asynchronous callback to return t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or directory to rename.| | uri | string | Yes| URI of the file or directory to rename.|
| displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.|
| callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the renamed file or directory.| | callback | AsyncCallback&lt;string&gt; | Yes| Promise used to return the URI of the renamed file or directory.|
**Example** **Example**
...@@ -939,7 +940,7 @@ Renames a file or directory. This API uses an asynchronous callback to return t ...@@ -939,7 +940,7 @@ Renames a file or directory. This API uses an asynchronous callback to return t
access(sourceFileUri: string) : Promise&lt;boolean&gt; access(sourceFileUri: string) : Promise&lt;boolean&gt;
Checks whether a file or directory exists. This API uses a promise to return the result. Checks whether a file or directory exists. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -947,9 +948,9 @@ Checks whether a file or directory exists. This API uses a promise to return th ...@@ -947,9 +948,9 @@ Checks whether a file or directory exists. This API uses a promise to return th
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFileUri | string | Yes| URI of the file or directory.| | sourceFileUri | string | Yes| URI of the file or directory.|
**Return value** **Return value**
...@@ -980,7 +981,7 @@ Checks whether a file or directory exists. This API uses a promise to return th ...@@ -980,7 +981,7 @@ Checks whether a file or directory exists. This API uses a promise to return th
access(sourceFileUri: string, callback: AsyncCallback&lt;boolean&gt;) : void; access(sourceFileUri: string, callback: AsyncCallback&lt;boolean&gt;) : void;
Checks whether a file or directory exists. This API uses an asynchronous callback to return the result. Checks whether a file or directory exists. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -988,10 +989,10 @@ Checks whether a file or directory exists. This API uses an asynchronous callba ...@@ -988,10 +989,10 @@ Checks whether a file or directory exists. This API uses an asynchronous callba
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFileUri | string | Yes| URI of the file or directory.| | sourceFileUri | string | Yes| URI of the file or directory.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Promise used to return the result.| | callback | AsyncCallback&lt;boolean&gt; | Yes| Promise used to return the result.|
**Example** **Example**
...@@ -1031,13 +1032,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob ...@@ -1031,13 +1032,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the directory until **done** returns **true**. The **value** field contains the root directory information.| | {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the directory until **done** returns **true**. The **value** field contains the root directory information.|
## FileIterator.next ## FileIterator.next
next( ) : { value: FileInfo, done: boolean } next( ) : { value: FileInfo, done: boolean }
Obtains the information about the next-level file or directory. **FileIterator** is an iterator object of a directory. Obtains the information about the next-level file or directory. **FileIterator** is an iterator object of a directory.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -1047,7 +1048,7 @@ Obtains the information about the next-level file or directory. **FileIterator* ...@@ -1047,7 +1048,7 @@ Obtains the information about the next-level file or directory. **FileIterator*
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| {value: FileInfo, done: boolean} | File or directory information obtained. This API traverses the specified directory until **done** returns **true**. The **value** field contains the file or directory information obtained.| | {value: FileInfo, done: boolean} | File or directory information obtained. This API traverses the specified directory until **done** returns **true**. The **value** field contains the file or directory information obtained.|
## RootInfo ## RootInfo
...@@ -1068,7 +1069,7 @@ Represents the root attribute information and interface capabilities of a device ...@@ -1068,7 +1069,7 @@ Represents the root attribute information and interface capabilities of a device
## FileInfo ## FileInfo
Represents the file or directory attribute information and interface capabilities. Represents the file or directory attribute information and interface capabilities.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -1078,12 +1079,12 @@ Represents the file or directory attribute information and interface capabiliti ...@@ -1078,12 +1079,12 @@ Represents the file or directory attribute information and interface capabiliti
| Name| Type | Readable| Writable| Description | | Name| Type | Readable| Writable| Description |
| ------ | ------ | -------- | ------ | -------- | | ------ | ------ | -------- | ------ | -------- |
| uri | string | Yes| No| URI of the file or directory.| | uri | string | Yes| No| URI of the file or directory.|
| fileName | string | Yes| No| Name of a file or directory.| | fileName | string | Yes| No| Name of a file or directory.|
| mode | number | Yes| No| Permissions on the file or directory.| | mode | number | Yes| No| Permissions on the file or directory.|
| size | number | Yes| No| Size of the file or directory.| | size | number | Yes| No| Size of the file or directory.|
| mtime | number | Yes| No| Time when the file or directory was last modified.| | mtime | number | Yes| No| Time when the file or directory was last modified.|
| mimeType | string | Yes| No| MIME type of the file or directory.| | mimeType | string | Yes| No| MIME type of the file or directory.|
## OPENFLAGS ## OPENFLAGS
......
# @system.cipher (Cipher Algorithm) # @system.cipher (Cipher Algorithm)
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs provided by this module are deprecated since API version 9. You are advised to use [cryptoFramework-Cipher](js-apis-cryptoFramework.md#Cipher).
## Modules to Import ## Modules to Import
...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called. ...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called.
**System capability**: SystemCapability.Security.Cipher **System capability**: SystemCapability.Security.Cipher
| Name| Type | Mandatory| Description | | Name| Type | Readable| Writable|Description |
| ------ | ------ | ---- | ------------ | | ------ | ------ | ---- | ---- | ------------ |
| text | string | Yes | Response content.| | text | string | Yes | No | Response content.|
## CipherRsaOptions ## CipherRsaOptions
...@@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA. ...@@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA.
**Example** **Example**
```js ```js
export default { export default {
rsa() { rsa() {
cipher.rsa({ cipher.rsa({
// Encrypt data. // Encrypt data.
action: 'encrypt', action: 'encrypt',
// Text to be encrypted. // Text to be encrypted.
text: 'hello', text: 'hello',
// Base64-encoded public key used for encryption. // Base64-encoded public key used for encryption.
key: key:
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' +
'6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' +
'+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' +
'jBpApTJ3TeneOo6Z5QIDAQAB', 'jBpApTJ3TeneOo6Z5QIDAQAB',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
cipher.rsa({ cipher.rsa({
// Decrypt data. // Decrypt data.
action: 'decrypt', action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello". // Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello".
text: text:
'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' + 'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' +
'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' + 'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' +
'EU5WO0oBHo5l4x6dTpU=', 'EU5WO0oBHo5l4x6dTpU=',
// Base64-encoded private key used for decryption. // Base64-encoded private key used for decryption.
key: key:
'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' + 'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' +
'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' + 'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' +
'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' + 'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' +
...@@ -118,18 +119,18 @@ export default { ...@@ -118,18 +119,18 @@ export default {
'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' + 'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' +
'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' + 'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' +
'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' + 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' +
'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
'8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
} }
} }
``` ```
...@@ -152,48 +153,48 @@ Encrypts or decrypts data using AES. ...@@ -152,48 +153,48 @@ Encrypts or decrypts data using AES.
**Example** **Example**
```js ```js
export default { export default {
aes() { aes() {
cipher.aes({ cipher.aes({
// Encrypt data. // Encrypt data.
action: 'encrypt', action: 'encrypt',
// Text to be encrypted. // Text to be encrypted.
text: 'hello', text: 'hello',
// Base64-encoded key. // Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding', transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
cipher.aes({ cipher.aes({
// Decrypt data. // Decrypt data.
action: 'decrypt', action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. // Text to be decrypted, which is binary text encoded in Base64.
text: '1o0kf2HXwLxHkSh5W5NhzA==', text: '1o0kf2HXwLxHkSh5W5NhzA==',
// Base64-encoded key. // Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding', transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.aes encryption failed ### ${code}:${data}`); console.log(`### cipher.aes encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
} }
} }
......
...@@ -26,6 +26,9 @@ getTagInfo(): tag.TagInfo ...@@ -26,6 +26,9 @@ getTagInfo(): tag.TagInfo
Obtains the **tagInfo** object provided by the NFC service when the tag is dispatched. Obtains the **tagInfo** object provided by the NFC service when the tag is dispatched.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tag.getTagInfo](js-apis-nfcTag.md#taggettaginfo9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -54,6 +57,9 @@ connectTag(): boolean; ...@@ -54,6 +57,9 @@ connectTag(): boolean;
Connects to this tag. Call this API to set up a connection before reading data from or writing data to a tag. Connects to this tag. Call this API to set up a connection before reading data from or writing data to a tag.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.connect](#tagsessionconnect9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -76,12 +82,49 @@ let connectStatus = tag.getIsoDep(tagInfo).connectTag(); ...@@ -76,12 +82,49 @@ let connectStatus = tag.getIsoDep(tagInfo).connectTag();
console.log("connectStatus: " + connectStatus); console.log("connectStatus: " + connectStatus);
``` ```
### tagSession.connect<sup>9+</sup>
connect(): void;
Connects to this tag. Call this API to set up a connection before reading data from or writing data to a tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
try {
tag.getIsoDep(tagInfo).connect();
console.log("tag connect success");
} catch (busiError) {
console.log("tag connect busiError: " + busiError);
}
```
### tagSession.reset() ### tagSession.reset()
reset(): void reset(): void
Resets the connection to this tag. Resets the connection to this tag.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.resetConnection](#tagsessionresetconnection9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -97,12 +140,49 @@ import tag from '@ohos.nfc.tag'; ...@@ -97,12 +140,49 @@ import tag from '@ohos.nfc.tag';
tag.getIsoDep(tagInfo).reset(); tag.getIsoDep(tagInfo).reset();
``` ```
### tagSession.resetConnection()<sup>9+</sup>
resetConnection(): void
Resets the connection to this tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
try {
tag.getIsoDep(tagInfo).resetConnection();
console.log("tag resetConnection success");
} catch (busiError) {
console.log("tag resetConnection busiError: " + busiError);
}
```
### tagSession.isTagConnected ### tagSession.isTagConnected
isTagConnected(): boolean isTagConnected(): boolean
Checks whether the tag is connected. Checks whether the tag is connected.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.isConnected](#tagsessionisconnected9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -125,12 +205,47 @@ let isTagConnected = tag.getIsoDep(tagInfo).isTagConnected(); ...@@ -125,12 +205,47 @@ let isTagConnected = tag.getIsoDep(tagInfo).isTagConnected();
console.log("isTagConnected: " + isTagConnected); console.log("isTagConnected: " + isTagConnected);
``` ```
### tagSession.isConnected<sup>9+</sup>
isConnected(): boolean
Checks whether the tag is connected.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| boolean | Returns **true** if the tag is connected; returns **false** otherwise.|
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
try {
var isConnected = tag.getIsoDep(tagInfo).isConnected();
console.log("tag isConnected = " + isConnected);
} catch (busiError) {
console.log("tag isConnected busiError: " + busiError);
}
```
### tagSession.getMaxSendLength ### tagSession.getMaxSendLength
getMaxSendLength(): number getMaxSendLength(): number
Obtains the maximum length of the data that can be sent to this tag. Obtains the maximum length of the data that can be sent to this tag.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.getMaxTransmitSize](#tagsessiongetmaxtransmitsize9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -152,12 +267,54 @@ let maxSendLen = tag.getIsoDep(tagInfo).getMaxSendLength(); ...@@ -152,12 +267,54 @@ let maxSendLen = tag.getIsoDep(tagInfo).getMaxSendLength();
console.log("tag maxSendLen: " + maxSendLen); console.log("tag maxSendLen: " + maxSendLen);
``` ```
### tagSession.getMaxTransmitSize<sup>9+</sup>
getMaxTransmitSize(): number
Obtains the maximum length of the data that can be sent to this tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| number | Maximum data length obtained. The value cannot be a negative number.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
try {
var maxTransmitSize = tag.getIsoDep(tagInfo).getMaxTransmitSize();
console.log("tag maxTransmitSize = " + maxTransmitSize);
} catch (busiError) {
console.log("tag getMaxTransmitSize busiError: " + busiError);
}
```
### tagSession.getSendDataTimeout ### tagSession.getSendDataTimeout
getSendDataTimeout(): number getSendDataTimeout(): number
Obtains the timeout period for sending data to this tag, in milliseconds. Obtains the timeout period for sending data to this tag, in milliseconds.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.getTimeout](#tagsessiongettimeout9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -180,12 +337,55 @@ let sendDataTimeout = tag.getIsoDep(tagInfo).getSendDataTimeout(); ...@@ -180,12 +337,55 @@ let sendDataTimeout = tag.getIsoDep(tagInfo).getSendDataTimeout();
console.log("tag sendDataTimeout: " + sendDataTimeout); console.log("tag sendDataTimeout: " + sendDataTimeout);
``` ```
### tagSession.getTimeout<sup>9+</sup>
getTimeout(): number
Obtains the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| number | Timeout period obtained, in milliseconds. The value cannot be a negative number.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
try {
var timeout = tag.getIsoDep(tagInfo).getTimeout();
console.log("tag timeout = " + timeout);
} catch (busiError) {
console.log("tag getTimeout busiError: " + busiError);
}
```
### tagSession.setSendDataTimeout ### tagSession.setSendDataTimeout
setSendDataTimeout(timeout: number): boolean setSendDataTimeout(timeout: number): boolean
Sets the timeout period for sending data to this tag, in milliseconds. Sets the timeout period for sending data to this tag, in milliseconds.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.setTimeout](#tagsessionsettimeout9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -215,12 +415,56 @@ let setStatus = tag.getIsoDep(tagInfo).setSendDataTimeout(timeoutMs); ...@@ -215,12 +415,56 @@ let setStatus = tag.getIsoDep(tagInfo).setSendDataTimeout(timeoutMs);
console.log("tag setSendDataTimeout setStatus: " + setStatus); console.log("tag setSendDataTimeout setStatus: " + setStatus);
``` ```
### tagSession.setTimeout<sup>9+</sup>
setTimeout(timeout: number): void
Obtains the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| timeout | number | Yes| Timeout period to set, in milliseconds. The value cannot be a negative number.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
let timeoutMs = 700; // Change it as required.
try {
tag.getIsoDep(tagInfo).setTimeout(timeoutMs);
console.log("tag setTimeout success");
} catch (busiError) {
console.log("tag setTimeout busiError: " + busiError);
}
```
### tagSession.sendData ### tagSession.sendData
sendData(data: number[]): Promise<number[]> sendData(data: number[]): Promise<number[]>
Sends data to this tag. This API uses a promise to return the result. Sends data to this tag. This API uses a promise to return the result.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.transmit](#tagsessiontransmit9).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -267,6 +511,9 @@ sendData(data: number[], callback: AsyncCallback<number[]>): void ...@@ -267,6 +511,9 @@ sendData(data: number[], callback: AsyncCallback<number[]>): void
Sends data to this tag. This API uses an asynchronous callback to return the result. Sends data to this tag. This API uses an asynchronous callback to return the result.
> **NOTE**
> This parameter is supported since API version 7 and discarded since API version 9. You are advised to use [tagSession.transmit](#tagsessiontransmit9-1).
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
...@@ -303,3 +550,123 @@ tag.getIsoDep(tagInfo).sendData(cmdData, (err, response)=> { ...@@ -303,3 +550,123 @@ tag.getIsoDep(tagInfo).sendData(cmdData, (err, response)=> {
} }
}); });
``` ```
### tagSession.transmit<sup>9+</sup>
transmit(data: number[]): Promise<number[]>
Sends data to this tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| Promise<number[]> | Promise used to return the response from the tag. The response consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
// Connect to the tag if it is not connected.
try {
if (!tag.getIsoDep(tagInfo).isConnected()) {
tag.getIsoDep(tagInfo).connect();
}
} catch (busiError) {
console.log("tag connect busiError: " + busiError);
return;
}
let cmdData = [0x01, 0x02, 0x03, 0x04]; // Change it as required.
try {
tag.getIsoDep(tagInfo).transmit(cmdData).then((response) => {
console.log("tagSession transmit Promise response: " + response);
}).catch((err)=> {
console.log("tagSession transmit Promise err: " + err);
});
} catch (busiError) {
console.log("tag transmit busiError: " + busiError);
return;
}
```
### tagSession.transmit<sup>9+</sup>
transmit(data: number[], callback: AsyncCallback<number[]>): void
Sends data to this tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| callback | AsyncCallback<number[]> | Yes| Callback invoked to return the response from the tag. The response consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error message|
| ------- | -------|
| 3100201 | Tag running state is abnormal in service. |
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
// Connect to the tag if it is not connected.
try {
if (!tag.getIsoDep(tagInfo).isConnected()) {
tag.getIsoDep(tagInfo).connect();
}
} catch (busiError) {
console.log("tag connect busiError: " + busiError);
return;
}
let cmdData = [0x01, 0x02, 0x03, 0x04]; // Change it as required.
try {
tag.getIsoDep(tagInfo).transmit(cmdData, (err, response)=> {
if (err) {
console.log("tagSession transmit AsyncCallback err: " + err);
} else {
console.log("tagSession transmit AsyncCallback response: " + response);
}
});
} catch (busiError) {
console.log("tag transmit busiError: " + busiError);
return;
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册