本文整理匯總了TypeScript中azure-devops-extension-api.IExtensionDataManager.getDocument方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IExtensionDataManager.getDocument方法的具體用法?TypeScript IExtensionDataManager.getDocument怎麽用?TypeScript IExtensionDataManager.getDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類azure-devops-extension-api.IExtensionDataManager
的用法示例。
在下文中一共展示了IExtensionDataManager.getDocument方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getLegacySession
async getLegacySession(id: string): Promise<ISession | null> {
const manager = await this.getManager();
try {
const legacySession: ILegacySession = await manager.getDocument(
"EstimationSessions",
id,
{
defaultValue: null
}
);
return {
id: legacySession.id,
name: `Migrated: '${legacySession.name}'`,
mode: SessionMode.Online,
source: SessionSource.Ids,
sourceData: legacySession.workItemIds,
version: 1,
createdAt: legacySession.createdAt,
createdBy: legacySession.creatorId,
cardSet: defaultCardSets[0].id, // Always use the first card set for migrated sessions
isLegacy: true
};
} catch {
return null;
}
}
示例2: getSession
async getSession(id: string): Promise<ISession | null> {
const manager = await this.getManager();
try {
const session: ISession | null = await manager.getDocument(
await this._getCollection(),
id,
{
defaultValue: null
}
);
return session;
} catch {
return null;
}
}
示例3: getDocument
private async getDocument(sessionId: string): Promise<ISessionDocument> {
const defaultValue: ISessionDocument = {
id: sessionId,
sessionEstimates: {}
};
const manager = await this.getManager();
try {
const document = await manager.getDocument(
OfflineEstimationCollection,
sessionId,
{
defaultValue
}
);
return document;
} catch (e) {
// Collection does not exist
return defaultValue;
}
}