提交 2d2603cb 编写于 作者: C cc_ggboy

账号docs示例代码语言标记更改

Signed-off-by: Ncc_ggboy <chenweimin8@huawei.com>
上级 b2defeb2
......@@ -9,7 +9,7 @@
## 导入模块
```js
```ts
import account_appAccount from '@ohos.account.appAccount';
```
......@@ -29,7 +29,7 @@ createAppAccountManager(): AppAccountManager
| AppAccountManager | 应用帐号管理器对象。 |
**示例:**
```js
```ts
let appAccountManager = account_appAccount.createAppAccountManager();
```
......@@ -63,7 +63,7 @@ createAccount(name: string, callback: AsyncCallback&lt;void&gt;): void;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -102,7 +102,7 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let options:account_appAccount.CreateAccountOptions = {
......@@ -155,7 +155,7 @@ createAccount(name: string, options?: CreateAccountOptions): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let options: account_appAccount.CreateAccountOptions = {
......@@ -202,7 +202,7 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -267,7 +267,7 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -332,7 +332,7 @@ removeAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -378,7 +378,7 @@ removeAccount(name: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -420,7 +420,7 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback:
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -469,7 +469,7 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise&l
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -509,7 +509,7 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;bool
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -557,7 +557,7 @@ checkAppAccess(name: string, bundleName: string): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -599,7 +599,7 @@ setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback&lt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -644,7 +644,7 @@ setDataSyncEnabled(name: string, isEnabled: boolean): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -685,7 +685,7 @@ checkDataSyncEnabled(name: string, callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -733,7 +733,7 @@ checkDataSyncEnabled(name: string): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -774,7 +774,7 @@ setCredential(name: string, credentialType: string, credential: string,callback:
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -822,7 +822,7 @@ setCredential(name: string, credentialType: string, credential: string): Promise
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -863,7 +863,7 @@ getCredential(name: string, credentialType: string, callback: AsyncCallback&lt;s
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -911,7 +911,7 @@ getCredential(name: string, credentialType: string): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -953,7 +953,7 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1002,7 +1002,7 @@ setCustomData(name: string, key: string, value: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1043,7 +1043,7 @@ getCustomData(name: string, key: string, callback: AsyncCallback&lt;string&gt;):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1091,7 +1091,7 @@ getCustomData(name: string, key: string): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1137,7 +1137,7 @@ getCustomDataSync(name: string, key: string): string;
**示例:**
```js
```ts
try {
let value = appAccountManager.getCustomDataSync('ZhangSan', 'age');
console.info('getCustomDataSync successfully, vaue: ' + value);
......@@ -1168,7 +1168,7 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1206,7 +1206,7 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1245,7 +1245,7 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1292,7 +1292,7 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1333,7 +1333,7 @@ on(type: 'accountChange', owners: Array&lt;string&gt;, callback: Callback&lt;Arr
**示例:**
```js
```ts
function changeOnCallback(data: account_appAccount.AppAccountInfo[]): void {
console.log('receive change data:' + JSON.stringify(data));
}
......@@ -1368,7 +1368,7 @@ off(type: 'accountChange', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt
**示例:**
```js
```ts
function changeOnCallback(data: account_appAccount.AppAccountInfo[]): void {
console.log('receive change data:' + JSON.stringify(data));
}
......@@ -1415,7 +1415,7 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -1482,7 +1482,7 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -1549,7 +1549,7 @@ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallb
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1599,7 +1599,7 @@ getAuthToken(name: string, owner: string, authType: string): Promise&lt;string&g
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1641,7 +1641,7 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1690,7 +1690,7 @@ setAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1733,7 +1733,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1784,7 +1784,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1829,7 +1829,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1882,7 +1882,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1924,7 +1924,7 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -1974,7 +1974,7 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2015,7 +2015,7 @@ getAllAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&l
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2063,7 +2063,7 @@ getAllAuthTokens(name: string, owner: string): Promise&lt;Array&lt;AuthTokenInfo
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2105,7 +2105,7 @@ getAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2153,7 +2153,7 @@ getAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2192,7 +2192,7 @@ getAuthCallback(sessionId: string, callback: AsyncCallback&lt;AuthCallback&gt;):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
......@@ -2256,7 +2256,7 @@ getAuthCallback(sessionId: string): Promise&lt;AuthCallback&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
......@@ -2313,7 +2313,7 @@ queryAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorIn
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2360,7 +2360,7 @@ queryAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2405,7 +2405,7 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;, cal
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let labels = ['student'];
......@@ -2458,7 +2458,7 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;): Pr
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let labels = ['student'];
......@@ -2501,7 +2501,7 @@ deleteCredential(name: string, credentialType: string, callback: AsyncCallback&l
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2549,7 +2549,7 @@ deleteCredential(name: string, credentialType: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
......@@ -2589,7 +2589,7 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let options: account_appAccount.SelectAccountsOptions = {
......@@ -2641,7 +2641,7 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise&lt;Array&lt;App
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let options: account_appAccount.SelectAccountsOptions = {
......@@ -2687,7 +2687,7 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void;
**示例:**
```js
```ts
import Want from '@ohos.app.ability.Want';
try {
......@@ -2735,7 +2735,7 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions,
**示例:**
```js
```ts
import Want from '@ohos.app.ability.Want';
let options: account_appAccount.VerifyCredentialOptions = {
......@@ -2784,7 +2784,7 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
**示例:**
```js
```ts
import Want from '@ohos.app.ability.Want';
try {
......@@ -2830,7 +2830,7 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
**示例:**
```js
```ts
import Want from '@ohos.app.ability.Want';
let options: account_appAccount.SetPropertiesOptions = {
......@@ -2874,7 +2874,7 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.addAccount('WangWu', (err: BusinessError) => {
......@@ -2903,7 +2903,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.addAccount('LiSi', 'token101', (err: BusinessError) => {
......@@ -2937,7 +2937,7 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.addAccount('LiSi', 'token101').then(()=> {
......@@ -2970,7 +2970,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -3023,7 +3023,7 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.deleteAccount('ZhaoLiu', (err: BusinessError) => {
......@@ -3057,7 +3057,7 @@ deleteAccount(name: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.deleteAccount('ZhaoLiu').then(() => {
......@@ -3088,7 +3088,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err: BusinessError) => {
......@@ -3123,7 +3123,7 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
......@@ -3155,7 +3155,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err: BusinessError) => {
......@@ -3190,7 +3190,7 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
......@@ -3223,7 +3223,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.checkAppAccountSyncEnable('ZhangSan', (err: BusinessError, result: boolean) => {
......@@ -3260,7 +3260,7 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.checkAppAccountSyncEnable('ZhangSan').then((data: boolean) => {
......@@ -3293,7 +3293,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAccountCredential('ZhangSan', 'credentialType001', 'credential001', (err: BusinessError) => {
......@@ -3329,7 +3329,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAccountCredential('ZhangSan', 'credentialType001', 'credential001').then(() => {
......@@ -3362,7 +3362,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002', (err: BusinessError) => {
......@@ -3398,7 +3398,7 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002').then(() => {
......@@ -3432,7 +3432,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAppAccountSyncEnable('ZhangSan', true, (err: BusinessError) => {
......@@ -3469,7 +3469,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager .setAppAccountSyncEnable('ZhangSan', true).then(() => {
......@@ -3503,7 +3503,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001', (err: BusinessError) => {
......@@ -3540,7 +3540,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001').then(() => {
......@@ -3572,7 +3572,7 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAllAccessibleAccounts((err: BusinessError, data: account_appAccount.AppAccountInfo[])=>{
......@@ -3603,7 +3603,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAllAccessibleAccounts().then((data: account_appAccount.AppAccountInfo[]) => {
......@@ -3636,7 +3636,7 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const selfBundle = 'com.example.actsgetallaaccounts';
......@@ -3674,7 +3674,7 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const selfBundle = 'com.example.actsgetallaaccounts';
......@@ -3707,7 +3707,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAccountCredential('ZhangSan', 'credentialType001', (err: BusinessError, result: string) => {
......@@ -3743,7 +3743,7 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAccountCredential('ZhangSan', 'credentialType001').then((data: string) => {
......@@ -3774,7 +3774,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAccountExtraInfo('ZhangSan', (err: BusinessError, result: string) => {
......@@ -3809,7 +3809,7 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAccountExtraInfo('ZhangSan').then((data: string) => {
......@@ -3841,7 +3841,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAssociatedData('ZhangSan', 'k001', (err: BusinessError, result: string) => {
......@@ -3877,7 +3877,7 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAssociatedData('ZhangSan', 'k001').then((data: string) => {
......@@ -3909,7 +3909,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
**示例:**
```js
```ts
function changeOnCallback(data: account_appAccount.AppAccountInfo[]): void {
console.debug('receive change data:' + JSON.stringify(data));
}
......@@ -3942,7 +3942,7 @@ off(type: 'change', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): voi
**示例:**
```js
```ts
function changeOnCallback(data: account_appAccount.AppAccountInfo[]): void {
console.debug('receive change data: ' + JSON.stringify(data));
appAccountManager.off('change', () => {
......@@ -3981,7 +3981,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import common from '@ohos.app.ability.common';
......@@ -4036,7 +4036,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData',
......@@ -4074,7 +4074,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData').then((data: string) => {
......@@ -4107,7 +4107,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx', (err: BusinessError) => {
......@@ -4143,7 +4143,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx').then(() => {
......@@ -4177,7 +4177,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.deleteOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx',
......@@ -4215,7 +4215,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.deleteOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx').then(() => {
......@@ -4249,7 +4249,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true,
......@@ -4287,7 +4287,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.setOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true).then(() => {
......@@ -4320,7 +4320,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.checkOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo',
......@@ -4358,7 +4358,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.checkOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo').then((
......@@ -4391,7 +4391,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo',
......@@ -4428,7 +4428,7 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo').then((
......@@ -4461,7 +4461,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getOAuthList('LiSi', 'getSocialData', (err: BusinessError, data: string[]) => {
......@@ -4497,7 +4497,7 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getOAuthList('LiSi', 'getSocialData').then((data: string[]) => {
......@@ -4528,7 +4528,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
......@@ -4580,7 +4580,7 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
......@@ -4625,7 +4625,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo',
......@@ -4661,7 +4661,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo').then((
......@@ -4869,7 +4869,7 @@ onResult: (code: number, result?: AuthResult) =&gt; void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let appAccountManager = account_appAccount.createAppAccountManager();
......@@ -4907,7 +4907,7 @@ onRequestRedirected: (request: Want) =&gt; void
**示例:**
```js
```ts
class MyAuthenticator extends account_appAccount.Authenticator {
createAccountImplicitly(
options: account_appAccount.CreateAccountImplicitlyOptions, callback: account_appAccount.AuthCallback) {
......@@ -4945,7 +4945,7 @@ onRequestContinued?: () =&gt; void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let appAccountManager = account_appAccount.createAppAccountManager();
......@@ -4984,7 +4984,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let appAccountManager = account_appAccount.createAppAccountManager();
......@@ -5017,7 +5017,7 @@ onRequestRedirected: (request: Want) =&gt; void
**示例:**
```js
```ts
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType: string, callerBundleName: string,
options: Record<string, Object>, callback: account_appAccount.AuthenticatorCallback) {
......@@ -5191,7 +5191,7 @@ getRemoteObject(): rpc.RemoteObject;
**示例:**
```js
```ts
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType: string, callerBundleName: string,
options: Record<string, Object>, callback: account_appAccount.AuthenticatorCallback) {
......
......@@ -8,7 +8,7 @@
## 导入模块
```js
```ts
import account_distributedAccount from '@ohos.account.distributedAccount';
```
......@@ -27,7 +27,7 @@ getDistributedAccountAbility(): DistributedAccountAbility
| [DistributedAccountAbility](#distributedaccountability) | 返回一个实例,实例提供查询和更新分布式帐号登录状态方法。 |
**示例:**
```js
```ts
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
```
......@@ -58,7 +58,7 @@ getOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): voi
| 12300001 | System service exception. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -99,7 +99,7 @@ getOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
| 12300001 | System service exception. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -141,7 +141,7 @@ getOsAccountDistributedInfoByLocalId(localId: number, callback: AsyncCallback&lt
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -185,7 +185,7 @@ getOsAccountDistributedInfoByLocalId(localId: number): Promise&lt;DistributedInf
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -221,7 +221,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): v
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | 是 | 回调函数。当获取分布式帐号信息成功,err为undefined,data为获取到的分布式帐号信息对象;否则为错误对象。 |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -256,7 +256,7 @@ queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise对象,返回分布式帐号信息对象。 |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -293,7 +293,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallbac
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -343,7 +343,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt;
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -389,7 +389,7 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
| 12300008 | Restricted OS account. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -443,7 +443,7 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
| 12300008 | Restricted OS account. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -482,7 +482,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当更新分布式帐号信息成功时,err为undefined,否则为错误对象。 |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......@@ -522,7 +522,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt
| Promise&lt;void&gt; | Promise对象,无返回结果的Promise对象。 |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
......
......@@ -9,7 +9,7 @@
## 导入模块
```js
```ts
import account_osAccount from '@ohos.account.osAccount';
```
......@@ -28,7 +28,7 @@ getAccountManager(): AccountManager
| [AccountManager](#accountmanager) | 系统帐号管理对象。 |
**示例:**
```js
```ts
let accountManager = account_osAccount.getAccountManager();
```
......@@ -78,7 +78,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
| 12300009 | Account has been activated. |
**示例:** 激活ID为100的系统帐号
```js
```ts
import { BusinessError } from '@ohos.base';
let localId: number = 100;
try {
......@@ -129,7 +129,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
| 12300009 | Account has been activated. |
**示例:** 激活ID为100的系统帐号
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -166,7 +166,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -204,7 +204,7 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
try {
let accountManager = account_osAccount.getAccountManager();
......@@ -245,7 +245,7 @@ checkOsAccountActivated(localId: number, callback: AsyncCallback&lt;boolean&gt;)
**示例:** 判断ID为100的系统帐号是否处于激活状态
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -294,7 +294,7 @@ checkOsAccountActivated(localId: number): Promise&lt;boolean&gt;
**示例:** 判断ID为100的系统帐号是否处于激活状态
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -337,7 +337,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A
**示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -388,7 +388,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise&lt
**示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -426,7 +426,7 @@ checkOsAccountTestable(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -464,7 +464,7 @@ checkOsAccountTestable(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -500,7 +500,7 @@ checkOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -538,7 +538,7 @@ checkOsAccountVerified(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -579,7 +579,7 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -628,7 +628,7 @@ checkOsAccountVerified(localId: number): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -665,7 +665,7 @@ checkOsAccountVerified(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -709,7 +709,7 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let accountName: string = 'testAccountName';
......@@ -764,7 +764,7 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let accountName: string = 'testAccountName';
......@@ -814,7 +814,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:** 给ID为100的系统帐号设置禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -869,7 +869,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:** 删除ID为100的系统帐号的禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -915,7 +915,7 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;
**示例:** 将ID为100的系统帐号的帐号名设置成demoName
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -969,7 +969,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
**示例:** 将ID为100的系统帐号的帐号名设置成demoName
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -1009,7 +1009,7 @@ getOsAccountCount(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1049,7 +1049,7 @@ getOsAccountCount(): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1085,7 +1085,7 @@ getOsAccountLocalId(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1123,7 +1123,7 @@ getOsAccountLocalId(): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1161,7 +1161,7 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): v
**示例:** 查询值为12345678的uid所属的系统帐号的帐号ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let uid: number = 12345678;
......@@ -1206,7 +1206,7 @@ getOsAccountLocalIdForUid(uid: number): Promise&lt;number&gt;
**示例:** 查询值为12345678的uid所属的系统帐号ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let uid: number = 12345678;
......@@ -1286,7 +1286,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainInfo: account_osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
let accountManager = account_osAccount.getAccountManager();
......@@ -1334,7 +1334,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise&lt;number&g
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let domainInfo: account_osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
......@@ -1373,7 +1373,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1413,7 +1413,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1454,7 +1454,7 @@ getOsAccountConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;str
**示例:** 获取ID为100的系统帐号的全部约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -1503,7 +1503,7 @@ getOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
**示例:** 获取ID为100的系统帐号的全部约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -1544,7 +1544,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1583,7 +1583,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1619,7 +1619,7 @@ getActivatedOsAccountLocalIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1657,7 +1657,7 @@ getActivatedOsAccountLocalIds(): Promise&lt;Array&lt;number&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1703,7 +1703,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1754,7 +1754,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1801,7 +1801,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let domainInfo: account_osAccount.DomainAccountInfo =
......@@ -1854,7 +1854,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let domainInfo: account_osAccount.DomainAccountInfo =
......@@ -1895,7 +1895,7 @@ getCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1932,7 +1932,7 @@ getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -1975,7 +1975,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;
**示例:** 查询ID为100的系统帐号信息
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2023,7 +2023,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
**示例:** 查询ID为100的系统帐号信息
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2060,7 +2060,7 @@ getOsAccountType(callback: AsyncCallback&lt;OsAccountType&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2095,7 +2095,7 @@ getOsAccountType(): Promise&lt;OsAccountType&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2133,7 +2133,7 @@ queryDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2170,7 +2170,7 @@ queryDistributedVirtualDeviceId(): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2213,7 +2213,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
**示例:** 获取ID为100的系统帐号的头像
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2261,7 +2261,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
**示例:** 获取ID为100的系统帐号的头像
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2307,7 +2307,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
**示例:** 给ID为100的系统帐号设置头像
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2360,7 +2360,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
**示例:** 给ID为100的系统帐号设置头像
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2404,7 +2404,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback
**示例:** 查询与SN码12345关联的系统帐号的ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let serialNumber: number = 12345;
......@@ -2448,7 +2448,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise&lt;number&gt;
**示例:** 查询与SN码12345关联的系统帐号的ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let serialNumber: number = 12345;
......@@ -2488,7 +2488,7 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback&lt;n
**示例:** 获取ID为100的系统帐号关联的SN码
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2532,7 +2532,7 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise&lt;number&gt;
**示例:** 获取ID为100的系统帐号关联的SN码
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -2576,7 +2576,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g
**示例:**
```js
```ts
let accountManager = account_osAccount.getAccountManager();
function onCallback(receiveLocalId: number){
console.log('receive localId:' + receiveLocalId);
......@@ -2617,7 +2617,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
**示例:**
```js
```ts
let accountManager = account_osAccount.getAccountManager();
function offCallback(){
console.log('off enter')
......@@ -2655,7 +2655,7 @@ getBundleIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let testUid: number = 1000000;
......@@ -2700,7 +2700,7 @@ getBundleIdForUid(uid: number): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let testUid: number = 1000000;
......@@ -2782,7 +2782,7 @@ isMainOsAccount(callback: AsyncCallback&lt;boolean&gt;): void;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2820,7 +2820,7 @@ isMainOsAccount(): Promise&lt;boolean&gt;;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2863,7 +2863,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback:
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2912,7 +2912,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
try {
......@@ -2947,7 +2947,7 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err: BusinessError, isEnabled: boolean) => {
......@@ -2979,7 +2979,7 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable().then((isEnabled: boolean) => {
......@@ -3013,7 +3013,7 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi
**示例:** 判断ID为100的系统帐号是否处于激活状态
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3054,7 +3054,7 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
**示例:** 判断ID为100的系统帐号是否处于激活状态
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3089,7 +3089,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
**示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3132,7 +3132,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo
**示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3164,7 +3164,7 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err: BusinessError, isTestable: boolean) => {
......@@ -3196,7 +3196,7 @@ isTestOsAccount(): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTestable: boolean) => {
......@@ -3228,7 +3228,7 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err: BusinessError, isVerified: boolean) => {
......@@ -3263,7 +3263,7 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3304,7 +3304,7 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified(localId).then((isVerified: boolean) => {
......@@ -3336,7 +3336,7 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err: BusinessError, count: number)=>{
......@@ -3370,7 +3370,7 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((count: number) => {
......@@ -3400,7 +3400,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err: BusinessError, localId: number) => {
......@@ -3432,7 +3432,7 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess().then((localId: number) => {
......@@ -3463,7 +3463,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
**示例:** 查询值为12345678的uid所属的系统帐号ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let uid: number = 12345678;
......@@ -3502,7 +3502,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
**示例:** 查询值为12345678的uid所属的系统帐号ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let uid: number = 12345678;
......@@ -3536,7 +3536,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'};
let accountManager = account_osAccount.getAccountManager();
......@@ -3577,7 +3577,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'};
......@@ -3611,7 +3611,7 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;
**示例:** 获取ID为100的系统帐号的全部约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3649,7 +3649,7 @@ getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
**示例:** 获取ID为100的系统帐号的全部约束
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -3680,7 +3680,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;):
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds((err: BusinessError, idArray: number[])=>{
......@@ -3712,7 +3712,7 @@ queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds().then((idArray: number[]) => {
......@@ -3744,7 +3744,7 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount((err: BusinessError, curAccountInfo: account_osAccount.OsAccountInfo)=>{
......@@ -3775,7 +3775,7 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount().then((accountInfo: account_osAccount.OsAccountInfo) => {
......@@ -3805,7 +3805,7 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess((err: BusinessError, accountType: account_osAccount.OsAccountType) => {
......@@ -3834,7 +3834,7 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess().then((accountType: account_osAccount.OsAccountType) => {
......@@ -3866,7 +3866,7 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId((err: BusinessError, virtualID: string) => {
......@@ -3897,7 +3897,7 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt;
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId().then((virtualID: string) => {
......@@ -3928,7 +3928,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&
**示例:** 查询与SN码12345关联的系统帐号的ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let serialNumber: number = 12345;
......@@ -3964,7 +3964,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
**示例:** 查询与SN码12345关联的系统帐号的ID
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let serialNumber: number = 12345;
......@@ -3996,7 +3996,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu
**示例:** 获取ID为100的系统帐号关联的SN码
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -4032,7 +4032,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
**示例:** 获取ID为100的系统帐号关联的SN码
```js
```ts
import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager();
let localId: number = 100;
......@@ -4060,7 +4060,7 @@ constructor()
**系统能力**:SystemCapability.Account.OsAccount
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
```
......@@ -4081,7 +4081,7 @@ getVersion(): number;
| number | 返回版本信息。|
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
let version: number = userAuth.getVersion();
console.log('getVersion version = ' + version);
......@@ -4120,7 +4120,7 @@ getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
| 12300002 | Invalid authType or authTrustLevel. |
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
let authType = account_osAccount.AuthType.PIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
......@@ -4159,7 +4159,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback&lt;ExecutorProp
| 12300002 | Invalid request. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth();
let keys = [
......@@ -4213,7 +4213,7 @@ getProperty(request: GetPropertyRequest): Promise&lt;ExecutorProperty&gt;;
| 12300002 | Invalid request. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth();
let keys = [
......@@ -4263,7 +4263,7 @@ setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;void&gt;): v
| 12300002 | Invalid request. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth();
let request: account_osAccount.SetPropertyRequest = {
......@@ -4316,7 +4316,7 @@ setProperty(request: SetPropertyRequest): Promise&lt;void&gt;;
| 12300002 | Invalid request. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth();
let request2: account_osAccount.SetPropertyRequest = {
......@@ -4378,7 +4378,7 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel,
| 12300112 | Authentication service is busy. |
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
let challenge = new Uint8Array([0]);
let authType = account_osAccount.AuthType.PIN;
......@@ -4439,7 +4439,7 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev
| 12300112 | Authentication service is busy. |
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
let userID: number = 100;
let challenge = new Uint8Array([0]);
......@@ -4483,7 +4483,7 @@ cancelAuth(contextID: Uint8Array): void;
| 12300002 | Invalid contextId. |
**示例:**
```js
```ts
let userAuth = new account_osAccount.UserAuth();
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
let challenge = new Uint8Array([0]);
......@@ -4517,7 +4517,7 @@ constructor()
**系统能力**:SystemCapability.Account.OsAccount
**示例:**
```js
```ts
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
```
......@@ -4548,7 +4548,7 @@ registerInputer(inputer: IInputer): void;
| 12300103 | Inputer already registered. |
**示例:**
```js
```ts
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
let password = new Uint8Array([0, 0, 0, 0, 0]);
try {
......@@ -4576,7 +4576,7 @@ unregisterInputer(): void;
**需要权限:** ohos.permission.ACCESS_PIN_AUTH
**示例:**
```js
```ts
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
pinAuth.unregisterInputer();
```
......@@ -4614,7 +4614,7 @@ static registerInputer(authType: AuthType, inputer: IInputer): void
| 12300106 | Unsupported authType. |
**示例:**
```js
```ts
let authType = account_osAccount.AuthType.DOMAIN;
let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0]);
try {
......@@ -4654,7 +4654,7 @@ static unregisterInputer(authType: AuthType): void
| 12300002 | Invalid authType. |
**示例:**
```js
```ts
let authType = account_osAccount.AuthType.DOMAIN;
try {
account_osAccount.InputerManager.unregisterInputer(authType);
......@@ -4689,7 +4689,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。|
**示例:**
```js
```ts
import { AsyncCallback } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -4753,7 +4753,7 @@ authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback)
| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。|
**示例:**
```js
```ts
import { AsyncCallback } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -4804,7 +4804,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。|
**示例:**
```js
```ts
import { AsyncCallback } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -4854,7 +4854,7 @@ getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallba
| callback | AsyncCallback&lt;[DomainAccountInfo](#domainaccountinfo8)&gt; | 是 | 指示查询结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from '@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -4909,7 +4909,7 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
| callback | AsyncCallback&lt;[AuthStatusInfo](#authstatusinfo10)&gt; | 是 | 指示查询结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from '@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -4961,7 +4961,7 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
| callback | AsyncCallback&lt;void&gt; | 是 | 指示绑定结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -5011,7 +5011,7 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;v
| callback | AsyncCallback&lt;void&gt; | 是 | 指示绑定结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -5062,7 +5062,7 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
| callback | AsyncCallback&lt;boolean&gt; | 是 | 指示检查结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -5112,7 +5112,7 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback&lt;
| callback | AsyncCallback&lt;Uint8Array&gt; | 是 | 指示结果回调。|
**示例:**
```js
```ts
import { AsyncCallback, BusinessError } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -5173,7 +5173,7 @@ static registerPlugin(plugin: DomainPlugin): void
| 12300201 | The domain plugin has been registered. |
**示例:**
```js
```ts
import { AsyncCallback } from './@ohos.base';
let plugin: account_osAccount.DomainPlugin = {
auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array,
......@@ -5214,7 +5214,7 @@ static unregisterPlugin(): void
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**示例:**
```js
```ts
try {
account_osAccount.DomainAccountManager.unregisterPlugin();
console.log('unregisterPlugin success.');
......@@ -5260,7 +5260,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
| 12300114 | Authentication service exception. |
**示例:**
```js
```ts
let domainAccountInfo: account_osAccount.DomainAccountInfo = {
domain: 'CHINA',
accountName: 'zhangsan'
......@@ -5312,7 +5312,7 @@ authWithPopup(callback: IUserAuthCallback): void
| 12300114 | Authentication service exception. |
**示例:**
```js
```ts
try {
account_osAccount.DomainAccountManager.authWithPopup({
onResult: (resultCode: number, authResult: account_osAccount.AuthResult) => {
......@@ -5361,7 +5361,7 @@ authWithPopup(localId: number, callback: IUserAuthCallback): void
| 12300114 | Authentication service exception. |
**示例:**
```js
```ts
try {
account_osAccount.DomainAccountManager.authWithPopup(100, {
onResult: (resultCode: number, authResult: account_osAccount.AuthResult) => {
......@@ -5403,7 +5403,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;bool
| 12300111 | Operation timeout. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.DomainAccountInfo = {
domain: 'CHINA',
......@@ -5456,7 +5456,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt;
| 12300111 | Operation timeout. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.DomainAccountInfo = {
domain: 'CHINA',
......@@ -5502,7 +5502,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.DomainAccountInfo = {
domain: 'CHINA',
......@@ -5557,7 +5557,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
| 12300003 | Account not found. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.DomainAccountInfo = {
domain: 'CHINA',
......@@ -5605,7 +5605,7 @@ getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback&lt;
| 12300111 | Operation timeout. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.GetDomainAccountInfoOptions = {
domain: 'CHINA',
......@@ -5659,7 +5659,7 @@ getAccountInfo(options: GetDomainAccountInfoOptions): Promise&lt;DomainAccountIn
| 12300111 | Operation timeout. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let domainAccountInfo: account_osAccount.GetDomainAccountInfoOptions = {
domain: 'CHINA',
......@@ -5694,7 +5694,7 @@ constructor()
**系统能力**:SystemCapability.Account.OsAccount
**示例:**
```js
```ts
let userIDM = new account_osAccount.UserIdentityManager();
```
......@@ -5723,7 +5723,7 @@ openSession(callback: AsyncCallback&lt;Uint8Array&gt;): void;
| 12300001 | System service exception. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
try {
......@@ -5761,7 +5761,7 @@ openSession(): Promise&lt;Uint8Array&gt;;
| 12300001 | System service exception. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
try {
......@@ -5807,7 +5807,7 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300115 | The number of credentials reaches the upper limit. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
......@@ -5868,7 +5868,7 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300111 | Operation timeout. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
let userAuth: account_osAccount.UserAuth = new account_osAccount.UserAuth();
......@@ -5921,7 +5921,7 @@ closeSession(): void;
**需要权限:** ohos.permission.MANAGE_USER_IDM
**示例:**
```js
```ts
let userIDM = new account_osAccount.UserIdentityManager();
userIDM.closeSession();
```
......@@ -5952,7 +5952,7 @@ cancel(challenge: Uint8Array): void;
| 12300002 | Invalid challenge. |
**示例:**
```js
```ts
let userIDM = new account_osAccount.UserIdentityManager();
let challenge: Uint8Array = new Uint8Array([0]);
try {
......@@ -5989,7 +5989,7 @@ delUser(token: Uint8Array, callback: IIdmCallback): void;
| 12300101 | Token is invalid. |
**示例:**
```js
```ts
let userIDM = new account_osAccount.UserIdentityManager();
let token: Uint8Array = new Uint8Array([0]);
try {
......@@ -6034,7 +6034,7 @@ delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): vo
| 12300102 | Credential not enrolled. |
**示例:**
```js
```ts
let userIDM = new account_osAccount.UserIdentityManager();
let credentialId: Uint8Array = new Uint8Array([0]);
let token: Uint8Array = new Uint8Array([0]);
......@@ -6076,7 +6076,7 @@ getAuthInfo(callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void;
| 12300102 | Credential not enrolled. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
try {
......@@ -6117,7 +6117,7 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback&lt;Array&lt;EnrolledCred
| 12300102 | Credential not enrolled. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
try {
......@@ -6164,7 +6164,7 @@ getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;;
| 12300102 | Credential not enrolled. |
**示例:**
```js
```ts
import { BusinessError } from '@ohos.base';
let userIDM = new account_osAccount.UserIdentityManager();
try {
......@@ -6208,7 +6208,7 @@ onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
| 12300002 | Invalid pinSubType. |
**示例:**
```js
```ts
let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber: Uint8Array = new Uint8Array([1, 2, 3, 4]);
let inputer: account_osAccount.IInputer = {
......@@ -6245,7 +6245,7 @@ onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
| callback | [IInputData](#iinputdata8) | 是 | 指示密码数据回调。|
**示例:**
```js
```ts
let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber: Uint8Array = new Uint8Array([1, 2, 3, 4]);
let inputer: account_osAccount.IInputer = {
......@@ -6286,7 +6286,7 @@ onResult: (result: number, extraInfo: AuthResult) => void;
| extraInfo | [AuthResult](#authresult8) | 是 | 表示不同情况下的具体信息,如果认证通过,则在extrainfo中返回认证令牌,如果身份验证失败,则在extrainfo中返回剩余的身份验证时间,如果身份验证执行器被锁定,冻结时间将在extrainfo中返回。|
**示例:**
```js
```ts
let authCallback: account_osAccount.IUserAuthCallback = {
onResult: (result: number, extraInfo: account_osAccount.AuthResult) => {
console.log('auth result = ' + result);
......@@ -6314,7 +6314,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| extraInfo | any | 是 | 保留参数。 |
**示例:**
```js
```ts
let authCallback: account_osAccount.IUserAuthCallback = {
onResult: (result: number, extraInfo: account_osAccount.AuthResult) => {
console.log('auth result = ' + result)
......@@ -6352,7 +6352,7 @@ onResult: (result: number, extraInfo: RequestResult) => void;
| extraInfo | [RequestResult](#requestresult8) | 是 | 针对不同情况传递具体信息。|
**示例:**
```js
```ts
let idmCallback: account_osAccount.IIdmCallback = {
onResult: (result: number, extraInfo: account_osAccount.RequestResult) => {
console.log('callback result = ' + result)
......@@ -6380,7 +6380,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| extraInfo | any | 是 | 保留参数。 |
**示例:**
```js
```ts
let idmCallback: account_osAccount.IIdmCallback = {
onResult: (result: number, extraInfo: Object) => {
console.log('callback result = ' + result)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册