161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkData 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport Context from './application/BaseContext'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace preferences 2861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 2961847f8eSopenharmony_ci * @since 9 3061847f8eSopenharmony_ci * @name preferences 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_ci/** 3361847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @namespace preferences 3661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 3761847f8eSopenharmony_ci * @crossplatform 3861847f8eSopenharmony_ci * @since 10 3961847f8eSopenharmony_ci * @name preferences 4061847f8eSopenharmony_ci */ 4161847f8eSopenharmony_ci/** 4261847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @namespace preferences 4561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 4661847f8eSopenharmony_ci * @crossplatform 4761847f8eSopenharmony_ci * @atomicservice 4861847f8eSopenharmony_ci * @since 11 4961847f8eSopenharmony_ci * @name preferences 5061847f8eSopenharmony_ci */ 5161847f8eSopenharmony_cideclare namespace preferences { 5261847f8eSopenharmony_ci /** 5361847f8eSopenharmony_ci * Indicates possible value types 5461847f8eSopenharmony_ci * 5561847f8eSopenharmony_ci * @typedef {number | string | boolean | Array<number> | Array<string> | Array<boolean>} 5661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 5761847f8eSopenharmony_ci * @since 9 5861847f8eSopenharmony_ci */ 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * Indicates possible value types 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * @typedef {number | string | boolean | Array<number> | Array<string> | Array<boolean>} 6361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 6461847f8eSopenharmony_ci * @since 10 6561847f8eSopenharmony_ci */ 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * Indicates possible value types 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @typedef {number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array} 7061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 7161847f8eSopenharmony_ci * @atomicservice 7261847f8eSopenharmony_ci * @since 11 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * Indicates possible value types 7661847f8eSopenharmony_ci * 7761847f8eSopenharmony_ci * @typedef {number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array | object | bigint} 7861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 7961847f8eSopenharmony_ci * @atomicservice 8061847f8eSopenharmony_ci * @since 12 8161847f8eSopenharmony_ci */ 8261847f8eSopenharmony_ci type ValueType = number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array | object | bigint; 8361847f8eSopenharmony_ci 8461847f8eSopenharmony_ci /** 8561847f8eSopenharmony_ci * Indicates the maximum length of a key (80 characters). 8661847f8eSopenharmony_ci * 8761847f8eSopenharmony_ci * @constant 8861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 8961847f8eSopenharmony_ci * @since 9 9061847f8eSopenharmony_ci */ 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * Indicates the maximum length of a key (80 characters). 9361847f8eSopenharmony_ci * 9461847f8eSopenharmony_ci * @constant 9561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 9661847f8eSopenharmony_ci * @crossplatform 9761847f8eSopenharmony_ci * @since 10 9861847f8eSopenharmony_ci */ 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Indicates the maximum length of a key (80 characters). 10161847f8eSopenharmony_ci * 10261847f8eSopenharmony_ci * @constant 10361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 10461847f8eSopenharmony_ci * @crossplatform 10561847f8eSopenharmony_ci * @atomicservice 10661847f8eSopenharmony_ci * @since 11 10761847f8eSopenharmony_ci */ 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * Maximum length of a key. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 11261847f8eSopenharmony_ci * @crossplatform 11361847f8eSopenharmony_ci * @atomicservice 11461847f8eSopenharmony_ci * @since 12 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ci const MAX_KEY_LENGTH: number; 11761847f8eSopenharmony_ci 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * Indicates the maximum length of a string (8192 characters). 12061847f8eSopenharmony_ci * 12161847f8eSopenharmony_ci * @constant 12261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 12361847f8eSopenharmony_ci * @since 9 12461847f8eSopenharmony_ci */ 12561847f8eSopenharmony_ci /** 12661847f8eSopenharmony_ci * Indicates the maximum length of a string (8192 characters). 12761847f8eSopenharmony_ci * 12861847f8eSopenharmony_ci * @constant 12961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 13061847f8eSopenharmony_ci * @crossplatform 13161847f8eSopenharmony_ci * @since 10 13261847f8eSopenharmony_ci */ 13361847f8eSopenharmony_ci /** 13461847f8eSopenharmony_ci * Indicates the maximum length of a string (8192 characters). 13561847f8eSopenharmony_ci * 13661847f8eSopenharmony_ci * @constant 13761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 13861847f8eSopenharmony_ci * @crossplatform 13961847f8eSopenharmony_ci * @atomicservice 14061847f8eSopenharmony_ci * @since 11 14161847f8eSopenharmony_ci */ 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * Maximum length of a value. 14461847f8eSopenharmony_ci * 14561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 14661847f8eSopenharmony_ci * @crossplatform 14761847f8eSopenharmony_ci * @atomicservice 14861847f8eSopenharmony_ci * @since 12 14961847f8eSopenharmony_ci */ 15061847f8eSopenharmony_ci const MAX_VALUE_LENGTH: number; 15161847f8eSopenharmony_ci 15261847f8eSopenharmony_ci /** 15361847f8eSopenharmony_ci * Manages preferences file configurations. 15461847f8eSopenharmony_ci * 15561847f8eSopenharmony_ci * @interface Options 15661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 15761847f8eSopenharmony_ci * @crossplatform 15861847f8eSopenharmony_ci * @since 10 15961847f8eSopenharmony_ci */ 16061847f8eSopenharmony_ci /** 16161847f8eSopenharmony_ci * Manages preferences file configurations. 16261847f8eSopenharmony_ci * 16361847f8eSopenharmony_ci * @interface Options 16461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 16561847f8eSopenharmony_ci * @crossplatform 16661847f8eSopenharmony_ci * @atomicservice 16761847f8eSopenharmony_ci * @since 11 16861847f8eSopenharmony_ci */ 16961847f8eSopenharmony_ci interface Options { 17061847f8eSopenharmony_ci /** 17161847f8eSopenharmony_ci * The preferences file name. 17261847f8eSopenharmony_ci * 17361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 17461847f8eSopenharmony_ci * @crossplatform 17561847f8eSopenharmony_ci * @since 10 17661847f8eSopenharmony_ci */ 17761847f8eSopenharmony_ci /** 17861847f8eSopenharmony_ci * The preferences file name. 17961847f8eSopenharmony_ci * 18061847f8eSopenharmony_ci * @type { string } 18161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 18261847f8eSopenharmony_ci * @crossplatform 18361847f8eSopenharmony_ci * @atomicservice 18461847f8eSopenharmony_ci * @since 11 18561847f8eSopenharmony_ci */ 18661847f8eSopenharmony_ci name: string; 18761847f8eSopenharmony_ci 18861847f8eSopenharmony_ci /** 18961847f8eSopenharmony_ci * Application Group Id. 19061847f8eSopenharmony_ci * 19161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 19261847f8eSopenharmony_ci * @StageModelOnly 19361847f8eSopenharmony_ci * @since 10 19461847f8eSopenharmony_ci */ 19561847f8eSopenharmony_ci /** 19661847f8eSopenharmony_ci * Application Group Id. 19761847f8eSopenharmony_ci * 19861847f8eSopenharmony_ci * @type { ?(string | null | undefined) } 19961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 20061847f8eSopenharmony_ci * @StageModelOnly 20161847f8eSopenharmony_ci * @atomicservice 20261847f8eSopenharmony_ci * @since 11 20361847f8eSopenharmony_ci */ 20461847f8eSopenharmony_ci dataGroupId?: string | null | undefined; 20561847f8eSopenharmony_ci } 20661847f8eSopenharmony_ci 20761847f8eSopenharmony_ci /** 20861847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 20961847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 21061847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 21361847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 21461847f8eSopenharmony_ci * @param { AsyncCallback<Preferences> } callback - The {@link Preferences} instance matching the specified 21561847f8eSopenharmony_ci * preferences file name. 21661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 21761847f8eSopenharmony_ci * 2. Incorrect parameter types; 21861847f8eSopenharmony_ci * 3. Parameter verification failed. 21961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 22061847f8eSopenharmony_ci * @since 9 22161847f8eSopenharmony_ci */ 22261847f8eSopenharmony_ci /** 22361847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 22461847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 22561847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 22661847f8eSopenharmony_ci * 22761847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 22861847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 22961847f8eSopenharmony_ci * @param { AsyncCallback<Preferences> } callback - The {@link Preferences} instance matching the specified 23061847f8eSopenharmony_ci * preferences file name. 23161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 23261847f8eSopenharmony_ci * 2. Incorrect parameter types; 23361847f8eSopenharmony_ci * 3. Parameter verification failed. 23461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 23561847f8eSopenharmony_ci * @crossplatform 23661847f8eSopenharmony_ci * @since 10 23761847f8eSopenharmony_ci */ 23861847f8eSopenharmony_ci /** 23961847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 24061847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 24161847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 24261847f8eSopenharmony_ci * 24361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 24461847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 24561847f8eSopenharmony_ci * @param { AsyncCallback<Preferences> } callback - The {@link Preferences} instance matching the specified 24661847f8eSopenharmony_ci * preferences file name. 24761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 24861847f8eSopenharmony_ci * 2. Incorrect parameter types; 24961847f8eSopenharmony_ci * 3. Parameter verification failed. 25061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 25161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 25261847f8eSopenharmony_ci * @crossplatform 25361847f8eSopenharmony_ci * @atomicservice 25461847f8eSopenharmony_ci * @since 11 25561847f8eSopenharmony_ci */ 25661847f8eSopenharmony_ci function getPreferences(context: Context, name: string, callback: AsyncCallback<Preferences>): void; 25761847f8eSopenharmony_ci 25861847f8eSopenharmony_ci /** 25961847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 26061847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 26161847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 26261847f8eSopenharmony_ci * 26361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 26461847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 26561847f8eSopenharmony_ci * @param { AsyncCallback<Preferences> } callback - The {@link Preferences} instance matching the specified 26661847f8eSopenharmony_ci * preferences file name. 26761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 26861847f8eSopenharmony_ci * 2. Incorrect parameter types; 26961847f8eSopenharmony_ci * 3. Parameter verification failed. 27061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 27161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 27261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 27361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 27461847f8eSopenharmony_ci * @crossplatform 27561847f8eSopenharmony_ci * @since 10 27661847f8eSopenharmony_ci */ 27761847f8eSopenharmony_ci /** 27861847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 27961847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 28061847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 28161847f8eSopenharmony_ci * 28261847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 28361847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 28461847f8eSopenharmony_ci * @param { AsyncCallback<Preferences> } callback - The {@link Preferences} instance matching the specified 28561847f8eSopenharmony_ci * preferences file name. 28661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 28761847f8eSopenharmony_ci * 2. Incorrect parameter types; 28861847f8eSopenharmony_ci * 3. Parameter verification failed. 28961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 29061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 29161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 29261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 29361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 29461847f8eSopenharmony_ci * @crossplatform 29561847f8eSopenharmony_ci * @atomicservice 29661847f8eSopenharmony_ci * @since 11 29761847f8eSopenharmony_ci */ 29861847f8eSopenharmony_ci function getPreferences(context: Context, options: Options, callback: AsyncCallback<Preferences>): void; 29961847f8eSopenharmony_ci 30061847f8eSopenharmony_ci /** 30161847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 30261847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 30361847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 30461847f8eSopenharmony_ci * 30561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 30661847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 30761847f8eSopenharmony_ci * @returns { Promise<Preferences> } The {@link Preferences} instance matching the specified preferences file name. 30861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 30961847f8eSopenharmony_ci * 2. Incorrect parameter types; 31061847f8eSopenharmony_ci * 3. Parameter verification failed. 31161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 31261847f8eSopenharmony_ci * @since 9 31361847f8eSopenharmony_ci */ 31461847f8eSopenharmony_ci /** 31561847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 31661847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 31761847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 31861847f8eSopenharmony_ci * 31961847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 32061847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 32161847f8eSopenharmony_ci * @returns { Promise<Preferences> } The {@link Preferences} instance matching the specified preferences file name. 32261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 32361847f8eSopenharmony_ci * 2. Incorrect parameter types; 32461847f8eSopenharmony_ci * 3. Parameter verification failed. 32561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 32661847f8eSopenharmony_ci * @crossplatform 32761847f8eSopenharmony_ci * @since 10 32861847f8eSopenharmony_ci */ 32961847f8eSopenharmony_ci /** 33061847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 33161847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 33261847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 33361847f8eSopenharmony_ci * 33461847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 33561847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 33661847f8eSopenharmony_ci * @returns { Promise<Preferences> } The {@link Preferences} instance matching the specified preferences file name. 33761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 33861847f8eSopenharmony_ci * 2. Incorrect parameter types; 33961847f8eSopenharmony_ci * 3. Parameter verification failed. 34061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 34161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 34261847f8eSopenharmony_ci * @crossplatform 34361847f8eSopenharmony_ci * @atomicservice 34461847f8eSopenharmony_ci * @since 11 34561847f8eSopenharmony_ci */ 34661847f8eSopenharmony_ci function getPreferences(context: Context, name: string): Promise<Preferences>; 34761847f8eSopenharmony_ci 34861847f8eSopenharmony_ci /** 34961847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 35061847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 35161847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 35261847f8eSopenharmony_ci * 35361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 35461847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 35561847f8eSopenharmony_ci * @returns { Promise<Preferences> } The {@link Preferences} instance matching the specified preferences file name. 35661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 35761847f8eSopenharmony_ci * 2. Incorrect parameter types; 35861847f8eSopenharmony_ci * 3. Parameter verification failed. 35961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 36061847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 36161847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 36261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 36361847f8eSopenharmony_ci * @crossplatform 36461847f8eSopenharmony_ci * @since 10 36561847f8eSopenharmony_ci */ 36661847f8eSopenharmony_ci /** 36761847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 36861847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 36961847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 37061847f8eSopenharmony_ci * 37161847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 37261847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 37361847f8eSopenharmony_ci * @returns { Promise<Preferences> } The {@link Preferences} instance matching the specified preferences file name. 37461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 37561847f8eSopenharmony_ci * 2. Incorrect parameter types; 37661847f8eSopenharmony_ci * 3. Parameter verification failed. 37761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 37861847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 37961847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 38061847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 38161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 38261847f8eSopenharmony_ci * @crossplatform 38361847f8eSopenharmony_ci * @atomicservice 38461847f8eSopenharmony_ci * @since 11 38561847f8eSopenharmony_ci */ 38661847f8eSopenharmony_ci function getPreferences(context: Context, options: Options): Promise<Preferences>; 38761847f8eSopenharmony_ci 38861847f8eSopenharmony_ci /** 38961847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 39061847f8eSopenharmony_ci * This interface is executed synchronously. 39161847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 39261847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 39361847f8eSopenharmony_ci * 39461847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 39561847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 39661847f8eSopenharmony_ci * @returns { Preferences } The {@link Preferences} instance matching the specified preferences file name. 39761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 39861847f8eSopenharmony_ci * 2. Incorrect parameter types; 39961847f8eSopenharmony_ci * 3. Parameter verification failed. 40061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 40161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 40261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 40361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 40461847f8eSopenharmony_ci * @crossplatform 40561847f8eSopenharmony_ci * @since 10 40661847f8eSopenharmony_ci */ 40761847f8eSopenharmony_ci /** 40861847f8eSopenharmony_ci * Obtains a {@link Preferences} instance matching a specified preferences file name. 40961847f8eSopenharmony_ci * This interface is executed synchronously. 41061847f8eSopenharmony_ci * <p>The {@link references} instance loads all data of the preferences file and 41161847f8eSopenharmony_ci * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. 41261847f8eSopenharmony_ci * 41361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 41461847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 41561847f8eSopenharmony_ci * @returns { Preferences } The {@link Preferences} instance matching the specified preferences file name. 41661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 41761847f8eSopenharmony_ci * 2. Incorrect parameter types; 41861847f8eSopenharmony_ci * 3. Parameter verification failed. 41961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 42061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 42161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 42261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 42361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 42461847f8eSopenharmony_ci * @crossplatform 42561847f8eSopenharmony_ci * @atomicservice 42661847f8eSopenharmony_ci * @since 11 42761847f8eSopenharmony_ci */ 42861847f8eSopenharmony_ci function getPreferencesSync(context: Context, options: Options): Preferences; 42961847f8eSopenharmony_ci 43061847f8eSopenharmony_ci /** 43161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 43261847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 43361847f8eSopenharmony_ci * preferences file. 43461847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 43561847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 43661847f8eSopenharmony_ci * will occur. 43761847f8eSopenharmony_ci * 43861847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 43961847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 44061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 44161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 44261847f8eSopenharmony_ci * 2. Incorrect parameter types; 44361847f8eSopenharmony_ci * 3. Parameter verification failed. 44461847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 44561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 44661847f8eSopenharmony_ci * @since 9 44761847f8eSopenharmony_ci */ 44861847f8eSopenharmony_ci /** 44961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 45061847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 45161847f8eSopenharmony_ci * preferences file. 45261847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 45361847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 45461847f8eSopenharmony_ci * will occur. 45561847f8eSopenharmony_ci * 45661847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 45761847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 45861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 45961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 46061847f8eSopenharmony_ci * 2. Incorrect parameter types; 46161847f8eSopenharmony_ci * 3. Parameter verification failed. 46261847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 46361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 46461847f8eSopenharmony_ci * @crossplatform 46561847f8eSopenharmony_ci * @since 10 46661847f8eSopenharmony_ci */ 46761847f8eSopenharmony_ci /** 46861847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 46961847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 47061847f8eSopenharmony_ci * preferences file. 47161847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 47261847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 47361847f8eSopenharmony_ci * will occur. 47461847f8eSopenharmony_ci * 47561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 47661847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 47761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 47861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 47961847f8eSopenharmony_ci * 2. Incorrect parameter types; 48061847f8eSopenharmony_ci * 3. Parameter verification failed. 48161847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 48261847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 48361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 48461847f8eSopenharmony_ci * @crossplatform 48561847f8eSopenharmony_ci * @atomicservice 48661847f8eSopenharmony_ci * @since 11 48761847f8eSopenharmony_ci */ 48861847f8eSopenharmony_ci function deletePreferences(context: Context, name: string, callback: AsyncCallback<void>): void; 48961847f8eSopenharmony_ci 49061847f8eSopenharmony_ci /** 49161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 49261847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 49361847f8eSopenharmony_ci * preferences file. 49461847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 49561847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 49661847f8eSopenharmony_ci * will occur. 49761847f8eSopenharmony_ci * 49861847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 49961847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 50061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 50161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 50261847f8eSopenharmony_ci * 2. Incorrect parameter types; 50361847f8eSopenharmony_ci * 3. Parameter verification failed. 50461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 50561847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 50661847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 50761847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 50861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 50961847f8eSopenharmony_ci * @crossplatform 51061847f8eSopenharmony_ci * @since 10 51161847f8eSopenharmony_ci */ 51261847f8eSopenharmony_ci /** 51361847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 51461847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 51561847f8eSopenharmony_ci * preferences file. 51661847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 51761847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 51861847f8eSopenharmony_ci * will occur. 51961847f8eSopenharmony_ci * 52061847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 52161847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 52261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 52361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 52461847f8eSopenharmony_ci * 2. Incorrect parameter types; 52561847f8eSopenharmony_ci * 3. Parameter verification failed. 52661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 52761847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 52861847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 52961847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 53061847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 53161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 53261847f8eSopenharmony_ci * @crossplatform 53361847f8eSopenharmony_ci * @atomicservice 53461847f8eSopenharmony_ci * @since 11 53561847f8eSopenharmony_ci */ 53661847f8eSopenharmony_ci function deletePreferences(context: Context, options: Options, callback: AsyncCallback<void>): void; 53761847f8eSopenharmony_ci 53861847f8eSopenharmony_ci /** 53961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 54061847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 54161847f8eSopenharmony_ci * preferences file. 54261847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 54361847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 54461847f8eSopenharmony_ci * will occur. 54561847f8eSopenharmony_ci * 54661847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 54761847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 54861847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 54961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 55061847f8eSopenharmony_ci * 2. Incorrect parameter types; 55161847f8eSopenharmony_ci * 3. Parameter verification failed. 55261847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 55361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 55461847f8eSopenharmony_ci * @since 9 55561847f8eSopenharmony_ci */ 55661847f8eSopenharmony_ci /** 55761847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 55861847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 55961847f8eSopenharmony_ci * preferences file. 56061847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 56161847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 56261847f8eSopenharmony_ci * will occur. 56361847f8eSopenharmony_ci * 56461847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 56561847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 56661847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 56761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 56861847f8eSopenharmony_ci * 2. Incorrect parameter types; 56961847f8eSopenharmony_ci * 3. Parameter verification failed. 57061847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 57161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 57261847f8eSopenharmony_ci * @crossplatform 57361847f8eSopenharmony_ci * @since 10 57461847f8eSopenharmony_ci */ 57561847f8eSopenharmony_ci /** 57661847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 57761847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 57861847f8eSopenharmony_ci * preferences file. 57961847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 58061847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 58161847f8eSopenharmony_ci * will occur. 58261847f8eSopenharmony_ci * 58361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 58461847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 58561847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 58661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 58761847f8eSopenharmony_ci * 2. Incorrect parameter types; 58861847f8eSopenharmony_ci * 3. Parameter verification failed. 58961847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 59061847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 59161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 59261847f8eSopenharmony_ci * @crossplatform 59361847f8eSopenharmony_ci * @atomicservice 59461847f8eSopenharmony_ci * @since 11 59561847f8eSopenharmony_ci */ 59661847f8eSopenharmony_ci function deletePreferences(context: Context, name: string): Promise<void>; 59761847f8eSopenharmony_ci 59861847f8eSopenharmony_ci /** 59961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 60061847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 60161847f8eSopenharmony_ci * preferences file. 60261847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 60361847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 60461847f8eSopenharmony_ci * will occur. 60561847f8eSopenharmony_ci * 60661847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 60761847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 60861847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 60961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 61061847f8eSopenharmony_ci * 2. Incorrect parameter types; 61161847f8eSopenharmony_ci * 3. Parameter verification failed. 61261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 61361847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 61461847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 61561847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 61661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 61761847f8eSopenharmony_ci * @crossplatform 61861847f8eSopenharmony_ci * @since 10 61961847f8eSopenharmony_ci */ 62061847f8eSopenharmony_ci /** 62161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 62261847f8eSopenharmony_ci * from the cache which is performed by removePreferencesFromCache and deletes the 62361847f8eSopenharmony_ci * preferences file. 62461847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 62561847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 62661847f8eSopenharmony_ci * will occur. 62761847f8eSopenharmony_ci * 62861847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 62961847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 63061847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 63161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 63261847f8eSopenharmony_ci * 2. Incorrect parameter types; 63361847f8eSopenharmony_ci * 3. Parameter verification failed. 63461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 63561847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 63661847f8eSopenharmony_ci * @throws { BusinessError } 15500010 - Failed to delete preferences file. 63761847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 63861847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 63961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 64061847f8eSopenharmony_ci * @crossplatform 64161847f8eSopenharmony_ci * @atomicservice 64261847f8eSopenharmony_ci * @since 11 64361847f8eSopenharmony_ci */ 64461847f8eSopenharmony_ci function deletePreferences(context: Context, options: Options): Promise<void>; 64561847f8eSopenharmony_ci 64661847f8eSopenharmony_ci /** 64761847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 64861847f8eSopenharmony_ci * from the cache. 64961847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 65061847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 65161847f8eSopenharmony_ci * will occur. 65261847f8eSopenharmony_ci * 65361847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 65461847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 65561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 65661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 65761847f8eSopenharmony_ci * 2. Incorrect parameter types; 65861847f8eSopenharmony_ci * 3. Parameter verification failed. 65961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 66061847f8eSopenharmony_ci * @since 9 66161847f8eSopenharmony_ci */ 66261847f8eSopenharmony_ci /** 66361847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 66461847f8eSopenharmony_ci * from the cache. 66561847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 66661847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 66761847f8eSopenharmony_ci * will occur. 66861847f8eSopenharmony_ci * 66961847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 67061847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 67161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 67261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 67361847f8eSopenharmony_ci * 2. Incorrect parameter types; 67461847f8eSopenharmony_ci * 3. Parameter verification failed. 67561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 67661847f8eSopenharmony_ci * @crossplatform 67761847f8eSopenharmony_ci * @since 10 67861847f8eSopenharmony_ci */ 67961847f8eSopenharmony_ci /** 68061847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 68161847f8eSopenharmony_ci * from the cache. 68261847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 68361847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 68461847f8eSopenharmony_ci * will occur. 68561847f8eSopenharmony_ci * 68661847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 68761847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 68861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 68961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 69061847f8eSopenharmony_ci * 2. Incorrect parameter types; 69161847f8eSopenharmony_ci * 3. Parameter verification failed. 69261847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 69361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 69461847f8eSopenharmony_ci * @crossplatform 69561847f8eSopenharmony_ci * @atomicservice 69661847f8eSopenharmony_ci * @since 11 69761847f8eSopenharmony_ci */ 69861847f8eSopenharmony_ci function removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback<void>): void; 69961847f8eSopenharmony_ci 70061847f8eSopenharmony_ci /** 70161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 70261847f8eSopenharmony_ci * from the cache. 70361847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 70461847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 70561847f8eSopenharmony_ci * will occur. 70661847f8eSopenharmony_ci * 70761847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 70861847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 70961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 71061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 71161847f8eSopenharmony_ci * 2. Incorrect parameter types; 71261847f8eSopenharmony_ci * 3. Parameter verification failed. 71361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 71461847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 71561847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 71661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 71761847f8eSopenharmony_ci * @crossplatform 71861847f8eSopenharmony_ci * @since 10 71961847f8eSopenharmony_ci */ 72061847f8eSopenharmony_ci /** 72161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 72261847f8eSopenharmony_ci * from the cache. 72361847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 72461847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 72561847f8eSopenharmony_ci * will occur. 72661847f8eSopenharmony_ci * 72761847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 72861847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 72961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 73061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 73161847f8eSopenharmony_ci * 2. Incorrect parameter types; 73261847f8eSopenharmony_ci * 3. Parameter verification failed. 73361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 73461847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 73561847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 73661847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 73761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 73861847f8eSopenharmony_ci * @crossplatform 73961847f8eSopenharmony_ci * @atomicservice 74061847f8eSopenharmony_ci * @since 11 74161847f8eSopenharmony_ci */ 74261847f8eSopenharmony_ci function removePreferencesFromCache(context: Context, options: Options, callback: AsyncCallback<void>): void; 74361847f8eSopenharmony_ci 74461847f8eSopenharmony_ci /** 74561847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 74661847f8eSopenharmony_ci * from the cache. 74761847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 74861847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 74961847f8eSopenharmony_ci * will occur. 75061847f8eSopenharmony_ci * 75161847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 75261847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 75361847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 75461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 75561847f8eSopenharmony_ci * 2. Incorrect parameter types; 75661847f8eSopenharmony_ci * 3. Parameter verification failed. 75761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 75861847f8eSopenharmony_ci * @since 9 75961847f8eSopenharmony_ci */ 76061847f8eSopenharmony_ci /** 76161847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 76261847f8eSopenharmony_ci * from the cache. 76361847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 76461847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 76561847f8eSopenharmony_ci * will occur. 76661847f8eSopenharmony_ci * 76761847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 76861847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 76961847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 77061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 77161847f8eSopenharmony_ci * 2. Incorrect parameter types; 77261847f8eSopenharmony_ci * 3. Parameter verification failed. 77361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 77461847f8eSopenharmony_ci * @crossplatform 77561847f8eSopenharmony_ci * @since 10 77661847f8eSopenharmony_ci */ 77761847f8eSopenharmony_ci /** 77861847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 77961847f8eSopenharmony_ci * from the cache. 78061847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 78161847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 78261847f8eSopenharmony_ci * will occur. 78361847f8eSopenharmony_ci * 78461847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 78561847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 78661847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 78761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 78861847f8eSopenharmony_ci * 2. Incorrect parameter types; 78961847f8eSopenharmony_ci * 3. Parameter verification failed. 79061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 79161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 79261847f8eSopenharmony_ci * @crossplatform 79361847f8eSopenharmony_ci * @atomicservice 79461847f8eSopenharmony_ci * @since 11 79561847f8eSopenharmony_ci */ 79661847f8eSopenharmony_ci function removePreferencesFromCache(context: Context, name: string): Promise<void>; 79761847f8eSopenharmony_ci 79861847f8eSopenharmony_ci /** 79961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 80061847f8eSopenharmony_ci * from the cache. 80161847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 80261847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 80361847f8eSopenharmony_ci * will occur. 80461847f8eSopenharmony_ci * 80561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 80661847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 80761847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 80861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 80961847f8eSopenharmony_ci * 2. Incorrect parameter types; 81061847f8eSopenharmony_ci * 3. Parameter verification failed. 81161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 81261847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 81361847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 81461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 81561847f8eSopenharmony_ci * @crossplatform 81661847f8eSopenharmony_ci * @since 10 81761847f8eSopenharmony_ci */ 81861847f8eSopenharmony_ci /** 81961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 82061847f8eSopenharmony_ci * from the cache. 82161847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 82261847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 82361847f8eSopenharmony_ci * will occur. 82461847f8eSopenharmony_ci * 82561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 82661847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 82761847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 82861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 82961847f8eSopenharmony_ci * 2. Incorrect parameter types; 83061847f8eSopenharmony_ci * 3. Parameter verification failed. 83161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 83261847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 83361847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 83461847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 83561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 83661847f8eSopenharmony_ci * @crossplatform 83761847f8eSopenharmony_ci * @atomicservice 83861847f8eSopenharmony_ci * @since 11 83961847f8eSopenharmony_ci */ 84061847f8eSopenharmony_ci function removePreferencesFromCache(context: Context, options: Options): Promise<void>; 84161847f8eSopenharmony_ci 84261847f8eSopenharmony_ci /** 84361847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 84461847f8eSopenharmony_ci * from the cache. This interface is executed synchronously. 84561847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 84661847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 84761847f8eSopenharmony_ci * will occur. 84861847f8eSopenharmony_ci * 84961847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 85061847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 85161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 85261847f8eSopenharmony_ci * 2. Incorrect parameter types; 85361847f8eSopenharmony_ci * 3. Parameter verification failed. 85461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 85561847f8eSopenharmony_ci * @crossplatform 85661847f8eSopenharmony_ci * @since 10 85761847f8eSopenharmony_ci */ 85861847f8eSopenharmony_ci /** 85961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 86061847f8eSopenharmony_ci * from the cache. This interface is executed synchronously. 86161847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 86261847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 86361847f8eSopenharmony_ci * will occur. 86461847f8eSopenharmony_ci * 86561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 86661847f8eSopenharmony_ci * @param { string } name - Indicates the preferences file name. 86761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 86861847f8eSopenharmony_ci * 2. Incorrect parameter types; 86961847f8eSopenharmony_ci * 3. Parameter verification failed. 87061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 87161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 87261847f8eSopenharmony_ci * @crossplatform 87361847f8eSopenharmony_ci * @atomicservice 87461847f8eSopenharmony_ci * @since 11 87561847f8eSopenharmony_ci */ 87661847f8eSopenharmony_ci function removePreferencesFromCacheSync(context: Context, name: string): void; 87761847f8eSopenharmony_ci 87861847f8eSopenharmony_ci /** 87961847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 88061847f8eSopenharmony_ci * from the cache. This interface is executed synchronously. 88161847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 88261847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 88361847f8eSopenharmony_ci * will occur. 88461847f8eSopenharmony_ci * 88561847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 88661847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 88761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 88861847f8eSopenharmony_ci * 2. Incorrect parameter types; 88961847f8eSopenharmony_ci * 3. Parameter verification failed. 89061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 89161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 89261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 89361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 89461847f8eSopenharmony_ci * @crossplatform 89561847f8eSopenharmony_ci * @since 10 89661847f8eSopenharmony_ci */ 89761847f8eSopenharmony_ci /** 89861847f8eSopenharmony_ci * Deletes a {@link Preferences} instance matching a specified preferences file name 89961847f8eSopenharmony_ci * from the cache. This interface is executed synchronously. 90061847f8eSopenharmony_ci * <p>When deleting the {@link Preferences} instance, you must release all references 90161847f8eSopenharmony_ci * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency 90261847f8eSopenharmony_ci * will occur. 90361847f8eSopenharmony_ci * 90461847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 90561847f8eSopenharmony_ci * @param { Options } options - Indicates the {@link Options} option of preferences file position. 90661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 90761847f8eSopenharmony_ci * 2. Incorrect parameter types; 90861847f8eSopenharmony_ci * 3. Parameter verification failed. 90961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 91061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 91161847f8eSopenharmony_ci * @throws { BusinessError } 15501001 - Only supported in stage mode. 91261847f8eSopenharmony_ci * @throws { BusinessError } 15501002 - The data group id is not valid. 91361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 91461847f8eSopenharmony_ci * @crossplatform 91561847f8eSopenharmony_ci * @atomicservice 91661847f8eSopenharmony_ci * @since 11 91761847f8eSopenharmony_ci */ 91861847f8eSopenharmony_ci function removePreferencesFromCacheSync(context: Context, options: Options): void; 91961847f8eSopenharmony_ci 92061847f8eSopenharmony_ci /** 92161847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 92261847f8eSopenharmony_ci * <p>The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. 92361847f8eSopenharmony_ci * You can use getPreferences to obtain the {@link Preferences} instance matching 92461847f8eSopenharmony_ci * the file that stores preferences data, and use movePreferencesFromCache 92561847f8eSopenharmony_ci * to remove the {@link Preferences} instance from the memory. 92661847f8eSopenharmony_ci * 92761847f8eSopenharmony_ci * @interface Preferences 92861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 92961847f8eSopenharmony_ci * @since 9 93061847f8eSopenharmony_ci */ 93161847f8eSopenharmony_ci /** 93261847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 93361847f8eSopenharmony_ci * <p>The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. 93461847f8eSopenharmony_ci * You can use getPreferences to obtain the {@link Preferences} instance matching 93561847f8eSopenharmony_ci * the file that stores preferences data, and use movePreferencesFromCache 93661847f8eSopenharmony_ci * to remove the {@link Preferences} instance from the memory. 93761847f8eSopenharmony_ci * 93861847f8eSopenharmony_ci * @interface Preferences 93961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 94061847f8eSopenharmony_ci * @crossplatform 94161847f8eSopenharmony_ci * @since 10 94261847f8eSopenharmony_ci */ 94361847f8eSopenharmony_ci /** 94461847f8eSopenharmony_ci * Provides interfaces to obtain and modify preferences data. 94561847f8eSopenharmony_ci * <p>The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. 94661847f8eSopenharmony_ci * You can use getPreferences to obtain the {@link Preferences} instance matching 94761847f8eSopenharmony_ci * the file that stores preferences data, and use movePreferencesFromCache 94861847f8eSopenharmony_ci * to remove the {@link Preferences} instance from the memory. 94961847f8eSopenharmony_ci * 95061847f8eSopenharmony_ci * @interface Preferences 95161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 95261847f8eSopenharmony_ci * @crossplatform 95361847f8eSopenharmony_ci * @atomicservice 95461847f8eSopenharmony_ci * @since 11 95561847f8eSopenharmony_ci */ 95661847f8eSopenharmony_ci interface Preferences { 95761847f8eSopenharmony_ci /** 95861847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 95961847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 96061847f8eSopenharmony_ci * 96161847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 96261847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 96361847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 96461847f8eSopenharmony_ci * @param { AsyncCallback<ValueType> } callback - The value matching the specified key if it is found; 96561847f8eSopenharmony_ci * returns the default value otherwise. 96661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 96761847f8eSopenharmony_ci * 2. Incorrect parameter types; 96861847f8eSopenharmony_ci * 3. Parameter verification failed. 96961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 97061847f8eSopenharmony_ci * @since 9 97161847f8eSopenharmony_ci */ 97261847f8eSopenharmony_ci /** 97361847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 97461847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 97561847f8eSopenharmony_ci * 97661847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 97761847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 97861847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 97961847f8eSopenharmony_ci * @param { AsyncCallback<ValueType> } callback - The value matching the specified key if it is found; 98061847f8eSopenharmony_ci * returns the default value otherwise. 98161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 98261847f8eSopenharmony_ci * 2. Incorrect parameter types; 98361847f8eSopenharmony_ci * 3. Parameter verification failed. 98461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 98561847f8eSopenharmony_ci * @crossplatform 98661847f8eSopenharmony_ci * @since 10 98761847f8eSopenharmony_ci */ 98861847f8eSopenharmony_ci /** 98961847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 99061847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 99161847f8eSopenharmony_ci * 99261847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 99361847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 99461847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 99561847f8eSopenharmony_ci * @param { AsyncCallback<ValueType> } callback - The value matching the specified key if it is found; 99661847f8eSopenharmony_ci * returns the default value otherwise. 99761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 99861847f8eSopenharmony_ci * 2. Incorrect parameter types; 99961847f8eSopenharmony_ci * 3. Parameter verification failed. 100061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 100161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 100261847f8eSopenharmony_ci * @crossplatform 100361847f8eSopenharmony_ci * @atomicservice 100461847f8eSopenharmony_ci * @since 11 100561847f8eSopenharmony_ci */ 100661847f8eSopenharmony_ci get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): void; 100761847f8eSopenharmony_ci 100861847f8eSopenharmony_ci /** 100961847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 101061847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 101161847f8eSopenharmony_ci * 101261847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 101361847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 101461847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 101561847f8eSopenharmony_ci * @returns { Promise<ValueType> } The value matching the specified key if it is found; 101661847f8eSopenharmony_ci * returns the default value otherwise. 101761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 101861847f8eSopenharmony_ci * 2. Incorrect parameter types; 101961847f8eSopenharmony_ci * 3. Parameter verification failed. 102061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 102161847f8eSopenharmony_ci * @since 9 102261847f8eSopenharmony_ci */ 102361847f8eSopenharmony_ci /** 102461847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 102561847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 102661847f8eSopenharmony_ci * 102761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 102861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 102961847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 103061847f8eSopenharmony_ci * @returns { Promise<ValueType> } The value matching the specified key if it is found; 103161847f8eSopenharmony_ci * returns the default value otherwise. 103261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 103361847f8eSopenharmony_ci * 2. Incorrect parameter types; 103461847f8eSopenharmony_ci * 3. Parameter verification failed. 103561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 103661847f8eSopenharmony_ci * @crossplatform 103761847f8eSopenharmony_ci * @since 10 103861847f8eSopenharmony_ci */ 103961847f8eSopenharmony_ci /** 104061847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. 104161847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 104261847f8eSopenharmony_ci * 104361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 104461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 104561847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 104661847f8eSopenharmony_ci * @returns { Promise<ValueType> } The value matching the specified key if it is found; 104761847f8eSopenharmony_ci * returns the default value otherwise. 104861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 104961847f8eSopenharmony_ci * 2. Incorrect parameter types; 105061847f8eSopenharmony_ci * 3. Parameter verification failed. 105161847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 105261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 105361847f8eSopenharmony_ci * @crossplatform 105461847f8eSopenharmony_ci * @atomicservice 105561847f8eSopenharmony_ci * @since 11 105661847f8eSopenharmony_ci */ 105761847f8eSopenharmony_ci get(key: string, defValue: ValueType): Promise<ValueType>; 105861847f8eSopenharmony_ci 105961847f8eSopenharmony_ci /** 106061847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. This interface is executed synchronously. 106161847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 106261847f8eSopenharmony_ci * 106361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 106461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 106561847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 106661847f8eSopenharmony_ci * @returns { ValueType } The value matching the specified key if it is found; 106761847f8eSopenharmony_ci * returns the default value otherwise. 106861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 106961847f8eSopenharmony_ci * 2. Incorrect parameter types; 107061847f8eSopenharmony_ci * 3. Parameter verification failed. 107161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 107261847f8eSopenharmony_ci * @crossplatform 107361847f8eSopenharmony_ci * @since 10 107461847f8eSopenharmony_ci */ 107561847f8eSopenharmony_ci /** 107661847f8eSopenharmony_ci * Obtains the value of a preferences in the ValueType format. This interface is executed synchronously. 107761847f8eSopenharmony_ci * <p>If the value is {@code null} or not in the ValueType format, the default value is returned. 107861847f8eSopenharmony_ci * 107961847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. 108061847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 108161847f8eSopenharmony_ci * @param { ValueType } defValue - Indicates the default value to return. 108261847f8eSopenharmony_ci * @returns { ValueType } The value matching the specified key if it is found; 108361847f8eSopenharmony_ci * returns the default value otherwise. 108461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 108561847f8eSopenharmony_ci * 2. Incorrect parameter types; 108661847f8eSopenharmony_ci * 3. Parameter verification failed. 108761847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 108861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 108961847f8eSopenharmony_ci * @crossplatform 109061847f8eSopenharmony_ci * @atomicservice 109161847f8eSopenharmony_ci * @since 11 109261847f8eSopenharmony_ci */ 109361847f8eSopenharmony_ci getSync(key: string, defValue: ValueType): ValueType; 109461847f8eSopenharmony_ci 109561847f8eSopenharmony_ci /** 109661847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 109761847f8eSopenharmony_ci * 109861847f8eSopenharmony_ci * @param { AsyncCallback<Object> } callback - The values and keys in an object. 109961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 110061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 110161847f8eSopenharmony_ci * @since 9 110261847f8eSopenharmony_ci */ 110361847f8eSopenharmony_ci /** 110461847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 110561847f8eSopenharmony_ci * 110661847f8eSopenharmony_ci * @param { AsyncCallback<Object> } callback - The values and keys in an object. 110761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 110861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 110961847f8eSopenharmony_ci * @crossplatform 111061847f8eSopenharmony_ci * @since 10 111161847f8eSopenharmony_ci */ 111261847f8eSopenharmony_ci /** 111361847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 111461847f8eSopenharmony_ci * 111561847f8eSopenharmony_ci * @param { AsyncCallback<Object> } callback - The values and keys in an object. 111661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 111761847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 111861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 111961847f8eSopenharmony_ci * @crossplatform 112061847f8eSopenharmony_ci * @atomicservice 112161847f8eSopenharmony_ci * @since 11 112261847f8eSopenharmony_ci */ 112361847f8eSopenharmony_ci getAll(callback: AsyncCallback<Object>): void; 112461847f8eSopenharmony_ci 112561847f8eSopenharmony_ci /** 112661847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 112761847f8eSopenharmony_ci * 112861847f8eSopenharmony_ci * @returns { Promise<Object> } The values and keys in an object. 112961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 113061847f8eSopenharmony_ci * @since 9 113161847f8eSopenharmony_ci */ 113261847f8eSopenharmony_ci /** 113361847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 113461847f8eSopenharmony_ci * 113561847f8eSopenharmony_ci * @returns { Promise<Object> } The values and keys in an object. 113661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 113761847f8eSopenharmony_ci * @crossplatform 113861847f8eSopenharmony_ci * @since 10 113961847f8eSopenharmony_ci */ 114061847f8eSopenharmony_ci /** 114161847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. 114261847f8eSopenharmony_ci * 114361847f8eSopenharmony_ci * @returns { Promise<Object> } The values and keys in an object. 114461847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 114561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 114661847f8eSopenharmony_ci * @crossplatform 114761847f8eSopenharmony_ci * @atomicservice 114861847f8eSopenharmony_ci * @since 11 114961847f8eSopenharmony_ci */ 115061847f8eSopenharmony_ci getAll(): Promise<Object>; 115161847f8eSopenharmony_ci 115261847f8eSopenharmony_ci /** 115361847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. This interface 115461847f8eSopenharmony_ci * is executed synchronously. 115561847f8eSopenharmony_ci * 115661847f8eSopenharmony_ci * @returns { Object } The values and keys in an object. 115761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 115861847f8eSopenharmony_ci * @crossplatform 115961847f8eSopenharmony_ci * @since 10 116061847f8eSopenharmony_ci */ 116161847f8eSopenharmony_ci /** 116261847f8eSopenharmony_ci * Obtains all the keys and values of a preferences in an object. This interface 116361847f8eSopenharmony_ci * is executed synchronously. 116461847f8eSopenharmony_ci * 116561847f8eSopenharmony_ci * @returns { Object } The values and keys in an object. 116661847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 116761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 116861847f8eSopenharmony_ci * @crossplatform 116961847f8eSopenharmony_ci * @atomicservice 117061847f8eSopenharmony_ci * @since 11 117161847f8eSopenharmony_ci */ 117261847f8eSopenharmony_ci getAllSync(): Object; 117361847f8eSopenharmony_ci 117461847f8eSopenharmony_ci /** 117561847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 117661847f8eSopenharmony_ci * 117761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 117861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 117961847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - {@code true} if the {@link Preferences} object contains a preferences 118061847f8eSopenharmony_ci * with the specified key;returns {@code false} otherwise. 118161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 118261847f8eSopenharmony_ci * 2. Incorrect parameter types; 118361847f8eSopenharmony_ci * 3. Parameter verification failed. 118461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 118561847f8eSopenharmony_ci * @since 9 118661847f8eSopenharmony_ci */ 118761847f8eSopenharmony_ci /** 118861847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 118961847f8eSopenharmony_ci * 119061847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 119161847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 119261847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - {@code true} if the {@link Preferences} object contains a preferences 119361847f8eSopenharmony_ci * with the specified key;returns {@code false} otherwise. 119461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 119561847f8eSopenharmony_ci * 2. Incorrect parameter types; 119661847f8eSopenharmony_ci * 3. Parameter verification failed. 119761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 119861847f8eSopenharmony_ci * @crossplatform 119961847f8eSopenharmony_ci * @since 10 120061847f8eSopenharmony_ci */ 120161847f8eSopenharmony_ci /** 120261847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 120361847f8eSopenharmony_ci * 120461847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 120561847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 120661847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - {@code true} if the {@link Preferences} object contains a preferences 120761847f8eSopenharmony_ci * with the specified key;returns {@code false} otherwise. 120861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 120961847f8eSopenharmony_ci * 2. Incorrect parameter types; 121061847f8eSopenharmony_ci * 3. Parameter verification failed. 121161847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 121261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 121361847f8eSopenharmony_ci * @crossplatform 121461847f8eSopenharmony_ci * @atomicservice 121561847f8eSopenharmony_ci * @since 11 121661847f8eSopenharmony_ci */ 121761847f8eSopenharmony_ci has(key: string, callback: AsyncCallback<boolean>): void; 121861847f8eSopenharmony_ci 121961847f8eSopenharmony_ci /** 122061847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 122161847f8eSopenharmony_ci * 122261847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 122361847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 122461847f8eSopenharmony_ci * @returns { Promise<boolean> } {@code true} if the {@link Preferences} object contains 122561847f8eSopenharmony_ci * a preferences with the specified key; returns {@code false} otherwise. 122661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 122761847f8eSopenharmony_ci * 2. Incorrect parameter types; 122861847f8eSopenharmony_ci * 3. Parameter verification failed. 122961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 123061847f8eSopenharmony_ci * @since 9 123161847f8eSopenharmony_ci */ 123261847f8eSopenharmony_ci /** 123361847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 123461847f8eSopenharmony_ci * 123561847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 123661847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 123761847f8eSopenharmony_ci * @returns { Promise<boolean> } {@code true} if the {@link Preferences} object contains 123861847f8eSopenharmony_ci * a preferences with the specified key; returns {@code false} otherwise. 123961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 124061847f8eSopenharmony_ci * 2. Incorrect parameter types; 124161847f8eSopenharmony_ci * 3. Parameter verification failed. 124261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 124361847f8eSopenharmony_ci * @crossplatform 124461847f8eSopenharmony_ci * @since 10 124561847f8eSopenharmony_ci */ 124661847f8eSopenharmony_ci /** 124761847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. 124861847f8eSopenharmony_ci * 124961847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 125061847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 125161847f8eSopenharmony_ci * @returns { Promise<boolean> } {@code true} if the {@link Preferences} object contains 125261847f8eSopenharmony_ci * a preferences with the specified key; returns {@code false} otherwise. 125361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 125461847f8eSopenharmony_ci * 2. Incorrect parameter types; 125561847f8eSopenharmony_ci * 3. Parameter verification failed. 125661847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 125761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 125861847f8eSopenharmony_ci * @crossplatform 125961847f8eSopenharmony_ci * @atomicservice 126061847f8eSopenharmony_ci * @since 11 126161847f8eSopenharmony_ci */ 126261847f8eSopenharmony_ci has(key: string): Promise<boolean>; 126361847f8eSopenharmony_ci 126461847f8eSopenharmony_ci /** 126561847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. This interface 126661847f8eSopenharmony_ci * is executed synchronously. 126761847f8eSopenharmony_ci * 126861847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 126961847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 127061847f8eSopenharmony_ci * @returns { boolean } {@code true} if the {@link Preferences} object contains 127161847f8eSopenharmony_ci * a preferences with the specified key; returns {@code false} otherwise. 127261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 127361847f8eSopenharmony_ci * 2. Incorrect parameter types; 127461847f8eSopenharmony_ci * 3. Parameter verification failed. 127561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 127661847f8eSopenharmony_ci * @crossplatform 127761847f8eSopenharmony_ci * @since 10 127861847f8eSopenharmony_ci */ 127961847f8eSopenharmony_ci /** 128061847f8eSopenharmony_ci * Checks whether the {@link Preferences} object contains a preferences matching a specified key. This interface 128161847f8eSopenharmony_ci * is executed synchronously. 128261847f8eSopenharmony_ci * 128361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 128461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 128561847f8eSopenharmony_ci * @returns { boolean } {@code true} if the {@link Preferences} object contains 128661847f8eSopenharmony_ci * a preferences with the specified key; returns {@code false} otherwise. 128761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 128861847f8eSopenharmony_ci * 2. Incorrect parameter types; 128961847f8eSopenharmony_ci * 3. Parameter verification failed. 129061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 129161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 129261847f8eSopenharmony_ci * @crossplatform 129361847f8eSopenharmony_ci * @atomicservice 129461847f8eSopenharmony_ci * @since 11 129561847f8eSopenharmony_ci */ 129661847f8eSopenharmony_ci hasSync(key: string): boolean; 129761847f8eSopenharmony_ci 129861847f8eSopenharmony_ci /** 129961847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 130061847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 130161847f8eSopenharmony_ci * file. 130261847f8eSopenharmony_ci * 130361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 130461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 130561847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 130661847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 130761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 130861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 130961847f8eSopenharmony_ci * 2. Incorrect parameter types; 131061847f8eSopenharmony_ci * 3. Parameter verification failed. 131161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 131261847f8eSopenharmony_ci * @since 9 131361847f8eSopenharmony_ci */ 131461847f8eSopenharmony_ci /** 131561847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 131661847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 131761847f8eSopenharmony_ci * file. 131861847f8eSopenharmony_ci * 131961847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 132061847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 132161847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 132261847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 132361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 132461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 132561847f8eSopenharmony_ci * 2. Incorrect parameter types; 132661847f8eSopenharmony_ci * 3. Parameter verification failed. 132761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 132861847f8eSopenharmony_ci * @crossplatform 132961847f8eSopenharmony_ci * @since 10 133061847f8eSopenharmony_ci */ 133161847f8eSopenharmony_ci /** 133261847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 133361847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 133461847f8eSopenharmony_ci * file. 133561847f8eSopenharmony_ci * 133661847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 133761847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 133861847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 133961847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 134061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 134161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 134261847f8eSopenharmony_ci * 2. Incorrect parameter types; 134361847f8eSopenharmony_ci * 3. Parameter verification failed. 134461847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 134561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 134661847f8eSopenharmony_ci * @crossplatform 134761847f8eSopenharmony_ci * @atomicservice 134861847f8eSopenharmony_ci * @since 11 134961847f8eSopenharmony_ci */ 135061847f8eSopenharmony_ci put(key: string, value: ValueType, callback: AsyncCallback<void>): void; 135161847f8eSopenharmony_ci 135261847f8eSopenharmony_ci /** 135361847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 135461847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 135561847f8eSopenharmony_ci * file. 135661847f8eSopenharmony_ci * 135761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 135861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 135961847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 136061847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 136161847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 136261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 136361847f8eSopenharmony_ci * 2. Incorrect parameter types; 136461847f8eSopenharmony_ci * 3. Parameter verification failed. 136561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 136661847f8eSopenharmony_ci * @since 9 136761847f8eSopenharmony_ci */ 136861847f8eSopenharmony_ci /** 136961847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 137061847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 137161847f8eSopenharmony_ci * file. 137261847f8eSopenharmony_ci * 137361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 137461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 137561847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 137661847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 137761847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 137861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 137961847f8eSopenharmony_ci * 2. Incorrect parameter types; 138061847f8eSopenharmony_ci * 3. Parameter verification failed. 138161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 138261847f8eSopenharmony_ci * @crossplatform 138361847f8eSopenharmony_ci * @since 10 138461847f8eSopenharmony_ci */ 138561847f8eSopenharmony_ci /** 138661847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. 138761847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 138861847f8eSopenharmony_ci * file. 138961847f8eSopenharmony_ci * 139061847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 139161847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 139261847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 139361847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 139461847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 139561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 139661847f8eSopenharmony_ci * 2. Incorrect parameter types; 139761847f8eSopenharmony_ci * 3. Parameter verification failed. 139861847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 139961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 140061847f8eSopenharmony_ci * @crossplatform 140161847f8eSopenharmony_ci * @atomicservice 140261847f8eSopenharmony_ci * @since 11 140361847f8eSopenharmony_ci */ 140461847f8eSopenharmony_ci put(key: string, value: ValueType): Promise<void>; 140561847f8eSopenharmony_ci 140661847f8eSopenharmony_ci /** 140761847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. This interface is executed synchronously. 140861847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 140961847f8eSopenharmony_ci * file. 141061847f8eSopenharmony_ci * 141161847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 141261847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 141361847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 141461847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 141561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 141661847f8eSopenharmony_ci * 2. Incorrect parameter types; 141761847f8eSopenharmony_ci * 3. Parameter verification failed. 141861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 141961847f8eSopenharmony_ci * @crossplatform 142061847f8eSopenharmony_ci * @since 10 142161847f8eSopenharmony_ci */ 142261847f8eSopenharmony_ci /** 142361847f8eSopenharmony_ci * Sets an int value for the key in the {@link Preferences} object. This interface is executed synchronously. 142461847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 142561847f8eSopenharmony_ci * file. 142661847f8eSopenharmony_ci * 142761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. 142861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 142961847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value of the preferences. 143061847f8eSopenharmony_ci * <tt>MAX_VALUE_LENGTH</tt>. 143161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 143261847f8eSopenharmony_ci * 2. Incorrect parameter types; 143361847f8eSopenharmony_ci * 3. Parameter verification failed. 143461847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 143561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 143661847f8eSopenharmony_ci * @crossplatform 143761847f8eSopenharmony_ci * @atomicservice 143861847f8eSopenharmony_ci * @since 11 143961847f8eSopenharmony_ci */ 144061847f8eSopenharmony_ci putSync(key: string, value: ValueType): void; 144161847f8eSopenharmony_ci 144261847f8eSopenharmony_ci /** 144361847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 144461847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 144561847f8eSopenharmony_ci * file. 144661847f8eSopenharmony_ci * 144761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 144861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 144961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 145061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 145161847f8eSopenharmony_ci * 2. Incorrect parameter types; 145261847f8eSopenharmony_ci * 3. Parameter verification failed. 145361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 145461847f8eSopenharmony_ci * @since 9 145561847f8eSopenharmony_ci */ 145661847f8eSopenharmony_ci /** 145761847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 145861847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 145961847f8eSopenharmony_ci * file. 146061847f8eSopenharmony_ci * 146161847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 146261847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 146361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 146461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 146561847f8eSopenharmony_ci * 2. Incorrect parameter types; 146661847f8eSopenharmony_ci * 3. Parameter verification failed. 146761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 146861847f8eSopenharmony_ci * @crossplatform 146961847f8eSopenharmony_ci * @since 10 147061847f8eSopenharmony_ci */ 147161847f8eSopenharmony_ci /** 147261847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 147361847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 147461847f8eSopenharmony_ci * file. 147561847f8eSopenharmony_ci * 147661847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 147761847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 147861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 147961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 148061847f8eSopenharmony_ci * 2. Incorrect parameter types; 148161847f8eSopenharmony_ci * 3. Parameter verification failed. 148261847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 148361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 148461847f8eSopenharmony_ci * @crossplatform 148561847f8eSopenharmony_ci * @atomicservice 148661847f8eSopenharmony_ci * @since 11 148761847f8eSopenharmony_ci */ 148861847f8eSopenharmony_ci delete(key: string, callback: AsyncCallback<void>): void; 148961847f8eSopenharmony_ci 149061847f8eSopenharmony_ci /** 149161847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 149261847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 149361847f8eSopenharmony_ci * file. 149461847f8eSopenharmony_ci * 149561847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 149661847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 149761847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 149861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 149961847f8eSopenharmony_ci * 2. Incorrect parameter types; 150061847f8eSopenharmony_ci * 3. Parameter verification failed. 150161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 150261847f8eSopenharmony_ci * @since 9 150361847f8eSopenharmony_ci */ 150461847f8eSopenharmony_ci /** 150561847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 150661847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 150761847f8eSopenharmony_ci * file. 150861847f8eSopenharmony_ci * 150961847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 151061847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 151161847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 151261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 151361847f8eSopenharmony_ci * 2. Incorrect parameter types; 151461847f8eSopenharmony_ci * 3. Parameter verification failed. 151561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 151661847f8eSopenharmony_ci * @crossplatform 151761847f8eSopenharmony_ci * @since 10 151861847f8eSopenharmony_ci */ 151961847f8eSopenharmony_ci /** 152061847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. 152161847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the 152261847f8eSopenharmony_ci * file. 152361847f8eSopenharmony_ci * 152461847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 152561847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 152661847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 152761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 152861847f8eSopenharmony_ci * 2. Incorrect parameter types; 152961847f8eSopenharmony_ci * 3. Parameter verification failed. 153061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 153161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 153261847f8eSopenharmony_ci * @crossplatform 153361847f8eSopenharmony_ci * @atomicservice 153461847f8eSopenharmony_ci * @since 11 153561847f8eSopenharmony_ci */ 153661847f8eSopenharmony_ci delete(key: string): Promise<void>; 153761847f8eSopenharmony_ci 153861847f8eSopenharmony_ci /** 153961847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. This interface is 154061847f8eSopenharmony_ci * executed synchronously. <p>You can call the {@link #flush} method to save the {@link Preferences} 154161847f8eSopenharmony_ci * object to the file. 154261847f8eSopenharmony_ci * 154361847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 154461847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 154561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 154661847f8eSopenharmony_ci * 2. Incorrect parameter types; 154761847f8eSopenharmony_ci * 3. Parameter verification failed. 154861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 154961847f8eSopenharmony_ci * @crossplatform 155061847f8eSopenharmony_ci * @since 10 155161847f8eSopenharmony_ci */ 155261847f8eSopenharmony_ci /** 155361847f8eSopenharmony_ci * Deletes the preferences with a specified key from the {@link Preferences} object. This interface is 155461847f8eSopenharmony_ci * executed synchronously. <p>You can call the {@link #flush} method to save the {@link Preferences} 155561847f8eSopenharmony_ci * object to the file. 155661847f8eSopenharmony_ci * 155761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. 155861847f8eSopenharmony_ci * <tt>MAX_KEY_LENGTH</tt>. 155961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 156061847f8eSopenharmony_ci * 2. Incorrect parameter types; 156161847f8eSopenharmony_ci * 3. Parameter verification failed. 156261847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 156361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 156461847f8eSopenharmony_ci * @crossplatform 156561847f8eSopenharmony_ci * @atomicservice 156661847f8eSopenharmony_ci * @since 11 156761847f8eSopenharmony_ci */ 156861847f8eSopenharmony_ci deleteSync(key: string): void; 156961847f8eSopenharmony_ci 157061847f8eSopenharmony_ci /** 157161847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 157261847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 157361847f8eSopenharmony_ci * 157461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 157561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 157661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 157761847f8eSopenharmony_ci * @since 9 157861847f8eSopenharmony_ci */ 157961847f8eSopenharmony_ci /** 158061847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 158161847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 158261847f8eSopenharmony_ci * 158361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 158461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 158561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 158661847f8eSopenharmony_ci * @crossplatform 158761847f8eSopenharmony_ci * @since 10 158861847f8eSopenharmony_ci */ 158961847f8eSopenharmony_ci /** 159061847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 159161847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 159261847f8eSopenharmony_ci * 159361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 159461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 159561847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 159661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 159761847f8eSopenharmony_ci * @crossplatform 159861847f8eSopenharmony_ci * @atomicservice 159961847f8eSopenharmony_ci * @since 11 160061847f8eSopenharmony_ci */ 160161847f8eSopenharmony_ci clear(callback: AsyncCallback<void>): void; 160261847f8eSopenharmony_ci 160361847f8eSopenharmony_ci /** 160461847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 160561847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 160661847f8eSopenharmony_ci * 160761847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 160861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 160961847f8eSopenharmony_ci * @since 9 161061847f8eSopenharmony_ci */ 161161847f8eSopenharmony_ci /** 161261847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 161361847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 161461847f8eSopenharmony_ci * 161561847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 161661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 161761847f8eSopenharmony_ci * @crossplatform 161861847f8eSopenharmony_ci * @since 10 161961847f8eSopenharmony_ci */ 162061847f8eSopenharmony_ci /** 162161847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. 162261847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 162361847f8eSopenharmony_ci * 162461847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 162561847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 162661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 162761847f8eSopenharmony_ci * @crossplatform 162861847f8eSopenharmony_ci * @atomicservice 162961847f8eSopenharmony_ci * @since 11 163061847f8eSopenharmony_ci */ 163161847f8eSopenharmony_ci clear(): Promise<void>; 163261847f8eSopenharmony_ci 163361847f8eSopenharmony_ci /** 163461847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. This interface is executed synchronously. 163561847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 163661847f8eSopenharmony_ci * 163761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 163861847f8eSopenharmony_ci * @crossplatform 163961847f8eSopenharmony_ci * @since 10 164061847f8eSopenharmony_ci */ 164161847f8eSopenharmony_ci /** 164261847f8eSopenharmony_ci * Clears all preferences from the {@link Preferences} object. This interface is executed synchronously. 164361847f8eSopenharmony_ci * <p>You can call the {@link #flush} method to save the {@link Preferences} object to the file. 164461847f8eSopenharmony_ci * 164561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 164661847f8eSopenharmony_ci * @crossplatform 164761847f8eSopenharmony_ci * @atomicservice 164861847f8eSopenharmony_ci * @since 11 164961847f8eSopenharmony_ci */ 165061847f8eSopenharmony_ci clearSync(): void; 165161847f8eSopenharmony_ci 165261847f8eSopenharmony_ci /** 165361847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 165461847f8eSopenharmony_ci * 165561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 165661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified; 165761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 165861847f8eSopenharmony_ci * @since 9 165961847f8eSopenharmony_ci */ 166061847f8eSopenharmony_ci /** 166161847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 166261847f8eSopenharmony_ci * 166361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 166461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified; 166561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 166661847f8eSopenharmony_ci * @crossplatform 166761847f8eSopenharmony_ci * @since 10 166861847f8eSopenharmony_ci */ 166961847f8eSopenharmony_ci /** 167061847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 167161847f8eSopenharmony_ci * 167261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Indicates the callback function. 167361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. 167461847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 167561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 167661847f8eSopenharmony_ci * @crossplatform 167761847f8eSopenharmony_ci * @atomicservice 167861847f8eSopenharmony_ci * @since 11 167961847f8eSopenharmony_ci */ 168061847f8eSopenharmony_ci flush(callback: AsyncCallback<void>): void; 168161847f8eSopenharmony_ci 168261847f8eSopenharmony_ci /** 168361847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 168461847f8eSopenharmony_ci * 168561847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 168661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 168761847f8eSopenharmony_ci * @since 9 168861847f8eSopenharmony_ci */ 168961847f8eSopenharmony_ci /** 169061847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 169161847f8eSopenharmony_ci * 169261847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 169361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 169461847f8eSopenharmony_ci * @crossplatform 169561847f8eSopenharmony_ci * @since 10 169661847f8eSopenharmony_ci */ 169761847f8eSopenharmony_ci /** 169861847f8eSopenharmony_ci * Asynchronously saves the {@link Preferences} object to the file. 169961847f8eSopenharmony_ci * 170061847f8eSopenharmony_ci * @returns { Promise<void> } A promise object. 170161847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 170261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 170361847f8eSopenharmony_ci * @crossplatform 170461847f8eSopenharmony_ci * @atomicservice 170561847f8eSopenharmony_ci * @since 11 170661847f8eSopenharmony_ci */ 170761847f8eSopenharmony_ci flush(): Promise<void>; 170861847f8eSopenharmony_ci 170961847f8eSopenharmony_ci /** 171061847f8eSopenharmony_ci * Registers an observer to listen for the change of a {@link Preferences} object. 171161847f8eSopenharmony_ci * 171261847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 171361847f8eSopenharmony_ci * @param { Callback<{ key: string }> } callback - Indicates the callback function. 171461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 171561847f8eSopenharmony_ci * 2. Incorrect parameter types; 171661847f8eSopenharmony_ci * 3. Parameter verification failed. 171761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 171861847f8eSopenharmony_ci * @since 9 171961847f8eSopenharmony_ci */ 172061847f8eSopenharmony_ci /** 172161847f8eSopenharmony_ci * Registers an observer to listen for the change of a {@link Preferences} object. 172261847f8eSopenharmony_ci * 172361847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 172461847f8eSopenharmony_ci * @param { Function } callback - Indicates the callback function. 172561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 172661847f8eSopenharmony_ci * 2. Incorrect parameter types; 172761847f8eSopenharmony_ci * 3. Parameter verification failed. 172861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 172961847f8eSopenharmony_ci * @crossplatform 173061847f8eSopenharmony_ci * @since 10 173161847f8eSopenharmony_ci */ 173261847f8eSopenharmony_ci /** 173361847f8eSopenharmony_ci * Registers an observer to listen for the change of a {@link Preferences} object. 173461847f8eSopenharmony_ci * 173561847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 173661847f8eSopenharmony_ci * @param { Callback<string> } callback - Indicates the callback function. 173761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 173861847f8eSopenharmony_ci * 2. Incorrect parameter types; 173961847f8eSopenharmony_ci * 3. Parameter verification failed. 174061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 174161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 174261847f8eSopenharmony_ci * @crossplatform 174361847f8eSopenharmony_ci * @atomicservice 174461847f8eSopenharmony_ci * @since 11 174561847f8eSopenharmony_ci */ 174661847f8eSopenharmony_ci on(type: 'change', callback: Callback<string>): void; 174761847f8eSopenharmony_ci 174861847f8eSopenharmony_ci /** 174961847f8eSopenharmony_ci * Registers an observer to listen for the change of a {@link Preferences} object. 175061847f8eSopenharmony_ci * 175161847f8eSopenharmony_ci * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. 175261847f8eSopenharmony_ci * @param { Function } callback - Indicates the callback function. 175361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 175461847f8eSopenharmony_ci * 2. Incorrect parameter types; 175561847f8eSopenharmony_ci * 3. Parameter verification failed. 175661847f8eSopenharmony_ci * @throws { BusinessError } 15500019 - Failed to obtain subscription service. 175761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 175861847f8eSopenharmony_ci * @since 10 175961847f8eSopenharmony_ci */ 176061847f8eSopenharmony_ci /** 176161847f8eSopenharmony_ci * Registers an observer to listen for the change of a {@link Preferences} object. 176261847f8eSopenharmony_ci * 176361847f8eSopenharmony_ci * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. 176461847f8eSopenharmony_ci * @param { Callback<string> } callback - Indicates the callback function. 176561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 176661847f8eSopenharmony_ci * 2. Incorrect parameter types; 176761847f8eSopenharmony_ci * 3. Parameter verification failed. 176861847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 176961847f8eSopenharmony_ci * @throws { BusinessError } 15500019 - Failed to obtain subscription service. 177061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 177161847f8eSopenharmony_ci * @atomicservice 177261847f8eSopenharmony_ci * @since 11 177361847f8eSopenharmony_ci */ 177461847f8eSopenharmony_ci on(type: 'multiProcessChange', callback: Callback<string>): void; 177561847f8eSopenharmony_ci 177661847f8eSopenharmony_ci /** 177761847f8eSopenharmony_ci * Registers an observer to listen for changes to the {@ link Preferences} object. 177861847f8eSopenharmony_ci * 177961847f8eSopenharmony_ci * @param { 'dataChange' } type - Indicates the type of the event to observe. 178061847f8eSopenharmony_ci * @param { Array<string> } keys - Indicates one or more keys to listen for. 178161847f8eSopenharmony_ci * @param { Callback<Record<string, ValueType>> } callback - Indicates the callback used to return the data change. 178261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 178361847f8eSopenharmony_ci * 2. Incorrect parameter types; 178461847f8eSopenharmony_ci * 3. Parameter verification failed. 178561847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 178661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 178761847f8eSopenharmony_ci * @atomicservice 178861847f8eSopenharmony_ci * @since 12 178961847f8eSopenharmony_ci */ 179061847f8eSopenharmony_ci on(type: 'dataChange', keys: Array<string>, callback: Callback<Record<string, ValueType>>): void; 179161847f8eSopenharmony_ci 179261847f8eSopenharmony_ci /** 179361847f8eSopenharmony_ci * Unregisters an existing observer. 179461847f8eSopenharmony_ci * 179561847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 179661847f8eSopenharmony_ci * @param { Callback<{ key: string }> } callback - Indicates the callback function. 179761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 179861847f8eSopenharmony_ci * 2. Incorrect parameter types; 179961847f8eSopenharmony_ci * 3. Parameter verification failed. 180061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 180161847f8eSopenharmony_ci * @since 9 180261847f8eSopenharmony_ci */ 180361847f8eSopenharmony_ci /** 180461847f8eSopenharmony_ci * Unregisters an existing observer. 180561847f8eSopenharmony_ci * 180661847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 180761847f8eSopenharmony_ci * @param { Function } callback - Indicates the callback function. 180861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 180961847f8eSopenharmony_ci * 2. Incorrect parameter types; 181061847f8eSopenharmony_ci * 3. Parameter verification failed. 181161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 181261847f8eSopenharmony_ci * @crossplatform 181361847f8eSopenharmony_ci * @since 10 181461847f8eSopenharmony_ci */ 181561847f8eSopenharmony_ci /** 181661847f8eSopenharmony_ci * Unregisters an existing observer. 181761847f8eSopenharmony_ci * 181861847f8eSopenharmony_ci * @param { 'change' } type - Indicates the callback when preferences changes. 181961847f8eSopenharmony_ci * @param { Callback<string> } callback - Indicates the callback function. 182061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 182161847f8eSopenharmony_ci * 2. Incorrect parameter types; 182261847f8eSopenharmony_ci * 3. Parameter verification failed. 182361847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 182461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 182561847f8eSopenharmony_ci * @crossplatform 182661847f8eSopenharmony_ci * @atomicservice 182761847f8eSopenharmony_ci * @since 11 182861847f8eSopenharmony_ci */ 182961847f8eSopenharmony_ci off(type: 'change', callback?: Callback<string>): void; 183061847f8eSopenharmony_ci 183161847f8eSopenharmony_ci /** 183261847f8eSopenharmony_ci * Unregisters an existing observer. 183361847f8eSopenharmony_ci * 183461847f8eSopenharmony_ci * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. 183561847f8eSopenharmony_ci * @param { Function } callback - Indicates the callback function. 183661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 183761847f8eSopenharmony_ci * 2. Incorrect parameter types; 183861847f8eSopenharmony_ci * 3. Parameter verification failed. 183961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 184061847f8eSopenharmony_ci * @since 10 184161847f8eSopenharmony_ci */ 184261847f8eSopenharmony_ci /** 184361847f8eSopenharmony_ci * Unregisters an existing observer. 184461847f8eSopenharmony_ci * 184561847f8eSopenharmony_ci * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. 184661847f8eSopenharmony_ci * @param { Callback<string> } callback - Indicates the callback function. 184761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 184861847f8eSopenharmony_ci * 2. Incorrect parameter types; 184961847f8eSopenharmony_ci * 3. Parameter verification failed. 185061847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 185161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 185261847f8eSopenharmony_ci * @atomicservice 185361847f8eSopenharmony_ci * @since 11 185461847f8eSopenharmony_ci */ 185561847f8eSopenharmony_ci off(type: 'multiProcessChange', callback?: Callback<string>): void; 185661847f8eSopenharmony_ci 185761847f8eSopenharmony_ci /** 185861847f8eSopenharmony_ci * Unregisters an observer for changes to the {@ link Preferences} object. 185961847f8eSopenharmony_ci * 186061847f8eSopenharmony_ci * @param { 'dataChange' } type - Indicates the event type. 186161847f8eSopenharmony_ci * @param { Array<string> } keys - Indicates the data whose changes are not observed. 186261847f8eSopenharmony_ci * @param { Callback<Record<string, ValueType>> } callback - Indicates the callback to unregister. 186361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 186461847f8eSopenharmony_ci * 2. Incorrect parameter types; 186561847f8eSopenharmony_ci * 3. Parameter verification failed. 186661847f8eSopenharmony_ci * @throws { BusinessError } 15500000 - Inner error. 186761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.Preferences.Core 186861847f8eSopenharmony_ci * @atomicservice 186961847f8eSopenharmony_ci * @since 12 187061847f8eSopenharmony_ci */ 187161847f8eSopenharmony_ci off(type: 'dataChange', keys: Array<string>, callback?: Callback<Record<string, ValueType>>): void; 187261847f8eSopenharmony_ci } 187361847f8eSopenharmony_ci} 187461847f8eSopenharmony_ci 187561847f8eSopenharmony_ciexport default preferences; 1876