編輯

共用方式為


IExtensionDataManager interface

Methods

createDocument(string, any, IDocumentOptions)

Returns a promise for creating a document in the provided collection

deleteDocument(string, string, IDocumentOptions)

Returns a promise for deleting the document at the provided scope, collection and id

getDocument(string, string, IDocumentOptions)

Returns a promise for getting a document with the provided id in the provided collection

getDocuments(string, IDocumentOptions)

Returns a promise for getting all of the documents in the provided collection

getValue<T>(string, IDocumentOptions)

Returns a promise for retrieving a setting at the provided key and scope

queryCollections(ExtensionDataCollection[])

Returns a promise for querying a set of collections

queryCollectionsByName(string[])

Returns a promise for querying a set of collections

setDocument(string, any, IDocumentOptions)

Returns a promise for setting a document in the provided collection Creates the document if it does not exist, otherwise updates the existing document with the id provided

setValue<T>(string, T, IDocumentOptions)

Returns a promise for saving a setting at the provided key and scope

updateDocument(string, any, IDocumentOptions)

Returns a promise for updating a document in the provided collection A document with the id provided must exist

Method Details

createDocument(string, any, IDocumentOptions)

Returns a promise for creating a document in the provided collection

function createDocument(collectionName: string, doc: any, documentOptions?: IDocumentOptions): Promise<any>

Parameters

collectionName

string

The name of the collection where the document lives

doc

any

The document to store

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<any>

deleteDocument(string, string, IDocumentOptions)

Returns a promise for deleting the document at the provided scope, collection and id

function deleteDocument(collectionName: string, id: string, documentOptions?: IDocumentOptions): Promise<void>

Parameters

collectionName

string

The name of the collection where the document lives

id

string

The id of the document in the collection

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<void>

getDocument(string, string, IDocumentOptions)

Returns a promise for getting a document with the provided id in the provided collection

function getDocument(collectionName: string, id: string, documentOptions?: IDocumentOptions): Promise<any>

Parameters

collectionName

string

The name of the collection where the document lives

id

string

The id of the document in the collection

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<any>

getDocuments(string, IDocumentOptions)

Returns a promise for getting all of the documents in the provided collection

function getDocuments(collectionName: string, documentOptions?: IDocumentOptions): Promise<any[]>

Parameters

collectionName

string

The name of the collection where the document lives

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<any[]>

getValue<T>(string, IDocumentOptions)

Returns a promise for retrieving a setting at the provided key and scope

function getValue<T>(key: string, documentOptions?: IDocumentOptions): Promise<T>

Parameters

key

string

The key to retrieve a value for

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<T>

queryCollections(ExtensionDataCollection[])

Returns a promise for querying a set of collections

function queryCollections(collections: ExtensionDataCollection[]): Promise<ExtensionDataCollection[]>

Parameters

collections

ExtensionDataCollection[]

The list of collections to query. Each collection will contain its collectionName, scopeType, and scopeValue

Returns

queryCollectionsByName(string[])

Returns a promise for querying a set of collections

function queryCollectionsByName(collectionNames: string[]): Promise<ExtensionDataCollection[]>

Parameters

collectionNames

string[]

Returns

setDocument(string, any, IDocumentOptions)

Returns a promise for setting a document in the provided collection Creates the document if it does not exist, otherwise updates the existing document with the id provided

function setDocument(collectionName: string, doc: any, documentOptions?: IDocumentOptions): Promise<any>

Parameters

collectionName

string

The name of the collection where the document lives

doc

any

The document to store

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<any>

setValue<T>(string, T, IDocumentOptions)

Returns a promise for saving a setting at the provided key and scope

function setValue<T>(key: string, value: T, documentOptions?: IDocumentOptions): Promise<T>

Parameters

key

string

The key to save a value for

value

T

The value to save

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<T>

updateDocument(string, any, IDocumentOptions)

Returns a promise for updating a document in the provided collection A document with the id provided must exist

function updateDocument(collectionName: string, doc: any, documentOptions?: IDocumentOptions): Promise<any>

Parameters

collectionName

string

The name of the collection where the document lives

doc

any

The document to store

documentOptions
IDocumentOptions

Extension document options, the default scope value is account-wide

Returns

Promise<any>