/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; import { Model } from './model'; import { Uri } from 'vscode'; export interface InputBox { value: string; } export interface Repository { readonly rootUri: Uri; readonly inputBox: InputBox; } export interface API { getRepositories(): Promise; } export function createApi(modelPromise: Promise) { return { async getRepositories(): Promise { const model = await modelPromise; return model.repositories.map(repository => ({ rootUri: Uri.file(repository.root), inputBox: { set value(value: string) { repository.inputBox.value = value; }, get value(): string { return repository.inputBox.value; } } })); } }; }