1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import {AsyncCallback} from './basic' 17 18/** 19 * This module provides the capability to manage distributed accounts. 20 * 21 * @since 7 22 * @syscap SystemCapability.Account.OsAccount 23 */ 24declare namespace distributedAccount { 25 /** 26 * Get the ability of the distributed account. 27 * @since 7 28 * @syscap SystemCapability.Account.OsAccount 29 * @permission N/A 30 * @return Ability to manage operations of distributed account. 31 */ 32 function getDistributedAccountAbility(): DistributedAccountAbility; 33 34 /** 35 * Defines distributed account functions and interfaces. 36 * 37 * @name DistributedAccountAbility 38 * @since 7 39 * @syscap SystemCapability.Account.OsAccount 40 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 41 */ 42 interface DistributedAccountAbility { 43 /** 44 * Queries the distributed information of the current OS account. 45 * 46 * @since 7 47 * @return The distributed information of the current OS account. 48 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC 49 */ 50 queryOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): void; 51 queryOsAccountDistributedInfo(): Promise<DistributedInfo>; 52 53 /** 54 * Updates the distributed information of the OS account. 55 * 56 * @since 7 57 * @param accountInfo Indicates the information of the OS account used for a distributed system. 58 * @return void 59 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. 60 */ 61 updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback<void>): void; 62 updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>; 63 } 64 65 /** 66 * Provides the distributed information of the OS account. 67 * 68 * @name DistributedInfo 69 * @since 7 70 * @syscap SystemCapability.Account.OsAccount 71 * @permission N/A 72 */ 73 interface DistributedInfo { 74 /** 75 * The name in the distributed information of the OS account. 76 */ 77 name: string; 78 79 /** 80 * The ID in the distributed information of the OS account. 81 */ 82 id: string; 83 84 /** 85 * The event string in the distributed information of the OS account. 86 */ 87 event: string; 88 89 /** 90 * The scalable data in the distributed information of the OS account. 91 */ 92 scalableData?: object; 93 } 94} 95 96export default distributedAccount;