import { ApiManagementModels } from "@azure/arm-apimanagement" ; import { AzExtTreeItem , AzureParentTreeItem } from "vscode-azureextensionui" ; import { topItemCount } from "../constants" ; import { treeUtils } from "../utils/treeUtils" ; import { IServiceTreeRoot } from "./IServiceTreeRoot" ; import { SubscriptionTreeItem } from "./SubscriptionTreeItem" ; export class SubscriptionsTreeItem extends AzureParentTreeItem < IServiceTreeRoot > { public get iconPath ( ) : { light : string ; dark : string ; } { return treeUtils . getThemedIconPath ( 'list' ) ; } public static contextValue : string = 'azureApiManagementSubscriptions' ; public label : string = "Subscriptions" ; public contextValue : string = SubscriptionsTreeItem . contextValue ; private _nextLink : string | undefined ; public hasMoreChildrenImpl ( ) { return this . _nextLink !== undefined ; } public async loadMoreChildrenImpl ( clearCache ) { if ( clearCache ) { this . _nextLink = undefined ; } const subscriptionCollection = this . _nextLink === undefined ? await this . root . client . subscription . list ( this . root . resourceGroupName , this . root . serviceName , { top : topItemCount } ) : await this . root . client . subscription . listNext ( this . _nextLink ) ; this . _nextLink = subscriptionCollection . nextLink ; return this . createTreeItemsWithErrorHandling ( subscriptionCollection , "invalidApiManagementSubscription" , async ( subscription ) => new SubscriptionTreeItem ( this , subscription ) , ( subscription ) => { if ( subscription . displayName !== null && subscription . displayName !== undefined ) { return subscription . displayName ; } else { return subscription . name ; } } ) ; } }