UNPKG

2.23 kBTypeScriptView Raw
1import * as restm from 'typed-rest-client/RestClient';
2import ifm = require("./interfaces/common/VsoBaseInterfaces");
3export interface ClientVersioningData {
4 /**
5 * The api version string to send in the request (e.g. "1.0" or "2.0-preview.2")
6 */
7 apiVersion?: string;
8 /**
9 * The request path string to send the request to. Looked up via an options request with the location id.
10 */
11 requestUrl?: string;
12}
13export declare class InvalidApiResourceVersionError implements Error {
14 name: string;
15 message: string;
16 constructor(message?: string);
17}
18/**
19 * Base class that should be used (derived from) to make requests to VSS REST apis
20 */
21export declare class VsoClient {
22 private static APIS_RELATIVE_PATH;
23 private static PREVIEW_INDICATOR;
24 private _locationsByAreaPromises;
25 private _initializationPromise;
26 restClient: restm.RestClient;
27 baseUrl: string;
28 basePath: string;
29 constructor(baseUrl: string, restClient: restm.RestClient);
30 protected autoNegotiateApiVersion(location: ifm.ApiResourceLocation, requestedVersion: string): string;
31 /**
32 * Gets the route template for a resource based on its location ID and negotiates the api version
33 */
34 getVersioningData(apiVersion: string, area: string, locationId: string, routeValues: any, queryParams?: any): Promise<ClientVersioningData>;
35 /**
36 * Sets a promise that is waited on before any requests are issued. Can be used to asynchronously
37 * set the request url and auth token manager.
38 */
39 _setInitializationPromise(promise: Promise<any>): void;
40 /**
41 * Gets information about an API resource location (route template, supported versions, etc.)
42 *
43 * @param area resource area name
44 * @param locationId Guid of the location to get
45 */
46 beginGetLocation(area: string, locationId: string): Promise<ifm.ApiResourceLocation | undefined>;
47 private beginGetAreaLocations;
48 resolveUrl(relativeUrl: string): string;
49 private queryParamsToStringHelper;
50 private queryParamsToString;
51 protected getRequestUrl(routeTemplate: string, area: string, resource: string, routeValues: any, queryParams?: any): string;
52 private replaceRouteValues;
53}