提交 bb234427 编写于 作者: Z zhangalong

add code type for sample codes

Signed-off-by:zhang_along<zhangalong@huawei.com>
Signed-off-by: Nzhangalong <zhangalong@huawei.com>
上级 97616189
......@@ -6,7 +6,7 @@
## Modules to Import
```
```js
import account_appAccount from '@ohos.account.appAccount';
```
......@@ -25,7 +25,7 @@ Creates an **AppAccountManager** instance.
| AppAccountManager | **AppAccountManager** instance created.|
**Example**
```
```js
var appAccountManager = account.createAppAccountManager();
```
......@@ -50,7 +50,7 @@ Adds an app account to the account management service. This method uses an async
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
......@@ -75,7 +75,7 @@ Adds an app account and its additional information to the account management ser
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
......@@ -107,7 +107,7 @@ Adds an app account and its additional information to the account management ser
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success');
......@@ -135,7 +135,7 @@ Implicitly adds an app account based on the specified account owner, authenticat
**Example**
```
```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) {
......@@ -174,7 +174,7 @@ Deletes an app account from the account management service. This method uses an
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err));
......@@ -203,7 +203,7 @@ Deletes an app account from the account management service. This method uses a p
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success');
......@@ -230,7 +230,7 @@ Disables an app account from accessing an application with the given bundle name
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err));
......@@ -260,7 +260,7 @@ Disables an app account from accessing an application with the given bundle name
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('disableAppAccess Success');
......@@ -287,7 +287,7 @@ Enables an app account to access an application with the given bundle name. This
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err));
......@@ -317,7 +317,7 @@ Enables an app account to access an application with the given bundle name. This
**Example**
```
```js
app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('enableAppAccess Success');
}).catch((err) => {
......@@ -344,7 +344,7 @@ Checks whether an app account allows application data synchronization. This meth
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
......@@ -376,7 +376,7 @@ Checks whether an app account allows application data synchronization. This meth
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data);
......@@ -404,7 +404,7 @@ Sets a credential for an app account. This method uses an asynchronous callback
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err));
......@@ -435,7 +435,7 @@ Sets a credential for an app account. This method uses a promise to return the r
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success');
......@@ -462,7 +462,7 @@ Sets additional information for an app account. This method uses an asynchronous
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err));
......@@ -492,7 +492,7 @@ Sets additional information for an app account. This method uses a promise to re
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success');
......@@ -521,7 +521,7 @@ Sets whether to enable application data synchronization for an app account. This
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
......@@ -553,7 +553,7 @@ Sets whether to enable application data synchronization for an app account. This
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success');
......@@ -581,7 +581,7 @@ Sets data to be associated with an app account. This method uses an asynchronous
**Example**
```
```js
app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err));
});
......@@ -611,7 +611,7 @@ Sets data to be associated with an app account. This method uses a promise to re
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success');
......@@ -638,7 +638,7 @@ Obtains the credential of an app account. This method uses an asynchronous callb
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err));
......@@ -669,7 +669,7 @@ Obtains the credential of an app account. This method uses a promise to return t
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data);
......@@ -695,7 +695,7 @@ Obtains additional information of an app account. This method uses an asynchrono
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err));
......@@ -725,7 +725,7 @@ Obtains additional information of an app account. This method uses a promise to
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data);
......@@ -752,7 +752,7 @@ Obtains data associated with an app account. This method uses an asynchronous ca
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err));
......@@ -783,7 +783,7 @@ Obtains data associated with an app account. This method uses a promise to retur
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data);
......@@ -810,7 +810,7 @@ Obtains information about all accessible app accounts. This method uses an async
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
......@@ -836,7 +836,7 @@ Obtains information about all accessible app accounts. This method uses an async
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data);
......@@ -864,7 +864,7 @@ Obtains information about all app accounts of the specified app. This method use
**Example**
```
```js
const appAccountManager = account.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
......@@ -897,7 +897,7 @@ Obtains information about all app accounts of the specified app. This method use
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => {
......@@ -925,7 +925,7 @@ Subscribes to the account change event of the specified account owners. This met
**Example**
```
```js
const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
......@@ -955,7 +955,7 @@ Unsubscribes from the account change event. This method uses an asynchronous cal
**Example**
```
```js
const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
......@@ -991,7 +991,7 @@ Authenticates an app account to obtain the Open Authorization (OAuth) access tok
**Example**
```
```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) {
......@@ -1032,7 +1032,7 @@ Obtains the OAuth access token of an app account based on the specified authenti
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err));
......@@ -1064,7 +1064,7 @@ Obtains the OAuth access token of an app account based on the specified authenti
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthToken token: ' + data);
......@@ -1092,7 +1092,7 @@ Sets an OAuth access token for an app account. This method uses an asynchronous
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err));
......@@ -1123,7 +1123,7 @@ Sets an OAuth access token for an app account. This method uses a promise to ret
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => {
console.log('setOAuthToken successfully');
......@@ -1152,7 +1152,7 @@ Deletes the specified OAuth access token for an app account. This method uses an
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err));
......@@ -1184,7 +1184,7 @@ Deletes the specified OAuth access token for an app account. This method uses a
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully');
......@@ -1213,7 +1213,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -1245,7 +1245,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully');
......@@ -1273,7 +1273,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -1305,7 +1305,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data);
......@@ -1332,7 +1332,7 @@ Obtains information about all OAuth access tokens of an app account visible to t
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err));
......@@ -1363,7 +1363,7 @@ Obtains information about all OAuth access tokens of an app account visible to t
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
......@@ -1390,7 +1390,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err));
......@@ -1421,7 +1421,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data));
......@@ -1447,7 +1447,7 @@ Obtains the authenticator callback for a session. This method uses an asynchrono
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
......@@ -1487,7 +1487,7 @@ Obtains the authenticator callback for a session. This method uses a promise to
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
......@@ -1522,7 +1522,7 @@ Obtains authenticator information of an app account. This method uses an asynchr
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
......@@ -1552,7 +1552,7 @@ Obtains authenticator information of an app account. This method uses a promise
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
......@@ -1663,7 +1663,7 @@ Called back to send the authentication result.
**Example**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
......@@ -1692,7 +1692,7 @@ Called back to redirect an authentication request.
**Example**
```
```js
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
......@@ -1749,7 +1749,7 @@ Authenticates an app account to obtain the OAuth access token. This method uses
**Example**
```
```js
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
......
......@@ -6,7 +6,7 @@
## Modules to Import
```
```js
import account_distributedAccount from '@ohos.account.distributedAccount';
```
......@@ -28,7 +28,7 @@ Obtains a **DistributedAccountAbility** instance.
| [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.|
- Example
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
```
......@@ -50,7 +50,7 @@ Obtains distributed account information. This method uses an asynchronous callba
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the distributed account information obtained.|
- Example
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
......@@ -73,7 +73,7 @@ Obtains distributed account information. This method uses a promise to return th
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise used to return the distributed account information obtained.|
- Example
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name);
......@@ -98,7 +98,7 @@ Updates distributed account information. This method uses an asynchronous callba
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the distributed account information is updated.|
- Example
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
......@@ -125,7 +125,7 @@ Updates distributed account information. This method uses a promise to return th
| Promise&lt;void&gt; | Promise used to return the result.|
- Example
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
......
......@@ -6,7 +6,7 @@
## 导入模块
```
```js
import account_appAccount from '@ohos.account.appAccount';
```
......@@ -25,7 +25,7 @@ createAppAccountManager(): AppAccountManager
| AppAccountManager | 获取应用帐号模块的实例。 |
**示例:**
```
```js
var appAccountManager = account.createAppAccountManager();
```
......@@ -50,7 +50,7 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
......@@ -75,7 +75,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
......@@ -107,7 +107,7 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success');
......@@ -135,7 +135,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**示例:**
```
```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) {
......@@ -174,7 +174,7 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err));
......@@ -203,7 +203,7 @@ deleteAccount(name: string): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success');
......@@ -230,7 +230,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err));
......@@ -260,7 +260,7 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('disableAppAccess Success');
......@@ -287,7 +287,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err));
......@@ -317,7 +317,7 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```
```js
app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('enableAppAccess Success');
}).catch((err) => {
......@@ -344,7 +344,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
......@@ -376,7 +376,7 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data);
......@@ -404,7 +404,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err));
......@@ -435,7 +435,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success');
......@@ -462,7 +462,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err));
......@@ -492,7 +492,7 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success');
......@@ -521,7 +521,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
......@@ -553,7 +553,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success');
......@@ -581,7 +581,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**示例:**
```
```js
app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err));
});
......@@ -611,7 +611,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success');
......@@ -638,7 +638,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err));
......@@ -669,7 +669,7 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data);
......@@ -695,7 +695,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err));
......@@ -725,7 +725,7 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data);
......@@ -752,7 +752,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err));
......@@ -783,7 +783,7 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data);
......@@ -810,7 +810,7 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
......@@ -836,7 +836,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data);
......@@ -864,7 +864,7 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
**示例:**
```
```js
const appAccountManager = account.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
......@@ -897,7 +897,7 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => {
......@@ -925,7 +925,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
**示例:**
```
```js
const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
......@@ -955,7 +955,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
**示例:**
```
```js
const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
......@@ -991,7 +991,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**示例:**
```
```js
import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) {
......@@ -1032,7 +1032,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err));
......@@ -1064,7 +1064,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthToken token: ' + data);
......@@ -1092,7 +1092,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err));
......@@ -1123,7 +1123,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => {
console.log('setOAuthToken successfully');
......@@ -1152,7 +1152,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err));
......@@ -1184,7 +1184,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully');
......@@ -1213,7 +1213,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -1245,7 +1245,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully');
......@@ -1273,7 +1273,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -1305,7 +1305,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data);
......@@ -1332,7 +1332,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err));
......@@ -1363,7 +1363,7 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
......@@ -1390,7 +1390,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err));
......@@ -1421,7 +1421,7 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data));
......@@ -1447,7 +1447,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
......@@ -1487,7 +1487,7 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
......@@ -1522,7 +1522,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
......@@ -1552,7 +1552,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
......@@ -1663,7 +1663,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
**示例:**
```
```js
const appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
......@@ -1692,7 +1692,7 @@ onRequestRedirected: (request: Want) =&gt; void
**示例:**
```
```js
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
......@@ -1749,7 +1749,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options:
**示例:**
```
```js
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
......
......@@ -6,7 +6,7 @@
## 导入模块
```
```js
import account_distributedAccount from '@ohos.account.distributedAccount';
```
......@@ -28,7 +28,7 @@ getDistributedAccountAbility(): DistributedAccountAbility
| [DistributedAccountAbility](#distributedaccountability) | 返回一个实例,实例提供查询和更新分布式帐号登录状态方法。 |
- 示例:
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
```
......@@ -50,7 +50,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): v
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | 是 | 获取分布式帐号信息的回调。 |
- 示例:
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
......@@ -73,7 +73,7 @@ queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise实例,用于获取异步返回结果。 |
- 示例:
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name);
......@@ -98,7 +98,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
| callback | AsyncCallback&lt;void&gt; | 是 | 更新分布式帐号信息的回调。 |
- 示例:
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
......@@ -125,7 +125,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例:
```
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
......
......@@ -6,7 +6,7 @@
## 导入模块
```
```js
import account_osAccount from '@ohos.account.osAccount';
```
......@@ -24,7 +24,7 @@ getAccountManager(): AccountManager
| [AccountManager](#accountmanager) | 获取系统帐号能力的实例。 |
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
```
......@@ -64,7 +64,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
**示例:**激活ID为100的系统帐号
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.activateOsAccount(localId, (err)=>{
......@@ -97,7 +97,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**激活ID为100的系统帐号
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.activateOsAccount(localId).then(() => {
......@@ -123,7 +123,7 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err, isEnabled) => {
console.log("isMultiOsAccountEnable err: " + JSON.stringify(err));
......@@ -147,7 +147,7 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable().then((isEnabled) => {
console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled);
......@@ -175,7 +175,7 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi
**示例:**判断ID为100的系统帐号是否处于激活状态
```
```js
const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{
......@@ -208,7 +208,7 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
**示例:**判断ID为100的系统帐号是否处于激活状态
```
```js
const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId).then((isActive) => {
......@@ -238,7 +238,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
**示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{
......@@ -272,7 +272,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo
**示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => {
......@@ -298,7 +298,7 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err, isTest) => {
console.log("isTestOsAccount err: " + JSON.stringify(err));
......@@ -322,7 +322,7 @@ isTestOsAccount(): Promise&lt;boolean&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTest) => {
console.log('isTestOsAccount, isTest: ' + isTest);
......@@ -347,7 +347,7 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err));
......@@ -374,7 +374,7 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err));
......@@ -406,7 +406,7 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified().then((isVerified) => {
console.log('isOsAccountVerified, isVerified: ' + isVerified);
......@@ -436,7 +436,7 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
......@@ -473,7 +473,7 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
......@@ -510,7 +510,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:**给ID为100的系统帐号设置禁止使用wifi的约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{
......@@ -546,7 +546,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:**删除ID为100的系统帐号的禁止使用wifi的约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => {
......@@ -578,7 +578,7 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;
**示例:**将ID为100的系统帐号的帐号名设置成demoName
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
var newName = "demoName";
......@@ -614,7 +614,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
**示例:**将ID为100的系统帐号的帐号名设置成demoName
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
var nameLimit = "demoName";
......@@ -643,7 +643,7 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{
console.log("obtains the number of all os accounts created err:" + JSON.stringify(err));
......@@ -669,7 +669,7 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((accountCnt) => {
console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt);
......@@ -694,7 +694,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err, accountID) => {
console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err));
......@@ -718,7 +718,7 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess().then((accountID) => {
console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID);
......@@ -744,7 +744,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
**示例:**查询值为12345678的uid所属的系统帐号的帐号ID
```
```js
const accountManager = account_osAccount.getAccountManager();
let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => {
......@@ -775,7 +775,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
**示例:**查询值为12345678的uid所属的系统帐号的帐号ID
```
```js
const accountManager = account_osAccount.getAccountManager();
let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => {
......@@ -804,7 +804,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
**示例:**
```
```js
var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => {
......@@ -837,7 +837,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => {
......@@ -865,7 +865,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{
console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err));
......@@ -891,7 +891,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber().then((maxCnt) => {
console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt);
......@@ -919,7 +919,7 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;
**示例:**获取ID为100的系统帐号的全部约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{
......@@ -952,7 +952,7 @@ getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
**示例:**获取ID为100的系统帐号的全部约束
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getOsAccountAllConstraints(localId).then((constraints) => {
......@@ -980,7 +980,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{
console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err));
......@@ -1006,7 +1006,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts().then((accountArr) => {
console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
......@@ -1031,7 +1031,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;):
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds((err, idArray)=>{
console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err));
......@@ -1058,7 +1058,7 @@ queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds().then((idArray) => {
console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
......@@ -1089,7 +1089,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
console.log("createOsAccount err:" + JSON.stringify(err));
......@@ -1124,7 +1124,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => {
console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo));
......@@ -1155,7 +1155,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{
......@@ -1191,7 +1191,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => {
......@@ -1219,7 +1219,7 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{
console.log("queryCurrentOsAccount err:" + JSON.stringify(err));
......@@ -1245,7 +1245,7 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount().then((accountInfo) => {
console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo));
......@@ -1275,7 +1275,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;
**示例:**查询ID为100的系统帐号信息
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.queryOsAccountById(localId, (err, accountInfo)=>{
......@@ -1310,7 +1310,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
**示例:**查询ID为100的系统帐号信息
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.queryOsAccountById(localId).then((accountInfo) => {
......@@ -1336,7 +1336,7 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess((err, accountType) => {
console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err));
......@@ -1360,7 +1360,7 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess().then((accountType) => {
console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
......@@ -1387,7 +1387,7 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId((err, virtualID) => {
console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err));
......@@ -1413,7 +1413,7 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt;
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId().then((virtualID) => {
console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
......@@ -1443,7 +1443,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
**示例:**获取ID为100的系统帐号的头像
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{
......@@ -1478,7 +1478,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
**示例:**获取ID为100的系统帐号的头像
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getOsAccountProfilePhoto(localId).then((photo) => {
......@@ -1510,7 +1510,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
**示例:**给ID为100的系统帐号设置头像
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
......@@ -1549,7 +1549,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
**示例:**给ID为100的系统帐号设置头像
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
......@@ -1580,7 +1580,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&
**示例:**查询与SN码12345关联的系统帐号的ID
```
```js
const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
......@@ -1611,7 +1611,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
**示例:**查询与SN码12345关联的系统帐号的ID
```
```js
const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => {
......@@ -1638,7 +1638,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu
**示例:**获取ID为100的系统帐号关联的SN码
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
......@@ -1669,7 +1669,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
**示例:**获取ID为100的系统帐号关联的SN码
```
```js
const accountManager = account_osAccount.getAccountManager();
var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => {
......@@ -1701,7 +1701,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
function onCallback(receiveLocalId){
console.log("receive localId:" + receiveLocalId);
......@@ -1731,7 +1731,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
**示例:**
```
```js
const accountManager = account_osAccount.getAccountManager();
function offCallback(){
console.log("off enter")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册