diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts deleted file mode 100644 index 495ac85091bc5345c5e121f2de3f95345f4b063e..0000000000000000000000000000000000000000 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"), - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from "./basic"; -import { ResultSet } from './data/rdb/resultSet'; -import ExtensionContext from "./application/ExtensionContext"; -import Want from './@ohos.application.Want'; -import dataAbility from './@ohos.data.dataAbility'; -import rdb from './@ohos.data.rdb'; - -/** - * class of datashare extension ability. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi Hide this for inner system use. - */ -export default class DataShareExtensionAbility { - /** - * Indicates datashare extension ability context. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi Hide this for inner system use. - */ - context?: ExtensionContext; - - /** - * Called back when a datashare extension ability is started for initialization. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param want Indicates connection information about the datashare extension ability. - * @systemapi Hide this for inner system use. - * @return - - */ - onCreate?(want: Want): void; - - /** - * Obtains the MIME type of files. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME type of the files to obtain. This parameter cannot be set to {@code - * null}. - *

1. "*/*": Obtains all types supported by a data share. - *

2. "image/*": Obtains files whose main type is image of any subtype. - *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @systemapi Hide this for inner system use. - * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data - */ - getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; - - /** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBucket Indicates the data to insert. - * @systemapi Hide this for inner system use. - * @return Returns the index of the newly inserted data record. - */ - insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; - - /** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the database table storing the data to update. - * @param valueBucket Indicates the data to update. This parameter can be null. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by - * default. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records updated. - */ - update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, - callback: AsyncCallback): void; - - /** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the database table storing the data to delete. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by - * default. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records deleted. - */ - delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - - /** - * Queries one or more data records in the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the database table storing the data to query. - * @param columns Indicates the columns to be queried, in array, for example, {"name","age"}. You should define - * the processing logic when this parameter is null. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be queried by - * default. - * @systemapi Hide this for inner system use. - * @return Returns the queried data. - */ - query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, - callback: AsyncCallback): void; - - /** - * Obtains the MIME type matching the data specified by the URI of the data share. This method should be - * implemented by a data share. - * - *

Data abilities supports general data types, including text, HTML, and JPEG.

- * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri of the data. - * @systemapi Hide this for inner system use. - * @return Returns the MIME type that matches the data specified by {@code uri}. - */ - getType?(uri: string, callback: AsyncCallback): void; - - /** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBuckets Indicates the data to insert. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records inserted. - */ - batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; - - /** - * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be - * used across devices, persisted, backed up, and restored. It can refer to the same item in the data share - * even if the context has changed. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri to normalize. - * @systemapi Hide this for inner system use. - * @return Returns the normalized uri if the data share supports URI normalization; - */ - normalizeUri?(uri: string, callback: AsyncCallback): void; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. - * The default implementation of this method returns the original uri passed to it. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri to denormalize. - * @systemapi Hide this for inner system use. - * @return Returns the denormalized {@code uri} object if the denormalization is successful; returns the original - * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by - * the original {@code uri} cannot be found in the current environment. - */ - denormalizeUri?(uri: string, callback: AsyncCallback): void; -} \ No newline at end of file diff --git a/api/@ohos.data.dataShare.d.ts b/api/@ohos.data.dataShare.d.ts deleted file mode 100644 index ee6279552e3f6dd3a70e4b8aaef3d665b72b4443..0000000000000000000000000000000000000000 --- a/api/@ohos.data.dataShare.d.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* -* Copyright (c) 2022 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import { AsyncCallback } from './basic'; -import { Want } from './ability/want'; -import { ResultSet } from './data/rdb/resultSet'; -import Context from './application/Context'; -import dataAbility from './@ohos.data.dataAbility'; -import rdb from './@ohos.data.rdb'; - -declare namespace dataShare { - /** - * Obtains the dataShareHelper. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param context Indicates the application context. - * @param want Indicates The element parameter of the service ability. - * @param uri Indicates the path of the file to open. - * @return Returns the dataShareHelper. - * @systemapi Hide this for inner system use. - */ - function createDataShareHelper(context: Context, want: Want, uri: string): DataShareHelper; - - /** - * DataShareHelper - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @systemapi Hide this for inner system use. - */ - interface DataShareHelper { - /** - * Registers an observer to observe data specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - * @return - - * @systemapi Hide this for inner system use. - */ - on(type: 'dataChange', uri: string, callback: AsyncCallback): void; - - /** - * Deregisters an observer used for monitoring data specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - * @return - - * @systemapi Hide this for inner system use. - */ - off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; - - /** - * Inserts a single data record into the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted. - * @return Returns the index of the inserted data record. - * @systemapi Hide this for inner system use. - */ - insert(uri: string, value: rdb.ValuesBucket, callback: AsyncCallback): void; - insert(uri: string, value: rdb.ValuesBucket): Promise; - - /** - * Deletes one or more data records from the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. - * @systemapi Hide this for inner system use. - */ - delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise; - - - /** - * Queries data in the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of data to query. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the query result. - * @systemapi Hide this for inner system use. - */ - query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): Promise; - - /** - * Updates data records in the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of data to update. - * @param value Indicates the data to update. This parameter can be null. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records updated. - * @systemapi Hide this for inner system use. - */ - update(uri: string, value: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - update(uri: string, value: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): Promise; - - - /** - * Inserts multiple data records into the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param values Indicates the data records to insert. - * @return Returns the number of data records inserted. - * @systemapi Hide this for inner system use. - */ - batchInsert(uri: string, values: Array, callback: AsyncCallback): void; - batchInsert(uri: string, values: Array): Promise; - - /** - * Obtains the MIME type of the date specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @return Returns the MIME type that matches the data specified by uri. - * @systemapi Hide this for inner system use. - */ - getType(uri: string, callback: AsyncCallback): void; - getType(uri: string): Promise; - - /** - * Obtains the MIME types of files supported. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME types of the files to obtain. This parameter cannot be null. - *

1. "*/*": Obtains all types supported by Data abilities. - *

2. "image/*": Obtains files whose main type is image of any subtype. - *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the matched MIME types. If there is no match, {@code null} is returned. - * @systemapi Hide this for inner system use. - */ - getFileTypes(uri: string, mimeTypeFilter:string, callback: AsyncCallback>): void; - getFileTypes(uri: string, mimeTypeFilter: string): Promise>; - - /** - * Converts the given {@code uri} that refers to the Data ability into a normalized {@link ohos.utils.net.Uri}. - * A normalized uri can be used across devices, persisted, backed up, and restored. - *

To transfer a normalized uri from another environment to the current environment, you should call this - * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} - * to convert it to a denormalized uri that can be used only in the current environment. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to normalize. - * @return Returns the normalized {@code Uri} object if the Data ability supports uri normalization; - * returns {@code null} otherwise. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #denormalizeUri - * @systemapi Hide this for inner system use. - */ - normalizeUri(uri: string, callback: AsyncCallback): void; - normalizeUri(uri: string): Promise; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to denormalize. - * @return Returns the denormalized {@code Uri} object if the denormalization is successful; returns the - * original {@code Uri} passed to this method if there is nothing to do; returns {@code null} if the data - * identified by the normalized {@code Uri} cannot be found in the current environment. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #normalizeUri - * @systemapi Hide this for inner system use. - */ - denormalizeUri(uri: string, callback: AsyncCallback): void; - denormalizeUri(uri: string): Promise; - - /** - * Notifies the registered observers of a change to the data resource specified by Uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to notifyChange. - * @return - - * @systemapi Hide this for inner system use. - */ - notifyChange(uri: string, callback: AsyncCallback): void; - notifyChange(uri: string): Promise; - } -} - -export default dataShare;