1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.data.cloudExtension.d.ts 35.37 KB
一键复制 编辑 原始数据 按行查看 历史
weishaoxiong 提交于 2024-07-20 14:25 +08:00 . fix: API lint告警处理
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit ArkData
*/
import type rpc from './@ohos.rpc';
import type cloudData from './@ohos.data.cloudData';
import type relationalStore from './@ohos.data.relationalStore';
/**
* Provides interfaces to implement extended cloud capabilities.
*
* @namespace cloudExtension
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @since 11
*/
declare namespace cloudExtension {
/**
* 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;
}
/**
* Indicates cloud assets in one column.
*
* @typedef { Array<CloudAsset> } CloudAssets
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
type CloudAssets = Array<CloudAsset>;
/**
* Indicates possible cloud types.
*
* @typedef { null | number | string | boolean | Uint8Array | CloudAsset | CloudAssets } CloudType
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
type CloudType = null | number | string | boolean | Uint8Array | CloudAsset | CloudAssets;
/**
* 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 { Record<string, AppBriefInfo> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
apps: Record<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 <b>true</b> means cloud is enabled;
* the value <b>false</b> 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 <b>true</b> means the cloud is enabled; the <b>false</b> 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 = 1,
/**
* Real.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
REAL = 2,
/**
* Text.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
TEXT = 3,
/**
* Boolean.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
BOOL = 4,
/**
* BLOB.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
BLOB = 5,
/**
* Asset. For details, see {@link relationalStore.Asset}.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
ASSET = 6,
/**
* Assets. For details, see {@link relationalStore.Assets}.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
ASSETS = 7
}
/**
* 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 { Array<Field> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
fields: Array<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 { Array<Table> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
tables: Array<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<Database> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
databases: Array<Database>;
}
/**
* 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<Record<string, CloudType>> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
values: Array<Record<string, CloudType>>;
}
/**
* 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 { Record<string, Array<SubscribeId>> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
subscribe: Record<string, Array<SubscribeId>>;
}
/**
* 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 = 0,
/**
* Update data.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
UPDATE = 1,
/**
* Delete data.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
DELETE = 2
}
/**
* 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;
/**
* Lock ID for locking the cloud database.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
lockId: 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 = 0,
/**
* Unknown error.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
UNKNOWN_ERROR = 1,
/**
* Network error.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NETWORK_ERROR = 2,
/**
* Cloud is disabled.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
CLOUD_DISABLED = 3,
/**
* The cloud database is locked by others.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
LOCKED_BY_OTHERS = 4,
/**
* The number of records exceeds the limit.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
RECORD_LIMIT_EXCEEDED = 5,
/**
* The cloud has no space for the asset.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NO_SPACE_FOR_ASSET = 6
}
/**
* Defines the result.
*
* @interface Result
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface Result<T> {
/**
* Error code.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
code: number;
/**
* Error code description.
*
* @type { ?string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
description?: string;
/**
* Result value.
*
* @type { ?T }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
value?: T;
}
/**
* Creates a share service stub with the specified instance.
*
* @param { ShareCenter } instance - Indicates the <b>ShareCenter</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createShareServiceStub(instance: ShareCenter): Promise<rpc.RemoteObject>;
/**
* Creates a cloud service stub with the specified instance.
*
* @param { CloudService } instance - Indicates the <b>CloudService</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns the remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createCloudServiceStub(instance: CloudService): Promise<rpc.RemoteObject>;
/**
* Creates a cloud database stub with the specified instance.
*
* @param { CloudDB } instance - Indicates the <b>CloudDB</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns the remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createCloudDBStub(instance: CloudDB): Promise<rpc.RemoteObject>;
/**
* Creates an asset loader stub with the specified instance.
*
* @param { AssetLoader } instance - Indicates the <b>AssetLoader</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createAssetLoaderStub(instance: AssetLoader): Promise<rpc.RemoteObject>;
/**
* 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<Result<Array<string>>> } Returns the IDs generated.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
generateId(count: number): Promise<Result<Array<string>>>;
/**
* Inserts data to the cloud.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } values - Indicates the data to insert.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the insert result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
insert(
table: string,
values: Array<Record<string, CloudType>>,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Updates data in the cloud.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } values - Indicates the new data.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the update result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
update(
table: string,
values: Array<Record<string, CloudType>>,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Deletes data.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the delete result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
delete(
table: string,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Queries data.
*
* @param { string } table - Indicates the table name.
* @param { Array<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<Result<CloudData>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
query(table: string, fields: Array<string>, queryCount: number, queryCursor: string): Promise<Result<CloudData>>;
/**
* 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<Result<LockInfo>> } Returns the locked information.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
lock(): Promise<Result<LockInfo>>;
/**
* Uses the heartbeat to extend the lock interval if it is not enough.
*
* @param { number } lockId - Indicates the lock ID of the heartbeat.
* @returns { Promise<Result<LockInfo>> } Returns the time.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
heartbeat(lockId: number): Promise<Result<LockInfo>>;
/**
* Unlocks the cloud database.
*
* @param { number } lockId - Indicates the lock ID.
* @returns { Promise<Result<boolean>> } Returns the unlock result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unlock(lockId: number): Promise<Result<boolean>>;
}
/**
* 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 { Array<CloudAsset> } assets - Indicates the assets to download.
* @returns { Promise<Array<Result<CloudAsset>>> } Returns the asset download result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
download(table: string, gid: string, prefix: string, assets: Array<CloudAsset>): Promise<Array<Result<CloudAsset>>>;
/**
* Uploads assets.
*
* @param { string } table - Indicates the name of the table.
* @param { string } gid - Indicates the GID.
* @param { Array<CloudAsset> } assets - Indicates the assets to upload.
* @returns { Promise<Array<Result<CloudAsset>>> } Returns the asset upload result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
upload(table: string, gid: string, assets: Array<CloudAsset>): Promise<Array<Result<CloudAsset>>>;
}
/**
* Provides interfaces for implementing ShareCenter.
*
* @interface ShareCenter
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface ShareCenter {
/**
* Shares data with specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the sharing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
share(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* UnShares data with specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the sharing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unshare(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* Exits the sharing.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @returns { Promise<Result<void>> } Returns the exit result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
exit(userId: number, bundleName: string, sharingResource: string): Promise<Result<void>>;
/**
* Changes privilege of the specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the changing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
changePrivilege(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* Queries participants of the specific sharing resource.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @returns { Promise<Result<Array<cloudData.sharing.Participant>>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
queryParticipants(
userId: number,
bundleName: string,
sharingResource: string
): Promise<Result<Array<cloudData.sharing.Participant>>>;
/**
* Queries participants based on the specified invitation code.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } invitationCode - Indicates the invitation code.
* @returns { Promise<Result<Array<cloudData.sharing.Participant>>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
queryParticipantsByInvitation(
userId: number,
bundleName: string,
invitationCode: string
): Promise<Result<Array<cloudData.sharing.Participant>>>;
/**
* Confirms invitation.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } invitationCode - Indicates the invitation code.
* @param { cloudData.sharing.State } state - Indicates the state.
* @returns { Promise<Result<string>> } Returns the sharing resource.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
confirmInvitation(
userId: number,
bundleName: string,
invitationCode: string,
state: cloudData.sharing.State
): Promise<Result<string>>;
/**
* Changes confirmation.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { cloudData.sharing.State } state - Indicates the state.
* @returns { Promise<Result<void>> } Returns the change result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
changeConfirmation(
userId: number,
bundleName: string,
sharingResource: string,
state: cloudData.sharing.State
): Promise<Result<void>>;
}
/**
* Provides interfaces for implementing CloudService.
*
* @interface CloudService
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudService {
/**
* Obtains the service information.
*
* @returns { Promise<ServiceInfo> } Returns the service information obtained.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getServiceInfo(): Promise<ServiceInfo>;
/**
* Obtains the brief application information.
*
* @returns { Promise<Record<string, AppBriefInfo>> }
* Returns the key-value pairs corresponding to <b>bundle</b> and
* <b>AppBriefInfo</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getAppBriefInfo(): Promise<Record<string, AppBriefInfo>>;
/**
* Obtains the application schema information.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @returns { Promise<Result<AppSchema>> } Returns <b>AppSchema</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getAppSchema(bundleName: string): Promise<Result<AppSchema>>;
/**
* Subscribes to data changes in the cloud.
* When the cloud server data is changed, the server notifies the device of
* the data change.
*
* @param { Record<string, Array<Database>> } 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<Result<SubscribeInfo>> } Returns <b>SubscribeInfo</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
subscribe(
subInfo: Record<string, Array<Database>>,
expirationTime: number
): Promise<Result<SubscribeInfo>>;
/**
* Unsubscribes from the data changes in the cloud.
*
* @param { Record<string, Array<string>> } 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<number> } Returns unsubscribeInfo result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unsubscribe(unsubscribeInfo: Record<string, Array<string>>): Promise<number>;
/**
* Connects to a database.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { Database } database - Indicates the database to connect.
* @returns { Promise<rpc.RemoteObject> } Returns connectDB RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectDB(bundleName: string, database: Database): Promise<rpc.RemoteObject>;
/**
* Connects to an assetLoader.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { Database } database - Indicates the database of bundle.
* @returns { Promise<rpc.RemoteObject> } Returns connectAssetLoader RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectAssetLoader(bundleName: string, database: Database): Promise<rpc.RemoteObject>;
/**
* Connects to a share center.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @returns { Promise<rpc.RemoteObject> } Returns shareCenter RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectShareCenter(userId: number, bundleName: string): Promise<rpc.RemoteObject>;
}
}
export default cloudExtension;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助