/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit BasicServicesKit */ import type { AsyncCallback, Callback } from './@ohos.base'; import type Want from './@ohos.app.ability.Want'; import type rpc from './@ohos.rpc'; /** * This module provides the capability to manage application accounts. * * @namespace appAccount * @syscap SystemCapability.Account.AppAccount * @since 7 */ declare namespace appAccount { /** * Obtains the AppAccountManager instance. * * @returns { AppAccountManager } Returns the instance of the AppAccountManager. * @syscap SystemCapability.Account.AppAccount * @since 7 */ function createAppAccountManager(): AppAccountManager; /** * Provides methods for managing application accounts. * * @interface AppAccountManager * @syscap SystemCapability.Account.AppAccount * @since 7 */ interface AppAccountManager { /** * Adds the account name and extra information of this application to the account management service. *
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { string } extraInfo - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { string } [extraInfo] - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { CreateAccountOptions } options - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { CreateAccountOptions } [options] - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @returns { Promise
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { AsyncCallback
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @returns { Promise
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { AsyncCallback
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @returns { Promise
* You can call this method when you forget the extra information of your application account or
* need to modify the extra information.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } extraInfo - Indicates the extra information to set.
* @param { AsyncCallback
* You can call this method when you forget the extra information of your application account or
* need to modify the extra information.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } extraInfo - Indicates the extra information to set.
* @returns { Promise
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not allowed, the application data is stored only on the local device.
*
* Application account-related changes: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
*
* Application data that can be synchronized: application account name, token,
* and data associated with this application account
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnable - Specifies whether to allow application data synchronization.
* @param { AsyncCallback
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not allowed, the application data is stored only on the local device.
*
* Application account-related changes: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
*
* Application data that can be synchronized: application account name, token,
* and data associated with this application account
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnable - Specifies whether to allow application data synchronization.
* @returns { Promise
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not enabled, the application data is stored only on the local device.
*
* Application account-related changes: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
*
* Application data that can be synchronized: application account name, token,
* and data associated with this application account
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
* @param { AsyncCallback
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not enabled, the application data is stored only on the local device.
*
* Application account-related changes: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
*
* Application data that can be synchronized: application account name, token,
* and data associated with this application account
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
* @returns { Promise
* When the account owner updates the account, the subscriber will receive a notification
* about the account change event.
*
* @param { 'change' } type - Event type.
* @param { Array
* When the account owner updates the account, the subscriber will receive a notification
* about the account change event.
*
* @param { 'accountChange' } type - Event type.
* @param { Array
* When the account owner updates the account, the subscriber will receive a notification
* about the account change event.
*
* @param { 'accountChange' } type - Event type.
* @param { Array
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @returns { Promise
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @param { AsyncCallback
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @returns { Promise
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @param { AsyncCallback
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @param { AsyncCallback
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @returns { Promise
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @param { AsyncCallback
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @returns { Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or options.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or options.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, options?: CreateAccountOptions): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccountImplicitly(owner: string, callback: AuthCallback): void;
/**
* Creates an application account of a specified owner implicitly.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner or options.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;
/**
* Deletes an application account from the account management service.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
removeAccount(name: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
removeAccount(name: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Sets a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
* @param { AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Sets a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
* @returns { Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAppAccess(name: string, bundleName: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAppAccess(name: string, bundleName: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkDataSyncEnabled(name: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkDataSyncEnabled(name: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCredential(name: string, credentialType: string, credential: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setDataSyncEnabled(name: string, isEnabled: boolean): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, key or value.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCustomData(name: string, key: string, value: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, key or value.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCustomData(name: string, key: string, value: string): Promise
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { AsyncCallback
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @returns { Promise
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAccounts(callback: AsyncCallback
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @returns { Promise
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Gets information about all accounts of a specified account owner.
* This method applies to the following accounts:
*
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
getAccountsByOwner(owner: string, callback: AsyncCallback
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Gets information about all accounts of a specified account owner.
* This method applies to the following accounts:
*
Accounts of this application.
*
Accounts of third-party applications. To obtain such information,
*
your application must have gained authorization from the third-party applications or
*
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
getAccountsByOwner(owner: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCredential(name: string, credentialType: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCredential(name: string, credentialType: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomData(name: string, key: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomData(name: string, key: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomDataSync(name: string, key: string): string;
/**
* Subscribes to the change events of accounts of the specified owners.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type or owners.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Subscribes to the change events of accounts of the specified owners.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type or owners.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
on(type: 'accountChange', owners: Array
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
off(type: 'accountChange', callback?: Callback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
auth(name: string, owner: string, authType: string, callback: AuthCallback): void;
/**
* Authenticates an application account to get an auth token.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { Record
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or options.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
auth(
name: string,
owner: string,
authType: string,
options: Record
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthToken(name: string, owner: string, authType: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthToken(name: string, authType: string, token: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteAuthToken(name: string, owner: string, authType: string, token: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400001 - Application not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Sets the auth token visibility of the specified authentication type to a third-party application.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
setAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
isVisible: boolean,
callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400001 - Application not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
/**
* Sets the auth token visibility of the specified authentication type to a third-party application.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 14
*/
setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or owner.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAuthTokens(name: string, owner: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or owner.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAuthTokens(name: string, owner: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthList(name: string, authType: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthList(name: string, authType: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid sessionId.
* @throws { BusinessError } 12300108 - Session not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthCallback(sessionId: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid sessionId.
* @throws { BusinessError } 12300108 - Session not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthCallback(sessionId: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
queryAuthenticatorInfo(owner: string, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
queryAuthenticatorInfo(owner: string): Promise
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or labels.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAccountLabels(name: string, owner: string, labels: Array