diff --git a/interface_sdk/api/@ohos.data.cloudData.d.ts b/interface_sdk/api/@ohos.data.cloudData.d.ts index 3aff00650cc7940400d35d32cd65a055f37c3ad1..cc985208092da81566b42736026f1ff72f411dfe 100644 --- a/interface_sdk/api/@ohos.data.cloudData.d.ts +++ b/interface_sdk/api/@ohos.data.cloudData.d.ts @@ -294,7 +294,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - export namespace Sharing { + export namespace sharing { /** * Enumerates the roles. * @@ -621,7 +621,7 @@ declare namespace cloudData { function share( sharingRes: string, participants: Array, - callback: AsyncCallback>> + callback: AsyncCallback>>> ): void; /** @@ -641,7 +641,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function share(sharingRes: string, participants: Array): Promise>>; + function share(sharingRes: string, participants: Array): Promise>>>; /** * Unshares data. @@ -664,7 +664,7 @@ declare namespace cloudData { function unshare( sharingRes: string, participants: Array, - callback: AsyncCallback>> + callback: AsyncCallback>>> ): void; /** @@ -684,7 +684,10 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function unshare(sharingRes: string, participants: Array): Promise>>; + function unshare( + sharingRes: string, + participants: Array + ): Promise>>>; /** * Exit sharing. @@ -701,7 +704,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function exit(sharingRes: string, callback: AsyncCallback): void; + function exit(sharingRes: string, callback: AsyncCallback>): void; /** * Exit sharing. @@ -718,7 +721,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function exit(sharingRes: string): Promise; + function exit(sharingRes: string): Promise>; /** * Changes the permissions for the shared data. @@ -741,7 +744,7 @@ declare namespace cloudData { function changePrivilege( sharingRes: string, participants: Array, - callback: AsyncCallback>> + callback: AsyncCallback>>> ): void; /** @@ -764,7 +767,7 @@ declare namespace cloudData { function changePrivilege( sharingRes: string, participants: Array - ): Promise>>; + ): Promise>>>; /** * Queries the participants based on the specified shared data. @@ -782,7 +785,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function queryParticipants(sharingRes: string, callback: AsyncCallback>>): void; + function queryParticipants(sharingRes: string, callback: AsyncCallback>>): void; /** * Queries the participants based on the specified shared data. @@ -799,12 +802,12 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function queryParticipants(sharingRes: string): Promise>>; + function queryParticipants(sharingRes: string): Promise>>; /** * Queries the participants based on the specified invitation code. * - * @param { string } InvitationCode - Indicates the invitation code. + * @param { string } invitationCode - Indicates the invitation code. * @param { AsyncCallback>> } callback - Indicates the * callback invoked to return the participants obtained. * @throws { BusinessError } 201 - Permission verification failed, which @@ -818,14 +821,14 @@ declare namespace cloudData { * @since 11 */ function queryParticipantsByInvitation( - InvitationCode: string, - callback: AsyncCallback>> + invitationCode: string, + callback: AsyncCallback>> ): void; /** * Queries the participants based on the specified invitation code. * - * @param { string } InvitationCode - Indicates the invitation code. + * @param { string } invitationCode - Indicates the invitation code. * @Returns { Promise>> } - Promise used to return the result. * @throws { BusinessError } 201 - Permission verification failed, which * is usually returned by VerifyAccessToken. @@ -837,7 +840,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function queryParticipantsByInvitation(InvitationCode: string): Promise>>; + function queryParticipantsByInvitation(invitationCode: string): Promise>>; /** * Confirms the invitation of cloud sharing. @@ -892,7 +895,7 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function changeConfirmation(sharingRes: string, status: Status, callback: AsyncCallback): void; + function changeConfirmation(sharingRes: string, status: Status, callback: AsyncCallback>): void; /** * Changes confirmation of shared record. @@ -910,8 +913,8 @@ declare namespace cloudData { * @systemapi * @since 11 */ - function changeConfirmation(sharingRes: string, status: Status): Promise; + function changeConfirmation(sharingRes: string, status: Status): Promise>; } } -export default cloudData; +export default cloudData; \ No newline at end of file diff --git a/interface_sdk/api/@ohos.data.cloudExtension.d.ts b/interface_sdk/api/@ohos.data.cloudExtension.d.ts index cca2371c329aa145b6518926d3c2ad6948ae6432..203f6fbf2a60e64299db2c9411a26f877da93525 100644 --- a/interface_sdk/api/@ohos.data.cloudExtension.d.ts +++ b/interface_sdk/api/@ohos.data.cloudExtension.d.ts @@ -13,7 +13,8 @@ * limitations under the License. */ -import rpc from './@ohos.rpc'; +import type relationalStore from './@ohos.data.relationalStore'; +import type rpc from './@ohos.rpc'; import cloudData from "./@ohos.data.cloudData"; import Result = cloudData.Sharing.Result; @@ -25,6 +26,717 @@ import Result = cloudData.Sharing.Result; * @since 11 */ declare namespace cloudExtension { + /** + * Defines valuesBucket, see {@link relationalStore.ValuesBucket}. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + type ValuesBucket = relationalStore.ValuesBucket; + + /** + * Defines cloud information. + * + * @interface CloudInfo + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface CloudInfo { + /** + * Cloud information. For details, see {@link ServiceInfo}. + * + * @type { ServiceInfo } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + cloudInfo: ServiceInfo; + + /** + * Defines brief application information. + * + * @type { object } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + apps: { [bundleName: string]: AppBriefInfo }; + } + + /** + * Defines cloud service information. + * + * @interface ServiceInfo + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface ServiceInfo { + /** + * Whether cloud is enabled. The value true means cloud is enabled; + * the value false means the opposite. + * + * @type { boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + enableCloud: boolean; + + /** + * ID of the cloud account generated by using SHA-256. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + id: string; + + /** + * Total space (in KB) of the account on the server. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + totalSpace: number; + + /** + * Available space (in KB) of the account on the server. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + remainingSpace: number; + + /** + * Current user of the device. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + user: number; + } + + /** + * Defines the brief application information. + * + * @interface AppBriefInfo + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface AppBriefInfo { + /** + * ID of the application. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + appId: string; + + /** + * Bundle name. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + bundleName: string; + + /** + * Whether cloud is enabled for the application. + * The value true means the cloud is enabled; the false means + * the opposite. + * + * @type { boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + cloudSwitch: boolean; + + /** + * Application instance ID. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + instanceId: number; + } + + /** + * Enumerates the field types. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export enum FieldType { + /** + * NULL. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + NULL = 0, + + /** + * Number. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + NUMBER, + + /** + * Real. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + REAL, + + /** + * Text. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + TEXT, + + /** + * Boolean. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + BOOL, + + /** + * BLOB. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + BLOB, + + /** + * Asset. For details, see {@link relationalStore.Asset}. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + ASSET, + + /** + * Assets. For details, see {@link relationalStore.Assets}. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + ASSETS + } + + /** + * Defines the fields. + * + * @interface Field + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface Field { + /** + * Alias of the field on the server. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + alias: string; + + /** + * Column name. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + colName: string; + + /** + * Type of the field. For details, see {@link FieldType}. + * + * @type { FieldType } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + type: FieldType; + + /** + * Whether the current column holds the primary key. + * + * @type { boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + primary: boolean; + + /** + * Whether the current column is nullable. + * + * @type { boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + nullable: boolean; + } + + /** + * Defines a table. + * + * @interface Table + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface Table { + /** + * Alias of the table on the server. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + alias: string; + + /** + * Name of the table. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + name: string; + + /** + * Fields in the table. For details, see {@link Field}. + * + * @type { Field[] } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + fields: Field[]; + } + + /** + * Defines a database. + * + * @interface Database + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface Database { + /** + * Name of the database. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + name: string; + + /** + * Alias of the database on the server. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + alias: string; + + /** + * Tables in the database. For details, see {@link Table}. + * + * @type { Table[] } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + tables: Table[]; + } + + /** + * Defines the application schema. + * + * @interface AppSchema + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface AppSchema { + /** + * Bundle name of the application. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + bundleName: string; + + /** + * Schema version. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + version: number; + + /** + * Databases {@link Database} of the application. + * + * @type { Array } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + databases: Array; + } + + /** + * Defines the data in the cloud. + * + * @interface CloudData + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface CloudData { + /** + * Next cursor for query. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + nextCursor: string; + + /** + * Whether the server has more data to query {@link CloudDB.query()}. + * + * @type { boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + hasMore: boolean; + + /** + * Array of data queried, including the data values and extension + * values {@link ExtensionValue}. + * + * @type { Array } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + values: Array; + } + + /** + * Defines the subscription information. + * + * @interface SubscribeInfo + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface SubscribeInfo { + /** + * Subscription expiration time, in milliseconds. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + expirationTime: number; + + /** + * Data to be observed. + * + * @type { object } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + subscribe: { [bundleName: string]: Array }; + } + + /** + * Defines the subscription ID. + * + * @interface SubscribeId + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface SubscribeId { + /** + * Alias of the database on the server. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + databaseAlias: string; + + /** + * Subscription ID generated by {@link CloudService.subscribe()}. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + id: string; + } + + /** + * Enumerates the operations that can be performed on the database. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export enum Flag { + /** + * Insert data. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + INSERT, + + /** + * Update data. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + UPDATE, + + /** + * Delete data. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + DELETE + } + + /** + * Defines the extension values. + * + * @interface ExtensionValue + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface ExtensionValue { + /** + * ID generated by {@link CloudDB.insert()}. + * An ID is generated for each row when data is first inserted to the cloud. + * The ID must be unique for each table. + * + * @type { string } + * @readonly + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + readonly id: string; + + /** + * Time when the row data was created. + * + * @type { number } + * @readonly + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + readonly createTime: number; + + /** + * Time when the row data was last modified. + * + * @type { number } + * @readonly + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + readonly modifyTime: number; + + /** + * Database operation. + * + * @type { Flag } + * @readonly + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + readonly operation: Flag; + } + + /** + * Defines the lock information. + * + * @interface LockInfo + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface LockInfo { + /** + * Duration for which the cloud database is locked, in seconds. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + interval: number; + + /** + * Session ID for locking the cloud database. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + sessionId: number; + } + + /** + * Enumerates the error codes. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export enum ErrorCode { + /** + * Successful. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + SUCCESS, + + /** + * Unknown error. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + UNKNOWN_ERROR, + + /** + * Network error. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + NETWORK_ERROR, + + /** + * Cloud is disabled. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + CLOUD_DISABLED, + + /** + * The cloud database is locked by others. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + LOCKED_BY_OTHERS, + + /** + * The number of records exceeds the limit. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + RECORD_LIMIT_EXCEEDED, + + /** + * The cloud has no space for the asset. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + NO_SPACE_FOR_ASSET + } + /** * Defines participant. * @@ -50,17 +762,343 @@ declare namespace cloudExtension { * @systemapi * @since 11 */ - function createShareServiceStub(instance: ShareService): Promise; + function createShareServiceStub(instance: ShareCenter): Promise; + + /** + * Creates a cloud service stub with the specified instance. + * + * @param { CloudService } instance - Indicates the CloudService instance. + * @returns { Promise } Returns the remote object. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + function createCloudServiceStub(instance: CloudService): Promise; + + /** + * Creates a cloud database stub with the specified instance. + * + * @param { CloudDB } instance - Indicates the CloudDB instance. + * @returns { Promise } Returns the remote object. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + function createCloudDBStub(instance: CloudDB): Promise; + + /** + * Creates an asset loader stub with the specified instance. + * + * @param { AssetLoader } instance - Indicates the AssetLoader instance. + * @returns { Promise } Returns remote object. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + function createAssetLoaderStub(instance: AssetLoader): Promise; + + /** + * Provides interfaces for implementing CloudService. + * + * @interface CloudService + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface CloudService { + /** + * Obtains the service information. + * + * @returns { Promise } Returns the service information obtained. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + getServiceInfo(): Promise; + + /** + * Obtains the brief application information. + * + * @returns { Promise<{ [bundleName: string]: AppBriefInfo }> } + * Returns the key-value pairs corresponding to bundle and + * AppBriefInfo. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + getAppBriefInfo(): Promise<{ [bundleName: string]: AppBriefInfo }>; + + /** + * Obtains the application schema information. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise> } Returns AppSchema. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + getAppSchema(bundleName: string): Promise>; + + /** + * Subscribes to data changes in the cloud. + * When the cloud server data is changed, the server notifies the device of + * the data change. + * + * @param { object } subInfo - Indicates + * the data to be subscribed to, that is, the key-value pairs corresponding + * to an array of bundle names and databases. + * @param { number } expirationTime - Indicates the subscription expiration + * time. + * @returns { Promise> } Returns SubscribeInfo. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + subscribe( + subInfo: { [bundleName: string]: Array }, + expirationTime: number + ): Promise>; + + /** + * Unsubscribes from the data changes in the cloud. + * + * @param { object } unsubscribeInfo - Indicates + * the data to be unsubscribe from, that is, the key-value pairs + * corresponding to an array of bundle names and databases. + * @returns { Promise } Returns unsubscribeInfo result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + unsubscribe(unsubscribeInfo: { [bundleName: string]: Array }): Promise; + + /** + * Connects to a database. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { Database } database - Indicates the database to connect. + * @returns { Promise } Returns connectDB RemoteObject. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + connectDB(bundleName: string, database: Database): Promise; + + /** + * Connects to an assetLoader. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { Database } database - Indicates the database of bundle. + * @returns { Promise } Returns connectAssetLoader RemoteObject. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + connectAssetLoader(bundleName: string, database: Database): Promise; + + /** + * Connects to a share center. + * + * @param { number } userId - Indicates the user ID. + * @param { string } bundleName - Indicates the bundle name. + * @returns { Promise } Returns connectAssetLoader RemoteObject. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + connectShareCenter(userId: number, bundleName: string): Promise; + } + + /** + * Provides interfaces for the operations on the cloud database. + * + * @interface CloudDB + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface CloudDB { + /** + * Generates the IDs of the rows of data to be inserted to the cloud. + * The IDs must be unique for each table. + * + * @param { number } count - Indicates the number of IDs to generate. + * @returns { Promise> } Returns the IDs generated. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + generateId(count: number): Promise>; + + /** + * Inserts data to the cloud. + * + * @param { string } table - Indicates the table name. + * @param { ValuesBucket[] } values - Indicates the data to insert. + * @param { ValuesBucket[] } extValues - Indicates the extension + * values {@link ExtensionValue}. + * @returns { Promise> } Returns the insert result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + insert(table: string, values: ValuesBucket[], extValues: ValuesBucket[]): Promise>; + + /** + * Updates data in the cloud. + * + * @param { string } table - Indicates the table name. + * @param { ValuesBucket[] } values - Indicates the new data. + * @param { ValuesBucket[] } extValues - Indicates the extension + * values {@link ExtensionValue}. + * @returns { Promise> } Returns the update result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + update(table: string, values: ValuesBucket[], extValues: ValuesBucket[]): Promise>; + + /** + * Deletes data. + * + * @param { string } table - Indicates the table name. + * @param { ValuesBucket[] } extValues - Indicates the extension + * values {@link ExtensionValue}. + * @returns { Promise> } Returns the delete result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + delete(table: string, extValues: ValuesBucket[]): Promise>; + + /** + * Queries data. + * + * @param { string } table - Indicates the table name. + * @param { string[] } fields - Indicates the columns to query. + * @param { number } queryCount - Indicates the number of data records + * to query. + * @param { string } queryCursor - Indicates the cursor. + * @returns { Promise> } Returns the query result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + query(table: string, fields: string[], queryCount: number, queryCursor: string): Promise>; + + /** + * Locks the cloud database. + * The cloud database will be unlocked when the lock interval has expired. + * When the cloud database is locked, other devices cannot synchronize data + * with the cloud. + * + * @returns { Promise> } Returns the locked information. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + lock(): Promise>; + + /** + * Uses the heartbeat to extend the lock interval if it is not enough. + * + * @param { number } sessionId - Indicates the session ID of the heartbeat. + * @returns { Promise> } Returns the time. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + heartbeat(sessionId: number): Promise>; + + /** + * Unlocks the cloud database. + * + * @param { number } sessionId - Indicates the session ID. + * @returns { Promise> } Returns the unlock result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + unlock(sessionId: number): Promise>; + } + + /** + * Provides interface for managing cloud assets. + * + * @interface CloudAsset + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface CloudAsset extends relationalStore.Asset { + /** + * Asset ID. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + assetId: string; + + /** + * Asset hash value. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + hash: string; + } + + /** + * Provides interfaces for implementing the asset loader. + * + * @interface AssetLoader + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + export interface AssetLoader { + + /** + * Downloads assets. + * + * @param { string } table - Indicates the name of the table. + * @param { string } gid - Indicates the GID. + * @param { string } prefix - Indicates the prefix information. + * @param { CloudAsset[] } assets - Indicates the assets to download. + * @returns { Promise[]> } Returns the asset download result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + download(table: string, gid: string, prefix: string, assets: CloudAsset[]): Promise[]>; + + /** + * Uploads assets. + * + * @param { string } table - Indicates the name of the table. + * @param { string } gid - Indicates the GID. + * @param { CloudAsset[] } assets - Indicates the assets to upload. + * @returns { Promise[]> } Returns the asset upload result. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @systemapi + * @since 11 + */ + upload(table: string, gid: string, assets: CloudAsset[]): Promise[]>; + } /** - * Provides interfaces for implementing ShareService. + * Provides interfaces for implementing ShareCenter. * - * @interface ShareService + * @interface ShareCenter * @syscap SystemCapability.DistributedDataManager.CloudSync.Server * @systemapi * @since 11 */ - export interface ShareService { + export interface ShareCenter { /** * Share data with specific participants. * @@ -74,10 +1112,10 @@ declare namespace cloudExtension { * @since 11 */ share( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array + userId: number, + bundleName: string, + sharingRes: string, + participants: Array ): Promise>>>; /** @@ -93,10 +1131,10 @@ declare namespace cloudExtension { * @since 11 */ unshare( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array + userId: number, + bundleName: string, + sharingRes: string, + participants: Array ): Promise>>>; /** @@ -125,10 +1163,10 @@ declare namespace cloudExtension { * @since 11 */ changePrivilege( - userId: number, - bundleName: string, - sharingRes: string, - participants: Array + userId: number, + bundleName: string, + sharingRes: string, + participants: Array ): Promise>>>; /** @@ -143,9 +1181,9 @@ declare namespace cloudExtension { * @since 11 */ queryParticipants( - userId: number, - bundleName: string, - sharingRes: string + userId: number, + bundleName: string, + sharingRes: string ): Promise>>; /** @@ -160,9 +1198,9 @@ declare namespace cloudExtension { * @since 11 */ queryParticipantsByInvitation( - userId: number, - bundleName: string, - invitationCode: string + userId: number, + bundleName: string, + invitationCode: string ): Promise>>; /** @@ -178,10 +1216,10 @@ declare namespace cloudExtension { * @since 11 */ confirmInvitation( - userId: number, - bundleName: string, - invitationCode: string, - status: ParticipantStatus + userId: number, + bundleName: string, + invitationCode: string, + status: ParticipantStatus ): Promise>; /** @@ -203,28 +1241,6 @@ declare namespace cloudExtension { status: ParticipantStatus ): Promise>; } - - /** - * Provides interfaces for implementing CloudService. - * - * @interface CloudService - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server - * @systemapi - * @since 11 - */ - export interface CloudService { - /** - * Connects to a share center. - * - * @param { number } userId - Indicates the user ID. - * @param { string } bundleName - Indicates the bundle name. - * @returns { Promise } Returns connectAssetLoader RemoteObject. - * @syscap SystemCapability.DistributedDataManager.CloudSync.Server - * @systemapi - * @since 11 - */ - connectShareCenter(userId: number, bundleName: string): Promise; - } } -export default cloudExtension; +export default cloudExtension; \ No newline at end of file