本文整理汇总了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;
}
}