* awaitable http and rest client

* bumping to preview

* new pattern in BuildApi.ts - does not compile yet

* regen

* change http client pattern

* remove serializer from rest client

* more no serializer in rest

* restclient users new http client

* Adding the DTA apis to testapi.ts (#76)

* get collection calls are wrong

* Removing the duplicate run filter (#77)

* bumping version

* new api pattern

* regenerate clients (#81)

* regenerate clients

* negotiation, another build sample

* fix upload (#82)

* update task sample
This commit is contained in:
Bryan MacFarlane 2017-03-09 08:11:52 -05:00 коммит произвёл GitHub
Родитель d60e4b7c40
Коммит d8f5e251f9
157 изменённых файлов: 91369 добавлений и 49259 удалений

Просмотреть файл

@ -102,6 +102,12 @@ Run samples:
$ npm run samples
```
Run a specific sample:
```bash
$ npm run samples -- http
```
## Contributing
To contribute to this repository, see the [contribution guide](./CONTRIBUTING.md)

282
api/AccountsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,282 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import AccountsInterfaces = require("./interfaces/AccountsInterfaces");
export interface IAccountsApi extends basem.ClientApiBase {
createAccount(info: AccountsInterfaces.AccountCreateInfoInternal, usePrecreated?: boolean): Promise<AccountsInterfaces.Account>;
getAccount(accountId: string, properties?: string): Promise<AccountsInterfaces.Account>;
getAccounts(ownerId?: string, memberId?: string, properties?: string): Promise<AccountsInterfaces.Account[]>;
isValidAccountName(accountName: string): Promise<AccountsInterfaces.AccountNameAvailability>;
getRegions(): Promise<AccountsInterfaces.AccountRegion[]>;
getAccountSettings(): Promise<{ [key: string] : string; }>;
}
export class AccountsApi extends basem.ClientApiBase implements IAccountsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Accounts-api');
}
/**
* @param {AccountsInterfaces.AccountCreateInfoInternal} info
* @param {boolean} usePrecreated
*/
public async createAccount(
info: AccountsInterfaces.AccountCreateInfoInternal,
usePrecreated?: boolean
): Promise<AccountsInterfaces.Account> {
return new Promise<AccountsInterfaces.Account>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
usePrecreated: usePrecreated,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"229a6a53-b428-4ffb-a835-e8f36b5b4b1e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AccountsInterfaces.Account>;
res = await this.rest.create<AccountsInterfaces.Account>(url, info, options);
let ret = this.formatResponse(res.result,
AccountsInterfaces.TypeInfo.Account,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} accountId
* @param {string} properties
*/
public async getAccount(
accountId: string,
properties?: string
): Promise<AccountsInterfaces.Account> {
return new Promise<AccountsInterfaces.Account>(async (resolve, reject) => {
let routeValues: any = {
accountId: accountId
};
let queryValues: any = {
properties: properties,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"229a6a53-b428-4ffb-a835-e8f36b5b4b1e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AccountsInterfaces.Account>;
res = await this.rest.get<AccountsInterfaces.Account>(url, options);
let ret = this.formatResponse(res.result,
AccountsInterfaces.TypeInfo.Account,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* A new version GetAccounts API. Only supports limited set of parameters, returns a list of account ref objects that only contains AccountUrl, AccountName and AccountId information, will use collection host Id as the AccountId.
*
* @param {string} ownerId - Owner Id to query for
* @param {string} memberId - Member Id to query for
* @param {string} properties - Only support service URL properties
*/
public async getAccounts(
ownerId?: string,
memberId?: string,
properties?: string
): Promise<AccountsInterfaces.Account[]> {
return new Promise<AccountsInterfaces.Account[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
ownerId: ownerId,
memberId: memberId,
properties: properties,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"229a6a53-b428-4ffb-a835-e8f36b5b4b1e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AccountsInterfaces.Account[]>;
res = await this.rest.get<AccountsInterfaces.Account[]>(url, options);
let ret = this.formatResponse(res.result,
AccountsInterfaces.TypeInfo.Account,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} accountName
*/
public async isValidAccountName(
accountName: string
): Promise<AccountsInterfaces.AccountNameAvailability> {
return new Promise<AccountsInterfaces.AccountNameAvailability>(async (resolve, reject) => {
let routeValues: any = {
accountName: accountName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"65dd1dc5-53fe-4c67-9b4e-0ec3e2539998",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AccountsInterfaces.AccountNameAvailability>;
res = await this.rest.get<AccountsInterfaces.AccountNameAvailability>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getRegions(
): Promise<AccountsInterfaces.AccountRegion[]> {
return new Promise<AccountsInterfaces.AccountRegion[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"642a93c7-8385-4d63-a5a5-20d044fe504f",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AccountsInterfaces.AccountRegion[]>;
res = await this.rest.get<AccountsInterfaces.AccountRegion[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getAccountSettings(
): Promise<{ [key: string] : string; }> {
return new Promise<{ [key: string] : string; }>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Account",
"4e012dd4-f8e1-485d-9bb3-c50d83c5b71b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : string; }>;
res = await this.rest.get<{ [key: string] : string; }>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

67
api/AuthenticationApi.ts Normal file
Просмотреть файл

@ -0,0 +1,67 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import AuthenticationInterfaces = require("./interfaces/AuthenticationInterfaces");
export interface IAuthenticationApi extends basem.ClientApiBase {
createSessionToken(sessionToken: AuthenticationInterfaces.WebSessionToken): Promise<AuthenticationInterfaces.WebSessionToken>;
}
export class AuthenticationApi extends basem.ClientApiBase implements IAuthenticationApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Authentication-api');
}
/**
* @param {AuthenticationInterfaces.WebSessionToken} sessionToken
*/
public async createSessionToken(
sessionToken: AuthenticationInterfaces.WebSessionToken
): Promise<AuthenticationInterfaces.WebSessionToken> {
return new Promise<AuthenticationInterfaces.WebSessionToken>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"WebPlatformAuth",
"11420b6b-3324-490a-848d-b8aafdb906ba",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AuthenticationInterfaces.WebSessionToken>;
res = await this.rest.create<AuthenticationInterfaces.WebSessionToken>(url, sessionToken, options);
let ret = this.formatResponse(res.result,
AuthenticationInterfaces.TypeInfo.WebSessionToken,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

106
api/AzureTfsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,106 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import AzureTfsInterfaces = require("./interfaces/AzureTfsInterfaces");
export interface IAzureTfsApi extends basem.ClientApiBase {
configureContinuousDeployment(configuration: AzureTfsInterfaces.ContinuousDeploymentConfiguration): Promise<AzureTfsInterfaces.ContinuousDeploymentOperation>;
getContinuousDeploymentOperation(continuousDeploymentOperationId: string): Promise<AzureTfsInterfaces.ContinuousDeploymentOperation>;
}
export class AzureTfsApi extends basem.ClientApiBase implements IAzureTfsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-AzureTfs-api');
}
/**
* @param {AzureTfsInterfaces.ContinuousDeploymentConfiguration} configuration
*/
public async configureContinuousDeployment(
configuration: AzureTfsInterfaces.ContinuousDeploymentConfiguration
): Promise<AzureTfsInterfaces.ContinuousDeploymentOperation> {
return new Promise<AzureTfsInterfaces.ContinuousDeploymentOperation>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"AzureTfs",
"76e9f914-2f9a-405d-8a22-e7034cb400c5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AzureTfsInterfaces.ContinuousDeploymentOperation>;
res = await this.rest.create<AzureTfsInterfaces.ContinuousDeploymentOperation>(url, configuration, options);
let ret = this.formatResponse(res.result,
AzureTfsInterfaces.TypeInfo.ContinuousDeploymentOperation,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} continuousDeploymentOperationId
*/
public async getContinuousDeploymentOperation(
continuousDeploymentOperationId: string
): Promise<AzureTfsInterfaces.ContinuousDeploymentOperation> {
return new Promise<AzureTfsInterfaces.ContinuousDeploymentOperation>(async (resolve, reject) => {
let routeValues: any = {
continuousDeploymentOperationId: continuousDeploymentOperationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"AzureTfs",
"76e9f914-2f9a-405d-8a22-e7034cb400c5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<AzureTfsInterfaces.ContinuousDeploymentOperation>;
res = await this.rest.get<AzureTfsInterfaces.ContinuousDeploymentOperation>(url, options);
let ret = this.formatResponse(res.result,
AzureTfsInterfaces.TypeInfo.ContinuousDeploymentOperation,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

152
api/CacheApi.ts Normal file
Просмотреть файл

@ -0,0 +1,152 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
export interface ICacheApi extends basem.ClientApiBase {
cache(data: any): Promise<string>;
delete(cacheKey: string): Promise<void>;
get(cacheKey: string): Promise<any>;
}
export class CacheApi extends basem.ClientApiBase implements ICacheApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Cache-api');
}
/**
* @param {any} data
*/
public async cache(
data: any
): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Cache",
"656342eb-ae7d-4ff2-802f-19c6e35b0fe6",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string>;
res = await this.rest.replace<string>(url, data, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} cacheKey
*/
public async delete(
cacheKey: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
cacheKey: cacheKey,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Cache",
"656342eb-ae7d-4ff2-802f-19c6e35b0fe6",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} cacheKey
*/
public async get(
cacheKey: string
): Promise<any> {
return new Promise<any>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
cacheKey: cacheKey,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Cache",
"656342eb-ae7d-4ff2-802f-19c6e35b0fe6",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<any>;
res = await this.rest.get<any>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

623
api/ChatApi.ts Normal file
Просмотреть файл

@ -0,0 +1,623 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ChatInterfaces = require("./interfaces/ChatInterfaces");
export interface IChatApi extends basem.ClientApiBase {
deleteMessage(roomId: number, messageId: number): Promise<void>;
getAllChatRoomMessages(roomId: number): Promise<ChatInterfaces.Message[]>;
getChatRoomMessageById(roomId: number, messageId: number): Promise<ChatInterfaces.Message>;
sendMessageToRoom(messageUpdate: ChatInterfaces.MessageData, roomId: number): Promise<ChatInterfaces.Message>;
updateChatMessage(messageUpdate: ChatInterfaces.MessageData, roomId: number, messageId: number): Promise<ChatInterfaces.Message>;
createChatRoom(roomUpdate: ChatInterfaces.RoomData): Promise<ChatInterfaces.Room>;
deleteChatRoom(roomId: number): Promise<void>;
getAllRooms(): Promise<ChatInterfaces.Room[]>;
getChatRoomById(roomId: number): Promise<ChatInterfaces.Room>;
updateChatRoom(roomUpdate: ChatInterfaces.RoomData, roomId: number): Promise<ChatInterfaces.Room>;
getAllChatRoomUsers(roomId: number): Promise<ChatInterfaces.User[]>;
getChatRoomUserById(roomId: number, userId: string): Promise<ChatInterfaces.User>;
joinRoom(userUpdate: ChatInterfaces.UserData, roomId: number, userId: string): Promise<void>;
leaveRoom(roomId: number, userId: string): Promise<void>;
}
export class ChatApi extends basem.ClientApiBase implements IChatApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Chat-api');
}
/**
* Delete a given chat message
*
* @param {number} roomId - Id of the room
* @param {number} messageId - Id of the message to delete
*/
public async deleteMessage(
roomId: number,
messageId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
messageId: messageId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"7d11c820-4bdc-4bca-8957-9d74e32cdd20",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve a listing of all chat messages in a given room
*
* @param {number} roomId - Id of the room
*/
public async getAllChatRoomMessages(
roomId: number
): Promise<ChatInterfaces.Message[]> {
return new Promise<ChatInterfaces.Message[]>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"7d11c820-4bdc-4bca-8957-9d74e32cdd20",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Message[]>;
res = await this.rest.get<ChatInterfaces.Message[]>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Message,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single chat message
*
* @param {number} roomId - Id of the room
* @param {number} messageId - Id of the message to retrieve
*/
public async getChatRoomMessageById(
roomId: number,
messageId: number
): Promise<ChatInterfaces.Message> {
return new Promise<ChatInterfaces.Message>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
messageId: messageId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"7d11c820-4bdc-4bca-8957-9d74e32cdd20",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Message>;
res = await this.rest.get<ChatInterfaces.Message>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Message,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Post message to a room
*
* @param {ChatInterfaces.MessageData} messageUpdate - Content of the message to post
* @param {number} roomId - Id of the room
*/
public async sendMessageToRoom(
messageUpdate: ChatInterfaces.MessageData,
roomId: number
): Promise<ChatInterfaces.Message> {
return new Promise<ChatInterfaces.Message>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"7d11c820-4bdc-4bca-8957-9d74e32cdd20",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Message>;
res = await this.rest.create<ChatInterfaces.Message>(url, messageUpdate, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Message,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update a given chat message
*
* @param {ChatInterfaces.MessageData} messageUpdate - New message content
* @param {number} roomId - Id of the room
* @param {number} messageId - Id of the message
*/
public async updateChatMessage(
messageUpdate: ChatInterfaces.MessageData,
roomId: number,
messageId: number
): Promise<ChatInterfaces.Message> {
return new Promise<ChatInterfaces.Message>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
messageId: messageId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"7d11c820-4bdc-4bca-8957-9d74e32cdd20",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Message>;
res = await this.rest.update<ChatInterfaces.Message>(url, messageUpdate, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Message,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create a single chat room
*
* @param {ChatInterfaces.RoomData} roomUpdate - Information to create the room
*/
public async createChatRoom(
roomUpdate: ChatInterfaces.RoomData
): Promise<ChatInterfaces.Room> {
return new Promise<ChatInterfaces.Room>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"3d0e7ee0-a6c9-497e-9a2c-23b687e860e2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Room>;
res = await this.rest.create<ChatInterfaces.Room>(url, roomUpdate, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Room,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Delete a given chat room
*
* @param {number} roomId - Id of the room
*/
public async deleteChatRoom(
roomId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"3d0e7ee0-a6c9-497e-9a2c-23b687e860e2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getAllRooms(
): Promise<ChatInterfaces.Room[]> {
return new Promise<ChatInterfaces.Room[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"3d0e7ee0-a6c9-497e-9a2c-23b687e860e2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Room[]>;
res = await this.rest.get<ChatInterfaces.Room[]>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Room,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single chat room
*
* @param {number} roomId - Id of the room to retrieve
*/
public async getChatRoomById(
roomId: number
): Promise<ChatInterfaces.Room> {
return new Promise<ChatInterfaces.Room>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"3d0e7ee0-a6c9-497e-9a2c-23b687e860e2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Room>;
res = await this.rest.get<ChatInterfaces.Room>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Room,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update information on a single chat room
*
* @param {ChatInterfaces.RoomData} roomUpdate - Room information
* @param {number} roomId - Id of the room to update
*/
public async updateChatRoom(
roomUpdate: ChatInterfaces.RoomData,
roomId: number
): Promise<ChatInterfaces.Room> {
return new Promise<ChatInterfaces.Room>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"3d0e7ee0-a6c9-497e-9a2c-23b687e860e2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.Room>;
res = await this.rest.update<ChatInterfaces.Room>(url, roomUpdate, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.Room,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve a listing of all chat users
*
* @param {number} roomId - Id of the room
*/
public async getAllChatRoomUsers(
roomId: number
): Promise<ChatInterfaces.User[]> {
return new Promise<ChatInterfaces.User[]>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"01408881-1a9a-4cc9-981d-9333e354e9d9",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.User[]>;
res = await this.rest.get<ChatInterfaces.User[]>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.User,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single chat user
*
* @param {number} roomId - Id of the room
* @param {string} userId - TfId of the user
*/
public async getChatRoomUserById(
roomId: number,
userId: string
): Promise<ChatInterfaces.User> {
return new Promise<ChatInterfaces.User>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
userId: userId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"01408881-1a9a-4cc9-981d-9333e354e9d9",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ChatInterfaces.User>;
res = await this.rest.get<ChatInterfaces.User>(url, options);
let ret = this.formatResponse(res.result,
ChatInterfaces.TypeInfo.User,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Joins a user to a given room
*
* @param {ChatInterfaces.UserData} userUpdate - user model information
* @param {number} roomId - Id of the room
* @param {string} userId - TfId of the user
*/
public async joinRoom(
userUpdate: ChatInterfaces.UserData,
roomId: number,
userId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
userId: userId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"01408881-1a9a-4cc9-981d-9333e354e9d9",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.replace<void>(url, userUpdate, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Leaves a user from a given room
*
* @param {number} roomId - Id of the room
* @param {string} userId - TfId of the user
*/
public async leaveRoom(
roomId: number,
userId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
roomId: roomId,
userId: userId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"chat",
"01408881-1a9a-4cc9-981d-9333e354e9d9",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -1,26 +1,41 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import Q = require('q');
import restm = require('./RestClient');
import httpm = require('./HttpClient');
import vsom = require('./VsoClient');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import serm = require('./Serialization');
import * as rm from 'typed-rest-client/RestClient';
import * as hm from 'typed-rest-client/HttpClient';
export class ClientApiBase {
baseUrl: string;
userAgent: string;
httpClient: httpm.HttpClient;
http: hm.HttpClient;
rest: rm.RestClient;
// TODO: delete these three after regen
httpClient: httpm.HttpCallbackClient;
restCallbackClient: restm.RestCallbackClient;
restClient: restm.RestClient;
vsoClient: vsom.VsoClient;
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[], userAgent?: string);
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[], userAgent: string) {
this.baseUrl = baseUrl;
this.httpClient = new httpm.HttpClient(userAgent, handlers);
this.restClient = new restm.RestClient(this.httpClient);
this.vsoClient = new vsom.VsoClient(baseUrl, this.restClient);
this.http = new hm.HttpClient(userAgent, handlers);
this.rest = new rm.RestClient(userAgent, null, handlers);
// TODO: delete these three after regen
this.httpClient = new httpm.HttpCallbackClient(userAgent, handlers);
this.restCallbackClient = new restm.RestCallbackClient(this.httpClient);
this.restClient = new restm.RestClient(userAgent, handlers);
this.vsoClient = new vsom.VsoClient(baseUrl, this.restCallbackClient);
this.userAgent = userAgent;
}
@ -30,18 +45,38 @@ export class ClientApiBase {
}
public connect(): Promise<any> {
var defer = Q.defer();
this.restClient.getJson(this.vsoClient.resolveUrl('/_apis/connectionData'), "", null, null, (err: any, statusCode: number, obj: any) => {
if (err) {
err.statusCode = statusCode;
defer.reject(err);
}
else {
defer.resolve(obj);
}
return new Promise((resolve, reject) => {
this.restCallbackClient.get(this.vsoClient.resolveUrl('/_apis/connectionData'), "", (err: any, statusCode: number, obj: any) => {
if (err) {
err.statusCode = statusCode;
reject(err);
}
else {
resolve(obj);
}
}, null);
});
return defer.promise;
}
public createAcceptHeader(type: string, apiVersion?: string): string {
return this.restCallbackClient.createAcceptHeader(type, apiVersion);
}
public createRequestOptions(type: string, apiVersion?: string) {
let options: rm.IRequestOptions = <rm.IRequestOptions>{};
options.acceptHeader = this.createAcceptHeader(type, apiVersion);
return options;
}
public formatResponse(data: any, responseTypeMetadata: any, isCollection: boolean): any {
let serializationData = {
responseTypeMetadata: responseTypeMetadata,
responseIsCollection: isCollection
};
let deserializedResult = serm.ContractSerializer.deserialize(data,
serializationData.responseTypeMetadata,
false,
serializationData.responseIsCollection);
return deserializedResult;
}
}

2411
api/CodeReviewApi.ts Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,73 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ConnectedServiceInterfaces = require("./interfaces/ConnectedServiceInterfaces");
export interface IConnectedServiceApi extends basem.ClientApiBase {
createAuthRequest(authRequest: ConnectedServiceInterfaces.AuthRequest, project: string, providerId: string): Promise<ConnectedServiceInterfaces.AuthRequest>;
}
export class ConnectedServiceApi extends basem.ClientApiBase implements IConnectedServiceApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-ConnectedService-api');
}
/**
* @param {ConnectedServiceInterfaces.AuthRequest} authRequest
* @param {string} project - Project ID or project name
* @param {string} providerId
*/
public async createAuthRequest(
authRequest: ConnectedServiceInterfaces.AuthRequest,
project: string,
providerId: string
): Promise<ConnectedServiceInterfaces.AuthRequest> {
return new Promise<ConnectedServiceInterfaces.AuthRequest>(async (resolve, reject) => {
let routeValues: any = {
project: project,
providerId: providerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"connectedService",
"e921b68f-92d6-44d4-aa88-19c84be1c4c7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ConnectedServiceInterfaces.AuthRequest>;
res = await this.rest.create<ConnectedServiceInterfaces.AuthRequest>(url, authRequest, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -1,164 +1,205 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import Q = require('q');
import restm = require('./RestClient');
import httpm = require('./HttpClient');
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ContributionsInterfaces = require("./interfaces/ContributionsInterfaces");
export interface IContributionsApi extends basem.ClientApiBase {
queryDataProviders(query: ContributionsInterfaces.DataProviderQuery): Promise<ContributionsInterfaces.DataProviderResult>;
getInstalledExtensions(contributionIds?: string[], includeDisabledApps?: boolean, assetTypes?: string[]): Promise<ContributionsInterfaces.InstalledExtension[]>;
getInstalledExtensionByName(publisherName: string, extensionName: string, assetTypes?: string[]): Promise<ContributionsInterfaces.InstalledExtension>;
}
export class ContributionsApi extends basem.ClientApiBase implements IContributionsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Contributions-api');
}
/**
* @param {ContributionsInterfaces.DataProviderQuery} query
*/
public queryDataProviders(
query: ContributionsInterfaces.DataProviderQuery
): Promise<ContributionsInterfaces.DataProviderResult> {
let deferred = Q.defer<ContributionsInterfaces.DataProviderResult>();
let onResult = (err: any, statusCode: number, dataProvidersQuery: ContributionsInterfaces.DataProviderResult) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(dataProvidersQuery);
}
};
let routeValues: any = {
};
this.vsoClient.getVersioningData("3.0-preview.1", "Contribution", "738368db-35ee-4b85-9f94-77ed34af2b0d", routeValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseIsCollection: false };
this.restClient.create(url, apiVersion, query, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* @param {string[]} contributionIds
* @param {boolean} includeDisabledApps
* @param {string[]} assetTypes
*/
public getInstalledExtensions(
contributionIds?: string[],
includeDisabledApps?: boolean,
assetTypes?: string[]
): Promise<ContributionsInterfaces.InstalledExtension[]> {
let deferred = Q.defer<ContributionsInterfaces.InstalledExtension[]>();
let onResult = (err: any, statusCode: number, InstalledApps: ContributionsInterfaces.InstalledExtension[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(InstalledApps);
}
};
let routeValues: any = {
};
let queryValues: any = {
contributionIds: contributionIds && contributionIds.join(";"),
includeDisabledApps: includeDisabledApps,
assetTypes: assetTypes && assetTypes.join(":"),
};
this.vsoClient.getVersioningData("3.0-preview.1", "Contribution", "2648442b-fd63-4b9a-902f-0c913510f139", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: ContributionsInterfaces.TypeInfo.InstalledExtension, responseIsCollection: true };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* @param {string} publisherName
* @param {string} extensionName
* @param {string[]} assetTypes
*/
public getInstalledExtensionByName(
publisherName: string,
extensionName: string,
assetTypes?: string[]
): Promise<ContributionsInterfaces.InstalledExtension> {
let deferred = Q.defer<ContributionsInterfaces.InstalledExtension>();
let onResult = (err: any, statusCode: number, InstalledApp: ContributionsInterfaces.InstalledExtension) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(InstalledApp);
}
};
let routeValues: any = {
publisherName: publisherName,
extensionName: extensionName
};
let queryValues: any = {
assetTypes: assetTypes && assetTypes.join(":"),
};
this.vsoClient.getVersioningData("3.0-preview.1", "Contribution", "3e2f6668-0798-4dcb-b592-bfe2fa57fde2", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: ContributionsInterfaces.TypeInfo.InstalledExtension, responseIsCollection: false };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
}
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ContributionsInterfaces = require("./interfaces/ContributionsInterfaces");
export interface IContributionsApi extends basem.ClientApiBase {
queryContributionNodes(query: ContributionsInterfaces.ContributionNodeQuery): Promise<ContributionsInterfaces.ContributionNodeQueryResult>;
queryDataProviders(query: ContributionsInterfaces.DataProviderQuery): Promise<ContributionsInterfaces.DataProviderResult>;
getInstalledExtensions(contributionIds?: string[], includeDisabledApps?: boolean, assetTypes?: string[]): Promise<ContributionsInterfaces.InstalledExtension[]>;
getInstalledExtensionByName(publisherName: string, extensionName: string, assetTypes?: string[]): Promise<ContributionsInterfaces.InstalledExtension>;
}
export class ContributionsApi extends basem.ClientApiBase implements IContributionsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Contributions-api');
}
/**
* Query for contribution nodes and provider details according the parameters in the passed in query object.
*
* @param {ContributionsInterfaces.ContributionNodeQuery} query
*/
public async queryContributionNodes(
query: ContributionsInterfaces.ContributionNodeQuery
): Promise<ContributionsInterfaces.ContributionNodeQueryResult> {
return new Promise<ContributionsInterfaces.ContributionNodeQueryResult>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Contribution",
"db7f2146-2309-4cee-b39c-c767777a1c55",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ContributionsInterfaces.ContributionNodeQueryResult>;
res = await this.rest.create<ContributionsInterfaces.ContributionNodeQueryResult>(url, query, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ContributionsInterfaces.DataProviderQuery} query
*/
public async queryDataProviders(
query: ContributionsInterfaces.DataProviderQuery
): Promise<ContributionsInterfaces.DataProviderResult> {
return new Promise<ContributionsInterfaces.DataProviderResult>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Contribution",
"738368db-35ee-4b85-9f94-77ed34af2b0d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ContributionsInterfaces.DataProviderResult>;
res = await this.rest.create<ContributionsInterfaces.DataProviderResult>(url, query, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string[]} contributionIds
* @param {boolean} includeDisabledApps
* @param {string[]} assetTypes
*/
public async getInstalledExtensions(
contributionIds?: string[],
includeDisabledApps?: boolean,
assetTypes?: string[]
): Promise<ContributionsInterfaces.InstalledExtension[]> {
return new Promise<ContributionsInterfaces.InstalledExtension[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
contributionIds: contributionIds && contributionIds.join(";"),
includeDisabledApps: includeDisabledApps,
assetTypes: assetTypes && assetTypes.join(":"),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Contribution",
"2648442b-fd63-4b9a-902f-0c913510f139",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ContributionsInterfaces.InstalledExtension[]>;
res = await this.rest.get<ContributionsInterfaces.InstalledExtension[]>(url, options);
let ret = this.formatResponse(res.result,
ContributionsInterfaces.TypeInfo.InstalledExtension,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} publisherName
* @param {string} extensionName
* @param {string[]} assetTypes
*/
public async getInstalledExtensionByName(
publisherName: string,
extensionName: string,
assetTypes?: string[]
): Promise<ContributionsInterfaces.InstalledExtension> {
return new Promise<ContributionsInterfaces.InstalledExtension>(async (resolve, reject) => {
let routeValues: any = {
publisherName: publisherName,
extensionName: extensionName
};
let queryValues: any = {
assetTypes: assetTypes && assetTypes.join(":"),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Contribution",
"3e2f6668-0798-4dcb-b592-bfe2fa57fde2",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ContributionsInterfaces.InstalledExtension>;
res = await this.rest.get<ContributionsInterfaces.InstalledExtension>(url, options);
let ret = this.formatResponse(res.result,
ContributionsInterfaces.TypeInfo.InstalledExtension,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,67 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import CustomerIntelligenceInterfaces = require("./interfaces/CustomerIntelligenceInterfaces");
export interface ICustomerIntelligenceApi extends basem.ClientApiBase {
publishEvents(events: CustomerIntelligenceInterfaces.CustomerIntelligenceEvent[]): Promise<void>;
}
export class CustomerIntelligenceApi extends basem.ClientApiBase implements ICustomerIntelligenceApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-CustomerIntelligence-api');
}
/**
* @param {CustomerIntelligenceInterfaces.CustomerIntelligenceEvent[]} events
*/
public async publishEvents(
events: CustomerIntelligenceInterfaces.CustomerIntelligenceEvent[]
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"customerintelligence",
"b5cc35c2-ff2b-491d-a085-24b6e9f396fd",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, events, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

635
api/DashboardApi.ts Normal file
Просмотреть файл

@ -0,0 +1,635 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import DashboardInterfaces = require("./interfaces/DashboardInterfaces");
import TfsCoreInterfaces = require("./interfaces/CoreInterfaces");
export interface IDashboardApi extends basem.ClientApiBase {
createDashboard(dashboard: DashboardInterfaces.Dashboard, teamContext: TfsCoreInterfaces.TeamContext): Promise<DashboardInterfaces.Dashboard>;
deleteDashboard(teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string): Promise<void>;
getDashboard(teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string): Promise<DashboardInterfaces.Dashboard>;
getDashboards(teamContext: TfsCoreInterfaces.TeamContext): Promise<DashboardInterfaces.DashboardGroup>;
replaceDashboard(dashboard: DashboardInterfaces.Dashboard, teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string): Promise<DashboardInterfaces.Dashboard>;
replaceDashboards(group: DashboardInterfaces.DashboardGroup, teamContext: TfsCoreInterfaces.TeamContext): Promise<DashboardInterfaces.DashboardGroup>;
createWidget(widget: DashboardInterfaces.Widget, teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string): Promise<DashboardInterfaces.Widget>;
deleteWidget(teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string, widgetId: string): Promise<DashboardInterfaces.Dashboard>;
getWidget(teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string, widgetId: string): Promise<DashboardInterfaces.Widget>;
replaceWidget(widget: DashboardInterfaces.Widget, teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string, widgetId: string): Promise<DashboardInterfaces.Widget>;
updateWidget(widget: DashboardInterfaces.Widget, teamContext: TfsCoreInterfaces.TeamContext, dashboardId: string, widgetId: string): Promise<DashboardInterfaces.Widget>;
getWidgetMetadata(contributionId: string): Promise<DashboardInterfaces.WidgetMetadataResponse>;
getWidgetTypes(scope: DashboardInterfaces.WidgetScope): Promise<DashboardInterfaces.WidgetTypesResponse>;
}
export class DashboardApi extends basem.ClientApiBase implements IDashboardApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Dashboard-api');
}
/**
* @param {DashboardInterfaces.Dashboard} dashboard
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
*/
public async createDashboard(
dashboard: DashboardInterfaces.Dashboard,
teamContext: TfsCoreInterfaces.TeamContext
): Promise<DashboardInterfaces.Dashboard> {
return new Promise<DashboardInterfaces.Dashboard>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Dashboard>;
res = await this.rest.create<DashboardInterfaces.Dashboard>(url, dashboard, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
*/
public async deleteDashboard(
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
*/
public async getDashboard(
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string
): Promise<DashboardInterfaces.Dashboard> {
return new Promise<DashboardInterfaces.Dashboard>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Dashboard>;
res = await this.rest.get<DashboardInterfaces.Dashboard>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
*/
public async getDashboards(
teamContext: TfsCoreInterfaces.TeamContext
): Promise<DashboardInterfaces.DashboardGroup> {
return new Promise<DashboardInterfaces.DashboardGroup>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.DashboardGroup>;
res = await this.rest.get<DashboardInterfaces.DashboardGroup>(url, options);
let ret = this.formatResponse(res.result,
DashboardInterfaces.TypeInfo.DashboardGroup,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DashboardInterfaces.Dashboard} dashboard
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
*/
public async replaceDashboard(
dashboard: DashboardInterfaces.Dashboard,
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string
): Promise<DashboardInterfaces.Dashboard> {
return new Promise<DashboardInterfaces.Dashboard>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Dashboard>;
res = await this.rest.replace<DashboardInterfaces.Dashboard>(url, dashboard, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DashboardInterfaces.DashboardGroup} group
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
*/
public async replaceDashboards(
group: DashboardInterfaces.DashboardGroup,
teamContext: TfsCoreInterfaces.TeamContext
): Promise<DashboardInterfaces.DashboardGroup> {
return new Promise<DashboardInterfaces.DashboardGroup>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"454b3e51-2e6e-48d4-ad81-978154089351",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.DashboardGroup>;
res = await this.rest.replace<DashboardInterfaces.DashboardGroup>(url, group, options);
let ret = this.formatResponse(res.result,
DashboardInterfaces.TypeInfo.DashboardGroup,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DashboardInterfaces.Widget} widget
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
*/
public async createWidget(
widget: DashboardInterfaces.Widget,
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string
): Promise<DashboardInterfaces.Widget> {
return new Promise<DashboardInterfaces.Widget>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"bdcff53a-8355-4172-a00a-40497ea23afc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Widget>;
res = await this.rest.create<DashboardInterfaces.Widget>(url, widget, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
* @param {string} widgetId
*/
public async deleteWidget(
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string,
widgetId: string
): Promise<DashboardInterfaces.Dashboard> {
return new Promise<DashboardInterfaces.Dashboard>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId,
widgetId: widgetId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"bdcff53a-8355-4172-a00a-40497ea23afc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Dashboard>;
res = await this.rest.del<DashboardInterfaces.Dashboard>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
* @param {string} widgetId
*/
public async getWidget(
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string,
widgetId: string
): Promise<DashboardInterfaces.Widget> {
return new Promise<DashboardInterfaces.Widget>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId,
widgetId: widgetId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"bdcff53a-8355-4172-a00a-40497ea23afc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Widget>;
res = await this.rest.get<DashboardInterfaces.Widget>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DashboardInterfaces.Widget} widget
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
* @param {string} widgetId
*/
public async replaceWidget(
widget: DashboardInterfaces.Widget,
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string,
widgetId: string
): Promise<DashboardInterfaces.Widget> {
return new Promise<DashboardInterfaces.Widget>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId,
widgetId: widgetId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"bdcff53a-8355-4172-a00a-40497ea23afc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Widget>;
res = await this.rest.replace<DashboardInterfaces.Widget>(url, widget, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DashboardInterfaces.Widget} widget
* @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
* @param {string} dashboardId
* @param {string} widgetId
*/
public async updateWidget(
widget: DashboardInterfaces.Widget,
teamContext: TfsCoreInterfaces.TeamContext,
dashboardId: string,
widgetId: string
): Promise<DashboardInterfaces.Widget> {
return new Promise<DashboardInterfaces.Widget>(async (resolve, reject) => {
let project = teamContext.projectId || teamContext.project;
let team = teamContext.teamId || teamContext.team;
let routeValues: any = {
project: project,
team: team,
dashboardId: dashboardId,
widgetId: widgetId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Dashboard",
"bdcff53a-8355-4172-a00a-40497ea23afc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.Widget>;
res = await this.rest.update<DashboardInterfaces.Widget>(url, widget, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} contributionId
*/
public async getWidgetMetadata(
contributionId: string
): Promise<DashboardInterfaces.WidgetMetadataResponse> {
return new Promise<DashboardInterfaces.WidgetMetadataResponse>(async (resolve, reject) => {
let routeValues: any = {
contributionId: contributionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Dashboard",
"6b3628d3-e96f-4fc7-b176-50240b03b515",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.WidgetMetadataResponse>;
res = await this.rest.get<DashboardInterfaces.WidgetMetadataResponse>(url, options);
let ret = this.formatResponse(res.result,
DashboardInterfaces.TypeInfo.WidgetMetadataResponse,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Returns available widgets in alphabetical order.
*
* @param {DashboardInterfaces.WidgetScope} scope
*/
public async getWidgetTypes(
scope: DashboardInterfaces.WidgetScope
): Promise<DashboardInterfaces.WidgetTypesResponse> {
return new Promise<DashboardInterfaces.WidgetTypesResponse>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
'$scope': scope,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Dashboard",
"6b3628d3-e96f-4fc7-b176-50240b03b515",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DashboardInterfaces.WidgetTypesResponse>;
res = await this.rest.get<DashboardInterfaces.WidgetTypesResponse>(url, options);
let ret = this.formatResponse(res.result,
DashboardInterfaces.TypeInfo.WidgetTypesResponse,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

332
api/DataImportApi.ts Normal file
Просмотреть файл

@ -0,0 +1,332 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import DataImportInterfaces = require("./interfaces/DataImportInterfaces");
export interface IDataImportApi extends basem.ClientApiBase {
cancelDataImportJob(requestId: string): Promise<void>;
getDataImportRequestStatus(requestId: string): Promise<DataImportInterfaces.DataImportRequestStatus>;
queueDatabaseImportJob(import: DataImportInterfaces.DatabaseDataImportRequest, validateOnly?: boolean): Promise<void>;
queueActivateImportJob(activateImport: DataImportInterfaces.ActivateDataImportRequest, validateOnly?: boolean): Promise<void>;
queueDataImportDehydrateJob(dehydrateRequest: DataImportInterfaces.DataImportDehydrateRequest, validateOnly?: boolean): Promise<void>;
queueHostMoveImportJob(hostMove: DataImportInterfaces.HostMoveDataImportRequest, validateOnly?: boolean): Promise<void>;
queueRemoveImportJob(removeImport: DataImportInterfaces.RemoveDataImportRequest, validateOnly?: boolean): Promise<void>;
}
export class DataImportApi extends basem.ClientApiBase implements IDataImportApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-DataImport-api');
}
/**
* @param {string} requestId
*/
public async cancelDataImportJob(
requestId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
requestId: requestId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"d8a12f6b-34c2-47b9-8c5a-a13eeea8816e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} requestId
*/
public async getDataImportRequestStatus(
requestId: string
): Promise<DataImportInterfaces.DataImportRequestStatus> {
return new Promise<DataImportInterfaces.DataImportRequestStatus>(async (resolve, reject) => {
let routeValues: any = {
requestId: requestId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"d8a12f6b-34c2-47b9-8c5a-a13eeea8816e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DataImportInterfaces.DataImportRequestStatus>;
res = await this.rest.get<DataImportInterfaces.DataImportRequestStatus>(url, options);
let ret = this.formatResponse(res.result,
DataImportInterfaces.TypeInfo.DataImportRequestStatus,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DataImportInterfaces.DatabaseDataImportRequest} import
* @param {boolean} validateOnly
*/
public async queueDatabaseImportJob(
import: DataImportInterfaces.DatabaseDataImportRequest,
validateOnly?: boolean
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
validateOnly: validateOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"d8a12f6b-34c2-47b9-8c5a-a13eeea8816e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, import, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DataImportInterfaces.ActivateDataImportRequest} activateImport
* @param {boolean} validateOnly
*/
public async queueActivateImportJob(
activateImport: DataImportInterfaces.ActivateDataImportRequest,
validateOnly?: boolean
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
validateOnly: validateOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"8217d957-104b-4ac8-9049-cbeea0a9910a",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, activateImport, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DataImportInterfaces.DataImportDehydrateRequest} dehydrateRequest
* @param {boolean} validateOnly
*/
public async queueDataImportDehydrateJob(
dehydrateRequest: DataImportInterfaces.DataImportDehydrateRequest,
validateOnly?: boolean
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
validateOnly: validateOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"b5f81f2f-00c4-4880-bd29-fa75411e8e00",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, dehydrateRequest, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DataImportInterfaces.HostMoveDataImportRequest} hostMove
* @param {boolean} validateOnly
*/
public async queueHostMoveImportJob(
hostMove: DataImportInterfaces.HostMoveDataImportRequest,
validateOnly?: boolean
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
validateOnly: validateOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"55c1dede-24b8-4c2b-82c8-731a2f0c7549",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, hostMove, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {DataImportInterfaces.RemoveDataImportRequest} removeImport
* @param {boolean} validateOnly
*/
public async queueRemoveImportJob(
removeImport: DataImportInterfaces.RemoveDataImportRequest,
validateOnly?: boolean
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
validateOnly: validateOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"DataImport",
"721974fc-e5d3-46a9-a427-81f84f5c965a",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, removeImport, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

580
api/DiscussionApi.ts Normal file
Просмотреть файл

@ -0,0 +1,580 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import DiscussionInterfaces = require("./interfaces/DiscussionInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IDiscussionApi extends basem.ClientApiBase {
addComment(newComment: DiscussionInterfaces.DiscussionComment, discussionId: number): Promise<DiscussionInterfaces.DiscussionComment>;
addCommentsByDiscussionId(newComments: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>, discussionId: number): Promise<DiscussionInterfaces.DiscussionComment[]>;
deleteComment(discussionId: number, commentId: number): Promise<void>;
getComment(discussionId: number, commentId: number): Promise<DiscussionInterfaces.DiscussionComment>;
getComments(discussionId: number): Promise<DiscussionInterfaces.DiscussionCommentCollection>;
updateComment(newComment: DiscussionInterfaces.DiscussionComment, discussionId: number, commentId: number): Promise<DiscussionInterfaces.DiscussionComment>;
addComments(newComments: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>): Promise<DiscussionInterfaces.DiscussionComment[]>;
createThread(newThread: DiscussionInterfaces.DiscussionThread): Promise<DiscussionInterfaces.DiscussionThread>;
createThreads(newThreads: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionThreadCollection>): Promise<DiscussionInterfaces.DiscussionThreadCollection>;
getThreadsByWorkItemId(workItemId: number): Promise<DiscussionInterfaces.DiscussionThreadCollection>;
getThread(discussionId: number): Promise<DiscussionInterfaces.DiscussionThread>;
updateThread(newThread: DiscussionInterfaces.DiscussionThread, discussionId: number): Promise<DiscussionInterfaces.DiscussionThread>;
getThreads(artifactUris: string[]): Promise<{ [key: string] : DiscussionInterfaces.DiscussionThread[]; }>;
}
export class DiscussionApi extends basem.ClientApiBase implements IDiscussionApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Discussion-api');
}
/**
* Create a discussion comment POST /_apis/discussion/threads/{discussionId}/comments
*
* @param {DiscussionInterfaces.DiscussionComment} newComment
* @param {number} discussionId
*/
public async addComment(
newComment: DiscussionInterfaces.DiscussionComment,
discussionId: number
): Promise<DiscussionInterfaces.DiscussionComment> {
return new Promise<DiscussionInterfaces.DiscussionComment>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionComment>;
res = await this.rest.create<DiscussionInterfaces.DiscussionComment>(url, newComment, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionComment,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create multiple discussion comments for a discussion thread PATCH /_apis/discussion/threads/{discussionId}/comments
*
* @param {VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>} newComments
* @param {number} discussionId
*/
public async addCommentsByDiscussionId(
newComments: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>,
discussionId: number
): Promise<DiscussionInterfaces.DiscussionComment[]> {
return new Promise<DiscussionInterfaces.DiscussionComment[]>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionComment[]>;
res = await this.rest.update<DiscussionInterfaces.DiscussionComment[]>(url, newComments, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionComment,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Remove a discussion comment DELETE /_apis/discussion/threads/{discussionId}/comments/{commentId}
*
* @param {number} discussionId
* @param {number} commentId
*/
public async deleteComment(
discussionId: number,
commentId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId,
commentId: commentId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Read a comment by id GET /_apis/discussion/threads/{discussionId}/comments/{commentId}
*
* @param {number} discussionId
* @param {number} commentId
*/
public async getComment(
discussionId: number,
commentId: number
): Promise<DiscussionInterfaces.DiscussionComment> {
return new Promise<DiscussionInterfaces.DiscussionComment>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId,
commentId: commentId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionComment>;
res = await this.rest.get<DiscussionInterfaces.DiscussionComment>(url, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionComment,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Read all comments for a discussion thread GET /_apis/discussion/threads/{discussionId}/comments
*
* @param {number} discussionId
*/
public async getComments(
discussionId: number
): Promise<DiscussionInterfaces.DiscussionCommentCollection> {
return new Promise<DiscussionInterfaces.DiscussionCommentCollection>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionCommentCollection>;
res = await this.rest.get<DiscussionInterfaces.DiscussionCommentCollection>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update a discussion comment PATCH /_apis/discussion/threads/{discussionId}/comments/{commentId}
*
* @param {DiscussionInterfaces.DiscussionComment} newComment
* @param {number} discussionId
* @param {number} commentId
*/
public async updateComment(
newComment: DiscussionInterfaces.DiscussionComment,
discussionId: number,
commentId: number
): Promise<DiscussionInterfaces.DiscussionComment> {
return new Promise<DiscussionInterfaces.DiscussionComment>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId,
commentId: commentId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"495211bd-b463-4578-86fe-924ea4953693",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionComment>;
res = await this.rest.update<DiscussionInterfaces.DiscussionComment>(url, newComment, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionComment,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create multiple comments across discussion threads PATCH /_apis/discussion/comments
*
* @param {VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>} newComments
*/
public async addComments(
newComments: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionComment[]>
): Promise<DiscussionInterfaces.DiscussionComment[]> {
return new Promise<DiscussionInterfaces.DiscussionComment[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"20933fc0-b6a7-4a57-8111-a7458da5441b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionComment[]>;
res = await this.rest.update<DiscussionInterfaces.DiscussionComment[]>(url, newComments, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionComment,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create a discussion thread POST /_apis/discussion/threads
*
* @param {DiscussionInterfaces.DiscussionThread} newThread
*/
public async createThread(
newThread: DiscussionInterfaces.DiscussionThread
): Promise<DiscussionInterfaces.DiscussionThread> {
return new Promise<DiscussionInterfaces.DiscussionThread>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"a50ddbe2-1a1d-4c55-857f-73c6a3a31722",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionThread>;
res = await this.rest.create<DiscussionInterfaces.DiscussionThread>(url, newThread, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionThread,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create multiple discussion threads PATCH /_apis/discussion/threads
*
* @param {VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionThreadCollection>} newThreads
*/
public async createThreads(
newThreads: VSSInterfaces.VssJsonCollectionWrapperV<DiscussionInterfaces.DiscussionThreadCollection>
): Promise<DiscussionInterfaces.DiscussionThreadCollection> {
return new Promise<DiscussionInterfaces.DiscussionThreadCollection>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"a50ddbe2-1a1d-4c55-857f-73c6a3a31722",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionThreadCollection>;
res = await this.rest.update<DiscussionInterfaces.DiscussionThreadCollection>(url, newThreads, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Query discussion threads by work item id GET /_apis/discussion/threads?workItemId={workItemId}
*
* @param {number} workItemId
*/
public async getThreadsByWorkItemId(
workItemId: number
): Promise<DiscussionInterfaces.DiscussionThreadCollection> {
return new Promise<DiscussionInterfaces.DiscussionThreadCollection>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
workItemId: workItemId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"a50ddbe2-1a1d-4c55-857f-73c6a3a31722",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionThreadCollection>;
res = await this.rest.get<DiscussionInterfaces.DiscussionThreadCollection>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Read a discussion thread by id GET /_apis/discussion/threads/{discussionId}
*
* @param {number} discussionId
*/
public async getThread(
discussionId: number
): Promise<DiscussionInterfaces.DiscussionThread> {
return new Promise<DiscussionInterfaces.DiscussionThread>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"010054f6-d9ed-4ed2-855f-7f86bff10c02",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionThread>;
res = await this.rest.get<DiscussionInterfaces.DiscussionThread>(url, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionThread,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update a discussion thread PATCH /_apis/discussion/threads/{discussionId}
*
* @param {DiscussionInterfaces.DiscussionThread} newThread
* @param {number} discussionId
*/
public async updateThread(
newThread: DiscussionInterfaces.DiscussionThread,
discussionId: number
): Promise<DiscussionInterfaces.DiscussionThread> {
return new Promise<DiscussionInterfaces.DiscussionThread>(async (resolve, reject) => {
let routeValues: any = {
discussionId: discussionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"010054f6-d9ed-4ed2-855f-7f86bff10c02",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<DiscussionInterfaces.DiscussionThread>;
res = await this.rest.update<DiscussionInterfaces.DiscussionThread>(url, newThread, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionThread,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Query discussion threads by artifact uri POST /_apis/discussion/threadsBatch
*
* @param {string[]} artifactUris
*/
public async getThreads(
artifactUris: string[]
): Promise<{ [key: string] : DiscussionInterfaces.DiscussionThread[]; }> {
return new Promise<{ [key: string] : DiscussionInterfaces.DiscussionThread[]; }>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"discussion",
"255a0b5e-3c2f-43c2-a688-36c878210ba2",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : DiscussionInterfaces.DiscussionThread[]; }>;
res = await this.rest.create<{ [key: string] : DiscussionInterfaces.DiscussionThread[]; }>(url, artifactUris, options);
let ret = this.formatResponse(res.result,
DiscussionInterfaces.TypeInfo.DiscussionThread,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

546
api/FavoriteApi.ts Normal file
Просмотреть файл

@ -0,0 +1,546 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FavoriteInterfaces = require("./interfaces/FavoriteInterfaces");
export interface IFavoriteApi extends basem.ClientApiBase {
getFavoriteProviders(faultInMissingHost?: boolean): Promise<FavoriteInterfaces.FavoriteProvider[]>;
createFavorite(favorite: FavoriteInterfaces.FavoriteCreateParameters): Promise<FavoriteInterfaces.Favorite>;
createFavoriteOfOwner(favorite: FavoriteInterfaces.FavoriteCreateParameters, ownerScopeType: string, ownerScopeId: string): Promise<FavoriteInterfaces.Favorite>;
deleteFavoriteById(favoriteId: string, artifactType: string, artifactScopeType: string, artifactScopeId?: string): Promise<void>;
deleteFavoriteOfOwnerById(favoriteId: string, ownerScopeType: string, ownerScopeId: string, artifactType: string, artifactScopeType: string, artifactScopeId?: string): Promise<void>;
getFavoriteByArtifact(artifactType: string, artifactId: string, artifactScopeType: string, artifactScopeId?: string): Promise<FavoriteInterfaces.Favorite>;
getFavoriteById(favoriteId: string, artifactScopeType: string, artifactType: string, artifactScopeId?: string, includeExtendedDetails?: boolean): Promise<FavoriteInterfaces.Favorite>;
getFavoriteOfOwnerById(favoriteId: string, ownerScopeType: string, ownerScopeId: string, artifactScopeType: string, artifactType: string, artifactScopeId?: string, includeExtendedDetails?: boolean): Promise<FavoriteInterfaces.Favorite>;
getFavorites(artifactType?: string, artifactScopeType?: string, artifactScopeId?: string, includeExtendedDetails?: boolean): Promise<FavoriteInterfaces.Favorite[]>;
getFavoritesOfOwner(ownerScopeType: string, ownerScopeId: string, artifactType?: string, artifactScopeType?: string, artifactScopeId?: string, includeExtendedDetails?: boolean): Promise<FavoriteInterfaces.Favorite[]>;
}
export class FavoriteApi extends basem.ClientApiBase implements IFavoriteApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Favorite-api');
}
/**
* @param {boolean} faultInMissingHost
*/
public async getFavoriteProviders(
faultInMissingHost?: boolean
): Promise<FavoriteInterfaces.FavoriteProvider[]> {
return new Promise<FavoriteInterfaces.FavoriteProvider[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
faultInMissingHost: faultInMissingHost,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"0c04d86b-e315-464f-8125-4d6222d306c2",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.FavoriteProvider[]>;
res = await this.rest.get<FavoriteInterfaces.FavoriteProvider[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {FavoriteInterfaces.FavoriteCreateParameters} favorite
*/
public async createFavorite(
favorite: FavoriteInterfaces.FavoriteCreateParameters
): Promise<FavoriteInterfaces.Favorite> {
return new Promise<FavoriteInterfaces.Favorite>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite>;
res = await this.rest.create<FavoriteInterfaces.Favorite>(url, favorite, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {FavoriteInterfaces.FavoriteCreateParameters} favorite
* @param {string} ownerScopeType
* @param {string} ownerScopeId
*/
public async createFavoriteOfOwner(
favorite: FavoriteInterfaces.FavoriteCreateParameters,
ownerScopeType: string,
ownerScopeId: string
): Promise<FavoriteInterfaces.Favorite> {
return new Promise<FavoriteInterfaces.Favorite>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
ownerScopeType: ownerScopeType,
ownerScopeId: ownerScopeId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite>;
res = await this.rest.create<FavoriteInterfaces.Favorite>(url, favorite, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} favoriteId
* @param {string} artifactType
* @param {string} artifactScopeType
* @param {string} artifactScopeId
*/
public async deleteFavoriteById(
favoriteId: string,
artifactType: string,
artifactScopeType: string,
artifactScopeId?: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
favoriteId: favoriteId
};
let queryValues: any = {
artifactType: artifactType,
artifactScopeType: artifactScopeType,
artifactScopeId: artifactScopeId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} favoriteId
* @param {string} ownerScopeType
* @param {string} ownerScopeId
* @param {string} artifactType
* @param {string} artifactScopeType
* @param {string} artifactScopeId
*/
public async deleteFavoriteOfOwnerById(
favoriteId: string,
ownerScopeType: string,
ownerScopeId: string,
artifactType: string,
artifactScopeType: string,
artifactScopeId?: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
favoriteId: favoriteId
};
let queryValues: any = {
ownerScopeType: ownerScopeType,
ownerScopeId: ownerScopeId,
artifactType: artifactType,
artifactScopeType: artifactScopeType,
artifactScopeId: artifactScopeId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} artifactType
* @param {string} artifactId
* @param {string} artifactScopeType
* @param {string} artifactScopeId
*/
public async getFavoriteByArtifact(
artifactType: string,
artifactId: string,
artifactScopeType: string,
artifactScopeId?: string
): Promise<FavoriteInterfaces.Favorite> {
return new Promise<FavoriteInterfaces.Favorite>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
artifactType: artifactType,
artifactId: artifactId,
artifactScopeType: artifactScopeType,
artifactScopeId: artifactScopeId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite>;
res = await this.rest.get<FavoriteInterfaces.Favorite>(url, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} favoriteId
* @param {string} artifactScopeType
* @param {string} artifactType
* @param {string} artifactScopeId
* @param {boolean} includeExtendedDetails
*/
public async getFavoriteById(
favoriteId: string,
artifactScopeType: string,
artifactType: string,
artifactScopeId?: string,
includeExtendedDetails?: boolean
): Promise<FavoriteInterfaces.Favorite> {
return new Promise<FavoriteInterfaces.Favorite>(async (resolve, reject) => {
let routeValues: any = {
favoriteId: favoriteId
};
let queryValues: any = {
artifactScopeType: artifactScopeType,
artifactType: artifactType,
artifactScopeId: artifactScopeId,
includeExtendedDetails: includeExtendedDetails,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite>;
res = await this.rest.get<FavoriteInterfaces.Favorite>(url, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} favoriteId
* @param {string} ownerScopeType
* @param {string} ownerScopeId
* @param {string} artifactScopeType
* @param {string} artifactType
* @param {string} artifactScopeId
* @param {boolean} includeExtendedDetails
*/
public async getFavoriteOfOwnerById(
favoriteId: string,
ownerScopeType: string,
ownerScopeId: string,
artifactScopeType: string,
artifactType: string,
artifactScopeId?: string,
includeExtendedDetails?: boolean
): Promise<FavoriteInterfaces.Favorite> {
return new Promise<FavoriteInterfaces.Favorite>(async (resolve, reject) => {
let routeValues: any = {
favoriteId: favoriteId
};
let queryValues: any = {
ownerScopeType: ownerScopeType,
ownerScopeId: ownerScopeId,
artifactScopeType: artifactScopeType,
artifactType: artifactType,
artifactScopeId: artifactScopeId,
includeExtendedDetails: includeExtendedDetails,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite>;
res = await this.rest.get<FavoriteInterfaces.Favorite>(url, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} artifactType
* @param {string} artifactScopeType
* @param {string} artifactScopeId
* @param {boolean} includeExtendedDetails
*/
public async getFavorites(
artifactType?: string,
artifactScopeType?: string,
artifactScopeId?: string,
includeExtendedDetails?: boolean
): Promise<FavoriteInterfaces.Favorite[]> {
return new Promise<FavoriteInterfaces.Favorite[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
artifactType: artifactType,
artifactScopeType: artifactScopeType,
artifactScopeId: artifactScopeId,
includeExtendedDetails: includeExtendedDetails,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite[]>;
res = await this.rest.get<FavoriteInterfaces.Favorite[]>(url, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} ownerScopeType
* @param {string} ownerScopeId
* @param {string} artifactType
* @param {string} artifactScopeType
* @param {string} artifactScopeId
* @param {boolean} includeExtendedDetails
*/
public async getFavoritesOfOwner(
ownerScopeType: string,
ownerScopeId: string,
artifactType?: string,
artifactScopeType?: string,
artifactScopeId?: string,
includeExtendedDetails?: boolean
): Promise<FavoriteInterfaces.Favorite[]> {
return new Promise<FavoriteInterfaces.Favorite[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
ownerScopeType: ownerScopeType,
ownerScopeId: ownerScopeId,
artifactType: artifactType,
artifactScopeType: artifactScopeType,
artifactScopeId: artifactScopeId,
includeExtendedDetails: includeExtendedDetails,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Favorite",
"6f13e9a6-aae2-4b89-b683-131ca9564cec",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FavoriteInterfaces.Favorite[]>;
res = await this.rest.get<FavoriteInterfaces.Favorite[]>(url, options);
let ret = this.formatResponse(res.result,
FavoriteInterfaces.TypeInfo.Favorite,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -0,0 +1,267 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FeatureAvailabilityInterfaces = require("./interfaces/FeatureAvailabilityInterfaces");
export interface IFeatureAvailabilityApi extends basem.ClientApiBase {
getAllFeatureFlags(userEmail?: string): Promise<FeatureAvailabilityInterfaces.FeatureFlag[]>;
getFeatureFlagByName(name: string): Promise<FeatureAvailabilityInterfaces.FeatureFlag>;
getFeatureFlagByNameAndUserEmail(name: string, userEmail: string): Promise<FeatureAvailabilityInterfaces.FeatureFlag>;
getFeatureFlagByNameAndUserId(name: string, userId: string): Promise<FeatureAvailabilityInterfaces.FeatureFlag>;
updateFeatureFlag(state: FeatureAvailabilityInterfaces.FeatureFlagPatch, name: string, userEmail?: string, checkFeatureExists?: boolean, setAtApplicationLevelAlso?: boolean): Promise<FeatureAvailabilityInterfaces.FeatureFlag>;
}
export class FeatureAvailabilityApi extends basem.ClientApiBase implements IFeatureAvailabilityApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-FeatureAvailability-api');
}
/**
* Retrieve a listing of all feature flags and their current states for a user
*
* @param {string} userEmail - The email of the user to check
*/
public async getAllFeatureFlags(
userEmail?: string
): Promise<FeatureAvailabilityInterfaces.FeatureFlag[]> {
return new Promise<FeatureAvailabilityInterfaces.FeatureFlag[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
userEmail: userEmail,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureAvailability",
"3e2b80f8-9e6f-441e-8393-005610692d9c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureAvailabilityInterfaces.FeatureFlag[]>;
res = await this.rest.get<FeatureAvailabilityInterfaces.FeatureFlag[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single feature flag and its current states
*
* @param {string} name - The name of the feature to retrieve
*/
public async getFeatureFlagByName(
name: string
): Promise<FeatureAvailabilityInterfaces.FeatureFlag> {
return new Promise<FeatureAvailabilityInterfaces.FeatureFlag>(async (resolve, reject) => {
let routeValues: any = {
name: name
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureAvailability",
"3e2b80f8-9e6f-441e-8393-005610692d9c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureAvailabilityInterfaces.FeatureFlag>;
res = await this.rest.get<FeatureAvailabilityInterfaces.FeatureFlag>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single feature flag and its current states for a user
*
* @param {string} name - The name of the feature to retrieve
* @param {string} userEmail - The email of the user to check
*/
public async getFeatureFlagByNameAndUserEmail(
name: string,
userEmail: string
): Promise<FeatureAvailabilityInterfaces.FeatureFlag> {
return new Promise<FeatureAvailabilityInterfaces.FeatureFlag>(async (resolve, reject) => {
let routeValues: any = {
name: name
};
let queryValues: any = {
userEmail: userEmail,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureAvailability",
"3e2b80f8-9e6f-441e-8393-005610692d9c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureAvailabilityInterfaces.FeatureFlag>;
res = await this.rest.get<FeatureAvailabilityInterfaces.FeatureFlag>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Retrieve information on a single feature flag and its current states for a user
*
* @param {string} name - The name of the feature to retrieve
* @param {string} userId - The id of the user to check
*/
public async getFeatureFlagByNameAndUserId(
name: string,
userId: string
): Promise<FeatureAvailabilityInterfaces.FeatureFlag> {
return new Promise<FeatureAvailabilityInterfaces.FeatureFlag>(async (resolve, reject) => {
let routeValues: any = {
name: name
};
let queryValues: any = {
userId: userId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureAvailability",
"3e2b80f8-9e6f-441e-8393-005610692d9c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureAvailabilityInterfaces.FeatureFlag>;
res = await this.rest.get<FeatureAvailabilityInterfaces.FeatureFlag>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Change the state of an individual feature flag for a name
*
* @param {FeatureAvailabilityInterfaces.FeatureFlagPatch} state - State that should be set
* @param {string} name - The name of the feature to change
* @param {string} userEmail
* @param {boolean} checkFeatureExists - Checks if the feature exists before setting the state
* @param {boolean} setAtApplicationLevelAlso
*/
public async updateFeatureFlag(
state: FeatureAvailabilityInterfaces.FeatureFlagPatch,
name: string,
userEmail?: string,
checkFeatureExists?: boolean,
setAtApplicationLevelAlso?: boolean
): Promise<FeatureAvailabilityInterfaces.FeatureFlag> {
return new Promise<FeatureAvailabilityInterfaces.FeatureFlag>(async (resolve, reject) => {
let routeValues: any = {
name: name
};
let queryValues: any = {
userEmail: userEmail,
checkFeatureExists: checkFeatureExists,
setAtApplicationLevelAlso: setAtApplicationLevelAlso,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureAvailability",
"3e2b80f8-9e6f-441e-8393-005610692d9c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureAvailabilityInterfaces.FeatureFlag>;
res = await this.rest.update<FeatureAvailabilityInterfaces.FeatureFlag>(url, state, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -1,317 +1,459 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import Q = require('q');
import restm = require('./RestClient');
import httpm = require('./HttpClient');
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FeatureManagementInterfaces = require("./interfaces/FeatureManagementInterfaces");
export interface IFeatureManagementApi extends basem.ClientApiBase {
getFeature(featureId: string): Promise<FeatureManagementInterfaces.ContributedFeature>;
getFeatures(): Promise<FeatureManagementInterfaces.ContributedFeature[]>;
getFeatureState(featureId: string, userScope: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
setFeatureState(feature: FeatureManagementInterfaces.ContributedFeatureState, featureId: string, userScope: string, reason?: string, reasonCode?: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
getFeatureStateForScope(featureId: string, userScope: string, scopeName: string, scopeValue: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
setFeatureStateForScope(feature: FeatureManagementInterfaces.ContributedFeatureState, featureId: string, userScope: string, scopeName: string, scopeValue: string, reason?: string, reasonCode?: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
}
export class FeatureManagementApi extends basem.ClientApiBase implements IFeatureManagementApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-FeatureManagement-api');
}
/**
* Get a specific feature by its id
*
* @param {string} featureId - The contribution id of the feature
*/
public getFeature(
featureId: string
): Promise<FeatureManagementInterfaces.ContributedFeature> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeature>();
let onResult = (err: any, statusCode: number, Feature: FeatureManagementInterfaces.ContributedFeature) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Feature);
}
};
let routeValues: any = {
featureId: featureId
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseIsCollection: false };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
*/
public getFeatures(
): Promise<FeatureManagementInterfaces.ContributedFeature[]> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeature[]>();
let onResult = (err: any, statusCode: number, Features: FeatureManagementInterfaces.ContributedFeature[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Features);
}
};
let routeValues: any = {
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseIsCollection: true };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* Get the state of the specified feature for the given user/all-users scope
*
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
*/
public getFeatureState(
featureId: string,
userScope: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeatureState>();
let onResult = (err: any, statusCode: number, FeatureState: FeatureManagementInterfaces.ContributedFeatureState) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(FeatureState);
}
};
let routeValues: any = {
featureId: featureId,
userScope: userScope
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseIsCollection: false };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* Set the state of a feature
*
* @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value.
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users.
* @param {string} reason - Reason for changing the state
* @param {string} reasonCode - Short reason code
*/
public setFeatureState(
feature: FeatureManagementInterfaces.ContributedFeatureState,
featureId: string,
userScope: string,
reason?: string,
reasonCode?: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeatureState>();
let onResult = (err: any, statusCode: number, FeatureState: FeatureManagementInterfaces.ContributedFeatureState) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(FeatureState);
}
};
let routeValues: any = {
featureId: featureId,
userScope: userScope
};
let queryValues: any = {
reason: reason,
reasonCode: reasonCode,
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { requestTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseIsCollection: false };
this.restClient.update(url, apiVersion, feature, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* Get the state of the specified feature for the given named scope
*
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
*/
public getFeatureStateForScope(
featureId: string,
userScope: string,
scopeName: string,
scopeValue: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeatureState>();
let onResult = (err: any, statusCode: number, FeatureState: FeatureManagementInterfaces.ContributedFeatureState) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(FeatureState);
}
};
let routeValues: any = {
featureId: featureId,
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseIsCollection: false };
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* Set the state of a feature at a specific scope
*
* @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value.
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
* @param {string} reason - Reason for changing the state
* @param {string} reasonCode - Short reason code
*/
public setFeatureStateForScope(
feature: FeatureManagementInterfaces.ContributedFeatureState,
featureId: string,
userScope: string,
scopeName: string,
scopeValue: string,
reason?: string,
reasonCode?: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
let deferred = Q.defer<FeatureManagementInterfaces.ContributedFeatureState>();
let onResult = (err: any, statusCode: number, FeatureState: FeatureManagementInterfaces.ContributedFeatureState) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(FeatureState);
}
};
let routeValues: any = {
featureId: featureId,
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
let queryValues: any = {
reason: reason,
reasonCode: reasonCode,
};
this.vsoClient.getVersioningData("3.0-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { requestTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseTypeMetadata: FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, responseIsCollection: false };
this.restClient.update(url, apiVersion, feature, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
}
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FeatureManagementInterfaces = require("./interfaces/FeatureManagementInterfaces");
export interface IFeatureManagementApi extends basem.ClientApiBase {
getFeature(featureId: string): Promise<FeatureManagementInterfaces.ContributedFeature>;
getFeatures(targetContributionId?: string): Promise<FeatureManagementInterfaces.ContributedFeature[]>;
getFeatureState(featureId: string, userScope: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
setFeatureState(feature: FeatureManagementInterfaces.ContributedFeatureState, featureId: string, userScope: string, reason?: string, reasonCode?: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
getFeatureStateForScope(featureId: string, userScope: string, scopeName: string, scopeValue: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
setFeatureStateForScope(feature: FeatureManagementInterfaces.ContributedFeatureState, featureId: string, userScope: string, scopeName: string, scopeValue: string, reason?: string, reasonCode?: string): Promise<FeatureManagementInterfaces.ContributedFeatureState>;
queryFeatureStates(query: FeatureManagementInterfaces.ContributedFeatureStateQuery): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
queryFeatureStatesForDefaultScope(query: FeatureManagementInterfaces.ContributedFeatureStateQuery, userScope: string): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
queryFeatureStatesForNamedScope(query: FeatureManagementInterfaces.ContributedFeatureStateQuery, userScope: string, scopeName: string, scopeValue: string): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
}
export class FeatureManagementApi extends basem.ClientApiBase implements IFeatureManagementApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-FeatureManagement-api');
}
/**
* Get a specific feature by its id
*
* @param {string} featureId - The contribution id of the feature
*/
public async getFeature(
featureId: string
): Promise<FeatureManagementInterfaces.ContributedFeature> {
return new Promise<FeatureManagementInterfaces.ContributedFeature>(async (resolve, reject) => {
let routeValues: any = {
featureId: featureId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"c4209f25-7a27-41dd-9f04-06080c7b6afd",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeature>;
res = await this.rest.get<FeatureManagementInterfaces.ContributedFeature>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get a list of all defined features
*
* @param {string} targetContributionId - Optional target contribution. If null/empty, return all features. If specified include the features that target the specified contribution.
*/
public async getFeatures(
targetContributionId?: string
): Promise<FeatureManagementInterfaces.ContributedFeature[]> {
return new Promise<FeatureManagementInterfaces.ContributedFeature[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
targetContributionId: targetContributionId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"c4209f25-7a27-41dd-9f04-06080c7b6afd",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeature[]>;
res = await this.rest.get<FeatureManagementInterfaces.ContributedFeature[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get the state of the specified feature for the given user/all-users scope
*
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
*/
public async getFeatureState(
featureId: string,
userScope: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureState>(async (resolve, reject) => {
let routeValues: any = {
featureId: featureId,
userScope: userScope
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"98911314-3f9b-4eaf-80e8-83900d8e85d9",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureState>;
res = await this.rest.get<FeatureManagementInterfaces.ContributedFeatureState>(url, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureState,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Set the state of a feature
*
* @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value.
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users.
* @param {string} reason - Reason for changing the state
* @param {string} reasonCode - Short reason code
*/
public async setFeatureState(
feature: FeatureManagementInterfaces.ContributedFeatureState,
featureId: string,
userScope: string,
reason?: string,
reasonCode?: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureState>(async (resolve, reject) => {
let routeValues: any = {
featureId: featureId,
userScope: userScope
};
let queryValues: any = {
reason: reason,
reasonCode: reasonCode,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"98911314-3f9b-4eaf-80e8-83900d8e85d9",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureState>;
res = await this.rest.update<FeatureManagementInterfaces.ContributedFeatureState>(url, feature, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureState,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get the state of the specified feature for the given named scope
*
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
*/
public async getFeatureStateForScope(
featureId: string,
userScope: string,
scopeName: string,
scopeValue: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureState>(async (resolve, reject) => {
let routeValues: any = {
featureId: featureId,
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"dd291e43-aa9f-4cee-8465-a93c78e414a4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureState>;
res = await this.rest.get<FeatureManagementInterfaces.ContributedFeatureState>(url, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureState,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Set the state of a feature at a specific scope
*
* @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value.
* @param {string} featureId - Contribution id of the feature
* @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
* @param {string} reason - Reason for changing the state
* @param {string} reasonCode - Short reason code
*/
public async setFeatureStateForScope(
feature: FeatureManagementInterfaces.ContributedFeatureState,
featureId: string,
userScope: string,
scopeName: string,
scopeValue: string,
reason?: string,
reasonCode?: string
): Promise<FeatureManagementInterfaces.ContributedFeatureState> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureState>(async (resolve, reject) => {
let routeValues: any = {
featureId: featureId,
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
let queryValues: any = {
reason: reason,
reasonCode: reasonCode,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"dd291e43-aa9f-4cee-8465-a93c78e414a4",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureState>;
res = await this.rest.update<FeatureManagementInterfaces.ContributedFeatureState>(url, feature, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureState,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get the effective state for a list of feature ids
*
* @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Features to query along with current scope values
*/
public async queryFeatureStates(
query: FeatureManagementInterfaces.ContributedFeatureStateQuery
): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"2b4486ad-122b-400c-ae65-17b6672c1f9d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
res = await this.rest.create<FeatureManagementInterfaces.ContributedFeatureStateQuery>(url, query, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get the states of the specified features for the default scope
*
* @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Query describing the features to query.
* @param {string} userScope
*/
public async queryFeatureStatesForDefaultScope(
query: FeatureManagementInterfaces.ContributedFeatureStateQuery,
userScope: string
): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"3f810f28-03e2-4239-b0bc-788add3005e5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
res = await this.rest.create<FeatureManagementInterfaces.ContributedFeatureStateQuery>(url, query, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get the states of the specified features for the specific named scope
*
* @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Query describing the features to query.
* @param {string} userScope
* @param {string} scopeName
* @param {string} scopeValue
*/
public async queryFeatureStatesForNamedScope(
query: FeatureManagementInterfaces.ContributedFeatureStateQuery,
userScope: string,
scopeName: string,
scopeValue: string
): Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery> {
return new Promise<FeatureManagementInterfaces.ContributedFeatureStateQuery>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"FeatureManagement",
"f29e997b-c2da-4d15-8380-765788a1a74c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<FeatureManagementInterfaces.ContributedFeatureStateQuery>;
res = await this.rest.create<FeatureManagementInterfaces.ContributedFeatureStateQuery>(url, query, options);
let ret = this.formatResponse(res.result,
FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -11,14 +11,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import stream = require("stream");
import Q = require('q');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FileContainerApiBase = require("./FileContainerApiBase");
import FileContainerInterfaces = require("./interfaces/FileContainerInterfaces");
import vsom = require('./VsoClient');
export interface IFileContainerApi extends FileContainerApiBase.IFileContainerApiBase {
createItem(contentStream: NodeJS.ReadableStream, uncompressedLength: number, containerId: number, itemPath: string, scope: string, options: any): Q.Promise<FileContainerInterfaces.FileContainerItem>;
createItem(contentStream: NodeJS.ReadableStream, uncompressedLength: number, containerId: number, itemPath: string, scope: string, options: any): Promise<FileContainerInterfaces.FileContainerItem>;
}
export class FileContainerApi extends FileContainerApiBase.FileContainerApiBase implements IFileContainerApi {
@ -26,18 +25,16 @@ export class FileContainerApi extends FileContainerApiBase.FileContainerApiBase
super(baseUrl, handlers);
}
public createItem(contentStream: NodeJS.ReadableStream, uncompressedLength: number, containerId: number, itemPath: string, scope: string, options: any): Q.Promise<FileContainerInterfaces.FileContainerItem> {
let deferred = Q.defer<FileContainerInterfaces.FileContainerItem>();
let chunkStream = new ChunkStream(this, uncompressedLength, containerId, itemPath, scope, options);
chunkStream.on('finish', () => {
deferred.resolve(chunkStream.getItem());
public createItem(contentStream: NodeJS.ReadableStream, uncompressedLength: number, containerId: number, itemPath: string, scope: string, options: any): Promise<FileContainerInterfaces.FileContainerItem> {
return new Promise<FileContainerInterfaces.FileContainerItem>((resolve, reject) => {
let chunkStream = new ChunkStream(this, uncompressedLength, containerId, itemPath, scope, options);
chunkStream.on('finish', () => {
resolve(chunkStream.getItem());
});
contentStream.pipe(chunkStream);
});
contentStream.pipe(chunkStream);
return <Q.Promise<FileContainerInterfaces.FileContainerItem>>deferred.promise;
}
public _createItem(
@ -62,16 +59,15 @@ export class FileContainerApi extends FileContainerApiBase.FileContainerApiBase
customHeaders["Content-Type"] = "application/octet-stream";
this.vsoClient.getVersioningData("2.2-preview.3", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
var url: string = versioningData.requestUrl;
var apiVersion: string = versioningData.apiVersion;
var serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: false };
this.restClient.uploadStream('PUT', url, apiVersion, contentStream, customHeaders, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
.then((versioningData: vsom.ClientVersioningData) => {
var url: string = versioningData.requestUrl;
var apiVersion: string = versioningData.apiVersion;
var serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: false };
this.restCallbackClient.uploadStream('PUT', url, apiVersion, contentStream, customHeaders, onResult, serializationData);
}, (error) => {
onResult(error, error.statusCode, null);
});
}
}

Просмотреть файл

@ -11,11 +11,11 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import Q = require('q');
import restm = require('./RestClient');
import httpm = require('./HttpClient');
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import FileContainerInterfaces = require("./interfaces/FileContainerInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
@ -25,7 +25,6 @@ export interface IFileContainerApiBase extends basem.ClientApiBase {
deleteItem(containerId: number, itemPath: string, scope?: string): Promise<void>;
getContainers(scope?: string, artifactUris?: string): Promise<FileContainerInterfaces.FileContainer[]>;
getItems(containerId: number, scope?: string, itemPath?: string, metadata?: boolean, format?: string, downloadFileName?: string, includeDownloadTickets?: boolean, isShallow?: boolean): Promise<FileContainerInterfaces.FileContainerItem[]>;
browseItems(container: number, itemPath?: string): Promise<FileContainerInterfaces.FileContainerItem[]>;
}
export class FileContainerApiBase extends basem.ClientApiBase implements IFileContainerApiBase {
@ -40,45 +39,43 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
* @param {number} containerId
* @param {string} scope - A guid representing the scope of the container. This is often the project id.
*/
public createItems(
public async createItems(
items: VSSInterfaces.VssJsonCollectionWrapperV<FileContainerInterfaces.FileContainerItem[]>,
containerId: number,
scope?: string
): Promise<FileContainerInterfaces.FileContainerItem[]> {
let deferred = Q.defer<FileContainerInterfaces.FileContainerItem[]>();
let onResult = (err: any, statusCode: number, Container: FileContainerInterfaces.FileContainerItem[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Container);
}
};
return new Promise<FileContainerInterfaces.FileContainerItem[]>(async (resolve, reject) => {
let routeValues: any = {
containerId: containerId
};
let routeValues: any = {
containerId: containerId
};
let queryValues: any = {
scope: scope,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.4",
"Container",
"e4f5c81e-e250-447b-9fef-bd48471bea5e",
routeValues,
queryValues);
let queryValues: any = {
scope: scope,
};
this.vsoClient.getVersioningData("3.0-preview.3", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: true };
let url: string = verData.requestUrl;
let apiVersion: string = verData.apiVersion;
this.restClient.create(url, apiVersion, items, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
let res: restm.IRestClientResponse = await this.restClient.create(url, apiVersion, items, null);
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: true };
let deserializedResult = serm.ContractSerializer.serialize(res.result, serializationData, true);
resolve(deserializedResult);
}
catch (err) {
reject(err);
}
});
}
/**
@ -88,46 +85,44 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
* @param {string} itemPath - Path to delete.
* @param {string} scope - A guid representing the scope of the container. This is often the project id.
*/
public deleteItem(
public async deleteItem(
containerId: number,
itemPath: string,
scope?: string
): Promise<void> {
let deferred = Q.defer<void>();
let onResult = (err: any, statusCode: number) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(null);
}
};
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
containerId: containerId
};
let routeValues: any = {
containerId: containerId
};
let queryValues: any = {
itemPath: itemPath,
scope: scope,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.4",
"Container",
"e4f5c81e-e250-447b-9fef-bd48471bea5e",
routeValues,
queryValues);
let queryValues: any = {
itemPath: itemPath,
scope: scope,
};
this.vsoClient.getVersioningData("3.0-preview.3", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseIsCollection: false };
let url: string = verData.requestUrl;
let apiVersion: string = verData.apiVersion;
this.restClient.delete(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode);
});
return deferred.promise;
let res: restm.IRestClientResponse = await this.restClient.del(url, apiVersion, null);
let serializationData = { responseIsCollection: false };
let deserializedResult = serm.ContractSerializer.serialize(res.result, serializationData, true);
resolve(null);
}
catch (err) {
reject(err);
}
});
}
/**
@ -136,44 +131,42 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
* @param {string} scope - A guid representing the scope of the container. This is often the project id.
* @param {string} artifactUris
*/
public getContainers(
public async getContainers(
scope?: string,
artifactUris?: string
): Promise<FileContainerInterfaces.FileContainer[]> {
let deferred = Q.defer<FileContainerInterfaces.FileContainer[]>();
let onResult = (err: any, statusCode: number, Containers: FileContainerInterfaces.FileContainer[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Containers);
}
};
return new Promise<FileContainerInterfaces.FileContainer[]>(async (resolve, reject) => {
let routeValues: any = {
};
let routeValues: any = {
};
let queryValues: any = {
scope: scope,
artifactUris: artifactUris,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.4",
"Container",
"e4f5c81e-e250-447b-9fef-bd48471bea5e",
routeValues,
queryValues);
let queryValues: any = {
scope: scope,
artifactUris: artifactUris,
};
this.vsoClient.getVersioningData("3.0-preview.3", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainer, responseIsCollection: true };
let url: string = verData.requestUrl;
let apiVersion: string = verData.apiVersion;
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
let res: restm.IRestClientResponse = await this.restClient.get(url, apiVersion, null);
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainer, responseIsCollection: true };
let deserializedResult = serm.ContractSerializer.serialize(res.result, serializationData, true);
resolve(deserializedResult);
}
catch (err) {
reject(err);
}
});
}
/**
@ -186,7 +179,7 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
* @param {boolean} includeDownloadTickets
* @param {boolean} isShallow
*/
public getItems(
public async getItems(
containerId: number,
scope?: string,
itemPath?: string,
@ -196,92 +189,44 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
includeDownloadTickets?: boolean,
isShallow?: boolean
): Promise<FileContainerInterfaces.FileContainerItem[]> {
let deferred = Q.defer<FileContainerInterfaces.FileContainerItem[]>();
let onResult = (err: any, statusCode: number, Containers: FileContainerInterfaces.FileContainerItem[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Containers);
}
};
return new Promise<FileContainerInterfaces.FileContainerItem[]>(async (resolve, reject) => {
let routeValues: any = {
containerId: containerId
};
let routeValues: any = {
containerId: containerId
};
let queryValues: any = {
scope: scope,
itemPath: itemPath,
metadata: metadata,
'$format': format,
downloadFileName: downloadFileName,
includeDownloadTickets: includeDownloadTickets,
isShallow: isShallow,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.4",
"Container",
"e4f5c81e-e250-447b-9fef-bd48471bea5e",
routeValues,
queryValues);
let queryValues: any = {
scope: scope,
itemPath: itemPath,
metadata: metadata,
'$format': format,
downloadFileName: downloadFileName,
includeDownloadTickets: includeDownloadTickets,
isShallow: isShallow,
};
this.vsoClient.getVersioningData("3.0-preview.3", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: true };
let url: string = verData.requestUrl;
let apiVersion: string = verData.apiVersion;
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
/**
* Allow browsing of file ,the contentDisposition is inline and Content-Type is determined by FileExtension
*
* @param {number} container
* @param {string} itemPath - The path to the item of interest
*/
public browseItems(
container: number,
itemPath?: string
): Promise<FileContainerInterfaces.FileContainerItem[]> {
let deferred = Q.defer<FileContainerInterfaces.FileContainerItem[]>();
let onResult = (err: any, statusCode: number, Containers: FileContainerInterfaces.FileContainerItem[]) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(Containers);
}
};
let routeValues: any = {
container: container
};
let queryValues: any = {
itemPath: itemPath,
};
this.vsoClient.getVersioningData("3.0-preview.3", "Container", "e71a64ac-b2b5-4230-a4c0-dad657cf97e2", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
let url: string = versioningData.requestUrl;
let apiVersion: string = versioningData.apiVersion;
let res: restm.IRestClientResponse = await this.restClient.get(url, apiVersion, null);
let serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: true };
let deserializedResult = serm.ContractSerializer.serialize(res.result, serializationData, true);
resolve(deserializedResult);
this.restClient.getJson(url, apiVersion, null, serializationData, onResult);
})
.fail((error) => {
onResult(error, error.statusCode, null);
});
return deferred.promise;
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,193 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import Q = require('q');
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import GalleryInterfaces = require("./interfaces/GalleryInterfaces");
export interface IGalleryCompatHttpClientBase extends basem.ClientApiBase {
createExtensionJson(extensionPackage: GalleryInterfaces.ExtensionPackage): Promise<GalleryInterfaces.PublishedExtension>;
updateExtensionByIdJson(extensionPackage: GalleryInterfaces.ExtensionPackage, extensionId: string): Promise<GalleryInterfaces.PublishedExtension>;
createExtensionWithPublisherJson(extensionPackage: GalleryInterfaces.ExtensionPackage, publisherName: string): Promise<GalleryInterfaces.PublishedExtension>;
updateExtensionJson(extensionPackage: GalleryInterfaces.ExtensionPackage, publisherName: string, extensionName: string): Promise<GalleryInterfaces.PublishedExtension>;
}
export class GalleryCompatHttpClientBase extends basem.ClientApiBase implements IGalleryCompatHttpClientBase {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[], userAgent?: string) {
super(baseUrl, handlers, userAgent);
}
/**
* @param {GalleryInterfaces.ExtensionPackage} extensionPackage
*/
public createExtensionJson(
extensionPackage: GalleryInterfaces.ExtensionPackage
): Promise<GalleryInterfaces.PublishedExtension> {
return new Promise<GalleryInterfaces.PublishedExtension>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.1",
"gallery",
"a41192c8-9525-4b58-bc86-179fa549d80d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GalleryInterfaces.PublishedExtension>;
res = await this.rest.create<GalleryInterfaces.PublishedExtension>(url, extensionPackage, options);
let ret = this.formatResponse(res.result,
GalleryInterfaces.TypeInfo.PublishedExtension,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GalleryInterfaces.ExtensionPackage} extensionPackage
* @param {string} extensionId
*/
public updateExtensionByIdJson(
extensionPackage: GalleryInterfaces.ExtensionPackage,
extensionId: string
): Promise<GalleryInterfaces.PublishedExtension> {
return new Promise<GalleryInterfaces.PublishedExtension>(async (resolve, reject) => {
let routeValues: any = {
extensionId: extensionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.1",
"gallery",
"a41192c8-9525-4b58-bc86-179fa549d80d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GalleryInterfaces.PublishedExtension>;
res = await this.rest.replace<GalleryInterfaces.PublishedExtension>(url, extensionPackage, options);
let ret = this.formatResponse(res.result,
GalleryInterfaces.TypeInfo.PublishedExtension,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GalleryInterfaces.ExtensionPackage} extensionPackage
* @param {string} publisherName
*/
public createExtensionWithPublisherJson(
extensionPackage: GalleryInterfaces.ExtensionPackage,
publisherName: string
): Promise<GalleryInterfaces.PublishedExtension> {
return new Promise<GalleryInterfaces.PublishedExtension>(async (resolve, reject) => {
let routeValues: any = {
publisherName: publisherName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.1",
"gallery",
"e11ea35a-16fe-4b80-ab11-c4cab88a0966",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GalleryInterfaces.PublishedExtension>;
res = await this.rest.create<GalleryInterfaces.PublishedExtension>(url, extensionPackage, options);
let ret = this.formatResponse(res.result,
GalleryInterfaces.TypeInfo.PublishedExtension,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GalleryInterfaces.ExtensionPackage} extensionPackage
* @param {string} publisherName
* @param {string} extensionName
*/
public updateExtensionJson(
extensionPackage: GalleryInterfaces.ExtensionPackage,
publisherName: string,
extensionName: string
): Promise<GalleryInterfaces.PublishedExtension> {
return new Promise<GalleryInterfaces.PublishedExtension>(async (resolve, reject) => {
let routeValues: any = {
publisherName: publisherName,
extensionName: extensionName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.1-preview.1",
"gallery",
"e11ea35a-16fe-4b80-ab11-c4cab88a0966",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GalleryInterfaces.PublishedExtension>;
res = await this.rest.replace<GalleryInterfaces.PublishedExtension>(url, extensionPackage, options);
let ret = this.formatResponse(res.result,
GalleryInterfaces.TypeInfo.PublishedExtension,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

595
api/GovernanceApi.ts Normal file
Просмотреть файл

@ -0,0 +1,595 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import GovernanceInterfaces = require("./interfaces/GovernanceInterfaces");
export interface IGovernanceApi extends basem.ClientApiBase {
createPolicy(policy: GovernanceInterfaces.Policy, includeUrls?: boolean): Promise<GovernanceInterfaces.Policy>;
deletePolicy(policyId: string): Promise<void>;
getPolicies(includeUrls?: boolean): Promise<GovernanceInterfaces.Policy[]>;
getPolicy(policyId: string, includeUrls?: boolean): Promise<GovernanceInterfaces.Policy>;
updatePolicy(policy: GovernanceInterfaces.Policy, policyId: string, includeUrls?: boolean): Promise<GovernanceInterfaces.Policy>;
addPolicyToProduct(policyId: string, productId: string): Promise<string>;
removePolicyFromProduct(productId: string, policyId: string): Promise<void>;
createProduct(product: GovernanceInterfaces.Product, includeUrls?: boolean): Promise<GovernanceInterfaces.Product>;
deleteProduct(productId: string): Promise<void>;
getProduct(productId: string, includeUrls?: boolean): Promise<GovernanceInterfaces.Product>;
getProducts(includeUrls?: boolean): Promise<GovernanceInterfaces.Product[]>;
updateProduct(product: GovernanceInterfaces.Product, productId: string, includeUrls?: boolean): Promise<GovernanceInterfaces.Product>;
createRegistrationRequests(registrationRequests: GovernanceInterfaces.RegistrationRequest[], productId: string): Promise<GovernanceInterfaces.Registration[]>;
}
export class GovernanceApi extends basem.ClientApiBase implements IGovernanceApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Governance-api');
}
/**
* @param {GovernanceInterfaces.Policy} policy
* @param {boolean} includeUrls
*/
public async createPolicy(
policy: GovernanceInterfaces.Policy,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Policy> {
return new Promise<GovernanceInterfaces.Policy>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"7d772072-15e9-48d6-98f0-4465462607f8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Policy>;
res = await this.rest.create<GovernanceInterfaces.Policy>(url, policy, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} policyId
*/
public async deletePolicy(
policyId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
policyId: policyId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"7d772072-15e9-48d6-98f0-4465462607f8",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {boolean} includeUrls
*/
public async getPolicies(
includeUrls?: boolean
): Promise<GovernanceInterfaces.Policy[]> {
return new Promise<GovernanceInterfaces.Policy[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"7d772072-15e9-48d6-98f0-4465462607f8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Policy[]>;
res = await this.rest.get<GovernanceInterfaces.Policy[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} policyId
* @param {boolean} includeUrls
*/
public async getPolicy(
policyId: string,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Policy> {
return new Promise<GovernanceInterfaces.Policy>(async (resolve, reject) => {
let routeValues: any = {
policyId: policyId
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"7d772072-15e9-48d6-98f0-4465462607f8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Policy>;
res = await this.rest.get<GovernanceInterfaces.Policy>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GovernanceInterfaces.Policy} policy
* @param {string} policyId
* @param {boolean} includeUrls
*/
public async updatePolicy(
policy: GovernanceInterfaces.Policy,
policyId: string,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Policy> {
return new Promise<GovernanceInterfaces.Policy>(async (resolve, reject) => {
let routeValues: any = {
policyId: policyId
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"7d772072-15e9-48d6-98f0-4465462607f8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Policy>;
res = await this.rest.update<GovernanceInterfaces.Policy>(url, policy, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} policyId
* @param {string} productId
*/
public async addPolicyToProduct(
policyId: string,
productId: string
): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
let routeValues: any = {
productId: productId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"85f9ab1b-f4e6-43f2-bb51-1dbff1e41786",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string>;
res = await this.rest.create<string>(url, policyId, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} productId
* @param {string} policyId
*/
public async removePolicyFromProduct(
productId: string,
policyId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
productId: productId,
policyId: policyId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"85f9ab1b-f4e6-43f2-bb51-1dbff1e41786",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GovernanceInterfaces.Product} product
* @param {boolean} includeUrls
*/
public async createProduct(
product: GovernanceInterfaces.Product,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Product> {
return new Promise<GovernanceInterfaces.Product>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"3d0ed9e4-20fd-45b9-b7e9-a991ab7d091e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Product>;
res = await this.rest.create<GovernanceInterfaces.Product>(url, product, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} productId
*/
public async deleteProduct(
productId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
productId: productId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"3d0ed9e4-20fd-45b9-b7e9-a991ab7d091e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} productId
* @param {boolean} includeUrls
*/
public async getProduct(
productId: string,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Product> {
return new Promise<GovernanceInterfaces.Product>(async (resolve, reject) => {
let routeValues: any = {
productId: productId
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"3d0ed9e4-20fd-45b9-b7e9-a991ab7d091e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Product>;
res = await this.rest.get<GovernanceInterfaces.Product>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {boolean} includeUrls
*/
public async getProducts(
includeUrls?: boolean
): Promise<GovernanceInterfaces.Product[]> {
return new Promise<GovernanceInterfaces.Product[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"3d0ed9e4-20fd-45b9-b7e9-a991ab7d091e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Product[]>;
res = await this.rest.get<GovernanceInterfaces.Product[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GovernanceInterfaces.Product} product
* @param {string} productId
* @param {boolean} includeUrls
*/
public async updateProduct(
product: GovernanceInterfaces.Product,
productId: string,
includeUrls?: boolean
): Promise<GovernanceInterfaces.Product> {
return new Promise<GovernanceInterfaces.Product>(async (resolve, reject) => {
let routeValues: any = {
productId: productId
};
let queryValues: any = {
includeUrls: includeUrls,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"3d0ed9e4-20fd-45b9-b7e9-a991ab7d091e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Product>;
res = await this.rest.update<GovernanceInterfaces.Product>(url, product, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GovernanceInterfaces.RegistrationRequest[]} registrationRequests
* @param {string} productId
*/
public async createRegistrationRequests(
registrationRequests: GovernanceInterfaces.RegistrationRequest[],
productId: string
): Promise<GovernanceInterfaces.Registration[]> {
return new Promise<GovernanceInterfaces.Registration[]>(async (resolve, reject) => {
let routeValues: any = {
productId: productId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Governance",
"4968fe48-e1a4-4e8c-b251-65ab65fd1d36",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GovernanceInterfaces.Registration[]>;
res = await this.rest.create<GovernanceInterfaces.Registration[]>(url, registrationRequests, options);
let ret = this.formatResponse(res.result,
GovernanceInterfaces.TypeInfo.Registration,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

903
api/GraphApi.ts Normal file
Просмотреть файл

@ -0,0 +1,903 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import GraphInterfaces = require("./interfaces/GraphInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IGraphApi extends basem.ClientApiBase {
getDescriptorById(id: string, isMasterId?: boolean): Promise<GraphInterfaces.SubjectDescriptor>;
createGroup(creationContext: GraphInterfaces.GraphGroupCreationContext, scopeDescriptor?: string, groupDescriptors?: GraphInterfaces.SubjectDescriptor[]): Promise<GraphInterfaces.GraphGroup>;
deleteGroup(groupDescriptor: string): Promise<void>;
getGroup(groupDescriptor: string): Promise<GraphInterfaces.GraphGroup>;
getGroups(scopeDescriptor?: string, subjectTypes?: string[]): Promise<GraphInterfaces.GraphGroup[]>;
updateGroup(customHeaders: any, groupDescriptor: string, patchDocument: VSSInterfaces.JsonPatchDocument): Promise<GraphInterfaces.GraphGroup>;
addMembership(subjectDescriptor: string, containerDescriptor: string): Promise<GraphInterfaces.GraphMembership>;
checkMembership(subjectDescriptor: string, containerDescriptor: string): Promise<void>;
getMembership(subjectDescriptor: string, containerDescriptor: string): Promise<GraphInterfaces.GraphMembership>;
removeMembership(subjectDescriptor: string, containerDescriptor: string): Promise<void>;
getMemberships(subjectDescriptor: string, direction?: string): Promise<GraphInterfaces.GraphMembership[]>;
createScope(creationContext: GraphInterfaces.GraphScopeCreationContext, scopeDescriptor?: string): Promise<GraphInterfaces.GraphScope>;
deleteScope(scopeDescriptor: string): Promise<void>;
getScope(scopeDescriptor: string): Promise<GraphInterfaces.GraphScope>;
updateScope(customHeaders: any, scopeDescriptor: string, patchDocument: VSSInterfaces.JsonPatchDocument): Promise<void>;
lookupSubjects(subjectLookup: GraphInterfaces.GraphSubjectLookup): Promise<GraphInterfaces.GraphSubject[]>;
createUser(creationContext: GraphInterfaces.GraphUserCreationContext, groupDescriptors?: GraphInterfaces.SubjectDescriptor[]): Promise<GraphInterfaces.GraphUser>;
deleteUser(userDescriptor: string): Promise<void>;
getUser(userDescriptor: string): Promise<GraphInterfaces.GraphUser>;
getUsers(subjectTypes?: string[]): Promise<GraphInterfaces.GraphUser[]>;
}
export class GraphApi extends basem.ClientApiBase implements IGraphApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Graph-api');
}
/**
* @param {string} id
* @param {boolean} isMasterId
*/
public async getDescriptorById(
id: string,
isMasterId?: boolean
): Promise<GraphInterfaces.SubjectDescriptor> {
return new Promise<GraphInterfaces.SubjectDescriptor>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
isMasterId: isMasterId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"048aee0a-7072-4cde-ab73-7af77b1e0b4e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.SubjectDescriptor>;
res = await this.rest.get<GraphInterfaces.SubjectDescriptor>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* The body of the request must be a derived type of GraphGroupCreationContext which contains a group reference. A group reference must either: 1. uniquely identify a group that exists in the graph of the instance's identity provider , such as Azure Active Directory (AAD) or Microsoft account (MSA), for a hosted VS Team Services account, or Active Directory (AD), for a TFS server. Use one of these supported creation contexts: - originId(e.g.the AAD object ID) [GraphGroupOriginIdCreationContext] - principalName(e.g.the AAD group principal name or the Microsoft account name) [GraphGroupPrincipalNameCreationContext] 2. Uniquely identify a group that exists in a hosted VS Team Services account and you want to restore that group. Use GraphGroupVstsCreationContext and fill only one of the following peroperties: - id (to reference a specific VS Team Services group in the restore case only) - descriptors (to reference a specific VS Team Services group in the restore case only) 3. Specify properties that should be used to create a new Team Foundation group. Use the GraphGroupVstsCreationContext - displayName [required] - description - optional test to help understand the pupose of the group - id - optionally specify the internal Guid - descriptor - optionally specify the sid at creation time
*
* @param {GraphInterfaces.GraphGroupCreationContext} creationContext - The subset of the full graph group used to uniquely find the graph subject in an external provider.
* @param {string} scopeDescriptor
* @param {GraphInterfaces.SubjectDescriptor[]} groupDescriptors - A comma separated list of descriptors referencing groups you want the graph group to join
*/
public async createGroup(
creationContext: GraphInterfaces.GraphGroupCreationContext,
scopeDescriptor?: string,
groupDescriptors?: GraphInterfaces.SubjectDescriptor[]
): Promise<GraphInterfaces.GraphGroup> {
return new Promise<GraphInterfaces.GraphGroup>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
scopeDescriptor: scopeDescriptor,
groupDescriptors: groupDescriptors && groupDescriptors.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"ebbe6af8-0b91-4c13-8cf1-777c14858188",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphGroup>;
res = await this.rest.create<GraphInterfaces.GraphGroup>(url, creationContext, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This call makes the group disabled and by default removes all members. If the includeMemberships=false flag is set, the memberships within this group are not evaluated and provide no permissions. Calls to GET .../groups/{} will return the group with disabled marked true. Other GET calls, which may return multiple groups, can control whether or not deleted groups should be returned using the disabled flag, which defaults to false.
*
* @param {string} groupDescriptor - The descriptor of the group to delete.
*/
public async deleteGroup(
groupDescriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
groupDescriptor: groupDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"ebbe6af8-0b91-4c13-8cf1-777c14858188",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This endpoint returns a result for any descriptor that has ever been valid in the system, even if the group has since been deleted or has had all their memberships deleted. The current validity of the group is indicated through its disabled property, which is omitted when false.
*
* @param {string} groupDescriptor - The descriptor of the desired graph group.
*/
public async getGroup(
groupDescriptor: string
): Promise<GraphInterfaces.GraphGroup> {
return new Promise<GraphInterfaces.GraphGroup>(async (resolve, reject) => {
let routeValues: any = {
groupDescriptor: groupDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"ebbe6af8-0b91-4c13-8cf1-777c14858188",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphGroup>;
res = await this.rest.get<GraphInterfaces.GraphGroup>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scopeDescriptor
* @param {string[]} subjectTypes
*/
public async getGroups(
scopeDescriptor?: string,
subjectTypes?: string[]
): Promise<GraphInterfaces.GraphGroup[]> {
return new Promise<GraphInterfaces.GraphGroup[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
scopeDescriptor: scopeDescriptor,
subjectTypes: subjectTypes && subjectTypes.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"ebbe6af8-0b91-4c13-8cf1-777c14858188",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphGroup[]>;
res = await this.rest.get<GraphInterfaces.GraphGroup[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update the fields of a VS Team Services group. Currently limited to only changing the description and account name.
*
* @param {string} groupDescriptor - The descriptor of the group to modify.
* @param {VSSInterfaces.JsonPatchDocument} patchDocument - The JSON+Patch document containing the fields to alter.
*/
public async updateGroup(
customHeaders: any,
groupDescriptor: string,
patchDocument: VSSInterfaces.JsonPatchDocument
): Promise<GraphInterfaces.GraphGroup> {
return new Promise<GraphInterfaces.GraphGroup>(async (resolve, reject) => {
let routeValues: any = {
groupDescriptor: groupDescriptor
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"ebbe6af8-0b91-4c13-8cf1-777c14858188",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphGroup>;
res = await this.rest.update<GraphInterfaces.GraphGroup>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create a new membership between two eligible members
*
* @param {string} subjectDescriptor - A descriptor to a group or user that can be the child subject in the relationship.
* @param {string} containerDescriptor - A descriptor to a group that can be the container in the relationship.
*/
public async addMembership(
subjectDescriptor: string,
containerDescriptor: string
): Promise<GraphInterfaces.GraphMembership> {
return new Promise<GraphInterfaces.GraphMembership>(async (resolve, reject) => {
let routeValues: any = {
subjectDescriptor: subjectDescriptor,
containerDescriptor: containerDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"3fd2e6ca-fb30-443a-b579-95b19ed0934c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphMembership>;
res = await this.rest.replace<GraphInterfaces.GraphMembership>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This method will search for a requested membership and return 200 if the membership is found.
*
* @param {string} subjectDescriptor - The group or user that is a child of the relationship.
* @param {string} containerDescriptor - The group that is the parent in the relationship.
*/
public async checkMembership(
subjectDescriptor: string,
containerDescriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
subjectDescriptor: subjectDescriptor,
containerDescriptor: containerDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"3fd2e6ca-fb30-443a-b579-95b19ed0934c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.head<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This method will search for a requested membership and return the membership if found.
*
* @param {string} subjectDescriptor - A descriptor to the member in the relationship.
* @param {string} containerDescriptor - A descriptor to the container in the relationship.
*/
public async getMembership(
subjectDescriptor: string,
containerDescriptor: string
): Promise<GraphInterfaces.GraphMembership> {
return new Promise<GraphInterfaces.GraphMembership>(async (resolve, reject) => {
let routeValues: any = {
subjectDescriptor: subjectDescriptor,
containerDescriptor: containerDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"3fd2e6ca-fb30-443a-b579-95b19ed0934c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphMembership>;
res = await this.rest.get<GraphInterfaces.GraphMembership>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Deletes a membership between to members of the graph.
*
* @param {string} subjectDescriptor - A descriptor to a group or user that is the child subject in the relationship.
* @param {string} containerDescriptor - A descriptor to a group that is the container in the relationship.
*/
public async removeMembership(
subjectDescriptor: string,
containerDescriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
subjectDescriptor: subjectDescriptor,
containerDescriptor: containerDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"3fd2e6ca-fb30-443a-b579-95b19ed0934c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get all the memberships where this descriptor is a member in the relationship by default. To get relationships where the descriptor is a container, use the optional parameter direction with a value of down. Scopes are not supported in this method yet.
*
* @param {string} subjectDescriptor - Fetch all direct memberships of this descriptor.
* @param {string} direction - Defaults to up.
*/
public async getMemberships(
subjectDescriptor: string,
direction?: string
): Promise<GraphInterfaces.GraphMembership[]> {
return new Promise<GraphInterfaces.GraphMembership[]>(async (resolve, reject) => {
let routeValues: any = {
subjectDescriptor: subjectDescriptor
};
let queryValues: any = {
direction: direction,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"e34b6394-6b30-4435-94a9-409a5eef3e31",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphMembership[]>;
res = await this.rest.get<GraphInterfaces.GraphMembership[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GraphInterfaces.GraphScopeCreationContext} creationContext
* @param {string} scopeDescriptor
*/
public async createScope(
creationContext: GraphInterfaces.GraphScopeCreationContext,
scopeDescriptor?: string
): Promise<GraphInterfaces.GraphScope> {
return new Promise<GraphInterfaces.GraphScope>(async (resolve, reject) => {
let routeValues: any = {
scopeDescriptor: scopeDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"21b5fea7-2513-41d0-af78-b8cdb0f328bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphScope>;
res = await this.rest.create<GraphInterfaces.GraphScope>(url, creationContext, options);
let ret = this.formatResponse(res.result,
GraphInterfaces.TypeInfo.GraphScope,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scopeDescriptor
*/
public async deleteScope(
scopeDescriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
scopeDescriptor: scopeDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"21b5fea7-2513-41d0-af78-b8cdb0f328bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get a scope identified by its descriptor
*
* @param {string} scopeDescriptor - A descriptor that uniquely identifies a scope.
*/
public async getScope(
scopeDescriptor: string
): Promise<GraphInterfaces.GraphScope> {
return new Promise<GraphInterfaces.GraphScope>(async (resolve, reject) => {
let routeValues: any = {
scopeDescriptor: scopeDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"21b5fea7-2513-41d0-af78-b8cdb0f328bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphScope>;
res = await this.rest.get<GraphInterfaces.GraphScope>(url, options);
let ret = this.formatResponse(res.result,
GraphInterfaces.TypeInfo.GraphScope,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scopeDescriptor
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
*/
public async updateScope(
customHeaders: any,
scopeDescriptor: string,
patchDocument: VSSInterfaces.JsonPatchDocument
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
scopeDescriptor: scopeDescriptor
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"21b5fea7-2513-41d0-af78-b8cdb0f328bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {GraphInterfaces.GraphSubjectLookup} subjectLookup
*/
public async lookupSubjects(
subjectLookup: GraphInterfaces.GraphSubjectLookup
): Promise<GraphInterfaces.GraphSubject[]> {
return new Promise<GraphInterfaces.GraphSubject[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"4dd4d168-11f2-48c4-83e8-756fa0de027c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphSubject[]>;
res = await this.rest.create<GraphInterfaces.GraphSubject[]>(url, subjectLookup, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* The body of the request must be a derived type of GraphUserCreationContext which contains a user reference. The user reference must uniquely identify a user that exists in the graph of the instance's identity provider, such as Azure Active Directory (AAD) or Microsoft Account (MSA), for a hosted VS Team Services account, or Active Directory (AD), for a TFS server. The properties supported for each user reference include: - originId(e.g.the AAD object ID) [GraphUserOriginIdCreationContext] - principalName(e.g.the AAD user principal name or the Microsoft account name) [GraphUserPrincipalNameCreationContext] - onPremisesSecurityIdentifier(e.g.the AD security identifier) [GraphUserOriginIdCreationContext] - id (optional, if you want the ID to be a particular GUID) If the user to be added corresponds to a user that was previously deleted, then that user will be restored. If the user was deleted with includeMemberships=false, they will have their previous memberships upon completion of the subsequent add request.
*
* @param {GraphInterfaces.GraphUserCreationContext} creationContext - The subset of the full graph user used to uniquely find the graph subject in an external provider.
* @param {GraphInterfaces.SubjectDescriptor[]} groupDescriptors - A comma separated list of descriptors of groups you want the graph user to join
*/
public async createUser(
creationContext: GraphInterfaces.GraphUserCreationContext,
groupDescriptors?: GraphInterfaces.SubjectDescriptor[]
): Promise<GraphInterfaces.GraphUser> {
return new Promise<GraphInterfaces.GraphUser>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
groupDescriptors: groupDescriptors && groupDescriptors.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"005e26ec-6b77-4e4f-a986-b3827bf241f5",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphUser>;
res = await this.rest.create<GraphInterfaces.GraphUser>(url, creationContext, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This is a soft delete. Calls to GET .../users/{persistentId} will return the user with disabled marked true. Other GET calls, which may return multiple users, can control whether or not deleted users should be returned using the disabled flag, which defaults to false.
*
* @param {string} userDescriptor - The descriptor of the user to delete.
*/
public async deleteUser(
userDescriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userDescriptor: userDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"005e26ec-6b77-4e4f-a986-b3827bf241f5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* This endpoint returns a result for any user that has ever been valid in the system, even if the user has since been deleted or has had all their memberships deleted. The current validity of the user is indicated through its disabled property, which is omitted when false.
*
* @param {string} userDescriptor
*/
public async getUser(
userDescriptor: string
): Promise<GraphInterfaces.GraphUser> {
return new Promise<GraphInterfaces.GraphUser>(async (resolve, reject) => {
let routeValues: any = {
userDescriptor: userDescriptor
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"005e26ec-6b77-4e4f-a986-b3827bf241f5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphUser>;
res = await this.rest.get<GraphInterfaces.GraphUser>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Gets all users in the current scope (usually organization or account). The optional parameters are used to filter down the returned results. May truncate exceptionally large result sets. Returned results are in no guaranteed order.
*
* @param {string[]} subjectTypes - A comma separated list of user subject subtypes to reduce the retrieved results, e.g. Microsoft.IdentityModel.Claims.ClaimsIdentity>
*/
public async getUsers(
subjectTypes?: string[]
): Promise<GraphInterfaces.GraphUser[]> {
return new Promise<GraphInterfaces.GraphUser[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
subjectTypes: subjectTypes && subjectTypes.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"graph",
"005e26ec-6b77-4e4f-a986-b3827bf241f5",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<GraphInterfaces.GraphUser[]>;
res = await this.rest.get<GraphInterfaces.GraphUser[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import url = require("url");
import http = require("http");
import https = require("https");
import tunnel = require("tunnel");
@ -10,7 +9,239 @@ import ifm = require('./interfaces/common/VsoBaseInterfaces');
http.globalAgent.maxSockets = 100;
export class HttpClient implements ifm.IHttpClient {
export enum HttpCodes {
OK = 200,
MultipleChoices = 300,
MovedPermanantly = 301,
ResourceMoved = 302,
NotModified = 304,
UseProxy = 305,
SwitchProxy = 306,
TemporaryRedirect = 307,
PermanentRedirect = 308,
BadRequest = 400,
Unauthorized = 401,
PaymentRequired = 402,
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
NotAcceptable = 406,
ProxyAuthenticationRequired = 407,
RequestTimeout = 408,
Conflict = 409,
Gone = 410,
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
GatewayTimeout = 504,
}
export class HttpClientResponse {
constructor(message: http.IncomingMessage) {
this.message = message;
}
public message: http.IncomingMessage;
readBody(): Promise<string> {
return new Promise<string>(async(resolve, reject) => {
let output: string = '';
this.message.on('data', (chunk: string) => {
output += chunk;
});
this.message.on('end', () => {
resolve(output);
});
});
}
}
export interface RequestInfo {
options: http.RequestOptions;
parsedUrl: url.Url;
httpModule: any;
}
export function isHttps(requestUrl: string) {
let parsedUrl: url.Url = url.parse(requestUrl);
return parsedUrl.protocol === 'https:';
}
export class HttpClient {
userAgent: string;
handlers: ifm.IRequestHandler[];
socketTimeout: number;
constructor(userAgent: string, handlers?: ifm.IRequestHandler[], socketTimeout?: number) {
this.userAgent = userAgent;
this.handlers = handlers;
this.socketTimeout = socketTimeout ? socketTimeout : 3 * 60000;
}
public get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request('GET', requestUrl, null, additionalHeaders || {});
}
public del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
}
public post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request('POST', requestUrl, data, additionalHeaders || {});
}
public patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
}
public put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request('PUT', requestUrl, data, additionalHeaders || {});
}
public sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse> {
return this.request(verb, requestUrl, stream, additionalHeaders);
}
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
* Prefer get, del, post and patch
*/
public request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<HttpClientResponse> {
return new Promise<HttpClientResponse>(async(resolve, reject) => {
try {
var info: RequestInfo = this._prepareRequest(verb, requestUrl, headers);
let res: HttpClientResponse = await this._requestRaw(info, data);
// TODO: check 401 if handled
// TODO: retry support
resolve(res);
}
catch (err) {
// only throws in truly exceptional cases (connection, can't resolve etc...)
// responses from the server do not throw
reject(err);
}
});
}
private _requestRaw(info: RequestInfo, data: string | NodeJS.ReadableStream): Promise<HttpClientResponse> {
return new Promise<HttpClientResponse>((resolve, reject) => {
let socket;
let isDataString = typeof(data) === 'string';
if (typeof(data) === 'string') {
info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8');
}
let req: http.ClientRequest = info.httpModule.request(info.options, (msg: http.IncomingMessage) => {
let res: HttpClientResponse = new HttpClientResponse(msg);
resolve(res);
});
req.on('socket', (sock) => {
socket = sock;
});
// If we ever get disconnected, we want the socket to timeout eventually
req.setTimeout(this.socketTimeout, () => {
if (socket) {
socket.end();
}
reject(new Error('Request timeout: ' + info.options.path));
});
req.on('error', function (err) {
// err has statusCode property
// res should have headers
reject(err);
});
if (data && typeof(data) === 'string') {
req.write(data, 'utf8');
}
if (data && typeof(data) !== 'string') {
data.on('close', function () {
req.end();
});
data.pipe(req);
}
else {
req.end();
}
});
}
private _prepareRequest(method: string, requestUrl: string, headers: any): RequestInfo {
let info: RequestInfo = <RequestInfo>{};
info.parsedUrl = url.parse(requestUrl);
let usingSsl = info.parsedUrl.protocol === 'https:';
info.httpModule = usingSsl ? https : http;
var defaultPort: number = usingSsl ? 443 : 80;
var proxyUrl: url.Url;
if (process.env.HTTPS_PROXY && usingSsl) {
proxyUrl = url.parse(process.env.HTTPS_PROXY);
} else if (process.env.HTTP_PROXY) {
proxyUrl = url.parse(process.env.HTTP_PROXY);
}
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
info.options = <http.RequestOptions>{};
info.options.host = info.parsedUrl.hostname;
info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort;
info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
info.options.method = method;
info.options.headers = headers || {};
info.options.headers["User-Agent"] = this.userAgent;
let useProxy = proxyUrl && proxyUrl.hostname;
if (useProxy) {
var agentOptions: tunnel.TunnelOptions = {
maxSockets: http.globalAgent.maxSockets,
proxy: {
// TODO: support proxy-authorization
//proxyAuth: "user:password",
host: proxyUrl.hostname,
port: proxyUrl.port
}
};
var tunnelAgent: Function;
var overHttps = proxyUrl.protocol === 'https:';
if (usingSsl) {
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
} else {
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
}
info.options.agent = tunnelAgent(agentOptions);
}
// gives handlers an opportunity to participate
if (this.handlers) {
this.handlers.forEach((handler) => {
handler.prepareRequest(info.options);
});
}
return info;
}
}
//
// Legacy callback client. Will delete.
//
export class HttpCallbackClient {
userAgent: string;
handlers: ifm.IRequestHandler[];
socketTimeout: number;
@ -19,30 +250,25 @@ export class HttpClient implements ifm.IHttpClient {
constructor(userAgent: string, handlers?: ifm.IRequestHandler[], socketTimeout?: number) {
this.userAgent = userAgent;
this.handlers = handlers;
if (socketTimeout) {
this.socketTimeout = socketTimeout;
} else {
// Default 3 minutes
this.socketTimeout = 3 * 60000;
}
this.socketTimeout = socketTimeout ? socketTimeout : 3 * 60000;
}
get(verb: string, requestUrl: string, headers: ifm.IHeaders, onResult: (err: any, res: http.ClientResponse, contents: string) => void): void {
get(verb: string, requestUrl: string, headers: ifm.IHeaders, onResult: (err: any, res: http.IncomingMessage, contents: string) => void): void {
var options = this._getOptions(verb, requestUrl, headers);
this.request(options.protocol, options.options, null, onResult);
}
// POST, PATCH, PUT
send(verb: string, requestUrl: string, objs: any, headers: ifm.IHeaders, onResult: (err: any, res: http.ClientResponse, contents: string) => void): void {
send(verb: string, requestUrl: string, data: string, headers: ifm.IHeaders, onResult: (err: any, res: http.IncomingMessage, contents: string) => void): void {
var options = this._getOptions(verb, requestUrl, headers);
this.request(options.protocol, options.options, objs, onResult);
this.request(options.protocol, options.options, data, onResult);
}
sendFile(verb: string, requestUrl: string, content: NodeJS.ReadableStream, headers: ifm.IHeaders, onResult: (err: any, res: http.ClientResponse, contents: string) => void): void {
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, headers: ifm.IHeaders, onResult: (err: any, res: http.IncomingMessage, contents: string) => void): void {
var options = this._getOptions(verb, requestUrl, headers);
var req = options.protocol.request(options.options, function (res) {
var output = '';
var req = options.protocol.request(options.options, (res) => {
let output: string = '';
res.on('data', function (chunk) {
output += chunk;
@ -60,34 +286,118 @@ export class HttpClient implements ifm.IHttpClient {
onResult(err, null, null);
});
content.on('close', function () {
stream.on('close', function () {
req.end();
});
content.pipe(req);
stream.pipe(req);
}
getStream(requestUrl: string, apiVersion: string, type: string, onResult: (err: any, statusCode: number, res: NodeJS.ReadableStream) => void): void {
var headers = {};
headers['Accept'] = this.makeAcceptHeader(type, apiVersion);
getStream(requestUrl: string, accept: string, onResult: (err: any, statusCode: number, res: NodeJS.ReadableStream) => void): void {
let headers = {};
headers['ACCEPT'] = accept;
var options = this._getOptions('GET', requestUrl, headers);
var req = options.protocol.request(options.options, function (res) {
var req = options.protocol.request(options.options, (res: http.IncomingMessage) => {
onResult(null, res.statusCode, res);
});
req.on('error', function (err) {
req.on('error', (err) => {
onResult(err, err.statusCode, null);
});
req.end();
}
makeAcceptHeader(type: string, apiVersion: string): string {
return type + (apiVersion ? (";api-version=" + apiVersion) : "");
/**
* Makes an http request delegating authentication to handlers.
* returns http result as contents buffer
* All other methods such as get, post, and patch ultimately call this.
*/
request(protocol: any, options: any, data: string, onResult: (err: any, res: http.IncomingMessage, contents: string) => void): void {
// Set up a callback to pass off 401s to an authentication handler that can deal with it
var callback = (err: any, res: http.ClientResponse, contents: string) => {
var authHandler;
if (this.handlers) {
this.handlers.some(function (handler, index, handlers) {
// Find the first one that can handle the auth based on the response
if (handler.canHandleAuthentication(res)) {
authHandler = handler;
return true;
}
return false;
});
}
if (authHandler !== undefined) {
authHandler.handleAuthentication(this, protocol, options, data, onResult);
} else {
// No auth handler found, call onResult normally
onResult(err, res, contents);
}
};
this.requestRaw(protocol, options, data, callback);
}
_getOptions(method: string, requestUrl: string, headers: any): any {
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
*/
requestRaw(protocol: any, options: any, data: string, onResult: (err: any, res: http.IncomingMessage, contents: string) => void): void {
var socket;
if (data) {
options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8');
}
var callbackCalled: boolean = false;
var handleResult = (err: any, res: http.IncomingMessage, contents: string) => {
if (!callbackCalled) {
callbackCalled = true;
onResult(err, res, contents);
}
};
var req = protocol.request(options, (res) => {
let output: string = '';
res.setEncoding('utf8');
res.on('data', (chunk: string) => {
output += chunk;
});
res.on('end', () => {
// res has statusCode and headers
handleResult(null, res, output);
});
});
req.on('socket', (sock) => {
socket = sock;
});
// If we ever get disconnected, we want the socket to timeout eventually
req.setTimeout(this.socketTimeout, function() {
if (socket) {
socket.end();
}
handleResult(new Error('Request timeout: ' + options.path), null, null);
});
req.on('error', function (err) {
// err has statusCode property
// res should have headers
handleResult(err, null, null);
});
if (data) {
req.write(data, 'utf8');
}
req.end();
}
private _getOptions(method: string, requestUrl: string, headers: any): any {
var parsedUrl: url.Url = url.parse(requestUrl);
var usingSsl = parsedUrl.protocol === 'https:';
@ -111,7 +421,6 @@ export class HttpClient implements ifm.IHttpClient {
headers: headers || {}
};
//options.headers["Accept"] = contentType;
options.headers["User-Agent"] = this.userAgent;
var useProxy = proxyUrl && proxyUrl.hostname;
@ -147,86 +456,5 @@ export class HttpClient implements ifm.IHttpClient {
protocol: prot,
options: options,
};
}
request(protocol: any, options: any, objs: any, onResult: (err: any, res: http.ClientResponse, contents: string) => void): void {
// Set up a callback to pass off 401s to an authentication handler that can deal with it
var callback = (err: any, res: http.ClientResponse, contents: string) => {
var authHandler;
if (this.handlers) {
this.handlers.some(function (handler, index, handlers) {
// Find the first one that can handle the auth based on the response
if (handler.canHandleAuthentication(res)) {
authHandler = handler;
return true;
}
return false;
});
}
if (authHandler !== undefined) {
authHandler.handleAuthentication(this, protocol, options, objs, onResult);
} else {
// No auth handler found, call onResult normally
onResult(err, res, contents);
}
};
this.requestInternal(protocol, options, objs, callback);
}
requestInternal(protocol: any, options: any, objs: any, onResult: (err: any, res: http.ClientResponse, contents: string) => void): void {
var reqData;
var socket;
if (objs) {
reqData = JSON.stringify(objs, null, 2);
options.headers["Content-Length"] = Buffer.byteLength(reqData, 'utf8');
}
var callbackCalled: boolean = false;
var handleResult = (err: any, res: http.ClientResponse, contents: string) => {
if (!callbackCalled) {
callbackCalled = true;
onResult(err, res, contents);
}
};
var req = protocol.request(options, function (res) {
var output = '';
res.setEncoding('utf8');
res.on('data', function (chunk) {
output += chunk;
});
res.on('end', function () {
// res has statusCode and headers
handleResult(null, res, output);
});
});
req.on('socket', function(sock) {
socket = sock;
});
// If we ever get disconnected, we want the socket to timeout eventually
req.setTimeout(this.socketTimeout, function() {
if (socket) {
socket.end();
}
handleResult(new Error('Request timeout: ' + options.path), null, null);
});
req.on('error', function (err) {
// err has statusCode property
// res should have headers
handleResult(err, null, null);
});
if (reqData) {
req.write(reqData, 'utf8');
}
req.end();
}
}
}

159
api/IdentityMruApi.ts Normal file
Просмотреть файл

@ -0,0 +1,159 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import IdentityMruInterfaces = require("./interfaces/IdentityMruInterfaces");
export interface IIdentityMruApi extends basem.ClientApiBase {
getMruIdentities(identityId: string, containerId: string): Promise<string[]>;
setMruIdentities(identityIds: string[], identityId: string, containerId: string): Promise<void>;
updateMruIdentities(updateData: IdentityMruInterfaces.MruIdentitiesUpdateData, identityId: string, containerId: string): Promise<void>;
}
export class IdentityMruApi extends basem.ClientApiBase implements IIdentityMruApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-IdentityMru-api');
}
/**
* @param {string} identityId
* @param {string} containerId
*/
public async getMruIdentities(
identityId: string,
containerId: string
): Promise<string[]> {
return new Promise<string[]>(async (resolve, reject) => {
let routeValues: any = {
identityId: identityId,
containerId: containerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Identity",
"15d952a1-bb4e-436c-88ca-cfe1e9ff3331",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string[]>;
res = await this.rest.get<string[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string[]} identityIds
* @param {string} identityId
* @param {string} containerId
*/
public async setMruIdentities(
identityIds: string[],
identityId: string,
containerId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
identityId: identityId,
containerId: containerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Identity",
"15d952a1-bb4e-436c-88ca-cfe1e9ff3331",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.replace<void>(url, identityIds, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {IdentityMruInterfaces.MruIdentitiesUpdateData} updateData
* @param {string} identityId
* @param {string} containerId
*/
public async updateMruIdentities(
updateData: IdentityMruInterfaces.MruIdentitiesUpdateData,
identityId: string,
containerId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
identityId: identityId,
containerId: containerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Identity",
"15d952a1-bb4e-436c-88ca-cfe1e9ff3331",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, updateData, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

74
api/IvyApi.ts Normal file
Просмотреть файл

@ -0,0 +1,74 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import IvyInterfaces = require("./interfaces/IvyInterfaces");
export interface IIvyApi extends basem.ClientApiBase {
packageInfo(feed: string, module: string, revision?: string): Promise<IvyInterfaces.IvyPackage>;
}
export class IvyApi extends basem.ClientApiBase implements IIvyApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Ivy-api');
}
/**
* @param {string} feed
* @param {string} module
* @param {string} revision
*/
public async packageInfo(
feed: string,
module: string,
revision?: string
): Promise<IvyInterfaces.IvyPackage> {
return new Promise<IvyInterfaces.IvyPackage>(async (resolve, reject) => {
let routeValues: any = {
feed: feed,
module: module,
revision: revision
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"ivy",
"36c942a9-5f36-4b8e-b7cd-dbb106910490",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<IvyInterfaces.IvyPackage>;
res = await this.rest.get<IvyInterfaces.IvyPackage>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

324
api/LocationsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,324 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import LocationsInterfaces = require("./interfaces/LocationsInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface ILocationsApi extends basem.ClientApiBase {
getConnectionData(connectOptions?: VSSInterfaces.ConnectOptions, lastChangeId?: number, lastChangeId64?: number): Promise<LocationsInterfaces.ConnectionData>;
getResourceArea(areaId: string): Promise<LocationsInterfaces.ResourceAreaInfo>;
getResourceAreas(): Promise<LocationsInterfaces.ResourceAreaInfo[]>;
deleteServiceDefinition(serviceType: string, identifier: string): Promise<void>;
getServiceDefinition(serviceType: string, identifier: string, allowFaultIn?: boolean): Promise<LocationsInterfaces.ServiceDefinition>;
getServiceDefinitions(serviceType?: string): Promise<LocationsInterfaces.ServiceDefinition[]>;
updateServiceDefinitions(serviceDefinitions: VSSInterfaces.VssJsonCollectionWrapperV<LocationsInterfaces.ServiceDefinition[]>): Promise<void>;
}
export class LocationsApi extends basem.ClientApiBase implements ILocationsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Locations-api');
}
/**
* This was copied and adapted from TeamFoundationConnectionService.Connect()
*
* @param {VSSInterfaces.ConnectOptions} connectOptions
* @param {number} lastChangeId - Obsolete 32-bit LastChangeId
* @param {number} lastChangeId64 - Non-truncated 64-bit LastChangeId
*/
public async getConnectionData(
connectOptions?: VSSInterfaces.ConnectOptions,
lastChangeId?: number,
lastChangeId64?: number
): Promise<LocationsInterfaces.ConnectionData> {
return new Promise<LocationsInterfaces.ConnectionData>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
connectOptions: connectOptions,
lastChangeId: lastChangeId,
lastChangeId64: lastChangeId64,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"00d9565f-ed9c-4a06-9a50-00e7896ccab4",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<LocationsInterfaces.ConnectionData>;
res = await this.rest.get<LocationsInterfaces.ConnectionData>(url, options);
let ret = this.formatResponse(res.result,
LocationsInterfaces.TypeInfo.ConnectionData,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} areaId
*/
public async getResourceArea(
areaId: string
): Promise<LocationsInterfaces.ResourceAreaInfo> {
return new Promise<LocationsInterfaces.ResourceAreaInfo>(async (resolve, reject) => {
let routeValues: any = {
areaId: areaId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"e81700f7-3be2-46de-8624-2eb35882fcaa",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<LocationsInterfaces.ResourceAreaInfo>;
res = await this.rest.get<LocationsInterfaces.ResourceAreaInfo>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getResourceAreas(
): Promise<LocationsInterfaces.ResourceAreaInfo[]> {
return new Promise<LocationsInterfaces.ResourceAreaInfo[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"e81700f7-3be2-46de-8624-2eb35882fcaa",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<LocationsInterfaces.ResourceAreaInfo[]>;
res = await this.rest.get<LocationsInterfaces.ResourceAreaInfo[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} serviceType
* @param {string} identifier
*/
public async deleteServiceDefinition(
serviceType: string,
identifier: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
serviceType: serviceType,
identifier: identifier
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"d810a47d-f4f4-4a62-a03f-fa1860585c4c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} serviceType
* @param {string} identifier
* @param {boolean} allowFaultIn
*/
public async getServiceDefinition(
serviceType: string,
identifier: string,
allowFaultIn?: boolean
): Promise<LocationsInterfaces.ServiceDefinition> {
return new Promise<LocationsInterfaces.ServiceDefinition>(async (resolve, reject) => {
let routeValues: any = {
serviceType: serviceType,
identifier: identifier
};
let queryValues: any = {
allowFaultIn: allowFaultIn,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"d810a47d-f4f4-4a62-a03f-fa1860585c4c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<LocationsInterfaces.ServiceDefinition>;
res = await this.rest.get<LocationsInterfaces.ServiceDefinition>(url, options);
let ret = this.formatResponse(res.result,
LocationsInterfaces.TypeInfo.ServiceDefinition,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} serviceType
*/
public async getServiceDefinitions(
serviceType?: string
): Promise<LocationsInterfaces.ServiceDefinition[]> {
return new Promise<LocationsInterfaces.ServiceDefinition[]>(async (resolve, reject) => {
let routeValues: any = {
serviceType: serviceType
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"d810a47d-f4f4-4a62-a03f-fa1860585c4c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<LocationsInterfaces.ServiceDefinition[]>;
res = await this.rest.get<LocationsInterfaces.ServiceDefinition[]>(url, options);
let ret = this.formatResponse(res.result,
LocationsInterfaces.TypeInfo.ServiceDefinition,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.VssJsonCollectionWrapperV<LocationsInterfaces.ServiceDefinition[]>} serviceDefinitions
*/
public async updateServiceDefinitions(
serviceDefinitions: VSSInterfaces.VssJsonCollectionWrapperV<LocationsInterfaces.ServiceDefinition[]>
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Location",
"d810a47d-f4f4-4a62-a03f-fa1860585c4c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, serviceDefinitions, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

590
api/MachineManagementApi.ts Normal file
Просмотреть файл

@ -0,0 +1,590 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import MachineManagementInterfaces = require("./interfaces/MachineManagementInterfaces");
export interface IMachineManagementApi extends basem.ClientApiBase {
getMachineConfiguration(poolName: string, instanceName: string): Promise<MachineManagementInterfaces.MachineConfigurationResponse>;
publishNotification(poolEvent: MachineManagementInterfaces.MachinePoolEvent, poolName: string): Promise<void>;
getPoolFriendlyImageNameList(): Promise<MachineManagementInterfaces.FriendlyImageName[]>;
registerMachineInstance(poolAuthToken: number[], poolName: string, instanceName: string, imageName: string, imageVersion: string, provisioning?: boolean, startProvisioning?: boolean): Promise<MachineManagementInterfaces.MachineRegistrationResponseData>;
updateMachineInstance(properties: any, poolName: string, instanceName: string, state?: string, enabled?: boolean, imageName?: string, imageVersion?: string, provisioned?: boolean): Promise<MachineManagementInterfaces.MachineInstance>;
deleteMessage(poolName: string, instanceName: string, queueName: string, accessToken: string, messageId: number): Promise<void>;
getMessage(poolName: string, instanceName: string, queueName: string, accessToken: string, lastMessageId?: number): Promise<MachineManagementInterfaces.MachineInstanceMessage>;
getMachinePool(poolName: string, propertyFilters?: string): Promise<MachineManagementInterfaces.MachinePool>;
requestAction(state: MachineManagementInterfaces.RequestStateData, poolName: string, requestId: number): Promise<void>;
queueRequest(machineRequest: MachineManagementInterfaces.MachineRequest): Promise<void>;
getResource(requestType: string, version: string): Promise<MachineManagementInterfaces.MachineRequestResource>;
getResources(requestType: string): Promise<MachineManagementInterfaces.MachineRequestResource[]>;
}
export class MachineManagementApi extends basem.ClientApiBase implements IMachineManagementApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-MachineManagement-api');
}
/**
* @param {string} poolName
* @param {string} instanceName
*/
public async getMachineConfiguration(
poolName: string,
instanceName: string
): Promise<MachineManagementInterfaces.MachineConfigurationResponse> {
return new Promise<MachineManagementInterfaces.MachineConfigurationResponse>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
instanceName: instanceName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"50c4e238-51d9-4144-93cc-8a842315f95d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineConfigurationResponse>;
res = await this.rest.get<MachineManagementInterfaces.MachineConfigurationResponse>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {MachineManagementInterfaces.MachinePoolEvent} poolEvent
* @param {string} poolName
*/
public async publishNotification(
poolEvent: MachineManagementInterfaces.MachinePoolEvent,
poolName: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"b770d7eb-cb9e-4d55-af35-4ce10d01dc1c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, poolEvent, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getPoolFriendlyImageNameList(
): Promise<MachineManagementInterfaces.FriendlyImageName[]> {
return new Promise<MachineManagementInterfaces.FriendlyImageName[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"33e5d203-cc38-478b-a0a0-aad8d7cc04ed",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.FriendlyImageName[]>;
res = await this.rest.get<MachineManagementInterfaces.FriendlyImageName[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {number[]} poolAuthToken
* @param {string} poolName
* @param {string} instanceName
* @param {string} imageName
* @param {string} imageVersion
* @param {boolean} provisioning
* @param {boolean} startProvisioning
*/
public async registerMachineInstance(
poolAuthToken: number[],
poolName: string,
instanceName: string,
imageName: string,
imageVersion: string,
provisioning?: boolean,
startProvisioning?: boolean
): Promise<MachineManagementInterfaces.MachineRegistrationResponseData> {
return new Promise<MachineManagementInterfaces.MachineRegistrationResponseData>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
instanceName: instanceName
};
let queryValues: any = {
imageName: imageName,
imageVersion: imageVersion,
provisioning: provisioning,
startProvisioning: startProvisioning,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"80ed82a1-c9f1-41bf-95b6-8becc1a72b89",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineRegistrationResponseData>;
res = await this.rest.create<MachineManagementInterfaces.MachineRegistrationResponseData>(url, poolAuthToken, options);
let ret = this.formatResponse(res.result,
MachineManagementInterfaces.TypeInfo.MachineRegistrationResponseData,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} properties
* @param {string} poolName
* @param {string} instanceName
* @param {string} state
* @param {boolean} enabled
* @param {string} imageName
* @param {string} imageVersion
* @param {boolean} provisioned
*/
public async updateMachineInstance(
properties: any,
poolName: string,
instanceName: string,
state?: string,
enabled?: boolean,
imageName?: string,
imageVersion?: string,
provisioned?: boolean
): Promise<MachineManagementInterfaces.MachineInstance> {
return new Promise<MachineManagementInterfaces.MachineInstance>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
instanceName: instanceName
};
let queryValues: any = {
state: state,
enabled: enabled,
imageName: imageName,
imageVersion: imageVersion,
provisioned: provisioned,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"a67cc23a-6234-4f05-a75b-f08892603e86",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineInstance>;
res = await this.rest.update<MachineManagementInterfaces.MachineInstance>(url, properties, options);
let ret = this.formatResponse(res.result,
MachineManagementInterfaces.TypeInfo.MachineInstance,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} poolName
* @param {string} instanceName
* @param {string} queueName
* @param {string} accessToken
* @param {number} messageId
*/
public async deleteMessage(
poolName: string,
instanceName: string,
queueName: string,
accessToken: string,
messageId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
instanceName: instanceName
};
let queryValues: any = {
queueName: queueName,
accessToken: accessToken,
messageId: messageId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"b53c80e3-c3eb-4224-9294-82e773974c5a",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} poolName
* @param {string} instanceName
* @param {string} queueName
* @param {string} accessToken
* @param {number} lastMessageId
*/
public async getMessage(
poolName: string,
instanceName: string,
queueName: string,
accessToken: string,
lastMessageId?: number
): Promise<MachineManagementInterfaces.MachineInstanceMessage> {
return new Promise<MachineManagementInterfaces.MachineInstanceMessage>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
instanceName: instanceName
};
let queryValues: any = {
queueName: queueName,
accessToken: accessToken,
lastMessageId: lastMessageId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"b53c80e3-c3eb-4224-9294-82e773974c5a",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineInstanceMessage>;
res = await this.rest.get<MachineManagementInterfaces.MachineInstanceMessage>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} poolName
* @param {string} propertyFilters
*/
public async getMachinePool(
poolName: string,
propertyFilters?: string
): Promise<MachineManagementInterfaces.MachinePool> {
return new Promise<MachineManagementInterfaces.MachinePool>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName
};
let queryValues: any = {
propertyFilters: propertyFilters,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"11ee58b6-3140-4a8d-a6dd-3e5093db23db",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachinePool>;
res = await this.rest.get<MachineManagementInterfaces.MachinePool>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {MachineManagementInterfaces.RequestStateData} state
* @param {string} poolName
* @param {number} requestId
*/
public async requestAction(
state: MachineManagementInterfaces.RequestStateData,
poolName: string,
requestId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
poolName: poolName,
requestId: requestId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"dc8c72f1-74e2-4788-98b0-26117efc38eb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, state, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {MachineManagementInterfaces.MachineRequest} machineRequest
*/
public async queueRequest(
machineRequest: MachineManagementInterfaces.MachineRequest
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"658f89f4-f19c-464c-85a4-7ea6669d78e5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, machineRequest, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} requestType
* @param {string} version
*/
public async getResource(
requestType: string,
version: string
): Promise<MachineManagementInterfaces.MachineRequestResource> {
return new Promise<MachineManagementInterfaces.MachineRequestResource>(async (resolve, reject) => {
let routeValues: any = {
requestType: requestType,
version: version
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"37016efb-bdea-4ddf-9684-19098d11ebd4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineRequestResource>;
res = await this.rest.get<MachineManagementInterfaces.MachineRequestResource>(url, options);
let ret = this.formatResponse(res.result,
MachineManagementInterfaces.TypeInfo.MachineRequestResource,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} requestType
*/
public async getResources(
requestType: string
): Promise<MachineManagementInterfaces.MachineRequestResource[]> {
return new Promise<MachineManagementInterfaces.MachineRequestResource[]>(async (resolve, reject) => {
let routeValues: any = {
requestType: requestType
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"mms",
"37016efb-bdea-4ddf-9684-19098d11ebd4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MachineManagementInterfaces.MachineRequestResource[]>;
res = await this.rest.get<MachineManagementInterfaces.MachineRequestResource[]>(url, options);
let ret = this.formatResponse(res.result,
MachineManagementInterfaces.TypeInfo.MachineRequestResource,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -0,0 +1,122 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
export interface IMarketingPreferencesApi extends basem.ClientApiBase {
getMarketingPreferences(contactPoints: string[]): Promise<{ [key: string] : boolean; }>;
setMarketingPreferences(contactPoint: string, canContact: boolean, country: string): Promise<boolean>;
}
export class MarketingPreferencesApi extends basem.ClientApiBase implements IMarketingPreferencesApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-MarketingPreferences-api');
}
/**
* @param {string[]} contactPoints
*/
public async getMarketingPreferences(
contactPoints: string[]
): Promise<{ [key: string] : boolean; }> {
return new Promise<{ [key: string] : boolean; }>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
contactPoints: contactPoints,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MarketingPreferences",
"2c34206e-7550-4ea7-b1f2-e0967c21ac13",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : boolean; }>;
res = await this.rest.get<{ [key: string] : boolean; }>(url, options);
let ret = this.formatResponse(res.result,
TypeInfo.{ [key: string] : boolean; },
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Sets marketing preference of a given user
*
* @param {string} contactPoint
* @param {boolean} canContact
* @param {string} country
*/
public async setMarketingPreferences(
contactPoint: string,
canContact: boolean,
country: string
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
contactPoint: contactPoint,
canContact: canContact,
country: country,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MarketingPreferences",
"2c34206e-7550-4ea7-b1f2-e0967c21ac13",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.create<boolean>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

128
api/MavenApi.ts Normal file
Просмотреть файл

@ -0,0 +1,128 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import MavenInterfaces = require("./interfaces/MavenInterfaces");
export interface IMavenApi extends basem.ClientApiBase {
packageInfo(feed: string, groupId: string, artifactId: string, version?: string, fileName?: string): Promise<MavenInterfaces.MavenPackage>;
pomInfo(feed: string, groupId: string, artifactId: string, version: string): Promise<MavenInterfaces.MavenPomMetadata>;
}
export class MavenApi extends basem.ClientApiBase implements IMavenApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Maven-api');
}
/**
* @param {string} feed
* @param {string} groupId
* @param {string} artifactId
* @param {string} version
* @param {string} fileName
*/
public async packageInfo(
feed: string,
groupId: string,
artifactId: string,
version?: string,
fileName?: string
): Promise<MavenInterfaces.MavenPackage> {
return new Promise<MavenInterfaces.MavenPackage>(async (resolve, reject) => {
let routeValues: any = {
feed: feed,
groupId: groupId,
artifactId: artifactId,
version: version,
fileName: fileName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"maven",
"e6d2830e-bac3-431b-ad07-d12c0605b02a",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MavenInterfaces.MavenPackage>;
res = await this.rest.get<MavenInterfaces.MavenPackage>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} feed
* @param {string} groupId
* @param {string} artifactId
* @param {string} version
*/
public async pomInfo(
feed: string,
groupId: string,
artifactId: string,
version: string
): Promise<MavenInterfaces.MavenPomMetadata> {
return new Promise<MavenInterfaces.MavenPomMetadata>(async (resolve, reject) => {
let routeValues: any = {
feed: feed,
groupId: groupId,
artifactId: artifactId,
version: version
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"maven",
"03cb6da7-7750-4452-8eb3-569d0ec7c04b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MavenInterfaces.MavenPomMetadata>;
res = await this.rest.get<MavenInterfaces.MavenPomMetadata>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -0,0 +1,253 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import MemberEntitlementManagementInterfaces = require("./interfaces/MemberEntitlementManagementInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IMemberEntitlementManagementApi extends basem.ClientApiBase {
addMemberEntitlement(memberEntitlement: MemberEntitlementManagementInterfaces.MemberEntitlement): Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPostResponse>;
deleteMemberEntitlement(memberId: string): Promise<void>;
getMemberEntitlement(memberId: string): Promise<MemberEntitlementManagementInterfaces.MemberEntitlement>;
getMemberEntitlements(top: number, skip: number, filter?: string, select?: string): Promise<MemberEntitlementManagementInterfaces.MemberEntitlement[]>;
updateMemberEntitlement(customHeaders: any, document: VSSInterfaces.JsonPatchDocument, memberId: string): Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPatchResponse>;
}
export class MemberEntitlementManagementApi extends basem.ClientApiBase implements IMemberEntitlementManagementApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-MemberEntitlementManagement-api');
}
/**
* Used to add members to a project in an account. It adds them to groups, assigns licenses, and assigns extensions.
*
* @param {MemberEntitlementManagementInterfaces.MemberEntitlement} memberEntitlement - Member model for where to add the member and what licenses and extensions they should receive.
*/
public async addMemberEntitlement(
memberEntitlement: MemberEntitlementManagementInterfaces.MemberEntitlement
): Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPostResponse> {
return new Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPostResponse>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MemberEntitlementManagement",
"1e8cabfb-1fda-461e-860f-eeeae54d06bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MemberEntitlementManagementInterfaces.MemberEntitlementsPostResponse>;
res = await this.rest.create<MemberEntitlementManagementInterfaces.MemberEntitlementsPostResponse>(url, memberEntitlement, options);
let ret = this.formatResponse(res.result,
MemberEntitlementManagementInterfaces.TypeInfo.MemberEntitlementsPostResponse,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Deletes members from an account
*
* @param {string} memberId - memberId of the member to be removed.
*/
public async deleteMemberEntitlement(
memberId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
memberId: memberId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MemberEntitlementManagement",
"1e8cabfb-1fda-461e-860f-eeeae54d06bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Used to get member entitlement information in an account
*
* @param {string} memberId
*/
public async getMemberEntitlement(
memberId: string
): Promise<MemberEntitlementManagementInterfaces.MemberEntitlement> {
return new Promise<MemberEntitlementManagementInterfaces.MemberEntitlement>(async (resolve, reject) => {
let routeValues: any = {
memberId: memberId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MemberEntitlementManagement",
"1e8cabfb-1fda-461e-860f-eeeae54d06bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MemberEntitlementManagementInterfaces.MemberEntitlement>;
res = await this.rest.get<MemberEntitlementManagementInterfaces.MemberEntitlement>(url, options);
let ret = this.formatResponse(res.result,
MemberEntitlementManagementInterfaces.TypeInfo.MemberEntitlement,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Used to get member entitlement information in an account
*
* @param {number} top
* @param {number} skip
* @param {string} filter
* @param {string} select
*/
public async getMemberEntitlements(
top: number,
skip: number,
filter?: string,
select?: string
): Promise<MemberEntitlementManagementInterfaces.MemberEntitlement[]> {
return new Promise<MemberEntitlementManagementInterfaces.MemberEntitlement[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
top: top,
skip: skip,
filter: filter,
select: select,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MemberEntitlementManagement",
"1e8cabfb-1fda-461e-860f-eeeae54d06bb",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MemberEntitlementManagementInterfaces.MemberEntitlement[]>;
res = await this.rest.get<MemberEntitlementManagementInterfaces.MemberEntitlement[]>(url, options);
let ret = this.formatResponse(res.result,
MemberEntitlementManagementInterfaces.TypeInfo.MemberEntitlement,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Used to edit a member in an account. Edits groups, licenses, and extensions.
*
* @param {VSSInterfaces.JsonPatchDocument} document - document of operations to be used
* @param {string} memberId - member Id of the member to be edit
*/
public async updateMemberEntitlement(
customHeaders: any,
document: VSSInterfaces.JsonPatchDocument,
memberId: string
): Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPatchResponse> {
return new Promise<MemberEntitlementManagementInterfaces.MemberEntitlementsPatchResponse>(async (resolve, reject) => {
let routeValues: any = {
memberId: memberId
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"MemberEntitlementManagement",
"1e8cabfb-1fda-461e-860f-eeeae54d06bb",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MemberEntitlementManagementInterfaces.MemberEntitlementsPatchResponse>;
res = await this.rest.update<MemberEntitlementManagementInterfaces.MemberEntitlementsPatchResponse>(url, document, options);
let ret = this.formatResponse(res.result,
MemberEntitlementManagementInterfaces.TypeInfo.MemberEntitlementsPatchResponse,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

67
api/MigrationApi.ts Normal file
Просмотреть файл

@ -0,0 +1,67 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import MigrationInterfaces = require("./interfaces/MigrationInterfaces");
export interface IMigrationApi extends basem.ClientApiBase {
createSasToken(request: MigrationInterfaces.SasTokenInfo): Promise<MigrationInterfaces.SasTokenInfo>;
}
export class MigrationApi extends basem.ClientApiBase implements IMigrationApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Migration-api');
}
/**
* @param {MigrationInterfaces.SasTokenInfo} request
*/
public async createSasToken(
request: MigrationInterfaces.SasTokenInfo
): Promise<MigrationInterfaces.SasTokenInfo> {
return new Promise<MigrationInterfaces.SasTokenInfo>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Migration",
"d6978331-6b7a-4c2a-905f-7797d31a92a0",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<MigrationInterfaces.SasTokenInfo>;
res = await this.rest.create<MigrationInterfaces.SasTokenInfo>(url, request, options);
let ret = this.formatResponse(res.result,
MigrationInterfaces.TypeInfo.SasTokenInfo,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

613
api/NotificationApi.ts Normal file
Просмотреть файл

@ -0,0 +1,613 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import NotificationInterfaces = require("./interfaces/NotificationInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface INotificationApi extends basem.ClientApiBase {
performBatchNotificationOperations(operation: NotificationInterfaces.BatchNotificationOperation): Promise<void>;
publishEvent(notificationEvent: VSSInterfaces.VssNotificationEvent): Promise<VSSInterfaces.VssNotificationEvent>;
queryEventTypes(inputValuesQuery: NotificationInterfaces.FieldValuesQuery, eventType: string): Promise<NotificationInterfaces.NotificationEventField[]>;
getEventType(eventType: string): Promise<NotificationInterfaces.NotificationEventType>;
listEventTypes(publisherId?: string): Promise<NotificationInterfaces.NotificationEventType[]>;
queryStatistics(statisticsQuery: NotificationInterfaces.NotificationStatisticsQuery): Promise<NotificationInterfaces.NotificationStatistic[]>;
querySubscriptions(subscriptionQuery: NotificationInterfaces.SubscriptionQuery): Promise<NotificationInterfaces.NotificationSubscription[]>;
createSubscription(createParameters: NotificationInterfaces.NotificationSubscriptionCreateParameters): Promise<NotificationInterfaces.NotificationSubscription>;
deleteSubscription(subscriptionId: string): Promise<void>;
getSubscription(subscriptionId: string, queryFlags?: NotificationInterfaces.SubscriptionQueryFlags): Promise<NotificationInterfaces.NotificationSubscription>;
listSubscriptions(subscriber?: string, queryFlags?: NotificationInterfaces.SubscriptionQueryFlags): Promise<NotificationInterfaces.NotificationSubscription[]>;
updateSubscription(updateParameters: NotificationInterfaces.NotificationSubscriptionUpdateParameters, subscriptionId: string): Promise<NotificationInterfaces.NotificationSubscription>;
getSubscriptionTemplates(): Promise<NotificationInterfaces.NotificationSubscriptionTemplate[]>;
updateSubscriptionUserSettings(userSettings: NotificationInterfaces.SubscriptionUserSettings, subscriptionId: string, userId: string): Promise<NotificationInterfaces.SubscriptionUserSettings>;
}
export class NotificationApi extends basem.ClientApiBase implements INotificationApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Notification-api');
}
/**
* @param {NotificationInterfaces.BatchNotificationOperation} operation
*/
public async performBatchNotificationOperations(
operation: NotificationInterfaces.BatchNotificationOperation
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"8f3c6ab2-5bae-4537-b16e-f84e0955599e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, operation, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Publish an event.
*
* @param {VSSInterfaces.VssNotificationEvent} notificationEvent
*/
public async publishEvent(
notificationEvent: VSSInterfaces.VssNotificationEvent
): Promise<VSSInterfaces.VssNotificationEvent> {
return new Promise<VSSInterfaces.VssNotificationEvent>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"14c57b7a-c0e6-4555-9f51-e067188fdd8e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VSSInterfaces.VssNotificationEvent>;
res = await this.rest.create<VSSInterfaces.VssNotificationEvent>(url, notificationEvent, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {NotificationInterfaces.FieldValuesQuery} inputValuesQuery
* @param {string} eventType
*/
public async queryEventTypes(
inputValuesQuery: NotificationInterfaces.FieldValuesQuery,
eventType: string
): Promise<NotificationInterfaces.NotificationEventField[]> {
return new Promise<NotificationInterfaces.NotificationEventField[]>(async (resolve, reject) => {
let routeValues: any = {
eventType: eventType
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"b5bbdd21-c178-4398-b6db-0166d910028a",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationEventField[]>;
res = await this.rest.create<NotificationInterfaces.NotificationEventField[]>(url, inputValuesQuery, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get a specific event type.
*
* @param {string} eventType
*/
public async getEventType(
eventType: string
): Promise<NotificationInterfaces.NotificationEventType> {
return new Promise<NotificationInterfaces.NotificationEventType>(async (resolve, reject) => {
let routeValues: any = {
eventType: eventType
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationEventType>;
res = await this.rest.get<NotificationInterfaces.NotificationEventType>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* List available event types for this service. Optionally filter by event types for the specified publisher.
*
* @param {string} publisherId
*/
public async listEventTypes(
publisherId?: string
): Promise<NotificationInterfaces.NotificationEventType[]> {
return new Promise<NotificationInterfaces.NotificationEventType[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
publisherId: publisherId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationEventType[]>;
res = await this.rest.get<NotificationInterfaces.NotificationEventType[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {NotificationInterfaces.NotificationStatisticsQuery} statisticsQuery
*/
public async queryStatistics(
statisticsQuery: NotificationInterfaces.NotificationStatisticsQuery
): Promise<NotificationInterfaces.NotificationStatistic[]> {
return new Promise<NotificationInterfaces.NotificationStatistic[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"77878ce9-6391-49af-aa9d-768ac784461f",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationStatistic[]>;
res = await this.rest.create<NotificationInterfaces.NotificationStatistic[]>(url, statisticsQuery, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationStatistic,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Query for notification subscriptions.
*
* @param {NotificationInterfaces.SubscriptionQuery} subscriptionQuery
*/
public async querySubscriptions(
subscriptionQuery: NotificationInterfaces.SubscriptionQuery
): Promise<NotificationInterfaces.NotificationSubscription[]> {
return new Promise<NotificationInterfaces.NotificationSubscription[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"6864db85-08c0-4006-8e8e-cc1bebe31675",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscription[]>;
res = await this.rest.create<NotificationInterfaces.NotificationSubscription[]>(url, subscriptionQuery, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscription,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create a notification subscription.
*
* @param {NotificationInterfaces.NotificationSubscriptionCreateParameters} createParameters
*/
public async createSubscription(
createParameters: NotificationInterfaces.NotificationSubscriptionCreateParameters
): Promise<NotificationInterfaces.NotificationSubscription> {
return new Promise<NotificationInterfaces.NotificationSubscription>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"70f911d6-abac-488c-85b3-a206bf57e165",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscription>;
res = await this.rest.create<NotificationInterfaces.NotificationSubscription>(url, createParameters, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Delete a notification subscription.
*
* @param {string} subscriptionId
*/
public async deleteSubscription(
subscriptionId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"70f911d6-abac-488c-85b3-a206bf57e165",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get a notification subscription.
*
* @param {string} subscriptionId
* @param {NotificationInterfaces.SubscriptionQueryFlags} queryFlags
*/
public async getSubscription(
subscriptionId: string,
queryFlags?: NotificationInterfaces.SubscriptionQueryFlags
): Promise<NotificationInterfaces.NotificationSubscription> {
return new Promise<NotificationInterfaces.NotificationSubscription>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
let queryValues: any = {
queryFlags: queryFlags,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"70f911d6-abac-488c-85b3-a206bf57e165",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscription>;
res = await this.rest.get<NotificationInterfaces.NotificationSubscription>(url, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get a list of subscriptions for the specified subscriber. If no subscriber is specified, subscriptions for the calling user are returned.
*
* @param {string} subscriber
* @param {NotificationInterfaces.SubscriptionQueryFlags} queryFlags
*/
public async listSubscriptions(
subscriber?: string,
queryFlags?: NotificationInterfaces.SubscriptionQueryFlags
): Promise<NotificationInterfaces.NotificationSubscription[]> {
return new Promise<NotificationInterfaces.NotificationSubscription[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
subscriber: subscriber,
queryFlags: queryFlags,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"70f911d6-abac-488c-85b3-a206bf57e165",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscription[]>;
res = await this.rest.get<NotificationInterfaces.NotificationSubscription[]>(url, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscription,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update an existing notification subscription.
*
* @param {NotificationInterfaces.NotificationSubscriptionUpdateParameters} updateParameters
* @param {string} subscriptionId
*/
public async updateSubscription(
updateParameters: NotificationInterfaces.NotificationSubscriptionUpdateParameters,
subscriptionId: string
): Promise<NotificationInterfaces.NotificationSubscription> {
return new Promise<NotificationInterfaces.NotificationSubscription>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"70f911d6-abac-488c-85b3-a206bf57e165",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscription>;
res = await this.rest.update<NotificationInterfaces.NotificationSubscription>(url, updateParameters, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getSubscriptionTemplates(
): Promise<NotificationInterfaces.NotificationSubscriptionTemplate[]> {
return new Promise<NotificationInterfaces.NotificationSubscriptionTemplate[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"fa5d24ba-7484-4f3d-888d-4ec6b1974082",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.NotificationSubscriptionTemplate[]>;
res = await this.rest.get<NotificationInterfaces.NotificationSubscriptionTemplate[]>(url, options);
let ret = this.formatResponse(res.result,
NotificationInterfaces.TypeInfo.NotificationSubscriptionTemplate,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {NotificationInterfaces.SubscriptionUserSettings} userSettings
* @param {string} subscriptionId
* @param {string} userId
*/
public async updateSubscriptionUserSettings(
userSettings: NotificationInterfaces.SubscriptionUserSettings,
subscriptionId: string,
userId: string
): Promise<NotificationInterfaces.SubscriptionUserSettings> {
return new Promise<NotificationInterfaces.SubscriptionUserSettings>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId,
userId: userId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"notification",
"ed5a3dff-aeb5-41b1-b4f7-89e66e58b62e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NotificationInterfaces.SubscriptionUserSettings>;
res = await this.rest.replace<NotificationInterfaces.SubscriptionUserSettings>(url, userSettings, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

81
api/NuGetInternalApi.ts Normal file
Просмотреть файл

@ -0,0 +1,81 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import NuGetInternalInterfaces = require("./interfaces/NuGetInternalInterfaces");
export interface INuGetInternalApi extends basem.ClientApiBase {
getPackageVersion(feedId: string, packageName: string, packageVersion: string, showDeleted?: boolean): Promise<NuGetInternalInterfaces.InternalNuGetMetadataEntry>;
}
export class NuGetInternalApi extends basem.ClientApiBase implements INuGetInternalApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-NuGetInternal-api');
}
/**
* @param {string} feedId
* @param {string} packageName
* @param {string} packageVersion
* @param {boolean} showDeleted
*/
public async getPackageVersion(
feedId: string,
packageName: string,
packageVersion: string,
showDeleted?: boolean
): Promise<NuGetInternalInterfaces.InternalNuGetMetadataEntry> {
return new Promise<NuGetInternalInterfaces.InternalNuGetMetadataEntry>(async (resolve, reject) => {
let routeValues: any = {
feedId: feedId,
packageName: packageName,
packageVersion: packageVersion
};
let queryValues: any = {
showDeleted: showDeleted,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"nugetInternal",
"89262d36-dccd-4f20-b1ff-1dcd2d3e61d0",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<NuGetInternalInterfaces.InternalNuGetMetadataEntry>;
res = await this.rest.get<NuGetInternalInterfaces.InternalNuGetMetadataEntry>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

70
api/OperationsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,70 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import OperationsInterfaces = require("./interfaces/OperationsInterfaces");
export interface IOperationsApi extends basem.ClientApiBase {
getOperation(operationId: string): Promise<OperationsInterfaces.Operation>;
}
export class OperationsApi extends basem.ClientApiBase implements IOperationsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Operations-api');
}
/**
* Gets an operation from the the Id.
*
* @param {string} operationId - The id for the operation.
*/
public async getOperation(
operationId: string
): Promise<OperationsInterfaces.Operation> {
return new Promise<OperationsInterfaces.Operation>(async (resolve, reject) => {
let routeValues: any = {
operationId: operationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"operations",
"9a1b74b4-2ca8-4a9f-8470-c2f2e6fdc949",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OperationsInterfaces.Operation>;
res = await this.rest.get<OperationsInterfaces.Operation>(url, options);
let ret = this.formatResponse(res.result,
OperationsInterfaces.TypeInfo.Operation,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

661
api/OrganizationApi.ts Normal file
Просмотреть файл

@ -0,0 +1,661 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import OrganizationInterfaces = require("./interfaces/OrganizationInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IOrganizationApi extends basem.ClientApiBase {
updateCollectionProperties(customHeaders: any, collectionId: string, patchDocument: VSSInterfaces.JsonPatchDocument): Promise<boolean>;
createCollection(resource: OrganizationInterfaces.Collection): Promise<OrganizationInterfaces.Collection>;
deleteCollection(collectionId: string): Promise<boolean>;
getCollection(collectionId: string, propertyNames?: string[]): Promise<OrganizationInterfaces.Collection>;
getCollections(): Promise<OrganizationInterfaces.Collection[]>;
restoreCollection(collectionId: string, collectionName: string): Promise<boolean>;
updateCollection(customHeaders: any, patchDocument: VSSInterfaces.JsonPatchDocument, collectionId: string): Promise<OrganizationInterfaces.Collection>;
exportOrganizationMigrationBlob(organizationId: string): Promise<OrganizationInterfaces.OrganizationMigrationBlob>;
importOrganizationMigrationBlob(migrationBlob: OrganizationInterfaces.OrganizationMigrationBlob): Promise<void>;
updateOrganizationProperties(customHeaders: any, organizationId: string, patchDocument: VSSInterfaces.JsonPatchDocument): Promise<boolean>;
createOrganization(resource: OrganizationInterfaces.Organization): Promise<OrganizationInterfaces.Organization>;
getOrganization(organizationId: string, propertyNames?: string[]): Promise<OrganizationInterfaces.Organization>;
getOrganizations(searchKind: OrganizationInterfaces.OrganizationSearchKind, searchValue: string, isActivated?: boolean): Promise<OrganizationInterfaces.Organization[]>;
updateOrganization(customHeaders: any, patchDocument: VSSInterfaces.JsonPatchDocument, organizationId: string): Promise<OrganizationInterfaces.Organization>;
getRegions(): Promise<OrganizationInterfaces.Region[]>;
}
export class OrganizationApi extends basem.ClientApiBase implements IOrganizationApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Organization-api');
}
/**
* @param {string} collectionId
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
*/
public async updateCollectionProperties(
customHeaders: any,
collectionId: string,
patchDocument: VSSInterfaces.JsonPatchDocument
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
collectionId: collectionId
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"a0f9c508-a3c4-456b-a812-3fb0c4743521",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.update<boolean>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {OrganizationInterfaces.Collection} resource
*/
public async createCollection(
resource: OrganizationInterfaces.Collection
): Promise<OrganizationInterfaces.Collection> {
return new Promise<OrganizationInterfaces.Collection>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Collection>;
res = await this.rest.create<OrganizationInterfaces.Collection>(url, resource, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Collection,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} collectionId
*/
public async deleteCollection(
collectionId: string
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
collectionId: collectionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.del<boolean>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} collectionId
* @param {string[]} propertyNames
*/
public async getCollection(
collectionId: string,
propertyNames?: string[]
): Promise<OrganizationInterfaces.Collection> {
return new Promise<OrganizationInterfaces.Collection>(async (resolve, reject) => {
let routeValues: any = {
collectionId: collectionId
};
let queryValues: any = {
propertyNames: propertyNames && propertyNames.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Collection>;
res = await this.rest.get<OrganizationInterfaces.Collection>(url, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Collection,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getCollections(
): Promise<OrganizationInterfaces.Collection[]> {
return new Promise<OrganizationInterfaces.Collection[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Collection[]>;
res = await this.rest.get<OrganizationInterfaces.Collection[]>(url, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Collection,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} collectionId
* @param {string} collectionName
*/
public async restoreCollection(
collectionId: string,
collectionName: string
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
collectionId: collectionId
};
let queryValues: any = {
collectionName: collectionName,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.update<boolean>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
* @param {string} collectionId
*/
public async updateCollection(
customHeaders: any,
patchDocument: VSSInterfaces.JsonPatchDocument,
collectionId: string
): Promise<OrganizationInterfaces.Collection> {
return new Promise<OrganizationInterfaces.Collection>(async (resolve, reject) => {
let routeValues: any = {
collectionId: collectionId
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"668b5607-0db2-49bb-83f8-5f46f1094250",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Collection>;
res = await this.rest.update<OrganizationInterfaces.Collection>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Collection,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} organizationId
*/
public async exportOrganizationMigrationBlob(
organizationId: string
): Promise<OrganizationInterfaces.OrganizationMigrationBlob> {
return new Promise<OrganizationInterfaces.OrganizationMigrationBlob>(async (resolve, reject) => {
let routeValues: any = {
organizationId: organizationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"93f69239-28ba-497e-b4d4-33e51e6303c3",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.OrganizationMigrationBlob>;
res = await this.rest.get<OrganizationInterfaces.OrganizationMigrationBlob>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {OrganizationInterfaces.OrganizationMigrationBlob} migrationBlob
*/
public async importOrganizationMigrationBlob(
migrationBlob: OrganizationInterfaces.OrganizationMigrationBlob
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"93f69239-28ba-497e-b4d4-33e51e6303c3",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, migrationBlob, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} organizationId
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
*/
public async updateOrganizationProperties(
customHeaders: any,
organizationId: string,
patchDocument: VSSInterfaces.JsonPatchDocument
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
organizationId: organizationId
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"103707c6-236d-4434-a0a2-9031fbb65fa6",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.update<boolean>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {OrganizationInterfaces.Organization} resource
*/
public async createOrganization(
resource: OrganizationInterfaces.Organization
): Promise<OrganizationInterfaces.Organization> {
return new Promise<OrganizationInterfaces.Organization>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"95f49097-6cdc-4afe-a039-48b4d4c4cbf7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Organization>;
res = await this.rest.create<OrganizationInterfaces.Organization>(url, resource, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Organization,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} organizationId
* @param {string[]} propertyNames
*/
public async getOrganization(
organizationId: string,
propertyNames?: string[]
): Promise<OrganizationInterfaces.Organization> {
return new Promise<OrganizationInterfaces.Organization>(async (resolve, reject) => {
let routeValues: any = {
organizationId: organizationId
};
let queryValues: any = {
propertyNames: propertyNames && propertyNames.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"95f49097-6cdc-4afe-a039-48b4d4c4cbf7",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Organization>;
res = await this.rest.get<OrganizationInterfaces.Organization>(url, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Organization,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {OrganizationInterfaces.OrganizationSearchKind} searchKind
* @param {string} searchValue
* @param {boolean} isActivated
*/
public async getOrganizations(
searchKind: OrganizationInterfaces.OrganizationSearchKind,
searchValue: string,
isActivated?: boolean
): Promise<OrganizationInterfaces.Organization[]> {
return new Promise<OrganizationInterfaces.Organization[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
searchKind: searchKind,
searchValue: searchValue,
isActivated: isActivated,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"95f49097-6cdc-4afe-a039-48b4d4c4cbf7",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Organization[]>;
res = await this.rest.get<OrganizationInterfaces.Organization[]>(url, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Organization,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
* @param {string} organizationId
*/
public async updateOrganization(
customHeaders: any,
patchDocument: VSSInterfaces.JsonPatchDocument,
organizationId: string
): Promise<OrganizationInterfaces.Organization> {
return new Promise<OrganizationInterfaces.Organization>(async (resolve, reject) => {
let routeValues: any = {
organizationId: organizationId
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"95f49097-6cdc-4afe-a039-48b4d4c4cbf7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Organization>;
res = await this.rest.update<OrganizationInterfaces.Organization>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
OrganizationInterfaces.TypeInfo.Organization,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getRegions(
): Promise<OrganizationInterfaces.Region[]> {
return new Promise<OrganizationInterfaces.Region[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Organization",
"6f84936f-1801-46f6-94fa-1817545d366d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationInterfaces.Region[]>;
res = await this.rest.get<OrganizationInterfaces.Region[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -0,0 +1,249 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import OrganizationPolicyInterfaces = require("./interfaces/OrganizationPolicyInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IOrganizationPolicyApi extends basem.ClientApiBase {
getPolicy(policyName: string, defaultValue: string): Promise<OrganizationPolicyInterfaces.Policy>;
updatePolicy(customHeaders: any, patchDocument: VSSInterfaces.JsonPatchDocument, policyName: string): Promise<void>;
getPolicies(policyNames: string[], defaultValues: string[]): Promise<{ [key: string] : OrganizationPolicyInterfaces.Policy; }>;
getPolicyInformation(policyName: string): Promise<OrganizationPolicyInterfaces.PolicyInfo>;
getPolicyInformations(policyNames?: string[]): Promise<{ [key: string] : OrganizationPolicyInterfaces.PolicyInfo; }>;
}
export class OrganizationPolicyApi extends basem.ClientApiBase implements IOrganizationPolicyApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-OrganizationPolicy-api');
}
/**
* @param {string} policyName
* @param {string} defaultValue
*/
public async getPolicy(
policyName: string,
defaultValue: string
): Promise<OrganizationPolicyInterfaces.Policy> {
return new Promise<OrganizationPolicyInterfaces.Policy>(async (resolve, reject) => {
let routeValues: any = {
policyName: policyName
};
let queryValues: any = {
defaultValue: defaultValue,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"OrganizationPolicy",
"d0ab077b-1b97-4f78-984c-cfe2d248fc79",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationPolicyInterfaces.Policy>;
res = await this.rest.get<OrganizationPolicyInterfaces.Policy>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.JsonPatchDocument} patchDocument
* @param {string} policyName
*/
public async updatePolicy(
customHeaders: any,
patchDocument: VSSInterfaces.JsonPatchDocument,
policyName: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
policyName: policyName
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/json-patch+json";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"OrganizationPolicy",
"d0ab077b-1b97-4f78-984c-cfe2d248fc79",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, patchDocument, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string[]} policyNames
* @param {string[]} defaultValues
*/
public async getPolicies(
policyNames: string[],
defaultValues: string[]
): Promise<{ [key: string] : OrganizationPolicyInterfaces.Policy; }> {
return new Promise<{ [key: string] : OrganizationPolicyInterfaces.Policy; }>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
policyNames: policyNames && policyNames.join(","),
defaultValues: defaultValues && defaultValues.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"OrganizationPolicy",
"7ef423e0-59d8-4c00-b951-7143b18bd97b",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : OrganizationPolicyInterfaces.Policy; }>;
res = await this.rest.get<{ [key: string] : OrganizationPolicyInterfaces.Policy; }>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} policyName
*/
public async getPolicyInformation(
policyName: string
): Promise<OrganizationPolicyInterfaces.PolicyInfo> {
return new Promise<OrganizationPolicyInterfaces.PolicyInfo>(async (resolve, reject) => {
let routeValues: any = {
policyName: policyName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"OrganizationPolicy",
"222af71b-7280-4a95-80e4-dcb0deeac834",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<OrganizationPolicyInterfaces.PolicyInfo>;
res = await this.rest.get<OrganizationPolicyInterfaces.PolicyInfo>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string[]} policyNames
*/
public async getPolicyInformations(
policyNames?: string[]
): Promise<{ [key: string] : OrganizationPolicyInterfaces.PolicyInfo; }> {
return new Promise<{ [key: string] : OrganizationPolicyInterfaces.PolicyInfo; }>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
policyNames: policyNames && policyNames.join(","),
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"OrganizationPolicy",
"222af71b-7280-4a95-80e4-dcb0deeac834",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : OrganizationPolicyInterfaces.PolicyInfo; }>;
res = await this.rest.get<{ [key: string] : OrganizationPolicyInterfaces.PolicyInfo; }>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -0,0 +1,73 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import PackagingDiagnosticsInterfaces = require("./interfaces/PackagingDiagnosticsInterfaces");
export interface IPackagingDiagnosticsApi extends basem.ClientApiBase {
getItem(experience: string, item: string): Promise<PackagingDiagnosticsInterfaces.ItemStoreItem>;
}
export class PackagingDiagnosticsApi extends basem.ClientApiBase implements IPackagingDiagnosticsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-PackagingDiagnostics-api');
}
/**
* Exposes ItemStore items to the AccountAdmin service. This is an undocumented internal API intended only to support engineering diagnostics via the AccountAdmin service. Do not rely on its existence or structure. This API can only be called by the AccountAdmin service.
*
* @param {string} experience
* @param {string} item
*/
public async getItem(
experience: string,
item: string
): Promise<PackagingDiagnosticsInterfaces.ItemStoreItem> {
return new Promise<PackagingDiagnosticsInterfaces.ItemStoreItem>(async (resolve, reject) => {
let routeValues: any = {
experience: experience,
item: item
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"PackagingDiagnostics",
"590f8ec4-01ec-46ea-907e-f2aafa542f89",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PackagingDiagnosticsInterfaces.ItemStoreItem>;
res = await this.rest.get<PackagingDiagnosticsInterfaces.ItemStoreItem>(url, options);
let ret = this.formatResponse(res.result,
PackagingDiagnosticsInterfaces.TypeInfo.ItemStoreItem,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

557
api/PolicyApi.ts Normal file
Просмотреть файл

@ -0,0 +1,557 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import PolicyInterfaces = require("./interfaces/PolicyInterfaces");
export interface IPolicyApi extends basem.ClientApiBase {
createPolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string, configurationId?: number): Promise<PolicyInterfaces.PolicyConfiguration>;
deletePolicyConfiguration(project: string, configurationId: number): Promise<void>;
getPolicyConfiguration(project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
getPolicyConfigurations(project: string): Promise<PolicyInterfaces.PolicyConfiguration[]>;
updatePolicyConfiguration(configuration: PolicyInterfaces.PolicyConfiguration, project: string, configurationId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
getPolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
requeuePolicyEvaluation(project: string, evaluationId: string): Promise<PolicyInterfaces.PolicyEvaluationRecord>;
getPolicyEvaluations(project: string, artifactId: string, includeNotApplicable?: boolean, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyEvaluationRecord[]>;
getPolicyConfigurationRevision(project: string, configurationId: number, revisionId: number): Promise<PolicyInterfaces.PolicyConfiguration>;
getPolicyConfigurationRevisions(project: string, configurationId: number, top?: number, skip?: number): Promise<PolicyInterfaces.PolicyConfiguration[]>;
getPolicyType(project: string, typeId: string): Promise<PolicyInterfaces.PolicyType>;
getPolicyTypes(project: string): Promise<PolicyInterfaces.PolicyType[]>;
}
export class PolicyApi extends basem.ClientApiBase implements IPolicyApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Policy-api');
}
/**
* @param {PolicyInterfaces.PolicyConfiguration} configuration
* @param {string} project - Project ID or project name
* @param {number} configurationId
*/
public async createPolicyConfiguration(
configuration: PolicyInterfaces.PolicyConfiguration,
project: string,
configurationId?: number
): Promise<PolicyInterfaces.PolicyConfiguration> {
return new Promise<PolicyInterfaces.PolicyConfiguration>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"dad91cbe-d183-45f8-9c6e-9c1164472121",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration>;
res = await this.rest.create<PolicyInterfaces.PolicyConfiguration>(url, configuration, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {number} configurationId
*/
public async deletePolicyConfiguration(
project: string,
configurationId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"dad91cbe-d183-45f8-9c6e-9c1164472121",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {number} configurationId
*/
public async getPolicyConfiguration(
project: string,
configurationId: number
): Promise<PolicyInterfaces.PolicyConfiguration> {
return new Promise<PolicyInterfaces.PolicyConfiguration>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"dad91cbe-d183-45f8-9c6e-9c1164472121",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration>;
res = await this.rest.get<PolicyInterfaces.PolicyConfiguration>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
*/
public async getPolicyConfigurations(
project: string
): Promise<PolicyInterfaces.PolicyConfiguration[]> {
return new Promise<PolicyInterfaces.PolicyConfiguration[]>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"dad91cbe-d183-45f8-9c6e-9c1164472121",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration[]>;
res = await this.rest.get<PolicyInterfaces.PolicyConfiguration[]>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {PolicyInterfaces.PolicyConfiguration} configuration
* @param {string} project - Project ID or project name
* @param {number} configurationId
*/
public async updatePolicyConfiguration(
configuration: PolicyInterfaces.PolicyConfiguration,
project: string,
configurationId: number
): Promise<PolicyInterfaces.PolicyConfiguration> {
return new Promise<PolicyInterfaces.PolicyConfiguration>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"dad91cbe-d183-45f8-9c6e-9c1164472121",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration>;
res = await this.rest.replace<PolicyInterfaces.PolicyConfiguration>(url, configuration, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} evaluationId
*/
public async getPolicyEvaluation(
project: string,
evaluationId: string
): Promise<PolicyInterfaces.PolicyEvaluationRecord> {
return new Promise<PolicyInterfaces.PolicyEvaluationRecord>(async (resolve, reject) => {
let routeValues: any = {
project: project,
evaluationId: evaluationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"46aecb7a-5d2c-4647-897b-0209505a9fe4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyEvaluationRecord>;
res = await this.rest.get<PolicyInterfaces.PolicyEvaluationRecord>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyEvaluationRecord,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} evaluationId
*/
public async requeuePolicyEvaluation(
project: string,
evaluationId: string
): Promise<PolicyInterfaces.PolicyEvaluationRecord> {
return new Promise<PolicyInterfaces.PolicyEvaluationRecord>(async (resolve, reject) => {
let routeValues: any = {
project: project,
evaluationId: evaluationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"46aecb7a-5d2c-4647-897b-0209505a9fe4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyEvaluationRecord>;
res = await this.rest.update<PolicyInterfaces.PolicyEvaluationRecord>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyEvaluationRecord,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} artifactId
* @param {boolean} includeNotApplicable
* @param {number} top
* @param {number} skip
*/
public async getPolicyEvaluations(
project: string,
artifactId: string,
includeNotApplicable?: boolean,
top?: number,
skip?: number
): Promise<PolicyInterfaces.PolicyEvaluationRecord[]> {
return new Promise<PolicyInterfaces.PolicyEvaluationRecord[]>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
let queryValues: any = {
artifactId: artifactId,
includeNotApplicable: includeNotApplicable,
'$top': top,
'$skip': skip,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"c23ddff5-229c-4d04-a80b-0fdce9f360c8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyEvaluationRecord[]>;
res = await this.rest.get<PolicyInterfaces.PolicyEvaluationRecord[]>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyEvaluationRecord,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {number} configurationId
* @param {number} revisionId
*/
public async getPolicyConfigurationRevision(
project: string,
configurationId: number,
revisionId: number
): Promise<PolicyInterfaces.PolicyConfiguration> {
return new Promise<PolicyInterfaces.PolicyConfiguration>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId,
revisionId: revisionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"fe1e68a2-60d3-43cb-855b-85e41ae97c95",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration>;
res = await this.rest.get<PolicyInterfaces.PolicyConfiguration>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {number} configurationId
* @param {number} top
* @param {number} skip
*/
public async getPolicyConfigurationRevisions(
project: string,
configurationId: number,
top?: number,
skip?: number
): Promise<PolicyInterfaces.PolicyConfiguration[]> {
return new Promise<PolicyInterfaces.PolicyConfiguration[]>(async (resolve, reject) => {
let routeValues: any = {
project: project,
configurationId: configurationId
};
let queryValues: any = {
'$top': top,
'$skip': skip,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"fe1e68a2-60d3-43cb-855b-85e41ae97c95",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyConfiguration[]>;
res = await this.rest.get<PolicyInterfaces.PolicyConfiguration[]>(url, options);
let ret = this.formatResponse(res.result,
PolicyInterfaces.TypeInfo.PolicyConfiguration,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} typeId
*/
public async getPolicyType(
project: string,
typeId: string
): Promise<PolicyInterfaces.PolicyType> {
return new Promise<PolicyInterfaces.PolicyType>(async (resolve, reject) => {
let routeValues: any = {
project: project,
typeId: typeId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"44096322-2d3d-466a-bb30-d1b7de69f61f",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyType>;
res = await this.rest.get<PolicyInterfaces.PolicyType>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
*/
public async getPolicyTypes(
project: string
): Promise<PolicyInterfaces.PolicyType[]> {
return new Promise<PolicyInterfaces.PolicyType[]>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"policy",
"44096322-2d3d-466a-bb30-d1b7de69f61f",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<PolicyInterfaces.PolicyType[]>;
res = await this.rest.get<PolicyInterfaces.PolicyType[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

106
api/ProcessApi.ts Normal file
Просмотреть файл

@ -0,0 +1,106 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ProcessInterfaces = require("./interfaces/ProcessInterfaces");
export interface IProcessApi extends basem.ClientApiBase {
getProcessById(processId: string): Promise<ProcessInterfaces.Process>;
getProcesses(): Promise<ProcessInterfaces.Process[]>;
}
export class ProcessApi extends basem.ClientApiBase implements IProcessApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Core-api');
}
/**
* Retrieve process by id
*
* @param {string} processId
*/
public async getProcessById(
processId: string
): Promise<ProcessInterfaces.Process> {
return new Promise<ProcessInterfaces.Process>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"93878975-88c5-4e6a-8abb-7ddd77a8a7d8",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProcessInterfaces.Process>;
res = await this.rest.get<ProcessInterfaces.Process>(url, options);
let ret = this.formatResponse(res.result,
ProcessInterfaces.TypeInfo.Process,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getProcesses(
): Promise<ProcessInterfaces.Process[]> {
return new Promise<ProcessInterfaces.Process[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"93878975-88c5-4e6a-8abb-7ddd77a8a7d8",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProcessInterfaces.Process[]>;
res = await this.rest.get<ProcessInterfaces.Process[]>(url, options);
let ret = this.formatResponse(res.result,
ProcessInterfaces.TypeInfo.Process,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

799
api/ProfileApi.ts Normal file
Просмотреть файл

@ -0,0 +1,799 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ProfileInterfaces = require("./interfaces/ProfileInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface IProfileApi extends basem.ClientApiBase {
deleteProfileAttribute(id: string, descriptor: string): Promise<void>;
getProfileAttribute(id: string, descriptor: string): Promise<ProfileInterfaces.ProfileAttribute>;
getProfileAttributes(id: string, partition: string, modifiedSince?: string, modifiedAfterRevision?: string, withCoreAttributes?: boolean, coreAttributes?: string): Promise<ProfileInterfaces.ProfileAttribute[]>;
setProfileAttribute(container: any, id: string, descriptor: string): Promise<void>;
setProfileAttributes(attributesCollection: VSSInterfaces.VssJsonCollectionWrapperV<ProfileInterfaces.ProfileAttributeBase<any>[]>, id: string): Promise<void>;
getAvatar(id: string, size?: string, format?: string): Promise<ProfileInterfaces.Avatar>;
getAvatarPreview(container: any, id: string, size?: string, format?: string, displayName?: string): Promise<ProfileInterfaces.Avatar>;
resetAvatar(id: string): Promise<void>;
setAvatar(container: any, id: string): Promise<void>;
getGeoRegion(ipaddress: string): Promise<ProfileInterfaces.GeoRegion>;
createProfile(createProfileContext: ProfileInterfaces.CreateProfileContext, autoCreate?: boolean): Promise<ProfileInterfaces.Profile>;
getProfile(id: string, details?: boolean, withAttributes?: boolean, partition?: string, coreAttributes?: string, forceRefresh?: boolean): Promise<ProfileInterfaces.Profile>;
updateProfile(profile: ProfileInterfaces.Profile, id: string): Promise<void>;
getRegions(): Promise<ProfileInterfaces.ProfileRegions>;
getSupportedLcids(): Promise<string[]>;
getUserDefaults(includeAvatar?: boolean): Promise<ProfileInterfaces.Profile>;
refreshUserDefaults(id: string): Promise<ProfileInterfaces.Profile>;
}
export class ProfileApi extends basem.ClientApiBase implements IProfileApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Profile-api');
}
/**
* @param {string} id
* @param {string} descriptor
*/
public async deleteProfileAttribute(
id: string,
descriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
descriptor: descriptor,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Profile",
"1392b6ac-d511-492e-af5b-2263e5545a5d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
* @param {string} descriptor
*/
public async getProfileAttribute(
id: string,
descriptor: string
): Promise<ProfileInterfaces.ProfileAttribute> {
return new Promise<ProfileInterfaces.ProfileAttribute>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
descriptor: descriptor,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Profile",
"1392b6ac-d511-492e-af5b-2263e5545a5d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.ProfileAttribute>;
res = await this.rest.get<ProfileInterfaces.ProfileAttribute>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.ProfileAttribute,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
* @param {string} partition
* @param {string} modifiedSince
* @param {string} modifiedAfterRevision
* @param {boolean} withCoreAttributes
* @param {string} coreAttributes
*/
public async getProfileAttributes(
id: string,
partition: string,
modifiedSince?: string,
modifiedAfterRevision?: string,
withCoreAttributes?: boolean,
coreAttributes?: string
): Promise<ProfileInterfaces.ProfileAttribute[]> {
return new Promise<ProfileInterfaces.ProfileAttribute[]>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
partition: partition,
modifiedSince: modifiedSince,
modifiedAfterRevision: modifiedAfterRevision,
withCoreAttributes: withCoreAttributes,
coreAttributes: coreAttributes,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Profile",
"1392b6ac-d511-492e-af5b-2263e5545a5d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.ProfileAttribute[]>;
res = await this.rest.get<ProfileInterfaces.ProfileAttribute[]>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.ProfileAttribute,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} container
* @param {string} id
* @param {string} descriptor
*/
public async setProfileAttribute(
container: any,
id: string,
descriptor: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
descriptor: descriptor,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Profile",
"1392b6ac-d511-492e-af5b-2263e5545a5d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.replace<void>(url, container, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.VssJsonCollectionWrapperV<ProfileInterfaces.ProfileAttributeBase<any>[]>} attributesCollection
* @param {string} id
*/
public async setProfileAttributes(
attributesCollection: VSSInterfaces.VssJsonCollectionWrapperV<ProfileInterfaces.ProfileAttributeBase<any>[]>,
id: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Profile",
"1392b6ac-d511-492e-af5b-2263e5545a5d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, attributesCollection, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
* @param {string} size
* @param {string} format
*/
public async getAvatar(
id: string,
size?: string,
format?: string
): Promise<ProfileInterfaces.Avatar> {
return new Promise<ProfileInterfaces.Avatar>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
size: size,
format: format,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"67436615-b382-462a-b659-5367a492fb3c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Avatar>;
res = await this.rest.get<ProfileInterfaces.Avatar>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Avatar,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} container
* @param {string} id
* @param {string} size
* @param {string} format
* @param {string} displayName
*/
public async getAvatarPreview(
container: any,
id: string,
size?: string,
format?: string,
displayName?: string
): Promise<ProfileInterfaces.Avatar> {
return new Promise<ProfileInterfaces.Avatar>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
size: size,
format: format,
displayName: displayName,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"67436615-b382-462a-b659-5367a492fb3c",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Avatar>;
res = await this.rest.create<ProfileInterfaces.Avatar>(url, container, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Avatar,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
*/
public async resetAvatar(
id: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"67436615-b382-462a-b659-5367a492fb3c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} container
* @param {string} id
*/
public async setAvatar(
container: any,
id: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"67436615-b382-462a-b659-5367a492fb3c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.replace<void>(url, container, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Lookup up country/region based on provided IPv4, null if using the remote IPv4 address.
*
* @param {string} ipaddress - IPv4 address to be used for reverse lookup, null if using RemoteIPAddress in request context
*/
public async getGeoRegion(
ipaddress: string
): Promise<ProfileInterfaces.GeoRegion> {
return new Promise<ProfileInterfaces.GeoRegion>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
ipaddress: ipaddress,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"3bcda9c0-3078-48a5-a1e0-83bd05931ad0",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.GeoRegion>;
res = await this.rest.get<ProfileInterfaces.GeoRegion>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Create profile
*
* @param {ProfileInterfaces.CreateProfileContext} createProfileContext - Context for profile creation
* @param {boolean} autoCreate - Create profile automatically
*/
public async createProfile(
createProfileContext: ProfileInterfaces.CreateProfileContext,
autoCreate?: boolean
): Promise<ProfileInterfaces.Profile> {
return new Promise<ProfileInterfaces.Profile>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
autoCreate: autoCreate,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.3",
"Profile",
"f83735dc-483f-4238-a291-d45f6080a9af",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Profile>;
res = await this.rest.create<ProfileInterfaces.Profile>(url, createProfileContext, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Profile,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
* @param {boolean} details
* @param {boolean} withAttributes
* @param {string} partition
* @param {string} coreAttributes
* @param {boolean} forceRefresh
*/
public async getProfile(
id: string,
details?: boolean,
withAttributes?: boolean,
partition?: string,
coreAttributes?: string,
forceRefresh?: boolean
): Promise<ProfileInterfaces.Profile> {
return new Promise<ProfileInterfaces.Profile>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
let queryValues: any = {
details: details,
withAttributes: withAttributes,
partition: partition,
coreAttributes: coreAttributes,
forceRefresh: forceRefresh,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.3",
"Profile",
"f83735dc-483f-4238-a291-d45f6080a9af",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Profile>;
res = await this.rest.get<ProfileInterfaces.Profile>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Profile,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update profile
*
* @param {ProfileInterfaces.Profile} profile - Update profile
* @param {string} id - Profile ID
*/
public async updateProfile(
profile: ProfileInterfaces.Profile,
id: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.3",
"Profile",
"f83735dc-483f-4238-a291-d45f6080a9af",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, profile, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getRegions(
): Promise<ProfileInterfaces.ProfileRegions> {
return new Promise<ProfileInterfaces.ProfileRegions>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"92d8d1c9-26b8-4774-a929-d640a73da524",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.ProfileRegions>;
res = await this.rest.get<ProfileInterfaces.ProfileRegions>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getSupportedLcids(
): Promise<string[]> {
return new Promise<string[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"d5bd1aa6-c269-4bcd-ad32-75fa17475584",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string[]>;
res = await this.rest.get<string[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {boolean} includeAvatar
*/
public async getUserDefaults(
includeAvatar?: boolean
): Promise<ProfileInterfaces.Profile> {
return new Promise<ProfileInterfaces.Profile>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeAvatar: includeAvatar,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"b583a356-1da7-4237-9f4c-1deb2edbc7e8",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Profile>;
res = await this.rest.get<ProfileInterfaces.Profile>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Profile,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} id
*/
public async refreshUserDefaults(
id: string
): Promise<ProfileInterfaces.Profile> {
return new Promise<ProfileInterfaces.Profile>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Profile",
"b583a356-1da7-4237-9f4c-1deb2edbc7e8",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProfileInterfaces.Profile>;
res = await this.rest.replace<ProfileInterfaces.Profile>(url, options);
let ret = this.formatResponse(res.result,
ProfileInterfaces.TypeInfo.Profile,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

156
api/ProxyApi.ts Normal file
Просмотреть файл

@ -0,0 +1,156 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ProxyInterfaces = require("./interfaces/ProxyInterfaces");
export interface IProxyApi extends basem.ClientApiBase {
createOrUpdateProxy(proxy: ProxyInterfaces.Proxy): Promise<ProxyInterfaces.Proxy>;
deleteProxy(proxyUrl: string, site?: string): Promise<void>;
getProxies(proxyUrl?: string): Promise<ProxyInterfaces.Proxy[]>;
}
export class ProxyApi extends basem.ClientApiBase implements IProxyApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Core-api');
}
/**
* @param {ProxyInterfaces.Proxy} proxy
*/
public async createOrUpdateProxy(
proxy: ProxyInterfaces.Proxy
): Promise<ProxyInterfaces.Proxy> {
return new Promise<ProxyInterfaces.Proxy>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"core",
"ec1f4311-f2b4-4c15-b2b8-8990b80d2908",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProxyInterfaces.Proxy>;
res = await this.rest.replace<ProxyInterfaces.Proxy>(url, proxy, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} proxyUrl
* @param {string} site
*/
public async deleteProxy(
proxyUrl: string,
site?: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
proxyUrl: proxyUrl,
site: site,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"core",
"ec1f4311-f2b4-4c15-b2b8-8990b80d2908",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} proxyUrl
*/
public async getProxies(
proxyUrl?: string
): Promise<ProxyInterfaces.Proxy[]> {
return new Promise<ProxyInterfaces.Proxy[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
proxyUrl: proxyUrl,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"core",
"ec1f4311-f2b4-4c15-b2b8-8990b80d2908",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ProxyInterfaces.Proxy[]>;
res = await this.rest.get<ProxyInterfaces.Proxy[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

103
api/RMApi.ts Normal file
Просмотреть файл

@ -0,0 +1,103 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
export interface IRMApi extends basem.ClientApiBase {
getConsumer(consumerId: string): Promise<string>;
getConsumers(): Promise<string[]>;
}
export class RMApi extends basem.ClientApiBase implements IRMApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-RM-api');
}
/**
* @param {string} consumerId
*/
public async getConsumer(
consumerId: string
): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
let routeValues: any = {
consumerId: consumerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"RM",
"e9abe73d-489c-4d84-b61b-598cd150232c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string>;
res = await this.rest.get<string>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getConsumers(
): Promise<string[]> {
return new Promise<string[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"RM",
"e9abe73d-489c-4d84-b61b-598cd150232c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string[]>;
res = await this.rest.get<string[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

324
api/ReportingApi.ts Normal file
Просмотреть файл

@ -0,0 +1,324 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ReportingInterfaces = require("./interfaces/ReportingInterfaces");
export interface IReportingApi extends basem.ClientApiBase {
createChartConfiguration(chartConfiguration: ReportingInterfaces.ChartConfiguration, project: string): Promise<ReportingInterfaces.ChartConfigurationResponse>;
deleteChartConfiguration(project: string, id: string): Promise<void>;
getChartConfiguration(project: string, id: string): Promise<ReportingInterfaces.ChartConfigurationResponse>;
getChartConfigurations(project: string, scope: string, groupKey: string): Promise<ReportingInterfaces.ChartConfigurationResponse[]>;
replaceChartConfiguration(chartConfiguration: ReportingInterfaces.ChartConfiguration, project: string): Promise<ReportingInterfaces.ChartConfigurationResponse>;
getDataServiceCapabilities(scope: string): Promise<ReportingInterfaces.DataServiceCapabilitiesResponse>;
runTransformQuery(transformOptions: ReportingInterfaces.TransformOptions[], scope: string): Promise<ReportingInterfaces.TransformResult[]>;
}
export class ReportingApi extends basem.ClientApiBase implements IReportingApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Reporting-api');
}
/**
* @param {ReportingInterfaces.ChartConfiguration} chartConfiguration
* @param {string} project - Project ID or project name
*/
public async createChartConfiguration(
chartConfiguration: ReportingInterfaces.ChartConfiguration,
project: string
): Promise<ReportingInterfaces.ChartConfigurationResponse> {
return new Promise<ReportingInterfaces.ChartConfigurationResponse>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"50fbd84e-398e-41da-8688-9a3a7b0e602b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.ChartConfigurationResponse>;
res = await this.rest.create<ReportingInterfaces.ChartConfigurationResponse>(url, chartConfiguration, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} id
*/
public async deleteChartConfiguration(
project: string,
id: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
project: project,
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"50fbd84e-398e-41da-8688-9a3a7b0e602b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} id
*/
public async getChartConfiguration(
project: string,
id: string
): Promise<ReportingInterfaces.ChartConfigurationResponse> {
return new Promise<ReportingInterfaces.ChartConfigurationResponse>(async (resolve, reject) => {
let routeValues: any = {
project: project,
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"50fbd84e-398e-41da-8688-9a3a7b0e602b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.ChartConfigurationResponse>;
res = await this.rest.get<ReportingInterfaces.ChartConfigurationResponse>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} scope
* @param {string} groupKey
*/
public async getChartConfigurations(
project: string,
scope: string,
groupKey: string
): Promise<ReportingInterfaces.ChartConfigurationResponse[]> {
return new Promise<ReportingInterfaces.ChartConfigurationResponse[]>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
let queryValues: any = {
scope: scope,
groupKey: groupKey,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"50fbd84e-398e-41da-8688-9a3a7b0e602b",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.ChartConfigurationResponse[]>;
res = await this.rest.get<ReportingInterfaces.ChartConfigurationResponse[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ReportingInterfaces.ChartConfiguration} chartConfiguration
* @param {string} project - Project ID or project name
*/
public async replaceChartConfiguration(
chartConfiguration: ReportingInterfaces.ChartConfiguration,
project: string
): Promise<ReportingInterfaces.ChartConfigurationResponse> {
return new Promise<ReportingInterfaces.ChartConfigurationResponse>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"50fbd84e-398e-41da-8688-9a3a7b0e602b",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.ChartConfigurationResponse>;
res = await this.rest.replace<ReportingInterfaces.ChartConfigurationResponse>(url, chartConfiguration, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scope
*/
public async getDataServiceCapabilities(
scope: string
): Promise<ReportingInterfaces.DataServiceCapabilitiesResponse> {
return new Promise<ReportingInterfaces.DataServiceCapabilitiesResponse>(async (resolve, reject) => {
let routeValues: any = {
scope: scope
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"81aa1f62-c70d-4356-ba6b-d8ee4be4379c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.DataServiceCapabilitiesResponse>;
res = await this.rest.get<ReportingInterfaces.DataServiceCapabilitiesResponse>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ReportingInterfaces.TransformOptions[]} transformOptions
* @param {string} scope
*/
public async runTransformQuery(
transformOptions: ReportingInterfaces.TransformOptions[],
scope: string
): Promise<ReportingInterfaces.TransformResult[]> {
return new Promise<ReportingInterfaces.TransformResult[]>(async (resolve, reject) => {
let routeValues: any = {
scope: scope
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"reporting",
"71ec2b57-742e-4c12-8bd3-ef633b473f66",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ReportingInterfaces.TransformResult[]>;
res = await this.rest.create<ReportingInterfaces.TransformResult[]>(url, transformOptions, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -5,17 +5,252 @@ import fs = require("fs");
import http = require("http");
import httpm = require('./HttpClient');
import ifm = require("./interfaces/common/VsoBaseInterfaces");
import Serialization = require('./Serialization');
import serm = require('./Serialization');
/**
* getJSON: REST get request returning JSON object(s)
* @param options: http options object
* @param callback: callback to pass the results JSON object(s) back
*/
export interface IRestClientResponse {
statusCode: number,
result: any
}
export class RestClient {
client: httpm.HttpClient;
versionParam: string;
constructor(userAgent: string, handlers?: ifm.IRequestHandler[], socketTimeout?: number, versionParam?: string) {
// TODO: should we really do this?
this.versionParam = versionParam || 'api-version';
this.client = new httpm.HttpClient(userAgent, handlers, socketTimeout);
}
public async get(requestUrl: string,
apiVersion: string,
additionalHeaders?: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
let res: httpm.HttpClientResponse = await this.client.get(requestUrl, headers);
return this._processResponse(res);
}
public async del(requestUrl: string,
apiVersion: string,
additionalHeaders?: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
let res: httpm.HttpClientResponse = await this.client.del(requestUrl, headers);
return this._processResponse(res);
}
public async create(requestUrl: string,
apiVersion: string,
resources: any,
additionalHeaders?: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
let data: string = JSON.stringify(resources, null, 2);
let res: httpm.HttpClientResponse = await this.client.post(requestUrl, data, headers);
return this._processResponse(res);
}
public async update(requestUrl: string,
apiVersion: string,
resources: any,
additionalHeaders?: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
let data: string = JSON.stringify(resources, null, 2);
let res: httpm.HttpClientResponse = await this.client.patch(requestUrl, data, headers);
return this._processResponse(res);
}
public async replace(requestUrl: string,
apiVersion: string,
resources: any,
additionalHeaders?: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
let data: string = JSON.stringify(resources, null, 2);
let res: httpm.HttpClientResponse = await this.client.put(requestUrl, data, headers);
return this._processResponse(res);
}
public async uploadStream(verb: string, requestUrl: string, apiVersion: string, stream: NodeJS.ReadableStream, additionalHeaders: ifm.IHeaders): Promise<IRestClientResponse> {
var headers = additionalHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
let res: httpm.HttpClientResponse = await this.client.sendStream(verb, requestUrl, stream, headers);
return this._processResponse(res);
}
public createAcceptHeader(type: string, apiVersion?: string): string {
return type + (apiVersion ? (';' + this.versionParam + '=' + apiVersion) : '');
}
private async _processResponse(res: httpm.HttpClientResponse): Promise<IRestClientResponse> {
return new Promise<IRestClientResponse>(async(resolve, reject) => {
let rres: IRestClientResponse = <IRestClientResponse>{};
let statusCode: number = res.message.statusCode;
rres.statusCode = statusCode;
// not found leads to null obj returned
if (statusCode == httpm.HttpCodes.NotFound) {
resolve(rres);
}
let obj: any;
// get the result from the body
try {
let contents: string = await res.readBody();
if (contents && contents.length > 0) {
obj = JSON.parse(contents);
rres.result = obj;
}
}
catch (err) {
reject(new Error('Invalid Resource'));
}
if (statusCode > 299) {
let msg: string;
// if exception/error in body, attempt to get better error
if (obj && obj.message) {
msg = obj.message;
} else {
msg = "Failed request: (" + statusCode + ") " + res.message.url;
}
reject(new Error(msg));
} else {
resolve(rres);
}
});
}
}
export class RestCallbackClient {
baseUrl: string;
basePath: string;
httpClient: httpm.HttpCallbackClient;
versionParam: string;
constructor(httpClient: httpm.HttpCallbackClient, versionParam?: string) {
versionParam = versionParam || 'api-version';
this.httpClient = httpClient;
this.versionParam = versionParam;
}
get(url: string, apiVersion: string, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('GET', url, apiVersion, customHeaders, onResult);
}
del(url: string, apiVersion: string, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('DELETE', url, apiVersion, customHeaders, onResult);
}
create(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void, serializationData?: serm.SerializationData): void {
var headers = customHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
this._sendJson('POST', url, apiVersion, resources, customHeaders, onResult);
}
update(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void, serializationData?: serm.SerializationData): void {
this._sendJson('PATCH', url, apiVersion, resources, customHeaders, onResult);
}
options(url: string, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('OPTIONS', url, "", null, onResult);
}
uploadFile(verb: string, url: string, apiVersion: string, filePath: string, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void, serializationData?: serm.SerializationData): void {
fs.stat(filePath, (err, stats) => {
if (err) {
onResult(err, 400, null);
return;
}
var headers = customHeaders || {};
headers["Content-Length"] = stats.size;
var contentStream: NodeJS.ReadableStream = fs.createReadStream(filePath);
this.uploadStream(verb, url, apiVersion, contentStream, headers, onResult, serializationData);
});
}
uploadStream(verb: string, url: string, apiVersion: string, contentStream: NodeJS.ReadableStream, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void, serializationData?: serm.SerializationData): void {
var headers = customHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
this.httpClient.sendStream(verb, url, contentStream, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, contents);
return;
}
_processResponse(url, res, contents, onResult);
});
}
replace(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._sendJson('PUT', url, apiVersion, resources, customHeaders, onResult);
}
_getJson(verb: string, url: string, apiVersion: string, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void): void {
var headers = {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
this.httpClient.get(verb, url, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, null);
return;
}
_processResponse(url, res, contents, onResult);
});
}
_sendJson(verb: string, url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, onResult: (err: any, statusCode: number, obj: any) => void): void {
if (!resources) {
throw new Error('invalid resource');
}
var headers = customHeaders || {};
headers["Accept"] = this.createAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
let data: string;
data = JSON.stringify(resources, null, 2);
this.httpClient.send(verb, url, data, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, null);
return;
}
_processResponse(url, res, contents, onResult);
});
}
public createAcceptHeader(type: string, apiVersion?: string): string {
return type + (apiVersion ? (';' + this.versionParam + '=' + apiVersion) : '');
}
var getJsonResponse = function (contents) {
var json = JSON.parse(contents);
return json;
}
var httpCodes = {
@ -45,156 +280,35 @@ var httpCodes = {
504: "Gateway Timeout"
}
export function processResponse(url, res, contents, serializationData: Serialization.SerializationData, onResult) {
function _processResponse(url: string,
res: ifm.IHttpResponse,
contents: string,
onResult: (err: any, statusCode: number, obj: any) => void) {
let jsonObj: any;
if (contents && contents.length > 0) {
try {
jsonObj = JSON.parse(contents);
} catch (e) {
onResult(new Error('Invalid Resource'), res.statusCode, null);
return;
}
}
if (res.statusCode > 299) {
// not success
// default error message
var msg = httpCodes[res.statusCode] ? "Failed Request: " + httpCodes[res.statusCode] : "Failed Request";
msg += '(' + res.statusCode + ') - ';
if (contents && contents.length > 0) {
var jsonObj = null;
try {
jsonObj = JSON.parse(contents);
} catch (e) {}
if (jsonObj && jsonObj.message) {
msg += jsonObj.message;
} else {
msg += url;
}
// if exception/error in body, attempt to get better error
if (jsonObj && jsonObj.message) {
msg += jsonObj.message;
} else {
msg += url;
}
onResult(new Error(msg), res.statusCode, null);
} else {
try {
var jsonObj = null;
if (contents && contents.length > 0) {
jsonObj = JSON.parse(contents);
if (serializationData) {
jsonObj = Serialization.ContractSerializer.deserialize(jsonObj, serializationData.responseTypeMetadata, false, serializationData.responseIsCollection);
}
}
} catch (e) {
onResult(new Error('Invalid Resource'), res.statusCode, null);
return;
}
onResult(null, res.statusCode, jsonObj);
}
};
export function enumToString(enumType: any, enumValue: number, camelCase: boolean) {
var valueString = enumType[enumValue];
if (valueString && camelCase) {
if (valueString.length <= 1) {
valueString = valueString.toLowerCase();
}
else {
valueString = valueString.substring(0, 1).toLowerCase() + valueString.substring(1);
}
}
return valueString;
}
export class RestClient implements ifm.IRestClient {
baseUrl: string;
basePath: string;
httpClient: ifm.IHttpClient;
constructor(httpClient: ifm.IHttpClient) {
this.httpClient = httpClient;
}
getJson(url: string, apiVersion: string, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('GET', url, apiVersion, customHeaders, serializationData, onResult);
}
options(url: string, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('OPTIONS', url, "", null, null, onResult);
}
delete(url: string, apiVersion: string, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._getJson('DELETE', url, apiVersion, customHeaders, serializationData, onResult);
}
create(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._sendJson('POST', url, apiVersion, resources, customHeaders, serializationData, onResult);
}
update(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._sendJson('PATCH', url, apiVersion, resources, customHeaders, serializationData, onResult);
}
uploadFile(verb: string, url: string, apiVersion: string, filePath: string, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
fs.stat(filePath, (err, stats) => {
if (err) {
onResult(err, 400, null);
return;
}
var headers = customHeaders || {};
headers["Content-Length"] = stats.size;
var contentStream: NodeJS.ReadableStream = fs.createReadStream(filePath);
this.uploadStream(verb, url, apiVersion, contentStream, headers, serializationData, onResult);
});
}
uploadStream(verb: string, url: string, apiVersion: string, contentStream: NodeJS.ReadableStream, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
var headers = customHeaders || {};
headers["Accept"] = this.httpClient.makeAcceptHeader('application/json', apiVersion);
this.httpClient.sendFile(verb, url, contentStream, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, contents);
return;
}
processResponse(url, res, contents, serializationData, onResult);
});
}
replace(url: string, apiVersion: string, resources: any, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
this._sendJson('PUT', url, apiVersion, resources, customHeaders, serializationData, onResult);
}
_getJson(verb: string, url: string, apiVersion: string, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
var headers = {};
headers["Accept"] = this.httpClient.makeAcceptHeader('application/json', apiVersion);
this.httpClient.get(verb, url, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, null);
return;
}
processResponse(url, res, contents, serializationData, onResult);
});
}
_sendJson(verb: string, url: string, apiVersion: string, data: any, customHeaders: ifm.IHeaders, serializationData: Serialization.SerializationData, onResult: (err: any, statusCode: number, obj: any) => void): void {
var headers = customHeaders || {};
headers["Accept"] = this.httpClient.makeAcceptHeader('application/json', apiVersion);
headers["Content-Type"] = headers["Content-Type"] || 'application/json; charset=utf-8';
if(serializationData) {
data = Serialization.ContractSerializer.serialize(data, serializationData.requestTypeMetadata, true);
}
this.httpClient.send(verb, url, data, headers, (err: any, res: ifm.IHttpResponse, contents: string) => {
if (err) {
onResult(err, err.statusCode, null);
return;
}
processResponse(url, res, contents, serializationData, onResult);
});
}
}

499
api/SecurityApi.ts Normal file
Просмотреть файл

@ -0,0 +1,499 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import SecurityInterfaces = require("./interfaces/SecurityInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface ISecurityApi extends basem.ClientApiBase {
removeAccessControlEntries(securityNamespaceId: string, token?: string, descriptors?: string): Promise<boolean>;
setAccessControlEntries(container: any, securityNamespaceId: string): Promise<SecurityInterfaces.AccessControlEntry[]>;
queryAccessControlLists(securityNamespaceId: string, token?: string, descriptors?: string, includeExtendedInfo?: boolean, recurse?: boolean): Promise<SecurityInterfaces.AccessControlList[]>;
removeAccessControlLists(securityNamespaceId: string, tokens?: string, recurse?: boolean): Promise<boolean>;
setAccessControlLists(accessControlLists: VSSInterfaces.VssJsonCollectionWrapperV<SecurityInterfaces.AccessControlListsCollection>, securityNamespaceId: string): Promise<void>;
hasPermissionsBatch(evalBatch: SecurityInterfaces.PermissionEvaluationBatch): Promise<SecurityInterfaces.PermissionEvaluationBatch>;
hasPermissions(securityNamespaceId: string, permissions?: number, tokens?: string, alwaysAllowAdministrators?: boolean, delimiter?: string): Promise<boolean[]>;
removePermission(securityNamespaceId: string, permissions?: number, token?: string, descriptor?: string): Promise<SecurityInterfaces.AccessControlEntry>;
querySecurityNamespaces(securityNamespaceId: string, localOnly?: boolean): Promise<SecurityInterfaces.SecurityNamespaceDescription[]>;
setInheritFlag(container: any, securityNamespaceId: string): Promise<void>;
}
export class SecurityApi extends basem.ClientApiBase implements ISecurityApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Security-api');
}
/**
* @param {string} securityNamespaceId
* @param {string} token
* @param {string} descriptors
*/
public async removeAccessControlEntries(
securityNamespaceId: string,
token?: string,
descriptors?: string
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
let queryValues: any = {
token: token,
descriptors: descriptors,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"ac08c8ff-4323-4b08-af90-bcd018d380ce",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.del<boolean>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} container
* @param {string} securityNamespaceId
*/
public async setAccessControlEntries(
container: any,
securityNamespaceId: string
): Promise<SecurityInterfaces.AccessControlEntry[]> {
return new Promise<SecurityInterfaces.AccessControlEntry[]>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"ac08c8ff-4323-4b08-af90-bcd018d380ce",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityInterfaces.AccessControlEntry[]>;
res = await this.rest.create<SecurityInterfaces.AccessControlEntry[]>(url, container, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} securityNamespaceId
* @param {string} token
* @param {string} descriptors
* @param {boolean} includeExtendedInfo
* @param {boolean} recurse
*/
public async queryAccessControlLists(
securityNamespaceId: string,
token?: string,
descriptors?: string,
includeExtendedInfo?: boolean,
recurse?: boolean
): Promise<SecurityInterfaces.AccessControlList[]> {
return new Promise<SecurityInterfaces.AccessControlList[]>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
let queryValues: any = {
token: token,
descriptors: descriptors,
includeExtendedInfo: includeExtendedInfo,
recurse: recurse,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"18a2ad18-7571-46ae-bec7-0c7da1495885",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityInterfaces.AccessControlList[]>;
res = await this.rest.get<SecurityInterfaces.AccessControlList[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} securityNamespaceId
* @param {string} tokens
* @param {boolean} recurse
*/
public async removeAccessControlLists(
securityNamespaceId: string,
tokens?: string,
recurse?: boolean
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
let queryValues: any = {
tokens: tokens,
recurse: recurse,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"18a2ad18-7571-46ae-bec7-0c7da1495885",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean>;
res = await this.rest.del<boolean>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VSSInterfaces.VssJsonCollectionWrapperV<SecurityInterfaces.AccessControlListsCollection>} accessControlLists
* @param {string} securityNamespaceId
*/
public async setAccessControlLists(
accessControlLists: VSSInterfaces.VssJsonCollectionWrapperV<SecurityInterfaces.AccessControlListsCollection>,
securityNamespaceId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"18a2ad18-7571-46ae-bec7-0c7da1495885",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, accessControlLists, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Perform a batch of "has permission" checks. This methods does not aggregate the results nor does it shortcircut if one of the permissions evaluates to false.
*
* @param {SecurityInterfaces.PermissionEvaluationBatch} evalBatch
*/
public async hasPermissionsBatch(
evalBatch: SecurityInterfaces.PermissionEvaluationBatch
): Promise<SecurityInterfaces.PermissionEvaluationBatch> {
return new Promise<SecurityInterfaces.PermissionEvaluationBatch>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"cf1faa59-1b63-4448-bf04-13d981a46f5d",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityInterfaces.PermissionEvaluationBatch>;
res = await this.rest.create<SecurityInterfaces.PermissionEvaluationBatch>(url, evalBatch, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} securityNamespaceId
* @param {number} permissions
* @param {string} tokens
* @param {boolean} alwaysAllowAdministrators
* @param {string} delimiter
*/
public async hasPermissions(
securityNamespaceId: string,
permissions?: number,
tokens?: string,
alwaysAllowAdministrators?: boolean,
delimiter?: string
): Promise<boolean[]> {
return new Promise<boolean[]>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId,
permissions: permissions
};
let queryValues: any = {
tokens: tokens,
alwaysAllowAdministrators: alwaysAllowAdministrators,
delimiter: delimiter,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Security",
"dd3b8bd6-c7fc-4cbd-929a-933d9c011c9d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<boolean[]>;
res = await this.rest.get<boolean[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} securityNamespaceId
* @param {number} permissions
* @param {string} token
* @param {string} descriptor
*/
public async removePermission(
securityNamespaceId: string,
permissions?: number,
token?: string,
descriptor?: string
): Promise<SecurityInterfaces.AccessControlEntry> {
return new Promise<SecurityInterfaces.AccessControlEntry>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId,
permissions: permissions
};
let queryValues: any = {
token: token,
descriptor: descriptor,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.2",
"Security",
"dd3b8bd6-c7fc-4cbd-929a-933d9c011c9d",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityInterfaces.AccessControlEntry>;
res = await this.rest.del<SecurityInterfaces.AccessControlEntry>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} securityNamespaceId
* @param {boolean} localOnly
*/
public async querySecurityNamespaces(
securityNamespaceId: string,
localOnly?: boolean
): Promise<SecurityInterfaces.SecurityNamespaceDescription[]> {
return new Promise<SecurityInterfaces.SecurityNamespaceDescription[]>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
let queryValues: any = {
localOnly: localOnly,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"ce7b9f95-fde9-4be8-a86d-83b366f0b87a",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityInterfaces.SecurityNamespaceDescription[]>;
res = await this.rest.get<SecurityInterfaces.SecurityNamespaceDescription[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {any} container
* @param {string} securityNamespaceId
*/
public async setInheritFlag(
container: any,
securityNamespaceId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
securityNamespaceId: securityNamespaceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Security",
"ce7b9f95-fde9-4be8-a86d-83b366f0b87a",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, container, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

290
api/SecurityRolesApi.ts Normal file
Просмотреть файл

@ -0,0 +1,290 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import SecurityRolesInterfaces = require("./interfaces/SecurityRolesInterfaces");
export interface ISecurityRolesApi extends basem.ClientApiBase {
getRoleAssignments(scopeId: string, resourceId: string): Promise<SecurityRolesInterfaces.RoleAssignment[]>;
removeRoleAssignment(scopeId: string, resourceId: string, identityId: string): Promise<void>;
removeRoleAssignments(identityIds: string[], scopeId: string, resourceId: string): Promise<void>;
setRoleAssignment(roleAssignment: SecurityRolesInterfaces.UserRoleAssignmentRef, scopeId: string, resourceId: string, identityId: string): Promise<SecurityRolesInterfaces.RoleAssignment>;
setRoleAssignments(roleAssignments: SecurityRolesInterfaces.UserRoleAssignmentRef[], scopeId: string, resourceId: string): Promise<SecurityRolesInterfaces.RoleAssignment[]>;
getRoleDefinitions(scopeId: string): Promise<SecurityRolesInterfaces.SecurityRole[]>;
}
export class SecurityRolesApi extends basem.ClientApiBase implements ISecurityRolesApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-SecurityRoles-api');
}
/**
* @param {string} scopeId
* @param {string} resourceId
*/
public async getRoleAssignments(
scopeId: string,
resourceId: string
): Promise<SecurityRolesInterfaces.RoleAssignment[]> {
return new Promise<SecurityRolesInterfaces.RoleAssignment[]>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId,
resourceId: resourceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"9461c234-c84c-4ed2-b918-2f0f92ad0a35",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityRolesInterfaces.RoleAssignment[]>;
res = await this.rest.get<SecurityRolesInterfaces.RoleAssignment[]>(url, options);
let ret = this.formatResponse(res.result,
SecurityRolesInterfaces.TypeInfo.RoleAssignment,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scopeId
* @param {string} resourceId
* @param {string} identityId
*/
public async removeRoleAssignment(
scopeId: string,
resourceId: string,
identityId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId,
resourceId: resourceId,
identityId: identityId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"9461c234-c84c-4ed2-b918-2f0f92ad0a35",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string[]} identityIds
* @param {string} scopeId
* @param {string} resourceId
*/
public async removeRoleAssignments(
identityIds: string[],
scopeId: string,
resourceId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId,
resourceId: resourceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"9461c234-c84c-4ed2-b918-2f0f92ad0a35",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, identityIds, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {SecurityRolesInterfaces.UserRoleAssignmentRef} roleAssignment
* @param {string} scopeId
* @param {string} resourceId
* @param {string} identityId
*/
public async setRoleAssignment(
roleAssignment: SecurityRolesInterfaces.UserRoleAssignmentRef,
scopeId: string,
resourceId: string,
identityId: string
): Promise<SecurityRolesInterfaces.RoleAssignment> {
return new Promise<SecurityRolesInterfaces.RoleAssignment>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId,
resourceId: resourceId,
identityId: identityId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"9461c234-c84c-4ed2-b918-2f0f92ad0a35",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityRolesInterfaces.RoleAssignment>;
res = await this.rest.replace<SecurityRolesInterfaces.RoleAssignment>(url, roleAssignment, options);
let ret = this.formatResponse(res.result,
SecurityRolesInterfaces.TypeInfo.RoleAssignment,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {SecurityRolesInterfaces.UserRoleAssignmentRef[]} roleAssignments
* @param {string} scopeId
* @param {string} resourceId
*/
public async setRoleAssignments(
roleAssignments: SecurityRolesInterfaces.UserRoleAssignmentRef[],
scopeId: string,
resourceId: string
): Promise<SecurityRolesInterfaces.RoleAssignment[]> {
return new Promise<SecurityRolesInterfaces.RoleAssignment[]>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId,
resourceId: resourceId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"9461c234-c84c-4ed2-b918-2f0f92ad0a35",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityRolesInterfaces.RoleAssignment[]>;
res = await this.rest.replace<SecurityRolesInterfaces.RoleAssignment[]>(url, roleAssignments, options);
let ret = this.formatResponse(res.result,
SecurityRolesInterfaces.TypeInfo.RoleAssignment,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} scopeId
*/
public async getRoleDefinitions(
scopeId: string
): Promise<SecurityRolesInterfaces.SecurityRole[]> {
return new Promise<SecurityRolesInterfaces.SecurityRole[]>(async (resolve, reject) => {
let routeValues: any = {
scopeId: scopeId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"securityroles",
"f4cc9a86-453c-48d2-b44d-d3bd5c105f4f",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<SecurityRolesInterfaces.SecurityRole[]>;
res = await this.rest.get<SecurityRolesInterfaces.SecurityRole[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -57,7 +57,7 @@ export module ContractSerializer {
* @param contractMetadata The type info/metadata for the contract type being serialized
* @param preserveOriginal If true, don't modify the original object. False modifies the original object (the return value points to the data argument).
*/
export function serialize(data: any, contractMetadata: ContractMetadata, preserveOriginal: boolean = true) {
export function serialize(data: any, contractMetadata: ContractMetadata, preserveOriginal: boolean) {
if (data && contractMetadata) {
if (Array.isArray(data)) {
return _getTranslatedArray(data, contractMetadata, true, preserveOriginal);
@ -81,7 +81,7 @@ export module ContractSerializer {
* @param preserveOriginal If true, don't modify the original object. False modifies the original object (the return value points to the data argument).
* @param unwrapWrappedCollections If true check for wrapped arrays (REST apis will not return arrays directly as the root result but will instead wrap them in a { values: [], count: 0 } object.
*/
export function deserialize(data: any, contractMetadata: ContractMetadata, preserveOriginal: boolean = true, unwrapWrappedCollections: boolean = false) {
export function deserialize(data: any, contractMetadata: ContractMetadata, preserveOriginal: boolean, unwrapWrappedCollections: boolean) {
if (data) {
if (unwrapWrappedCollections && Array.isArray((<IWebApiArrayResult>data).value)) {
// Wrapped json array - unwrap it and send the array as the result

675
api/ServiceHooksApi.ts Normal file
Просмотреть файл

@ -0,0 +1,675 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import ServiceHooksInterfaces = require("./interfaces/ServiceHooksInterfaces");
export interface IServiceHooksApi extends basem.ClientApiBase {
getConsumerAction(consumerId: string, consumerActionId: string): Promise<ServiceHooksInterfaces.ConsumerAction>;
getConsumerActions(consumerId: string): Promise<ServiceHooksInterfaces.ConsumerAction[]>;
getConsumer(consumerId: string): Promise<ServiceHooksInterfaces.Consumer>;
getConsumers(): Promise<ServiceHooksInterfaces.Consumer[]>;
createEvents(eventsRequestData: ServiceHooksInterfaces.PublishEventsRequestData): Promise<void>;
queryInputValues(inputValuesQuery: ServiceHooksInterfaces.SubscriptionInputValuesQuery): Promise<ServiceHooksInterfaces.SubscriptionInputValuesQuery>;
getNotification(subscriptionId: string, notificationId: number): Promise<ServiceHooksInterfaces.Notification>;
getNotifications(subscriptionId: string, maxResults?: number, status?: ServiceHooksInterfaces.NotificationStatus, result?: ServiceHooksInterfaces.NotificationResult): Promise<ServiceHooksInterfaces.Notification[]>;
queryNotifications(query: ServiceHooksInterfaces.NotificationsQuery): Promise<ServiceHooksInterfaces.NotificationsQuery>;
createSubscription(subscription: ServiceHooksInterfaces.Subscription): Promise<ServiceHooksInterfaces.Subscription>;
deleteSubscription(subscriptionId: string): Promise<void>;
getSubscription(subscriptionId: string): Promise<ServiceHooksInterfaces.Subscription>;
listSubscriptions(publisherId?: string, eventType?: string, consumerId?: string, consumerActionId?: string): Promise<ServiceHooksInterfaces.Subscription[]>;
replaceSubscription(subscription: ServiceHooksInterfaces.Subscription): Promise<ServiceHooksInterfaces.Subscription>;
querySubscriptions(query: ServiceHooksInterfaces.SubscriptionsQuery): Promise<ServiceHooksInterfaces.SubscriptionsQuery>;
createTestNotification(testNotification: ServiceHooksInterfaces.Notification): Promise<ServiceHooksInterfaces.Notification>;
}
export class ServiceHooksApi extends basem.ClientApiBase implements IServiceHooksApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-ServiceHooks-api');
}
/**
* @param {string} consumerId
* @param {string} consumerActionId
*/
public async getConsumerAction(
consumerId: string,
consumerActionId: string
): Promise<ServiceHooksInterfaces.ConsumerAction> {
return new Promise<ServiceHooksInterfaces.ConsumerAction>(async (resolve, reject) => {
let routeValues: any = {
consumerId: consumerId,
consumerActionId: consumerActionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"6a1f0102-a266-4ca8-bfe9-f126df266a37",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.ConsumerAction>;
res = await this.rest.get<ServiceHooksInterfaces.ConsumerAction>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.ConsumerAction,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} consumerId
*/
public async getConsumerActions(
consumerId: string
): Promise<ServiceHooksInterfaces.ConsumerAction[]> {
return new Promise<ServiceHooksInterfaces.ConsumerAction[]>(async (resolve, reject) => {
let routeValues: any = {
consumerId: consumerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"6a1f0102-a266-4ca8-bfe9-f126df266a37",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.ConsumerAction[]>;
res = await this.rest.get<ServiceHooksInterfaces.ConsumerAction[]>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.ConsumerAction,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} consumerId
*/
public async getConsumer(
consumerId: string
): Promise<ServiceHooksInterfaces.Consumer> {
return new Promise<ServiceHooksInterfaces.Consumer>(async (resolve, reject) => {
let routeValues: any = {
consumerId: consumerId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"5f431332-1a18-43d9-ba45-109ec52c71c7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Consumer>;
res = await this.rest.get<ServiceHooksInterfaces.Consumer>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Consumer,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getConsumers(
): Promise<ServiceHooksInterfaces.Consumer[]> {
return new Promise<ServiceHooksInterfaces.Consumer[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"5f431332-1a18-43d9-ba45-109ec52c71c7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Consumer[]>;
res = await this.rest.get<ServiceHooksInterfaces.Consumer[]>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Consumer,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.PublishEventsRequestData} eventsRequestData
*/
public async createEvents(
eventsRequestData: ServiceHooksInterfaces.PublishEventsRequestData
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"46f7c4d2-97a1-48e6-85f3-5083742752fd",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, eventsRequestData, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.SubscriptionInputValuesQuery} inputValuesQuery
*/
public async queryInputValues(
inputValuesQuery: ServiceHooksInterfaces.SubscriptionInputValuesQuery
): Promise<ServiceHooksInterfaces.SubscriptionInputValuesQuery> {
return new Promise<ServiceHooksInterfaces.SubscriptionInputValuesQuery>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"95784519-7b74-4625-8888-49b294fe46b3",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.SubscriptionInputValuesQuery>;
res = await this.rest.create<ServiceHooksInterfaces.SubscriptionInputValuesQuery>(url, inputValuesQuery, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.SubscriptionInputValuesQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} subscriptionId
* @param {number} notificationId
*/
public async getNotification(
subscriptionId: string,
notificationId: number
): Promise<ServiceHooksInterfaces.Notification> {
return new Promise<ServiceHooksInterfaces.Notification>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId,
notificationId: notificationId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"a8dbbb75-c3cf-4d7b-a61d-c95f5a97ca55",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Notification>;
res = await this.rest.get<ServiceHooksInterfaces.Notification>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Notification,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} subscriptionId
* @param {number} maxResults
* @param {ServiceHooksInterfaces.NotificationStatus} status
* @param {ServiceHooksInterfaces.NotificationResult} result
*/
public async getNotifications(
subscriptionId: string,
maxResults?: number,
status?: ServiceHooksInterfaces.NotificationStatus,
result?: ServiceHooksInterfaces.NotificationResult
): Promise<ServiceHooksInterfaces.Notification[]> {
return new Promise<ServiceHooksInterfaces.Notification[]>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
let queryValues: any = {
maxResults: maxResults,
status: status,
result: result,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"a8dbbb75-c3cf-4d7b-a61d-c95f5a97ca55",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Notification[]>;
res = await this.rest.get<ServiceHooksInterfaces.Notification[]>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Notification,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.NotificationsQuery} query
*/
public async queryNotifications(
query: ServiceHooksInterfaces.NotificationsQuery
): Promise<ServiceHooksInterfaces.NotificationsQuery> {
return new Promise<ServiceHooksInterfaces.NotificationsQuery>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"e5e555f6-94ad-475b-ac98-7f011b48dcd5",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.NotificationsQuery>;
res = await this.rest.create<ServiceHooksInterfaces.NotificationsQuery>(url, query, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.NotificationsQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.Subscription} subscription
*/
public async createSubscription(
subscription: ServiceHooksInterfaces.Subscription
): Promise<ServiceHooksInterfaces.Subscription> {
return new Promise<ServiceHooksInterfaces.Subscription>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"4431ee3f-13e3-4b41-b62e-47289e90d3dc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Subscription>;
res = await this.rest.create<ServiceHooksInterfaces.Subscription>(url, subscription, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Subscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} subscriptionId
*/
public async deleteSubscription(
subscriptionId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"4431ee3f-13e3-4b41-b62e-47289e90d3dc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} subscriptionId
*/
public async getSubscription(
subscriptionId: string
): Promise<ServiceHooksInterfaces.Subscription> {
return new Promise<ServiceHooksInterfaces.Subscription>(async (resolve, reject) => {
let routeValues: any = {
subscriptionId: subscriptionId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"4431ee3f-13e3-4b41-b62e-47289e90d3dc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Subscription>;
res = await this.rest.get<ServiceHooksInterfaces.Subscription>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Subscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} publisherId
* @param {string} eventType
* @param {string} consumerId
* @param {string} consumerActionId
*/
public async listSubscriptions(
publisherId?: string,
eventType?: string,
consumerId?: string,
consumerActionId?: string
): Promise<ServiceHooksInterfaces.Subscription[]> {
return new Promise<ServiceHooksInterfaces.Subscription[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
publisherId: publisherId,
eventType: eventType,
consumerId: consumerId,
consumerActionId: consumerActionId,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"4431ee3f-13e3-4b41-b62e-47289e90d3dc",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Subscription[]>;
res = await this.rest.get<ServiceHooksInterfaces.Subscription[]>(url, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Subscription,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.Subscription} subscription
*/
public async replaceSubscription(
subscription: ServiceHooksInterfaces.Subscription
): Promise<ServiceHooksInterfaces.Subscription> {
return new Promise<ServiceHooksInterfaces.Subscription>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"4431ee3f-13e3-4b41-b62e-47289e90d3dc",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Subscription>;
res = await this.rest.replace<ServiceHooksInterfaces.Subscription>(url, subscription, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Subscription,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.SubscriptionsQuery} query
*/
public async querySubscriptions(
query: ServiceHooksInterfaces.SubscriptionsQuery
): Promise<ServiceHooksInterfaces.SubscriptionsQuery> {
return new Promise<ServiceHooksInterfaces.SubscriptionsQuery>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"d4a77d7b-9be6-4060-b53d-1211f34de619",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.SubscriptionsQuery>;
res = await this.rest.create<ServiceHooksInterfaces.SubscriptionsQuery>(url, query, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.SubscriptionsQuery,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {ServiceHooksInterfaces.Notification} testNotification
*/
public async createTestNotification(
testNotification: ServiceHooksInterfaces.Notification
): Promise<ServiceHooksInterfaces.Notification> {
return new Promise<ServiceHooksInterfaces.Notification>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"hookssvc",
"b906cedb-0a8e-4e3c-b1b1-2f3d680f035e",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<ServiceHooksInterfaces.Notification>;
res = await this.rest.create<ServiceHooksInterfaces.Notification>(url, testNotification, options);
let ret = this.formatResponse(res.result,
ServiceHooksInterfaces.TypeInfo.Notification,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

308
api/SettingsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,308 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
export interface ISettingsApi extends basem.ClientApiBase {
getEntries(userScope: string, key?: string): Promise<{ [key: string] : any; }>;
removeEntries(userScope: string, key: string): Promise<void>;
setEntries(entries: { [key: string] : any; }, userScope: string): Promise<void>;
getEntriesForScope(userScope: string, scopeName: string, scopeValue: string, key?: string): Promise<{ [key: string] : any; }>;
removeEntriesForScope(userScope: string, scopeName: string, scopeValue: string, key: string): Promise<void>;
setEntriesForScope(entries: { [key: string] : any; }, userScope: string, scopeName: string, scopeValue: string): Promise<void>;
}
export class SettingsApi extends basem.ClientApiBase implements ISettingsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Settings-api');
}
/**
* Get all setting entries for the given user/all-users scope
*
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
* @param {string} key - Optional key under which to filter all the entries
*/
public async getEntries(
userScope: string,
key?: string
): Promise<{ [key: string] : any; }> {
return new Promise<{ [key: string] : any; }>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
key: key
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"cd006711-163d-4cd4-a597-b05bad2556ff",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : any; }>;
res = await this.rest.get<{ [key: string] : any; }>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Remove the entry or entries under the specified path
*
* @param {string} userScope - User-Scope at which to remove the value. Should be "me" for the current user or "host" for all users.
* @param {string} key - Root key of the entry or entries to remove
*/
public async removeEntries(
userScope: string,
key: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
key: key
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"cd006711-163d-4cd4-a597-b05bad2556ff",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Set the specified setting entry values for the given user/all-users scope
*
* @param {{ [key: string] : any; }} entries - The entries to set
* @param {string} userScope - User-Scope at which to set the values. Should be "me" for the current user or "host" for all users.
*/
public async setEntries(
entries: { [key: string] : any; },
userScope: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"cd006711-163d-4cd4-a597-b05bad2556ff",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, entries, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get all setting entries for the given named scope
*
* @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
* @param {string} key - Optional key under which to filter all the entries
*/
public async getEntriesForScope(
userScope: string,
scopeName: string,
scopeValue: string,
key?: string
): Promise<{ [key: string] : any; }> {
return new Promise<{ [key: string] : any; }>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue,
key: key
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"4cbaafaf-e8af-4570-98d1-79ee99c56327",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<{ [key: string] : any; }>;
res = await this.rest.get<{ [key: string] : any; }>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Remove the entry or entries under the specified path
*
* @param {string} userScope - User-Scope at which to remove the value. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to get the setting for (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
* @param {string} key - Root key of the entry or entries to remove
*/
public async removeEntriesForScope(
userScope: string,
scopeName: string,
scopeValue: string,
key: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue,
key: key
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"4cbaafaf-e8af-4570-98d1-79ee99c56327",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Set the specified entries for the given named scope
*
* @param {{ [key: string] : any; }} entries - The entries to set
* @param {string} userScope - User-Scope at which to set the values. Should be "me" for the current user or "host" for all users.
* @param {string} scopeName - Scope at which to set the settings on (e.g. "project" or "team")
* @param {string} scopeValue - Value of the scope (e.g. the project or team id)
*/
public async setEntriesForScope(
entries: { [key: string] : any; },
userScope: string,
scopeName: string,
scopeValue: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userScope: userScope,
scopeName: scopeName,
scopeValue: scopeValue
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Settings",
"4cbaafaf-e8af-4570-98d1-79ee99c56327",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, entries, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

28
api/TFSAnalyticsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,28 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
export interface ITFSAnalyticsApi extends basem.ClientApiBase {
}
export class TFSAnalyticsApi extends basem.ClientApiBase implements ITFSAnalyticsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-TFSAnalytics-api');
}
}

Просмотреть файл

@ -3,7 +3,6 @@ import ifm = require("./interfaces/common/VsoBaseInterfaces");
import taskagentbasem = require('./TaskAgentApiBase');
import url = require('url');
import vsom = require('./VsoClient');
import Q = require("q");
import TaskAgentInterfaces = require("./interfaces/TaskAgentInterfaces");
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
@ -209,7 +208,7 @@ export class TaskAgentApi extends taskagentbasem.TaskAgentApiBase implements ITa
contentStream: NodeJS.ReadableStream,
taskId: string,
overwrite: boolean
): Q.Promise<void> {
): Promise<void> {
let routeValues: any = {
taskId: taskId
@ -222,26 +221,24 @@ export class TaskAgentApi extends taskagentbasem.TaskAgentApiBase implements ITa
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/octet-stream";
let deferred = Q.defer<void>();
return new Promise<void>((resolve, reject) => {
this.vsoClient.getVersioningData("3.0-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
var url: string = versioningData.requestUrl;
var apiVersion: string = versioningData.apiVersion;
var serializationData = { responseIsCollection: false };
this.vsoClient.getVersioningData("3.0-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues)
.then((versioningData: vsom.ClientVersioningData) => {
var url: string = versioningData.requestUrl;
var apiVersion: string = versioningData.apiVersion;
var serializationData = { responseIsCollection: false };
this.restClient.uploadStream('PUT', url, apiVersion, contentStream, customHeaders, serializationData, (err: any, statusCode: number, obj: any) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
deferred.resolve(null);
}
});
});
return deferred.promise;
this.restCallbackClient.uploadStream('PUT', url, apiVersion, contentStream, customHeaders, (err: any, statusCode: number, obj: any) => {
if (err) {
err.statusCode = statusCode;
reject(err);
}
else {
resolve(null);
}
}, serializationData);
});
});
}
private _getFallbackClient(baseUrl: string): TaskAgentApi {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

308
api/TeamApi.ts Normal file
Просмотреть файл

@ -0,0 +1,308 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import TeamInterfaces = require("./interfaces/TeamInterfaces");
import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
export interface ITeamApi extends basem.ClientApiBase {
getTeamMembers(projectId: string, teamId: string, top?: number, skip?: number): Promise<VSSInterfaces.IdentityRef[]>;
createTeam(team: TeamInterfaces.WebApiTeam, projectId: string): Promise<TeamInterfaces.WebApiTeam>;
deleteTeam(projectId: string, teamId: string): Promise<void>;
getTeam(projectId: string, teamId: string): Promise<TeamInterfaces.WebApiTeam>;
getTeams(projectId: string, top?: number, skip?: number): Promise<TeamInterfaces.WebApiTeam[]>;
updateTeam(teamData: TeamInterfaces.WebApiTeam, projectId: string, teamId: string): Promise<TeamInterfaces.WebApiTeam>;
}
export class TeamApi extends basem.ClientApiBase implements ITeamApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Core-api');
}
/**
* @param {string} projectId
* @param {string} teamId
* @param {number} top
* @param {number} skip
*/
public async getTeamMembers(
projectId: string,
teamId: string,
top?: number,
skip?: number
): Promise<VSSInterfaces.IdentityRef[]> {
return new Promise<VSSInterfaces.IdentityRef[]>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId,
teamId: teamId
};
let queryValues: any = {
'$top': top,
'$skip': skip,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"294c494c-2600-4d7e-b76c-3dd50c3c95be",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VSSInterfaces.IdentityRef[]>;
res = await this.rest.get<VSSInterfaces.IdentityRef[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Creates a team
*
* @param {TeamInterfaces.WebApiTeam} team - The team data used to create the team.
* @param {string} projectId - The name or id (GUID) of the team project in which to create the team.
*/
public async createTeam(
team: TeamInterfaces.WebApiTeam,
projectId: string
): Promise<TeamInterfaces.WebApiTeam> {
return new Promise<TeamInterfaces.WebApiTeam>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"d30a3dd1-f8ba-442a-b86a-bd0c0c383e59",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TeamInterfaces.WebApiTeam>;
res = await this.rest.create<TeamInterfaces.WebApiTeam>(url, team, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Deletes a team
*
* @param {string} projectId - The name or id (GUID) of the team project containing the team to delete.
* @param {string} teamId - The name of id of the team to delete.
*/
public async deleteTeam(
projectId: string,
teamId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId,
teamId: teamId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"d30a3dd1-f8ba-442a-b86a-bd0c0c383e59",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Gets a team
*
* @param {string} projectId
* @param {string} teamId
*/
public async getTeam(
projectId: string,
teamId: string
): Promise<TeamInterfaces.WebApiTeam> {
return new Promise<TeamInterfaces.WebApiTeam>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId,
teamId: teamId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"d30a3dd1-f8ba-442a-b86a-bd0c0c383e59",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TeamInterfaces.WebApiTeam>;
res = await this.rest.get<TeamInterfaces.WebApiTeam>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} projectId
* @param {number} top
* @param {number} skip
*/
public async getTeams(
projectId: string,
top?: number,
skip?: number
): Promise<TeamInterfaces.WebApiTeam[]> {
return new Promise<TeamInterfaces.WebApiTeam[]>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId
};
let queryValues: any = {
'$top': top,
'$skip': skip,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"d30a3dd1-f8ba-442a-b86a-bd0c0c383e59",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TeamInterfaces.WebApiTeam[]>;
res = await this.rest.get<TeamInterfaces.WebApiTeam[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Updates a team's name and/or description
*
* @param {TeamInterfaces.WebApiTeam} teamData
* @param {string} projectId - The name or id (GUID) of the team project containing the team to update.
* @param {string} teamId - The name of id of the team to update.
*/
public async updateTeam(
teamData: TeamInterfaces.WebApiTeam,
projectId: string,
teamId: string
): Promise<TeamInterfaces.WebApiTeam> {
return new Promise<TeamInterfaces.WebApiTeam>(async (resolve, reject) => {
let routeValues: any = {
projectId: projectId,
teamId: teamId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"core",
"d30a3dd1-f8ba-442a-b86a-bd0c0c383e59",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TeamInterfaces.WebApiTeam>;
res = await this.rest.update<TeamInterfaces.WebApiTeam>(url, teamData, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

317
api/TestExecutionApi.ts Normal file
Просмотреть файл

@ -0,0 +1,317 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import TestExecutionInterfaces = require("./interfaces/TestExecutionInterfaces");
export interface ITestApi extends basem.ClientApiBase {
createAgent(testAgent: TestExecutionInterfaces.TestAgent): Promise<TestExecutionInterfaces.TestAgent>;
deleteAgent(id: number): Promise<void>;
getAgent(id: number): Promise<TestExecutionInterfaces.TestAgent>;
getCommand(testAgentId?: number, commandId?: number): Promise<TestExecutionInterfaces.TestExecutionServiceCommand>;
updateTestRun(distributedTestRun: TestExecutionInterfaces.DistributedTestRun, project: string): Promise<TestExecutionInterfaces.DistributedTestRun>;
getSlice(testAgentId: number): Promise<TestExecutionInterfaces.TestAutomationRunSlice>;
updateSlice(sliceDetails: TestExecutionInterfaces.TestAutomationRunSlice): Promise<void>;
}
export class TestApi extends basem.ClientApiBase implements ITestApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Test-api');
}
/**
* http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/agents Request: Json of TestAgent
*
* @param {TestExecutionInterfaces.TestAgent} testAgent
*/
public async createAgent(
testAgent: TestExecutionInterfaces.TestAgent
): Promise<TestExecutionInterfaces.TestAgent> {
return new Promise<TestExecutionInterfaces.TestAgent>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"0f1857de-6e56-4010-9ea7-f29b80b911c4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TestExecutionInterfaces.TestAgent>;
res = await this.rest.create<TestExecutionInterfaces.TestAgent>(url, testAgent, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/agents/id Request: Json of id
*
* @param {number} id
*/
public async deleteAgent(
id: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"0f1857de-6e56-4010-9ea7-f29b80b911c4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/agents/id Request: Json of id
*
* @param {number} id
*/
public async getAgent(
id: number
): Promise<TestExecutionInterfaces.TestAgent> {
return new Promise<TestExecutionInterfaces.TestAgent>(async (resolve, reject) => {
let routeValues: any = {
id: id
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"0f1857de-6e56-4010-9ea7-f29b80b911c4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TestExecutionInterfaces.TestAgent>;
res = await this.rest.get<TestExecutionInterfaces.TestAgent>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Gets test message that is in queue after lastMessageId.
*
* @param {number} testAgentId - The test agent which calls this api.
* @param {number} commandId
*/
public async getCommand(
testAgentId?: number,
commandId?: number
): Promise<TestExecutionInterfaces.TestExecutionServiceCommand> {
return new Promise<TestExecutionInterfaces.TestExecutionServiceCommand>(async (resolve, reject) => {
let routeValues: any = {
testAgentId: testAgentId,
commandId: commandId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"5b78449b-a866-4726-b989-9083eb2d977c",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TestExecutionInterfaces.TestExecutionServiceCommand>;
res = await this.rest.get<TestExecutionInterfaces.TestExecutionServiceCommand>(url, options);
let ret = this.formatResponse(res.result,
TestExecutionInterfaces.TypeInfo.TestExecutionServiceCommand,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/DistributedTestRuns/ Request: Json of TestRun
*
* @param {TestExecutionInterfaces.DistributedTestRun} distributedTestRun
* @param {string} project
*/
public async updateTestRun(
distributedTestRun: TestExecutionInterfaces.DistributedTestRun,
project: string
): Promise<TestExecutionInterfaces.DistributedTestRun> {
return new Promise<TestExecutionInterfaces.DistributedTestRun>(async (resolve, reject) => {
let routeValues: any = {
project: project
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"b7c4fe2a-9dd1-4dae-8b77-8412002de5a4",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TestExecutionInterfaces.DistributedTestRun>;
res = await this.rest.update<TestExecutionInterfaces.DistributedTestRun>(url, distributedTestRun, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/slices/[?testAgentId=1]
*
* @param {number} testAgentId
*/
public async getSlice(
testAgentId: number
): Promise<TestExecutionInterfaces.TestAutomationRunSlice> {
return new Promise<TestExecutionInterfaces.TestAutomationRunSlice>(async (resolve, reject) => {
let routeValues: any = {
testAgentId: testAgentId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"575891b2-50a3-474f-a963-7ca011c97500",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TestExecutionInterfaces.TestAutomationRunSlice>;
res = await this.rest.get<TestExecutionInterfaces.TestAutomationRunSlice>(url, options);
let ret = this.formatResponse(res.result,
TestExecutionInterfaces.TypeInfo.TestAutomationRunSlice,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {TestExecutionInterfaces.TestAutomationRunSlice} sliceDetails
*/
public async updateSlice(
sliceDetails: TestExecutionInterfaces.TestAutomationRunSlice
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Test",
"575891b2-50a3-474f-a963-7ca011c97500",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.update<void>(url, sliceDetails, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

130
api/UserMappingApi.ts Normal file
Просмотреть файл

@ -0,0 +1,130 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import UserMappingInterfaces = require("./interfaces/UserMappingInterfaces");
export interface IUserMappingApi extends basem.ClientApiBase {
activateUserAccountMapping(userId: string, accountId: string, userType?: UserMappingInterfaces.UserType): Promise<void>;
queryAccountIds(userId: string, userType: UserMappingInterfaces.UserType, useEqualsCheckForUserTypeMatch?: boolean, includeDeletedAccounts?: boolean): Promise<string[]>;
}
export class UserMappingApi extends basem.ClientApiBase implements IUserMappingApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-UserMapping-api');
}
/**
* @param {string} userId
* @param {string} accountId
* @param {UserMappingInterfaces.UserType} userType
*/
public async activateUserAccountMapping(
userId: string,
accountId: string,
userType?: UserMappingInterfaces.UserType
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
userId: userId
};
let queryValues: any = {
accountId: accountId,
userType: userType,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"UserMapping",
"0dbf02cc-5ec3-4250-a145-5beb580e0086",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.create<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} userId
* @param {UserMappingInterfaces.UserType} userType
* @param {boolean} useEqualsCheckForUserTypeMatch
* @param {boolean} includeDeletedAccounts
*/
public async queryAccountIds(
userId: string,
userType: UserMappingInterfaces.UserType,
useEqualsCheckForUserTypeMatch?: boolean,
includeDeletedAccounts?: boolean
): Promise<string[]> {
return new Promise<string[]>(async (resolve, reject) => {
let routeValues: any = {
userId: userId
};
let queryValues: any = {
userType: userType,
useEqualsCheckForUserTypeMatch: useEqualsCheckForUserTypeMatch,
includeDeletedAccounts: includeDeletedAccounts,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"UserMapping",
"0dbf02cc-5ec3-4250-a145-5beb580e0086",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<string[]>;
res = await this.rest.get<string[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

74
api/UtilizationApi.ts Normal file
Просмотреть файл

@ -0,0 +1,74 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import UtilizationInterfaces = require("./interfaces/UtilizationInterfaces");
export interface IUtilizationApi extends basem.ClientApiBase {
getUsageSummary(queryCriteria: UtilizationInterfaces.UsageSummaryQueryCriteria): Promise<UtilizationInterfaces.CommandUsage[]>;
}
export class UtilizationApi extends basem.ClientApiBase implements IUtilizationApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Utilization-api');
}
/**
* Returns the usage summary for the specified identity.
*
* @param {UtilizationInterfaces.UsageSummaryQueryCriteria} queryCriteria - The query criteria for this request
*/
public async getUsageSummary(
queryCriteria: UtilizationInterfaces.UsageSummaryQueryCriteria
): Promise<UtilizationInterfaces.CommandUsage[]> {
return new Promise<UtilizationInterfaces.CommandUsage[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
queryCriteria: queryCriteria,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Utilization",
"d3709376-907a-49d8-b7a7-c4ea99ca3772",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<UtilizationInterfaces.CommandUsage[]>;
res = await this.rest.get<UtilizationInterfaces.CommandUsage[]>(url, options);
let ret = this.formatResponse(res.result,
UtilizationInterfaces.TypeInfo.CommandUsage,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

156
api/VisitsApi.ts Normal file
Просмотреть файл

@ -0,0 +1,156 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import VisitsInterfaces = require("./interfaces/VisitsInterfaces");
export interface IVisitsApi extends basem.ClientApiBase {
getStats(stats: VisitsInterfaces.ArtifactStats[], includeUpdatesSinceLastVisit?: boolean): Promise<VisitsInterfaces.ArtifactStats[]>;
updateLastVisit(visit: VisitsInterfaces.ArtifactVisit): Promise<VisitsInterfaces.ArtifactVisit>;
getVisits(visits: VisitsInterfaces.ArtifactVisit[]): Promise<VisitsInterfaces.ArtifactVisit[]>;
}
export class VisitsApi extends basem.ClientApiBase implements IVisitsApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-Visits-api');
}
/**
* Get last visit dates POST /_apis/visits/artifactStatsBatch
*
* @param {VisitsInterfaces.ArtifactStats[]} stats
* @param {boolean} includeUpdatesSinceLastVisit
*/
public async getStats(
stats: VisitsInterfaces.ArtifactStats[],
includeUpdatesSinceLastVisit?: boolean
): Promise<VisitsInterfaces.ArtifactStats[]> {
return new Promise<VisitsInterfaces.ArtifactStats[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
includeUpdatesSinceLastVisit: includeUpdatesSinceLastVisit,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"visits",
"2d358c96-88cc-42ba-9b5d-a2cb26c64972",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VisitsInterfaces.ArtifactStats[]>;
res = await this.rest.create<VisitsInterfaces.ArtifactStats[]>(url, stats, options);
let ret = this.formatResponse(res.result,
VisitsInterfaces.TypeInfo.ArtifactStats,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Update or create a last visit date PUT /_apis/visits/artifactVisits
*
* @param {VisitsInterfaces.ArtifactVisit} visit
*/
public async updateLastVisit(
visit: VisitsInterfaces.ArtifactVisit
): Promise<VisitsInterfaces.ArtifactVisit> {
return new Promise<VisitsInterfaces.ArtifactVisit>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"visits",
"c4bc78ab-8d09-4b62-98f2-efb1affe50f8",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VisitsInterfaces.ArtifactVisit>;
res = await this.rest.replace<VisitsInterfaces.ArtifactVisit>(url, visit, options);
let ret = this.formatResponse(res.result,
VisitsInterfaces.TypeInfo.ArtifactVisit,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Get last visit dates POST /_apis/visits/artifactVisitsBatch
*
* @param {VisitsInterfaces.ArtifactVisit[]} visits
*/
public async getVisits(
visits: VisitsInterfaces.ArtifactVisit[]
): Promise<VisitsInterfaces.ArtifactVisit[]> {
return new Promise<VisitsInterfaces.ArtifactVisit[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"visits",
"d1786677-7a19-445b-9a7a-25728f48d149",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VisitsInterfaces.ArtifactVisit[]>;
res = await this.rest.create<VisitsInterfaces.ArtifactVisit[]>(url, visits, options);
let ret = this.formatResponse(res.result,
VisitsInterfaces.TypeInfo.ArtifactVisit,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -1,335 +1,343 @@
//*******************************************************************************************************
// significant portions of this file copied from: VSO\src\Vssf\WebPlatform\Platform\Scripts\VSS\WebApi\RestClient.ts
//*******************************************************************************************************
/// Imports of 3rd Party ///
import Q = require("q");
import url = require("url");
import path = require("path");
/// Import base rest class ///
import restm = require("./RestClient");
import httpm = require("./HttpClient");
import ifm = require("./interfaces/common/VsoBaseInterfaces");
interface VssApiResourceLocationLookup {
[locationId: string]: ifm.ApiResourceLocation;
}
export interface ClientVersioningData {
/**
* The api version string to send in the request (e.g. "1.0" or "2.0-preview.2")
*/
apiVersion?: string;
/**
* The request path string to send the request to. Looked up via an options request with the location id.
*/
requestUrl?: string;
}
export class InvalidApiResourceVersionError implements Error {
public name: string = "Invalid resource version";
public message: string;
constructor(message?: string) {
this.message = message;
}
}
/**
* Base class that should be used (derived from) to make requests to VSS REST apis
*/
export class VsoClient {
private static APIS_RELATIVE_PATH = "_apis";
private static PREVIEW_INDICATOR = "-preview.";
private _locationsByAreaPromises: { [areaName: string]: Q.Promise<VssApiResourceLocationLookup>; };
private _initializationPromise: Q.Promise<any>;
restClient: ifm.IRestClient;
baseUrl: string;
basePath: string;
constructor(baseUrl: string, restClient: restm.RestClient) {
this.baseUrl = baseUrl;
this.basePath = url.parse(baseUrl).pathname;
this.restClient = restClient;
this._locationsByAreaPromises = {};
this._initializationPromise = Q.fcall(() => true);
}
/**
* Compares the version on the server (locationVersion) to the api version given by the client (apiVersion).
* Returns a negative value if the location version is older (less than) the api version
* Returns 0 if the two are equal
* Returns a positive value if the location version is newer (greater than) the api version
*/
private compareResourceVersions(locationVersion: string, apiVersion: string) {
// escape early if versions are the same
if (locationVersion == apiVersion) {
return 0;
}
// otherwise replaces the '-preview' flag and compares each .-separated piece of the string individually
locationVersion = locationVersion.replace(VsoClient.PREVIEW_INDICATOR, "");
apiVersion = apiVersion.replace(VsoClient.PREVIEW_INDICATOR, "");
var splitLocationVersion: string[] = locationVersion.split('.');
var splitApiVersion: string[] = apiVersion.split('.');
var i;
for (i = 0; i < Math.min(splitLocationVersion.length, splitApiVersion.length); i++) {
var locationVersionPart: number = parseInt(splitLocationVersion[i]);
var apiVersionPart: number = parseInt(splitApiVersion[i]);
if (locationVersionPart != apiVersionPart) {
return locationVersionPart - apiVersionPart;
}
}
// if the strings aren't equal, but were the same all the way through the loop, then one version is longer (and thus newer) than the other
return splitLocationVersion.length - splitApiVersion.length;
}
/**
* Gets the route template for a resource based on its location ID and negotiates the api version
*/
public getVersioningData(apiVersion: string, area: string, locationId: string, routeValues: any, queryParams?: any): Q.Promise<ClientVersioningData> {
var requestUrl;
var deferred = Q.defer<ClientVersioningData>();
this.beginGetLocation(area, locationId)
.then((location: ifm.ApiResourceLocation) => {
if (!location) {
throw new Error("Failed to find api location for area: " + area + " id: " + locationId);
}
if (!apiVersion) {
// Use the latest version of the resource if the api version was not specified in the request.
apiVersion = location.maxVersion + VsoClient.PREVIEW_INDICATOR + location.resourceVersion;
}
else {
if (this.compareResourceVersions(location.minVersion, apiVersion) > 1) {
// Client is older than the server. The server no longer supports this resource (deprecated).
throw new InvalidApiResourceVersionError("The client being used is older than the server. The server no longer supports this resource (deprecated). Update the client.");
}
else if (this.compareResourceVersions(location.maxVersion, apiVersion) < 1) {
// Client is newer than the server. Negotiate down to the latest version on the server
apiVersion = location.maxVersion + VsoClient.PREVIEW_INDICATOR + location.resourceVersion;
}
}
requestUrl = this.getRequestUrl(location.routeTemplate, location.area, location.resourceName, routeValues, queryParams);
var versionData = {
apiVersion: apiVersion,
requestUrl: requestUrl
};
deferred.resolve(versionData);
})
.fail((err) => {
deferred.reject(err);
});
return deferred.promise;
}
/**
* Sets a promise that is waited on before any requests are issued. Can be used to asynchronously
* set the request url and auth token manager.
*/
public _setInitializationPromise(promise: Q.Promise<any>) {
if (promise) {
this._initializationPromise = promise;
}
}
/**
* Gets information about an API resource location (route template, supported versions, etc.)
*
* @param area resource area name
* @param locationId Guid of the location to get
*/
public beginGetLocation(area: string, locationId: string): Q.Promise<ifm.ApiResourceLocation> {
return this._initializationPromise.then(() => {
return this.beginGetAreaLocations(area);
}).then((areaLocations: VssApiResourceLocationLookup) => {
return areaLocations[(locationId || "").toLowerCase()];
});
}
private beginGetAreaLocations(area: string): Q.Promise<VssApiResourceLocationLookup> {
var areaLocationsPromise = this._locationsByAreaPromises[area];
if (!areaLocationsPromise) {
var deferred = Q.defer<VssApiResourceLocationLookup>();
areaLocationsPromise = deferred.promise;
var requestUrl = this.resolveUrl(VsoClient.APIS_RELATIVE_PATH + "/" + area);
this._issueOptionsRequest(requestUrl, (err: any, statusCode: number, locationsResult: any) => {
if (err) {
err.statusCode = statusCode;
deferred.reject(err);
}
else {
var locationsLookup: VssApiResourceLocationLookup = {};
var resourceLocations: ifm.ApiResourceLocation[] = locationsResult.value;
var i;
for (i = 0; i < locationsResult.count; i++) {
var resourceLocation = resourceLocations[i];
locationsLookup[resourceLocation.id.toLowerCase()] = resourceLocation;
}
deferred.resolve(locationsLookup);
}
});
this._locationsByAreaPromises[area] = areaLocationsPromise;
}
return areaLocationsPromise;
}
public resolveUrl(relativeUrl: string): string {
return url.resolve(this.baseUrl, path.join(this.basePath, relativeUrl));
}
/**
* Issues an OPTIONS request to get location objects from a location id
*/
public _issueOptionsRequest(requestUrl: string, onResult: (err: any, statusCode: number, locationsResult: any) => void): void {
return this.restClient.options(requestUrl, onResult);
}
private getSerializedObject(object: any): string {
let value:string = "";
let first:boolean = true;
for (var property in object) {
if (object.hasOwnProperty(property)) {
let prop = object[property];
if (first && prop !== undefined) {
value += property + "=" + encodeURIComponent(prop);
first = false;
} else if (prop !== undefined) {
value += "&" + property +"=" + encodeURIComponent(prop);
}
}
}
return value;
}
protected getRequestUrl(routeTemplate: string, area: string, resource: string, routeValues: any, queryParams?: any): string {
// Add area/resource route values (based on the location)
routeValues = routeValues || {};
if (!routeValues.area) {
routeValues.area = area;
}
if (!routeValues.resource) {
routeValues.resource = resource;
}
// Replace templated route values
var relativeUrl = this.replaceRouteValues(routeTemplate, routeValues);
//append query parameters to the end
var first = true;
for (var queryValue in queryParams) {
if (queryParams[queryValue] != null) {
var value = queryParams[queryValue];
var valueString = null;
if (typeof(value) === 'object') {
valueString = this.getSerializedObject(value);
} else {
valueString = queryValue + "=" + encodeURIComponent(queryParams[queryValue]);
}
if (first) {
relativeUrl += "?" + valueString;
first = false;
} else {
relativeUrl += "&" + valueString;
}
}
}
//resolve the relative url with the base
return url.resolve(this.baseUrl, path.join(this.basePath, relativeUrl));
}
/*
* helper method copied directly from VSS\WebAPI\restclient.ts
*/
private replaceRouteValues(routeTemplate: string, routeValues: any): string {
var result = "",
currentPathPart = "",
paramName = "",
insideParam = false,
charIndex: number,
routeTemplateLength = routeTemplate.length,
c: string;
for (charIndex = 0; charIndex < routeTemplateLength; charIndex++) {
c = routeTemplate[charIndex];
if (insideParam) {
if (c == "}") {
insideParam = false;
if (routeValues[paramName]) {
currentPathPart += encodeURIComponent(routeValues[paramName]);
} else {
// Normalize param name in order to capture wild-card routes
var strippedParamName = paramName.replace(/[^a-z0-9]/ig, '');
if (routeValues[strippedParamName]) {
currentPathPart += encodeURIComponent(routeValues[strippedParamName]);
}
}
paramName = "";
}
else {
paramName += c;
}
}
else {
if (c == "/") {
if (currentPathPart) {
if (result) {
result += "/";
}
result += currentPathPart;
currentPathPart = "";
}
}
else if (c == "{") {
if ((charIndex + 1) < routeTemplateLength && routeTemplate[charIndex + 1] == "{") {
// Escaped '{'
currentPathPart += c;
charIndex++;
}
else {
insideParam = true;
}
}
else if (c == '}') {
currentPathPart += c;
if ((charIndex + 1) < routeTemplateLength && routeTemplate[charIndex + 1] == "}") {
// Escaped '}'
charIndex++;
}
}
else {
currentPathPart += c;
}
}
}
if (currentPathPart) {
if (result) {
result += "/";
}
result += currentPathPart;
}
return result;
}
}
//*******************************************************************************************************
// significant portions of this file copied from: VSO\src\Vssf\WebPlatform\Platform\Scripts\VSS\WebApi\RestClient.ts
//*******************************************************************************************************
/// Imports of 3rd Party ///
import url = require("url");
import path = require("path");
/// Import base rest class ///
import restm = require("./RestClient");
import httpm = require("./HttpClient");
import ifm = require("./interfaces/common/VsoBaseInterfaces");
interface VssApiResourceLocationLookup {
[locationId: string]: ifm.ApiResourceLocation;
}
export interface ClientVersioningData {
/**
* The api version string to send in the request (e.g. "1.0" or "2.0-preview.2")
*/
apiVersion?: string;
/**
* The request path string to send the request to. Looked up via an options request with the location id.
*/
requestUrl?: string;
}
export class InvalidApiResourceVersionError implements Error {
public name: string = "Invalid resource version";
public message: string;
constructor(message?: string) {
this.message = message;
}
}
/**
* Base class that should be used (derived from) to make requests to VSS REST apis
*/
export class VsoClient {
private static APIS_RELATIVE_PATH = "_apis";
private static PREVIEW_INDICATOR = "-preview.";
private _locationsByAreaPromises: { [areaName: string]: Promise<VssApiResourceLocationLookup>; };
private _initializationPromise: Promise<any>;
restClient: restm.RestCallbackClient;
baseUrl: string;
basePath: string;
constructor(baseUrl: string, restClient: restm.RestCallbackClient) {
this.baseUrl = baseUrl;
this.basePath = url.parse(baseUrl).pathname;
this.restClient = restClient;
this._locationsByAreaPromises = {};
this._initializationPromise = Promise.resolve(true);
}
protected autoNegotiateApiVersion(location: ifm.ApiResourceLocation, requestedVersion: string): string {
let negotiatedVersion: string;
let apiVersion: number;
let apiVersionString: string;
if (requestedVersion) {
let apiVersionRegEx = new RegExp('(\\d+(\\.\\d+)?)(-preview(\\.(\\d+))?)?');
// Need to handle 3 types of api versions + invalid apiversion
// '2.1-preview.1' = ["2.1-preview.1", "2.1", ".1", -preview.1", ".1", "1"]
// '2.1-preview' = ["2.1-preview", "2.1", ".1", "-preview", undefined, undefined]
// '2.1' = ["2.1", "2.1", ".1", undefined, undefined, undefined]
let isPreview = false;
let resourceVersion: number;
let regExExecArray = apiVersionRegEx.exec(requestedVersion);
if (regExExecArray) {
if (regExExecArray[1]) {
// we have an api version
apiVersion = +regExExecArray[1];
apiVersionString = regExExecArray[1];
if (regExExecArray[3]) {
// requesting preview
isPreview = true;
if (regExExecArray[5]) {
// we have a resource version
resourceVersion = +regExExecArray[5];
}
}
// compare the location version and requestedversion
if (apiVersion <= +location.releasedVersion
|| (!resourceVersion && apiVersion <= +location.maxVersion && isPreview)
|| (resourceVersion && apiVersion <= +location.maxVersion && resourceVersion <= +location.resourceVersion)) {
negotiatedVersion = requestedVersion;
}
// else fall back to latest version of the resource from location
}
}
}
if (!negotiatedVersion) {
// Use the latest version of the resource if the api version was not specified in the request or if the requested version is higher then the location's supported version
if (apiVersion < +location.maxVersion) {
negotiatedVersion = apiVersionString + "-preview";
}
else if (location.maxVersion === location.releasedVersion) {
negotiatedVersion = location.maxVersion;
}
else {
negotiatedVersion = location.maxVersion + "-preview." + location.resourceVersion;
}
}
return negotiatedVersion;
}
/**
* Gets the route template for a resource based on its location ID and negotiates the api version
*/
public getVersioningData(apiVersion: string, area: string, locationId: string, routeValues: any, queryParams?: any): Promise<ClientVersioningData> {
let requestUrl;
return new Promise<ClientVersioningData>((resolve, reject) => {
this.beginGetLocation(area, locationId)
.then((location: ifm.ApiResourceLocation) => {
if (!location) {
throw new Error("Failed to find api location for area: " + area + " id: " + locationId);
}
apiVersion = this.autoNegotiateApiVersion(location, apiVersion);
requestUrl = this.getRequestUrl(location.routeTemplate, location.area, location.resourceName, routeValues, queryParams);
let versionData = {
apiVersion: apiVersion,
requestUrl: requestUrl
};
resolve(versionData);
}, (err) => {
reject(err);
});
});
}
/**
* Sets a promise that is waited on before any requests are issued. Can be used to asynchronously
* set the request url and auth token manager.
*/
public _setInitializationPromise(promise: Promise<any>) {
if (promise) {
this._initializationPromise = promise;
}
}
/**
* Gets information about an API resource location (route template, supported versions, etc.)
*
* @param area resource area name
* @param locationId Guid of the location to get
*/
public beginGetLocation(area: string, locationId: string): Promise<ifm.ApiResourceLocation> {
return this._initializationPromise.then(() => {
return this.beginGetAreaLocations(area);
}).then((areaLocations: VssApiResourceLocationLookup) => {
return areaLocations[(locationId || "").toLowerCase()];
});
}
private beginGetAreaLocations(area: string): Promise<VssApiResourceLocationLookup> {
let areaLocationsPromise = this._locationsByAreaPromises[area];
if (!areaLocationsPromise) {
areaLocationsPromise = new Promise<VssApiResourceLocationLookup>((resolve, reject) => {
let requestUrl = this.resolveUrl(VsoClient.APIS_RELATIVE_PATH + "/" + area);
this._issueOptionsRequest(requestUrl, (err: any, statusCode: number, locationsResult: any) => {
if (err) {
err.statusCode = statusCode;
reject(err);
}
else {
let locationsLookup: VssApiResourceLocationLookup = {};
let resourceLocations: ifm.ApiResourceLocation[] = locationsResult.value;
let i;
for (i = 0; i < locationsResult.count; i++) {
let resourceLocation = resourceLocations[i];
locationsLookup[resourceLocation.id.toLowerCase()] = resourceLocation;
}
resolve(locationsLookup);
}
});
});
this._locationsByAreaPromises[area] = areaLocationsPromise;
}
return areaLocationsPromise;
}
public resolveUrl(relativeUrl: string): string {
return url.resolve(this.baseUrl, path.join(this.basePath, relativeUrl));
}
/**
* Issues an OPTIONS request to get location objects from a location id
*/
public _issueOptionsRequest(requestUrl: string, onResult: (err: any, statusCode: number, locationsResult: any) => void): void {
return this.restClient.options(requestUrl, onResult);
}
private getSerializedObject(object: any): string {
let value:string = "";
let first:boolean = true;
for (let property in object) {
if (object.hasOwnProperty(property)) {
let prop = object[property];
if (first && prop !== undefined) {
value += property + "=" + encodeURIComponent(prop);
first = false;
} else if (prop !== undefined) {
value += "&" + property +"=" + encodeURIComponent(prop);
}
}
}
return value;
}
protected getRequestUrl(routeTemplate: string, area: string, resource: string, routeValues: any, queryParams?: any): string {
// Add area/resource route values (based on the location)
routeValues = routeValues || {};
if (!routeValues.area) {
routeValues.area = area;
}
if (!routeValues.resource) {
routeValues.resource = resource;
}
// Replace templated route values
let relativeUrl = this.replaceRouteValues(routeTemplate, routeValues);
//append query parameters to the end
let first = true;
for (let queryValue in queryParams) {
if (queryParams[queryValue] != null) {
let value = queryParams[queryValue];
let valueString = null;
if (typeof(value) === 'object') {
valueString = this.getSerializedObject(value);
} else {
valueString = queryValue + "=" + encodeURIComponent(queryParams[queryValue]);
}
if (first) {
relativeUrl += "?" + valueString;
first = false;
} else {
relativeUrl += "&" + valueString;
}
}
}
//resolve the relative url with the base
return url.resolve(this.baseUrl, path.join(this.basePath, relativeUrl));
}
// helper method copied directly from VSS\WebAPI\restclient.ts
private replaceRouteValues(routeTemplate: string, routeValues: any): string {
let result = "",
currentPathPart = "",
paramName = "",
insideParam = false,
charIndex: number,
routeTemplateLength = routeTemplate.length,
c: string;
for (charIndex = 0; charIndex < routeTemplateLength; charIndex++) {
c = routeTemplate[charIndex];
if (insideParam) {
if (c == "}") {
insideParam = false;
if (routeValues[paramName]) {
currentPathPart += encodeURIComponent(routeValues[paramName]);
} else {
// Normalize param name in order to capture wild-card routes
let strippedParamName = paramName.replace(/[^a-z0-9]/ig, '');
if (routeValues[strippedParamName]) {
currentPathPart += encodeURIComponent(routeValues[strippedParamName]);
}
}
paramName = "";
}
else {
paramName += c;
}
}
else {
if (c == "/") {
if (currentPathPart) {
if (result) {
result += "/";
}
result += currentPathPart;
currentPathPart = "";
}
}
else if (c == "{") {
if ((charIndex + 1) < routeTemplateLength && routeTemplate[charIndex + 1] == "{") {
// Escaped '{'
currentPathPart += c;
charIndex++;
}
else {
insideParam = true;
}
}
else if (c == '}') {
currentPathPart += c;
if ((charIndex + 1) < routeTemplateLength && routeTemplate[charIndex + 1] == "}") {
// Escaped '}'
charIndex++;
}
}
else {
currentPathPart += c;
}
}
}
if (currentPathPart) {
if (result) {
result += "/";
}
result += currentPathPart;
}
return result;
}
}

222
api/VssfSdkSampleApi.ts Normal file
Просмотреть файл

@ -0,0 +1,222 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import VssfSdkSampleInterfaces = require("./interfaces/VssfSdkSampleInterfaces");
export interface IVssfSdkSampleApi extends basem.ClientApiBase {
createNote(note: VssfSdkSampleInterfaces.Note): Promise<VssfSdkSampleInterfaces.Note>;
deleteNote(noteId: number): Promise<void>;
getNote(noteId: number): Promise<VssfSdkSampleInterfaces.Note>;
getNotes(): Promise<VssfSdkSampleInterfaces.Note[]>;
updateNote(note: VssfSdkSampleInterfaces.Note, noteId: number): Promise<VssfSdkSampleInterfaces.Note>;
}
export class VssfSdkSampleApi extends basem.ClientApiBase implements IVssfSdkSampleApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-VssfSdkSample-api');
}
/**
* @param {VssfSdkSampleInterfaces.Note} note
*/
public async createNote(
note: VssfSdkSampleInterfaces.Note
): Promise<VssfSdkSampleInterfaces.Note> {
return new Promise<VssfSdkSampleInterfaces.Note>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Notes",
"d56223df-8ccd-45c9-89b4-eddf69240000",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VssfSdkSampleInterfaces.Note>;
res = await this.rest.create<VssfSdkSampleInterfaces.Note>(url, note, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {number} noteId
*/
public async deleteNote(
noteId: number
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
noteId: noteId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Notes",
"d56223df-8ccd-45c9-89b4-eddf69240000",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {number} noteId
*/
public async getNote(
noteId: number
): Promise<VssfSdkSampleInterfaces.Note> {
return new Promise<VssfSdkSampleInterfaces.Note>(async (resolve, reject) => {
let routeValues: any = {
noteId: noteId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Notes",
"d56223df-8ccd-45c9-89b4-eddf69240000",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VssfSdkSampleInterfaces.Note>;
res = await this.rest.get<VssfSdkSampleInterfaces.Note>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
*/
public async getNotes(
): Promise<VssfSdkSampleInterfaces.Note[]> {
return new Promise<VssfSdkSampleInterfaces.Note[]>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Notes",
"d56223df-8ccd-45c9-89b4-eddf69240000",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VssfSdkSampleInterfaces.Note[]>;
res = await this.rest.get<VssfSdkSampleInterfaces.Note[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {VssfSdkSampleInterfaces.Note} note
* @param {number} noteId
*/
public async updateNote(
note: VssfSdkSampleInterfaces.Note,
noteId: number
): Promise<VssfSdkSampleInterfaces.Note> {
return new Promise<VssfSdkSampleInterfaces.Note>(async (resolve, reject) => {
let routeValues: any = {
noteId: noteId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"Notes",
"d56223df-8ccd-45c9-89b4-eddf69240000",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<VssfSdkSampleInterfaces.Note>;
res = await this.rest.replace<VssfSdkSampleInterfaces.Note>(url, note, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -17,8 +17,6 @@ import testm = require('./TestApi');
import tfvcm = require('./TfvcApi');
import workitemtrackingm = require('./WorkItemTrackingApi');
import releasem = require('./ReleaseApi');
import apivm = require('./handlers/apiversion');
import basicm = require('./handlers/basiccreds');
import bearm = require('./handlers/bearertoken');
import ntlmm = require('./handlers/ntlm');
@ -27,9 +25,6 @@ import patm = require('./handlers/personalaccesstoken');
/**
* Methods to return handler objects (see handlers folder)
*/
export function getVersionHandler(apiVersion: string) {
return new apivm.ApiVersionHandler(apiVersion);
}
export function getBasicHandler(username: string, password: string) {
return new basicm.BasicCredentialHandler(username, password);
@ -59,74 +54,112 @@ export class WebApi {
/*
* Factory to return client apis and handlers
* @param defaultServerUrl default server url to use when creating new apis from factory methods
* @param defaultAuthHandler default authentication credentials to use when creating new apis from factory methods
* @param defaultUrl default server url to use when creating new apis from factory methods
* @param authHandler default authentication credentials to use when creating new apis from factory methods
*/
constructor(serverUrl: string, authHandler: VsoBaseInterfaces.IRequestHandler) {
this.serverUrl = serverUrl;
constructor(defaultUrl: string, authHandler: VsoBaseInterfaces.IRequestHandler) {
this.serverUrl = defaultUrl;
this.authHandler = authHandler;
}
/**
* Convenience factory to create with a bearer token.
* @param defaultServerUrl default server url to use when creating new apis from factory methods
* @param defaultAuthHandler default authentication credentials to use when creating new apis from factory methods
*/
public static createWithBearerToken(defaultUrl: string, token: string) {
let bearerHandler = getBearerHandler(token);
return new this(defaultUrl, bearerHandler);
}
/**
* Each factory method can take a serverUrl and a list of handlers
* if these aren't provided, the default url and auth handler given to the constructor for this class will be used
*/
public getBuildApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): buildm.IBuildApi {
public getBuildApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): buildm.IBuildApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new buildm.BuildApi(serverUrl, handlers);
}
/**
* Each API has a method here to create the client.
*/
public getCoreApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): corem.ICoreApi {
public getCoreApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): corem.ICoreApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new corem.CoreApi(serverUrl, handlers);
}
public getContributionsApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): contributionsm.ContributionsApi {
public getContributionsApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): contributionsm.ContributionsApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new contributionsm.ContributionsApi(serverUrl, handlers);
}
public getExtensionManagementApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): extmgmtm.IExtensionManagementApi {
public getExtensionManagementApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): extmgmtm.IExtensionManagementApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new extmgmtm.ExtensionManagementApi(serverUrl, handlers);
}
public getFeatureManagementApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): featuremgmtm.FeatureManagementApi {
public getFeatureManagementApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): featuremgmtm.FeatureManagementApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new featuremgmtm.FeatureManagementApi(serverUrl, handlers);
}
public getFileContainerApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): filecontainerm.IFileContainerApi {
public getFileContainerApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): filecontainerm.IFileContainerApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new filecontainerm.FileContainerApi(serverUrl, handlers);
}
public getGalleryApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): gallerym.IGalleryApi {
public getGalleryApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): gallerym.IGalleryApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new gallerym.GalleryApi(serverUrl, handlers);
}
public getGitApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): gitm.IGitApi {
public getGitApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): gitm.IGitApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new gitm.GitApi(serverUrl, handlers);
}
public getTaskApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): taskm.ITaskApi {
public getTaskApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): taskm.ITaskApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new taskm.TaskApi(serverUrl, handlers);
}
public getTaskAgentApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): taskagentm.ITaskAgentApi {
public getTaskAgentApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): taskagentm.ITaskAgentApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new taskagentm.TaskAgentApi(serverUrl, handlers);
}
public getTestApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): testm.ITestApi {
public getTestApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): testm.ITestApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new testm.TestApi(serverUrl, handlers);
}
public getTfvcApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): tfvcm.ITfvcApi {
public getTfvcApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): tfvcm.ITfvcApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new tfvcm.TfvcApi(serverUrl, handlers);
}
public getWorkItemTrackingApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): workitemtrackingm.IWorkItemTrackingApi {
public getWorkItemTrackingApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): workitemtrackingm.IWorkItemTrackingApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new workitemtrackingm.WorkItemTrackingApi(serverUrl, handlers);
}
public getReleaseApi(serverUrl: string = this.serverUrl, handlers: VsoBaseInterfaces.IRequestHandler[] = [this.authHandler]): releasem.IReleaseApi {
public getReleaseApi(serverUrl?: string, handlers?: VsoBaseInterfaces.IRequestHandler[]): releasem.IReleaseApi {
serverUrl = serverUrl || this.serverUrl;
handlers = handlers || [this.authHandler];
return new releasem.ReleaseApi(serverUrl, handlers);
}
}

2064
api/WorkApi.ts Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,507 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import WorkItemTrackingProcessInterfaces = require("./interfaces/WorkItemTrackingProcessInterfaces");
export interface IWorkItemTrackingApi extends basem.ClientApiBase {
getBehavior(processId: string, behaviorRefName: string, expand?: WorkItemTrackingProcessInterfaces.GetBehaviorsExpand): Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior>;
getBehaviors(processId: string, expand?: WorkItemTrackingProcessInterfaces.GetBehaviorsExpand): Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior[]>;
getFields(processId: string): Promise<WorkItemTrackingProcessInterfaces.FieldModel[]>;
getWorkItemTypeFields(processId: string, witRefName: string): Promise<WorkItemTrackingProcessInterfaces.FieldModel[]>;
createProcess(createRequest: WorkItemTrackingProcessInterfaces.CreateProcessModel): Promise<WorkItemTrackingProcessInterfaces.ProcessModel>;
deleteProcess(processTypeId: string): Promise<void>;
getProcessById(processTypeId: string, expand?: WorkItemTrackingProcessInterfaces.GetProcessExpandLevel): Promise<WorkItemTrackingProcessInterfaces.ProcessModel>;
getProcesses(expand?: WorkItemTrackingProcessInterfaces.GetProcessExpandLevel): Promise<WorkItemTrackingProcessInterfaces.ProcessModel[]>;
updateProcess(updateRequest: WorkItemTrackingProcessInterfaces.UpdateProcessModel, processTypeId: string): Promise<WorkItemTrackingProcessInterfaces.ProcessModel>;
getWorkItemType(processId: string, witRefName: string, expand?: WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand): Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel>;
getWorkItemTypes(processId: string, expand?: WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand): Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel[]>;
}
export class WorkItemTrackingApi extends basem.ClientApiBase implements IWorkItemTrackingApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-WorkItemTracking-api');
}
/**
* @param {string} processId
* @param {string} behaviorRefName
* @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand
*/
public async getBehavior(
processId: string,
behaviorRefName: string,
expand?: WorkItemTrackingProcessInterfaces.GetBehaviorsExpand
): Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior> {
return new Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior>(async (resolve, reject) => {
let routeValues: any = {
processId: processId,
behaviorRefName: behaviorRefName
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"d1800200-f184-4e75-a5f2-ad0b04b4373e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.WorkItemBehavior>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.WorkItemBehavior>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
* @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand
*/
public async getBehaviors(
processId: string,
expand?: WorkItemTrackingProcessInterfaces.GetBehaviorsExpand
): Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior[]> {
return new Promise<WorkItemTrackingProcessInterfaces.WorkItemBehavior[]>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"d1800200-f184-4e75-a5f2-ad0b04b4373e",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.WorkItemBehavior[]>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.WorkItemBehavior[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
*/
public async getFields(
processId: string
): Promise<WorkItemTrackingProcessInterfaces.FieldModel[]> {
return new Promise<WorkItemTrackingProcessInterfaces.FieldModel[]>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"7a0e7a1a-0b34-4ae0-9744-0aaffb7d0ed1",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.FieldModel[]>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.FieldModel[]>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.FieldModel,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
* @param {string} witRefName
*/
public async getWorkItemTypeFields(
processId: string,
witRefName: string
): Promise<WorkItemTrackingProcessInterfaces.FieldModel[]> {
return new Promise<WorkItemTrackingProcessInterfaces.FieldModel[]>(async (resolve, reject) => {
let routeValues: any = {
processId: processId,
witRefName: witRefName
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"bc0ad8dc-e3f3-46b0-b06c-5bf861793196",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.FieldModel[]>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.FieldModel[]>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.FieldModel,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {WorkItemTrackingProcessInterfaces.CreateProcessModel} createRequest
*/
public async createProcess(
createRequest: WorkItemTrackingProcessInterfaces.CreateProcessModel
): Promise<WorkItemTrackingProcessInterfaces.ProcessModel> {
return new Promise<WorkItemTrackingProcessInterfaces.ProcessModel>(async (resolve, reject) => {
let routeValues: any = {
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.ProcessModel>;
res = await this.rest.create<WorkItemTrackingProcessInterfaces.ProcessModel>(url, createRequest, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.ProcessModel,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processTypeId
*/
public async deleteProcess(
processTypeId: string
): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
let routeValues: any = {
processTypeId: processTypeId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<void>;
res = await this.rest.del<void>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processTypeId
* @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand
*/
public async getProcessById(
processTypeId: string,
expand?: WorkItemTrackingProcessInterfaces.GetProcessExpandLevel
): Promise<WorkItemTrackingProcessInterfaces.ProcessModel> {
return new Promise<WorkItemTrackingProcessInterfaces.ProcessModel>(async (resolve, reject) => {
let routeValues: any = {
processTypeId: processTypeId
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.ProcessModel>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.ProcessModel>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.ProcessModel,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand
*/
public async getProcesses(
expand?: WorkItemTrackingProcessInterfaces.GetProcessExpandLevel
): Promise<WorkItemTrackingProcessInterfaces.ProcessModel[]> {
return new Promise<WorkItemTrackingProcessInterfaces.ProcessModel[]>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.ProcessModel[]>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.ProcessModel[]>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.ProcessModel,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {WorkItemTrackingProcessInterfaces.UpdateProcessModel} updateRequest
* @param {string} processTypeId
*/
public async updateProcess(
updateRequest: WorkItemTrackingProcessInterfaces.UpdateProcessModel,
processTypeId: string
): Promise<WorkItemTrackingProcessInterfaces.ProcessModel> {
return new Promise<WorkItemTrackingProcessInterfaces.ProcessModel>(async (resolve, reject) => {
let routeValues: any = {
processTypeId: processTypeId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.ProcessModel>;
res = await this.rest.update<WorkItemTrackingProcessInterfaces.ProcessModel>(url, updateRequest, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.ProcessModel,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
* @param {string} witRefName
* @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand
*/
public async getWorkItemType(
processId: string,
witRefName: string,
expand?: WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand
): Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel> {
return new Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel>(async (resolve, reject) => {
let routeValues: any = {
processId: processId,
witRefName: witRefName
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"e2e9d1a6-432d-4062-8870-bfcb8c324ad7",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.WorkItemTypeModel>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.WorkItemTypeModel>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemTypeModel,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
* @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand
*/
public async getWorkItemTypes(
processId: string,
expand?: WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand
): Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel[]> {
return new Promise<WorkItemTrackingProcessInterfaces.WorkItemTypeModel[]>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
let queryValues: any = {
'$expand': expand,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processes",
"e2e9d1a6-432d-4062-8870-bfcb8c324ad7",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessInterfaces.WorkItemTypeModel[]>;
res = await this.rest.get<WorkItemTrackingProcessInterfaces.WorkItemTypeModel[]>(url, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemTypeModel,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,256 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from 'typed-rest-client/HttpClient';
import vsom = require('./VsoClient');
import basem = require('./ClientApiBases');
import serm = require('./Serialization');
import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
import WorkItemTrackingProcessTemplateInterfaces = require("./interfaces/WorkItemTrackingProcessTemplateInterfaces");
export interface IWorkItemTrackingApi extends basem.ClientApiBase {
getBehavior(processId: string, behaviorRefName: string): Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior>;
getBehaviors(processId: string): Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior[]>;
exportProcessTemplate(id: string): Promise<any>;
importProcessTemplate(customHeaders: any, contentStream: NodeJS.ReadableStream, ignoreWarnings?: boolean): Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessImportResult>;
importProcessTemplateStatus(id: string): Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessPromoteStatus>;
}
export class WorkItemTrackingApi extends basem.ClientApiBase implements IWorkItemTrackingApi {
constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[]) {
super(baseUrl, handlers, 'node-WorkItemTracking-api');
}
/**
* @param {string} processId
* @param {string} behaviorRefName
*/
public async getBehavior(
processId: string,
behaviorRefName: string
): Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior> {
return new Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
let queryValues: any = {
behaviorRefName: behaviorRefName,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processAdmin",
"90bf9317-3571-487b-bc8c-a523ba0e05d7",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior>;
res = await this.rest.get<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* @param {string} processId
*/
public async getBehaviors(
processId: string
): Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior[]> {
return new Promise<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior[]>(async (resolve, reject) => {
let routeValues: any = {
processId: processId
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processAdmin",
"90bf9317-3571-487b-bc8c-a523ba0e05d7",
routeValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior[]>;
res = await this.rest.get<WorkItemTrackingProcessTemplateInterfaces.AdminBehavior[]>(url, options);
let ret = this.formatResponse(res.result,
null,
true);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Returns requested process template
*
* @param {string} id
*/
public async exportProcessTemplate(
id: string
): Promise<any> {
return new Promise<any>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
id: id,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processAdmin",
"29e1f38d-9e9c-4358-86a5-cdf9896a5759",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<any>;
res = await this.rest.get<any>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Records supplied process template and triggers promote
*
* @param {NodeJS.ReadableStream} contentStream - Content to upload
* @param {boolean} ignoreWarnings
*/
public async importProcessTemplate(
customHeaders: any,
contentStream: NodeJS.ReadableStream,
ignoreWarnings?: boolean
): Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessImportResult> {
return new Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessImportResult>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
ignoreWarnings: ignoreWarnings,
};
customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "application/octet-stream";
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processAdmin",
"29e1f38d-9e9c-4358-86a5-cdf9896a5759",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessTemplateInterfaces.ProcessImportResult>;
res = await this.rest.uploadStream<WorkItemTrackingProcessTemplateInterfaces.ProcessImportResult>("POST", url, contentStream, options);
let ret = this.formatResponse(res.result,
WorkItemTrackingProcessTemplateInterfaces.TypeInfo.ProcessImportResult,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
/**
* Whether promote has completed for the specified promote job id
*
* @param {string} id
*/
public async importProcessTemplateStatus(
id: string
): Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessPromoteStatus> {
return new Promise<WorkItemTrackingProcessTemplateInterfaces.ProcessPromoteStatus>(async (resolve, reject) => {
let routeValues: any = {
};
let queryValues: any = {
id: id,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"3.2-preview.1",
"processAdmin",
"29e1f38d-9e9c-4358-86a5-cdf9896a5759",
routeValues,
queryValues);
let url: string = verData.requestUrl;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<WorkItemTrackingProcessTemplateInterfaces.ProcessPromoteStatus>;
res = await this.rest.get<WorkItemTrackingProcessTemplateInterfaces.ProcessPromoteStatus>(url, options);
let ret = this.formatResponse(res.result,
null,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}
}

Просмотреть файл

@ -1,28 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import VsoBaseInterfaces = require('../interfaces/common/VsoBaseInterfaces');
export class ApiVersionHandler implements VsoBaseInterfaces.IRequestHandler {
apiVersion: string;
constructor(apiVersion: string) {
this.apiVersion = apiVersion;
}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options:any): void {
if (options.headers && options.headers['Accept']) {
options.headers["Accept"] = options.headers['Accept'] + '; api-version=' + this.apiVersion;
}
}
// This handler cannot handle 401
canHandleAuthentication(res: VsoBaseInterfaces.IHttpResponse): boolean {
return false;
}
handleAuthentication(httpClient, protocol, options, objs, finalCallback): void {
}
}

Просмотреть файл

@ -0,0 +1,242 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface Account {
/**
* Identifier for an Account
*/
accountId: string;
/**
* Name for an account
*/
accountName: string;
/**
* Owner of account
*/
accountOwner: string;
/**
* Current account status
*/
accountStatus: AccountStatus;
/**
* Type of account: Personal, Organization
*/
accountType: AccountType;
/**
* Uri for an account
*/
accountUri: string;
/**
* Who created the account
*/
createdBy: string;
/**
* Date account was created
*/
createdDate: Date;
hasMoved: boolean;
/**
* Identity of last person to update the account
*/
lastUpdatedBy: string;
/**
* Date account was last updated
*/
lastUpdatedDate: Date;
/**
* Namespace for an account
*/
namespaceId: string;
newCollectionId: string;
/**
* Organization that created the account
*/
organizationName: string;
/**
* Extended properties
*/
properties: any;
/**
* Reason for current status
*/
statusReason: string;
}
export interface AccountCreateInfoInternal {
accountName: string;
creator: string;
organization: string;
preferences: AccountPreferencesInternal;
properties: any;
serviceDefinitions: { key: string; value: string }[];
}
export interface AccountNameAvailability {
isValidName: boolean;
/**
* Reason for current status
*/
statusReason: string;
}
export interface AccountPreferencesInternal {
culture: any;
language: any;
timeZone: any;
}
/**
* Account region metadata
*/
export interface AccountRegion {
/**
* Display name of the account region
*/
displayName: string;
/**
* Whether the region is default or not
*/
isDefault: boolean;
/**
* Azure location name
*/
locationName: string;
}
export enum AccountStatus {
None = 0,
/**
* This hosting account is active and assigned to a customer.
*/
Enabled = 1,
/**
* This hosting account is disabled.
*/
Disabled = 2,
/**
* This account is part of deletion batch and scheduled for deletion.
*/
Deleted = 3,
/**
* This account is not mastered locally and has physically moved.
*/
Moved = 4,
}
export enum AccountType {
Personal = 0,
Organization = 1,
}
export enum AccountUserStatus {
None = 0,
/**
* User has signed in at least once to the VSTS account
*/
Active = 1,
/**
* User cannot sign in; primarily used by admin to temporarily remove a user due to absence or license reallocation
*/
Disabled = 2,
/**
* User is removed from the VSTS account by the VSTS account admin
*/
Deleted = 3,
/**
* User is invited to join the VSTS account by the VSTS account admin, but has not signed up/signed in yet
*/
Pending = 4,
/**
* User can sign in; primarily used when license is in expired state and we give a grace period
*/
Expired = 5,
/**
* User is disabled; if reenabled, they will still be in the Pending state
*/
PendingDisabled = 6,
}
export var TypeInfo = {
Account: {
fields: <any>null
},
AccountCreateInfoInternal: {
fields: <any>null
},
AccountNameAvailability: {
fields: <any>null
},
AccountPreferencesInternal: {
fields: <any>null
},
AccountRegion: {
fields: <any>null
},
AccountStatus: {
enumValues: {
"none": 0,
"enabled": 1,
"disabled": 2,
"deleted": 3,
"moved": 4,
}
},
AccountType: {
enumValues: {
"personal": 0,
"organization": 1,
}
},
AccountUserStatus: {
enumValues: {
"none": 0,
"active": 1,
"disabled": 2,
"deleted": 3,
"pending": 4,
"expired": 5,
"pendingDisabled": 6,
}
},
};
TypeInfo.Account.fields = {
accountStatus: {
enumType: TypeInfo.AccountStatus
},
accountType: {
enumType: TypeInfo.AccountType
},
createdDate: {
isDate: true,
},
lastUpdatedDate: {
isDate: true,
},
};
TypeInfo.AccountCreateInfoInternal.fields = {
preferences: {
typeInfo: TypeInfo.AccountPreferencesInternal
},
};
TypeInfo.AccountNameAvailability.fields = {
};
TypeInfo.AccountPreferencesInternal.fields = {
};
TypeInfo.AccountRegion.fields = {
};

Просмотреть файл

@ -0,0 +1,310 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface Default {
value: string;
}
/**
* Issue information for feature enablement of a process template.
*/
export interface EnablementIssue {
/**
* Severity of the issue.
*/
level: any;
/**
* Message for the issue.
*/
message: string;
}
export interface ExtensionsViewModel {
extensions: WebAccessExtensionModel[];
hasWritePermission: boolean;
privateExtensionsEnabled: boolean;
}
/**
* Exposes information about a feature.
*/
export interface FeatureInfo {
/**
* Indicates the state of the feature. 1 = Not configured 2 = Partially configured 3 = Fully configured See ProjectFeatureState enum. We store this as an int since it is only used to hand off to the client.
*/
featureState: number;
/**
* Name of the feature.
*/
name: string;
}
/**
* Exposes the state information for all features.
*/
export interface FeaturesState {
/**
* Information for each of the features.
*/
featureList: FeatureInfo[];
/**
* Indicates if there are any features that are are enabled.
*/
partiallyConfigured: boolean;
}
export interface Field {
description: string;
id: string;
name: string;
pickListId: string;
rules: Rule;
type: string;
usages: FieldUsage[];
}
export interface FieldUsage {
isBehaviorField: boolean;
isInherited: boolean;
isSystem: boolean;
rules: UsageRule;
workItemTypeId: string;
}
export interface IdentityDefault extends Default {
vsid: string;
}
export interface LayoutGroup {
id: string;
label: string;
}
export interface ProcessDescriptorModel {
}
export interface ProcessFieldUsageInfo {
fields: Field[];
workItemTypes: WorkItemType[];
}
/**
* Summary of the feature enablement information for the process template.
*/
export interface ProcessTemplateSummary {
/**
* Actions which will be taken to enable the features in the project.
*/
actions: string[];
/**
* Id of the process template.
*/
id: string;
/**
* Indicates whether this process template is recommended for upgrade
*/
isRecommended: boolean;
/**
* Issues associated with the process template which could prevent it from being used to enable features in the project.
*/
issues: EnablementIssue[];
/**
* Indicates if the process template can be used to enable the features in the project.
*/
isValid: boolean;
/**
* Name of the process template.
*/
name: string;
}
export interface Rule {
allowGroups: boolean;
default: Default;
isReadOnly: boolean;
isRequired: boolean;
}
export interface UsageRule extends Rule {
helpText: string;
isVisible: boolean;
}
export interface WebAccessExtensionModel {
description: string;
enabled: boolean;
hostType: any;
iconUrl: string;
id: string;
installDate: Date;
isPrivate: boolean;
moreInfo: string;
name: string;
vendor: string;
version: string;
}
export interface WorkItemType {
color: string;
description: string;
id: string;
isCustomType: boolean;
isDisabled: boolean;
layout: any;
layoutGroups: LayoutGroup[];
name: string;
parentWorkItemTypeId: string;
}
export var TypeInfo = {
Default: {
fields: <any>null
},
EnablementIssue: {
fields: <any>null
},
ExtensionsViewModel: {
fields: <any>null
},
FeatureInfo: {
fields: <any>null
},
FeaturesState: {
fields: <any>null
},
Field: {
fields: <any>null
},
FieldUsage: {
fields: <any>null
},
IdentityDefault: {
fields: <any>null
},
LayoutGroup: {
fields: <any>null
},
ProcessDescriptorModel: {
fields: <any>null
},
ProcessFieldUsageInfo: {
fields: <any>null
},
ProcessTemplateSummary: {
fields: <any>null
},
Rule: {
fields: <any>null
},
UsageRule: {
fields: <any>null
},
WebAccessExtensionModel: {
fields: <any>null
},
WorkItemType: {
fields: <any>null
},
};
TypeInfo.Default.fields = {
};
TypeInfo.EnablementIssue.fields = {
};
TypeInfo.ExtensionsViewModel.fields = {
extensions: {
isArray: true,
typeInfo: TypeInfo.WebAccessExtensionModel
},
};
TypeInfo.FeatureInfo.fields = {
};
TypeInfo.FeaturesState.fields = {
featureList: {
isArray: true,
typeInfo: TypeInfo.FeatureInfo
},
};
TypeInfo.Field.fields = {
rules: {
typeInfo: TypeInfo.Rule
},
usages: {
isArray: true,
typeInfo: TypeInfo.FieldUsage
},
};
TypeInfo.FieldUsage.fields = {
rules: {
typeInfo: TypeInfo.UsageRule
},
};
TypeInfo.IdentityDefault.fields = {
};
TypeInfo.LayoutGroup.fields = {
};
TypeInfo.ProcessDescriptorModel.fields = {
};
TypeInfo.ProcessFieldUsageInfo.fields = {
fields: {
isArray: true,
typeInfo: TypeInfo.Field
},
workItemTypes: {
isArray: true,
typeInfo: TypeInfo.WorkItemType
},
};
TypeInfo.ProcessTemplateSummary.fields = {
issues: {
isArray: true,
typeInfo: TypeInfo.EnablementIssue
},
};
TypeInfo.Rule.fields = {
default: {
typeInfo: TypeInfo.Default
},
};
TypeInfo.UsageRule.fields = {
default: {
typeInfo: TypeInfo.Default
},
};
TypeInfo.WebAccessExtensionModel.fields = {
installDate: {
isDate: true,
},
};
TypeInfo.WorkItemType.fields = {
layoutGroups: {
isArray: true,
typeInfo: TypeInfo.LayoutGroup
},
};

Просмотреть файл

@ -0,0 +1,51 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export enum DelegatedAppTokenType {
Session = 0,
App = 1,
}
export interface WebSessionToken {
appId: string;
extensionName: string;
force: boolean;
name: string;
namedTokenId: string;
publisherName: string;
token: string;
tokenType: DelegatedAppTokenType;
validTo: Date;
}
export var TypeInfo = {
DelegatedAppTokenType: {
enumValues: {
"session": 0,
"app": 1,
}
},
WebSessionToken: {
fields: <any>null
},
};
TypeInfo.WebSessionToken.fields = {
tokenType: {
enumType: TypeInfo.DelegatedAppTokenType
},
validTo: {
isDate: true,
},
};

Просмотреть файл

@ -0,0 +1,175 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import OperationsInterfaces = require("../interfaces/common/OperationsInterfaces");
export enum ClientType {
Undefined = 0,
Ibiza = 1,
}
export interface ContinuousDeploymentConfiguration {
accountConfiguration: ResourceConfiguration;
pipelineConfiguration: PipelineConfiguration;
projectConfiguration: ResourceConfiguration;
sourceConfiguration: SourceConfiguration;
targetConfiguration: Property[];
testConfiguration: Property[];
}
export interface ContinuousDeploymentOperation extends OperationsInterfaces.Operation {
deploymentStepIds: Property[];
}
export interface PipelineConfiguration {
clientType: ClientType;
prodEnvironmentName: string;
testEnvironmentName: string;
}
export interface Property {
name: string;
value: string;
}
export interface ResourceConfiguration {
createIfNotFound: boolean;
properties: Property[];
resourceName: string;
}
export interface SourceConfiguration {
sourceRepository: SourceRepository;
sourceVersion: string;
}
export interface SourceRepository {
identifier: string;
/**
* The properties cannot be IEnumerable/IList, since XML serializer does not work well with interfaces. This object gets passed as job parameter which uses XML serializer.
*/
properties: Property[];
repositoryType: SourceRepositoryType;
}
export enum SourceRepositoryType {
Invalid = 0,
VstsGit = 1,
GitHub = 2,
VstsTfvc = 3,
ExternalGit = 4,
}
export var TypeInfo = {
ClientType: {
enumValues: {
"undefined": 0,
"ibiza": 1,
}
},
ContinuousDeploymentConfiguration: {
fields: <any>null
},
ContinuousDeploymentOperation: {
fields: <any>null
},
PipelineConfiguration: {
fields: <any>null
},
Property: {
fields: <any>null
},
ResourceConfiguration: {
fields: <any>null
},
SourceConfiguration: {
fields: <any>null
},
SourceRepository: {
fields: <any>null
},
SourceRepositoryType: {
enumValues: {
"invalid": 0,
"vstsGit": 1,
"gitHub": 2,
"vstsTfvc": 3,
"externalGit": 4,
}
},
};
TypeInfo.ContinuousDeploymentConfiguration.fields = {
accountConfiguration: {
typeInfo: TypeInfo.ResourceConfiguration
},
pipelineConfiguration: {
typeInfo: TypeInfo.PipelineConfiguration
},
projectConfiguration: {
typeInfo: TypeInfo.ResourceConfiguration
},
sourceConfiguration: {
typeInfo: TypeInfo.SourceConfiguration
},
targetConfiguration: {
isArray: true,
typeInfo: TypeInfo.Property
},
testConfiguration: {
isArray: true,
typeInfo: TypeInfo.Property
},
};
TypeInfo.ContinuousDeploymentOperation.fields = {
deploymentStepIds: {
isArray: true,
typeInfo: TypeInfo.Property
},
status: {
enumType: OperationsInterfaces.TypeInfo.OperationStatus
},
};
TypeInfo.PipelineConfiguration.fields = {
clientType: {
enumType: TypeInfo.ClientType
},
};
TypeInfo.Property.fields = {
};
TypeInfo.ResourceConfiguration.fields = {
properties: {
isArray: true,
typeInfo: TypeInfo.Property
},
};
TypeInfo.SourceConfiguration.fields = {
sourceRepository: {
typeInfo: TypeInfo.SourceRepository
},
};
TypeInfo.SourceRepository.fields = {
properties: {
isArray: true,
typeInfo: TypeInfo.Property
},
repositoryType: {
enumType: TypeInfo.SourceRepositoryType
},
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,255 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface AccessTokenResult {
accessToken: JsonWebToken;
accessTokenError: TokenError;
authorizationId: string;
errorDescription: string;
hasError: boolean;
refreshToken: RefreshTokenGrant;
tokenType: string;
validTo: Date;
}
export enum AccountLicenseType {
None = 0,
EarlyAdopter = 1,
Express = 2,
Professional = 3,
Advanced = 4,
Stakeholder = 5,
}
export enum AccountUserStatus {
None = 0,
/**
* User has signed in at least once to the VSTS account
*/
Active = 1,
/**
* User cannot sign in; primarily used by admin to temporarily remove a user due to absence or license reallocation
*/
Disabled = 2,
/**
* User is removed from the VSTS account by the VSTS account admin
*/
Deleted = 3,
/**
* User is invited to join the VSTS account by the VSTS account admin, but has not signed up/signed in yet
*/
Pending = 4,
/**
* User can sign in; primarily used when license is in expired state and we give a grace period
*/
Expired = 5,
/**
* User is disabled; if reenabled, they will still be in the Pending state
*/
PendingDisabled = 6,
}
export interface AuthorizationGrant {
grantType: GrantType;
}
export enum GrantType {
None = 0,
JwtBearer = 1,
RefreshToken = 2,
Implicit = 3,
ClientCredentials = 4,
}
export interface JsonWebToken {
}
export interface Policy {
effectiveValue: any;
enforce: boolean;
isValueUndefined: boolean;
name: string;
parentPolicy: Policy;
value: any;
}
export interface PolicyInfo {
description: string;
moreInfoLink: string;
name: string;
}
export interface RefreshTokenGrant extends AuthorizationGrant {
jwt: JsonWebToken;
}
export enum TokenError {
None = 0,
GrantTypeRequired = 1,
AuthorizationGrantRequired = 2,
ClientSecretRequired = 3,
RedirectUriRequired = 4,
InvalidAuthorizationGrant = 5,
InvalidAuthorizationScopes = 6,
InvalidRefreshToken = 7,
AuthorizationNotFound = 8,
AuthorizationGrantExpired = 9,
AccessAlreadyIssued = 10,
InvalidRedirectUri = 11,
AccessTokenNotFound = 12,
InvalidAccessToken = 13,
AccessTokenAlreadyRefreshed = 14,
InvalidClientSecret = 15,
ClientSecretExpired = 16,
ServerError = 17,
AccessDenied = 18,
AccessTokenKeyRequired = 19,
InvalidAccessTokenKey = 20,
FailedToGetAccessToken = 21,
InvalidClientId = 22,
InvalidClient = 23,
InvalidValidTo = 24,
InvalidUserId = 25,
FailedToIssueAccessToken = 26,
AuthorizationGrantScopeMissing = 27,
InvalidPublicAccessTokenKey = 28,
InvalidPublicAccessToken = 29,
}
export var TypeInfo = {
AccessTokenResult: {
fields: <any>null
},
AccountLicenseType: {
enumValues: {
"none": 0,
"earlyAdopter": 1,
"express": 2,
"professional": 3,
"advanced": 4,
"stakeholder": 5,
}
},
AccountUserStatus: {
enumValues: {
"none": 0,
"active": 1,
"disabled": 2,
"deleted": 3,
"pending": 4,
"expired": 5,
"pendingDisabled": 6,
}
},
AuthorizationGrant: {
fields: <any>null
},
GrantType: {
enumValues: {
"none": 0,
"jwtBearer": 1,
"refreshToken": 2,
"implicit": 3,
"clientCredentials": 4,
}
},
JsonWebToken: {
fields: <any>null
},
Policy: {
fields: <any>null
},
PolicyInfo: {
fields: <any>null
},
RefreshTokenGrant: {
fields: <any>null
},
TokenError: {
enumValues: {
"none": 0,
"grantTypeRequired": 1,
"authorizationGrantRequired": 2,
"clientSecretRequired": 3,
"redirectUriRequired": 4,
"invalidAuthorizationGrant": 5,
"invalidAuthorizationScopes": 6,
"invalidRefreshToken": 7,
"authorizationNotFound": 8,
"authorizationGrantExpired": 9,
"accessAlreadyIssued": 10,
"invalidRedirectUri": 11,
"accessTokenNotFound": 12,
"invalidAccessToken": 13,
"accessTokenAlreadyRefreshed": 14,
"invalidClientSecret": 15,
"clientSecretExpired": 16,
"serverError": 17,
"accessDenied": 18,
"accessTokenKeyRequired": 19,
"invalidAccessTokenKey": 20,
"failedToGetAccessToken": 21,
"invalidClientId": 22,
"invalidClient": 23,
"invalidValidTo": 24,
"invalidUserId": 25,
"failedToIssueAccessToken": 26,
"authorizationGrantScopeMissing": 27,
"invalidPublicAccessTokenKey": 28,
"invalidPublicAccessToken": 29,
}
},
};
TypeInfo.AccessTokenResult.fields = {
accessToken: {
typeInfo: TypeInfo.JsonWebToken
},
accessTokenError: {
enumType: TypeInfo.TokenError
},
refreshToken: {
typeInfo: TypeInfo.RefreshTokenGrant
},
validTo: {
isDate: true,
},
};
TypeInfo.AuthorizationGrant.fields = {
grantType: {
enumType: TypeInfo.GrantType
},
};
TypeInfo.JsonWebToken.fields = {
};
TypeInfo.Policy.fields = {
parentPolicy: {
typeInfo: TypeInfo.Policy
},
};
TypeInfo.PolicyInfo.fields = {
};
TypeInfo.RefreshTokenGrant.fields = {
grantType: {
enumType: TypeInfo.GrantType
},
jwt: {
typeInfo: TypeInfo.JsonWebToken
},
};

Просмотреть файл

@ -0,0 +1,211 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
export interface Message {
/**
* Message content
*/
content: string;
/**
* Message Id
*/
id: number;
/**
* Message Type, currently only plain text is supported.
*/
messageType: MessageType;
/**
* User who posted the message. May be null if message came from a system account
*/
postedBy: VSSInterfaces.IdentityRef;
/**
* Id of the room in which message is posted
*/
postedRoomId: number;
/**
* Message posted time
*/
postedTime: Date;
}
export interface MessageData {
content: string;
}
export enum MessageType {
/**
* A normal message that is sent by a user in plain text
*/
Normal = 0,
/**
* A system message like User Entered and User Left Room
*/
System = 1,
/**
* A notification from a TFS event
*/
Notification = 2,
/**
* An error messsage.
*/
Error = 3,
}
export interface Room {
/**
* Room creator user
*/
createdBy: VSSInterfaces.IdentityRef;
/**
* Room creation date
*/
createdDate: Date;
/**
* Description of the room
*/
description: string;
/**
* Admin permissions for current user
*/
hasAdminPermissions: boolean;
/**
* Read/Write permissions for current user
*/
hasReadWritePermissions: boolean;
/**
* Id of the room
*/
id: number;
/**
* Last activity in the room
*/
lastActivity: Date;
/**
* Name of the room
*/
name: string;
}
export interface RoomData {
/**
* Description of the room
*/
description: string;
/**
* Name of the room
*/
name: string;
}
export interface User {
/**
* A value indicating whether the user is online or not.
*/
isOnline: boolean;
/**
* Time when user joined the room
*/
joinedDate: Date;
/**
* Last activity time
*/
lastActivity: Date;
/**
* Id of the Room
*/
roomId: number;
/**
* The shallow reference for the user
*/
user: VSSInterfaces.IdentityRef;
}
export interface UserData {
userId: string;
}
export var TypeInfo = {
Message: {
fields: <any>null
},
MessageData: {
fields: <any>null
},
MessageType: {
enumValues: {
"normal": 0,
"system": 1,
"notification": 2,
"error": 3,
}
},
Room: {
fields: <any>null
},
RoomData: {
fields: <any>null
},
User: {
fields: <any>null
},
UserData: {
fields: <any>null
},
};
TypeInfo.Message.fields = {
messageType: {
enumType: TypeInfo.MessageType
},
postedBy: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
postedTime: {
isDate: true,
},
};
TypeInfo.MessageData.fields = {
};
TypeInfo.Room.fields = {
createdBy: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
createdDate: {
isDate: true,
},
lastActivity: {
isDate: true,
},
};
TypeInfo.RoomData.fields = {
};
TypeInfo.User.fields = {
joinedDate: {
isDate: true,
},
lastActivity: {
isDate: true,
},
user: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.UserData.fields = {
};

Просмотреть файл

@ -0,0 +1,696 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import DiscussionInterfaces = require("../interfaces/DiscussionInterfaces");
import IdentitiesInterfaces = require("../interfaces/IdentitiesInterfaces");
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
/**
* This class contains the metadata of a file attached to a code review.
*/
export interface Attachment {
_links: any;
author: VSSInterfaces.IdentityRef;
/**
* Content hash of on-disk representation of file content. Its calculated by the client by using SHA1 hash function.
*/
contentHash: string;
createdDate: Date;
/**
* The description of the attachment, can be null.
*/
description: string;
/**
* The display name of the attachment, can't be null or empty.
*/
displayName: string;
id: number;
properties: any;
}
export interface ChangeEntry {
base: ChangeEntryFileInfo;
/**
* Uniquely tracks each change in an iteration. Automatically generated in server.
*/
changeId: number;
changeTrackingId: number;
/**
* Change types as provided by source control. It contains change types that aren't supported by Type field.
*/
extendedChangeType: string;
iterationId: number;
modified: ChangeEntryFileInfo;
/**
* Specify simplified change types that can be used by client to drive client logic.
*/
type: ChangeType;
}
export interface ChangeEntryFileInfo extends ReviewFileContentInfo {
}
export enum ChangeEntryFileType {
Base = 0,
Modified = 1,
}
export enum ChangeType {
None = 0,
Add = 1,
Edit = 2,
Rename = 8,
Move = 16,
Delete = 32,
}
export interface CommentThread extends DiscussionInterfaces.DiscussionThread {
/**
* Specify thread context such as position in left/right file.
*/
threadContext: CommentThreadContext;
}
export interface CommentThreadContext {
/**
* Used to track a comment across iterations.
*/
changeTrackingId: number;
/**
* File path relative to the root of the repository. It's up to the client to use any path format.
*/
filePath: string;
/**
* Specify comparing iteration Ids when a comment thread is added while comparing 2 iterations.
*/
iterationContext: IterationContext;
/**
* Position of last character of the comment in left file.
*/
leftFileEnd: Position;
/**
* Position of first character of the comment in left file.
*/
leftFileStart: Position;
/**
* Position of last character of the comment in right file.
*/
rightFileEnd: Position;
/**
* Position of first character of the comment in right file.
*/
rightFileStart: Position;
/**
* The criteria used to track this thread. If this property is filled out when the thread is returned, then the thread has been tracked from its original location using the given criteria.
*/
trackingCriteria: CommentTrackingCriteria;
}
/**
* Criteria to decide if and how a thread should be tracked
*/
export interface CommentTrackingCriteria {
/**
* The first comparing iteration being viewed. Threads will be tracked if this is greater than 0.
*/
firstComparingIteration: number;
/**
* The second comparing iteration being viewed. Threads will be tracked if this is greater than 0.
*/
secondComparingIteration: number;
}
export interface DownloadContentsCriteria {
/**
* If provided, specifies the exact content hashes of the files to fetch. Cannot be combined with other parameters such as IterationIds.
*/
contentHashes: string[];
/**
* If provided, specifies the file type to fetch. Applicable only for content hashes.
*/
fileType: ReviewFileType;
/**
* If provided, filter iteration files by fetching only base files or modified files. Applicable only for iterations.
*/
filterBy: ChangeEntryFileType;
/**
* If provided, specifies the iteration ids of the files to fetch. Cannot be combined with Content hashes.
*/
iterationIds: number[];
}
export interface Iteration {
_links: any;
author: VSSInterfaces.IdentityRef;
changeList: ChangeEntry[];
createdDate: Date;
description: string;
id: number;
isUnpublished: boolean;
properties: any;
reviewId: number;
statuses: Status[];
updatedDate: Date;
}
export interface IterationChanges {
changeEntries: ChangeEntry[];
nextSkip: string[];
nextTop: string[];
}
/**
* Iteration context is used to specify comparing iteration Ids when a comment thread is added while comparing 2 iterations.
*/
export interface IterationContext {
/**
* First comparing iteration Id. Minimum value is 1.
*/
firstComparingIteration: number;
/**
* Second comparing iteration Id. Minimum value is 1.
*/
secondComparingIteration: number;
}
export enum MetaState {
NotSet = 0,
Pending = 1,
Succeeded = 2,
Failed = 3,
}
/**
* Context used while sharing a review.
*/
export interface NotificationContext {
/**
* Optional user note or message.
*/
message: string;
/**
* Identities of users who will receive a share notification.
*/
receivers: VSSInterfaces.IdentityRef[];
/**
* Append text to subject of share notification. Ex: Email subject. When missing, server will set to a default.
*/
subject: string;
}
export interface Position {
/**
* Position line starting with one.
*/
line: number;
/**
* Position offset starting with zero.
*/
offset: number;
}
export interface Review {
_links: any;
attachments: Attachment[];
author: VSSInterfaces.IdentityRef;
completedDate: Date;
createdDate: Date;
description: string;
id: number;
isDeleted: boolean;
iterations: Iteration[];
projectId: string;
properties: any;
reviewers: Reviewer[];
sourceArtifactId: string;
status: ReviewStatus;
statuses: Status[];
title: string;
updatedDate: Date;
}
export interface Reviewer {
createdDate: Date;
identity: VSSInterfaces.IdentityRef;
/**
* Id of a valid published iteration. Latest iteration where the reviewer had voted. When a reviewer votes, client provided iterationId must be a published iterationId. When null, latest published iterationId is used.
*/
iterationId: number;
/**
* Specifies reviewer kind. Its set to "optional" if not set for a new reviewer.
*/
kind: ReviewerKind;
modifiedDate: Date;
/**
* Specifies reviewer vote. By default, its set to "No response" if not set for a new reviewer. If a reviewer has voted on multiple iterations then it provides vote of latest iteration.
*/
reviewerStateId: number;
votedFor: string[];
/**
* Specifies the groups (if any) for which this reviewer has voted. It will have length > 0 only if the reviewer is a member of other groups and have voted. Voted means having reviewer state other than the initial "NotStarted" state.
*/
votedForGroups: Reviewer[];
}
export enum ReviewerKind {
/**
* Specifies that a reviewer was added by an author but reviewer approval isn't mandatory for review approval.
*/
Optional = 0,
/**
* Specifies that a reviewer was added by an author. Reviewer must vote to conclude that a review is signed-off/approved. For example, a review needs to be approved in order to merge a pull request.
*/
Required = 1,
}
export interface ReviewFileContentInfo {
_links: any;
/**
* A generic way to store metadata about a particular change entry content. This information is later used by the IReviewContentProvider to decide how to retrieve the content.
*/
flags: number;
path: string;
reviewId: number;
/**
* Content hash of on-disk representation of file content. Its calculated by the client by using SHA1 hash function. Ensure that uploaded file has same encoding as in source control.
*/
sHA1Hash: string;
}
export interface ReviewFilesZipContent {
nextSkip: string[];
nextTop: string[];
zipStream: any;
}
export enum ReviewFileType {
ChangeEntry = 0,
Attachment = 1,
}
export interface ReviewSearchCriteria {
creatorIdentity: IdentitiesInterfaces.IdentityDescriptor;
includeDeleted: boolean;
maxCreatedDate: Date;
maxUpdatedDate: Date;
minCreatedDate: Date;
minUpdatedDate: Date;
orderAscending: boolean;
reviewerIdentity: IdentitiesInterfaces.IdentityDescriptor;
sourceArtifactPrefix: string;
status: ReviewStatus;
}
/**
* This class contains the code review settings of a team project.
*/
export interface ReviewSettings {
_links: any;
/**
* The settings shared between all the source control connections.
*/
globalSettings: any;
/**
* The settings that are not shared by all the source control connections.
*/
settings: { [key: string] : any; };
}
export enum ReviewStatus {
Active = 0,
Completed = 1,
Abandoned = 2,
Creating = 3,
}
/**
* This class contains the metadata of a service/extension posting status. Status can be associated with a code review or a review iteration.
*/
export interface Status {
_links: any;
context: StatusContext;
createdDate: Date;
/**
* The description of the status, can be null.
*/
description: string;
id: number;
iterationId: number;
state: MetaState;
/**
* The url associated with the status, can be null.
*/
targetUrl: string;
updatedDate: Date;
}
/**
* This class contains the metadata of a service/extension posting status context.
*/
export interface StatusContext {
/**
* The genre of the status, can be null.
*/
genre: string;
/**
* The name of the status, can't be null or empty.
*/
name: string;
}
export var TypeInfo = {
Attachment: {
fields: <any>null
},
ChangeEntry: {
fields: <any>null
},
ChangeEntryFileInfo: {
fields: <any>null
},
ChangeEntryFileType: {
enumValues: {
"base": 0,
"modified": 1,
}
},
ChangeType: {
enumValues: {
"none": 0,
"add": 1,
"edit": 2,
"rename": 8,
"move": 16,
"delete": 32,
}
},
CommentThread: {
fields: <any>null
},
CommentThreadContext: {
fields: <any>null
},
CommentTrackingCriteria: {
fields: <any>null
},
DownloadContentsCriteria: {
fields: <any>null
},
Iteration: {
fields: <any>null
},
IterationChanges: {
fields: <any>null
},
IterationContext: {
fields: <any>null
},
MetaState: {
enumValues: {
"notSet": 0,
"pending": 1,
"succeeded": 2,
"failed": 3,
}
},
NotificationContext: {
fields: <any>null
},
Position: {
fields: <any>null
},
Review: {
fields: <any>null
},
Reviewer: {
fields: <any>null
},
ReviewerKind: {
enumValues: {
"optional": 0,
"required": 1,
}
},
ReviewFileContentInfo: {
fields: <any>null
},
ReviewFilesZipContent: {
fields: <any>null
},
ReviewFileType: {
enumValues: {
"changeEntry": 0,
"attachment": 1,
}
},
ReviewSearchCriteria: {
fields: <any>null
},
ReviewSettings: {
fields: <any>null
},
ReviewStatus: {
enumValues: {
"active": 0,
"completed": 1,
"abandoned": 2,
"creating": 3,
}
},
Status: {
fields: <any>null
},
StatusContext: {
fields: <any>null
},
};
TypeInfo.Attachment.fields = {
author: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
createdDate: {
isDate: true,
},
};
TypeInfo.ChangeEntry.fields = {
base: {
typeInfo: TypeInfo.ChangeEntryFileInfo
},
modified: {
typeInfo: TypeInfo.ChangeEntryFileInfo
},
type: {
enumType: TypeInfo.ChangeType
},
};
TypeInfo.ChangeEntryFileInfo.fields = {
};
TypeInfo.CommentThread.fields = {
comments: {
isArray: true,
typeInfo: DiscussionInterfaces.TypeInfo.DiscussionComment
},
lastUpdatedDate: {
isDate: true,
},
publishedDate: {
isDate: true,
},
status: {
enumType: DiscussionInterfaces.TypeInfo.DiscussionStatus
},
threadContext: {
typeInfo: TypeInfo.CommentThreadContext
},
};
TypeInfo.CommentThreadContext.fields = {
iterationContext: {
typeInfo: TypeInfo.IterationContext
},
leftFileEnd: {
typeInfo: TypeInfo.Position
},
leftFileStart: {
typeInfo: TypeInfo.Position
},
rightFileEnd: {
typeInfo: TypeInfo.Position
},
rightFileStart: {
typeInfo: TypeInfo.Position
},
trackingCriteria: {
typeInfo: TypeInfo.CommentTrackingCriteria
},
};
TypeInfo.CommentTrackingCriteria.fields = {
};
TypeInfo.DownloadContentsCriteria.fields = {
fileType: {
enumType: TypeInfo.ReviewFileType
},
filterBy: {
enumType: TypeInfo.ChangeEntryFileType
},
};
TypeInfo.Iteration.fields = {
author: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
changeList: {
isArray: true,
typeInfo: TypeInfo.ChangeEntry
},
createdDate: {
isDate: true,
},
statuses: {
isArray: true,
typeInfo: TypeInfo.Status
},
updatedDate: {
isDate: true,
},
};
TypeInfo.IterationChanges.fields = {
changeEntries: {
isArray: true,
typeInfo: TypeInfo.ChangeEntry
},
};
TypeInfo.IterationContext.fields = {
};
TypeInfo.NotificationContext.fields = {
receivers: {
isArray: true,
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.Position.fields = {
};
TypeInfo.Review.fields = {
attachments: {
isArray: true,
typeInfo: TypeInfo.Attachment
},
author: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
completedDate: {
isDate: true,
},
createdDate: {
isDate: true,
},
iterations: {
isArray: true,
typeInfo: TypeInfo.Iteration
},
reviewers: {
isArray: true,
typeInfo: TypeInfo.Reviewer
},
status: {
enumType: TypeInfo.ReviewStatus
},
statuses: {
isArray: true,
typeInfo: TypeInfo.Status
},
updatedDate: {
isDate: true,
},
};
TypeInfo.Reviewer.fields = {
createdDate: {
isDate: true,
},
identity: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
kind: {
enumType: TypeInfo.ReviewerKind
},
modifiedDate: {
isDate: true,
},
votedForGroups: {
isArray: true,
typeInfo: TypeInfo.Reviewer
},
};
TypeInfo.ReviewFileContentInfo.fields = {
};
TypeInfo.ReviewFilesZipContent.fields = {
};
TypeInfo.ReviewSearchCriteria.fields = {
creatorIdentity: {
typeInfo: IdentitiesInterfaces.TypeInfo.IdentityDescriptor
},
maxCreatedDate: {
isDate: true,
},
maxUpdatedDate: {
isDate: true,
},
minCreatedDate: {
isDate: true,
},
minUpdatedDate: {
isDate: true,
},
reviewerIdentity: {
typeInfo: IdentitiesInterfaces.TypeInfo.IdentityDescriptor
},
status: {
enumType: TypeInfo.ReviewStatus
},
};
TypeInfo.ReviewSettings.fields = {
};
TypeInfo.Status.fields = {
context: {
typeInfo: TypeInfo.StatusContext
},
createdDate: {
isDate: true,
},
state: {
enumType: TypeInfo.MetaState
},
updatedDate: {
isDate: true,
},
};
TypeInfo.StatusContext.fields = {
};

Просмотреть файл

@ -0,0 +1,27 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface AuthRequest {
errorMessage: string;
url: string;
}
export var TypeInfo = {
AuthRequest: {
fields: <any>null
},
};
TypeInfo.AuthRequest.fields = {
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,28 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface CustomerIntelligenceEvent {
area: string;
feature: string;
properties: { [key: string] : any; };
}
export var TypeInfo = {
CustomerIntelligenceEvent: {
fields: <any>null
},
};
TypeInfo.CustomerIntelligenceEvent.fields = {
};

Просмотреть файл

@ -0,0 +1,459 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface Dashboard {
_links: any;
eTag: string;
id: string;
name: string;
position: number;
refreshInterval: number;
url: string;
widgets: Widget[];
}
export interface DashboardGroup {
_links: any;
dashboardEntries: DashboardGroupEntry[];
permission: GroupMemberPermission;
url: string;
}
/**
* Dashboard group entry, wraping around Dashboard (needed?)
*/
export interface DashboardGroupEntry extends Dashboard {
}
/**
* Response from RestAPI when saving and editing DashboardGroupEntry
*/
export interface DashboardGroupEntryResponse extends DashboardGroupEntry {
}
export interface DashboardResponse extends DashboardGroupEntry {
}
export enum DashboardScope {
Collection_User = 0,
Project_Team = 1,
}
export enum GroupMemberPermission {
None = 0,
Edit = 1,
Manage = 2,
ManagePermissions = 3,
}
/**
* Lightbox configuration
*/
export interface LightboxOptions {
/**
* Height of desired lightbox, in pixels
*/
height: number;
/**
* True to allow lightbox resizing, false to disallow lightbox resizing, defaults to false.
*/
resizable: boolean;
/**
* Width of desired lightbox, in pixels
*/
width: number;
}
/**
* versioning for an artifact as described at: http://semver.org/, of the form major.minor.patch.
*/
export interface SemanticVersion {
/**
* Major version when you make incompatible API changes
*/
major: number;
/**
* Minor version when you add functionality in a backwards-compatible manner
*/
minor: number;
/**
* Patch version when you make backwards-compatible bug fixes
*/
patch: number;
}
/**
* Widget data
*/
export interface Widget {
_links: any;
/**
* Refers to the allowed sizes for the widget. This gets populated when user wants to configure the widget
*/
allowedSizes: WidgetSize[];
/**
* Refers to unique identifier of a feature artifact. Used for pinning+unpinning a specific artifact.
*/
artifactId: string;
configurationContributionId: string;
configurationContributionRelativeId: string;
contentUri: string;
/**
* The id of the underlying contribution defining the supplied Widget Configuration.
*/
contributionId: string;
/**
* Optional partial dashboard content, to support exchanging dashboard-level version ETag for widget-level APIs
*/
dashboard: Dashboard;
eTag: string;
id: string;
isEnabled: boolean;
isNameConfigurable: boolean;
lightboxOptions: LightboxOptions;
loadingImageUrl: string;
name: string;
position: WidgetPosition;
settings: string;
settingsVersion: SemanticVersion;
size: WidgetSize;
typeId: string;
url: string;
}
/**
* For V1, this is just a pool of definitions describing our possible Widgets.
*/
export interface WidgetMetadata {
/**
* Sizes supported by the Widget.
*/
allowedSizes: WidgetSize[];
/**
* Opt-in boolean that indicates if the widget requires the Analytics Service to function. Widgets requiring the analytics service are hidden from the catalog if the Analytics Service is not available.
*/
analyticsServiceRequired: boolean;
/**
* Resource for an icon in the widget catalog.
*/
catalogIconUrl: string;
/**
* Opt-in URL string pointing at widget information. Defaults to extension marketplace URL if omitted
*/
catalogInfoUrl: string;
/**
* The id of the underlying contribution defining the supplied Widget custom configuration UI. Null if custom configuration UI is not available.
*/
configurationContributionId: string;
/**
* The relative id of the underlying contribution defining the supplied Widget custom configuration UI. Null if custom configuration UI is not available.
*/
configurationContributionRelativeId: string;
/**
* Indicates if the widget requires configuration before being added to dashboard.
*/
configurationRequired: boolean;
/**
* Uri for the WidgetFactory to get the widget
*/
contentUri: string;
/**
* The id of the underlying contribution defining the supplied Widget.
*/
contributionId: string;
/**
* Optional default settings to be copied into widget settings
*/
defaultSettings: string;
/**
* Summary information describing the widget.
*/
description: string;
/**
* Widgets can be disabled by the app store. We'll need to gracefully handle for: - persistence (Allow) - Requests (Tag as disabled, and provide context)
*/
isEnabled: boolean;
/**
* Opt-out boolean that indicates if the widget supports widget name/title configuration. Widgets ignoring the name should set it to false in the manifest.
*/
isNameConfigurable: boolean;
/**
* Opt-out boolean indicating if the widget is hidden from the catalog. For V1, only "pull" model widgets can be provided from the catalog.
*/
isVisibleFromCatalog: boolean;
/**
* Opt-in lightbox properties
*/
lightboxOptions: LightboxOptions;
/**
* Resource for a loading placeholder image on dashboard
*/
loadingImageUrl: string;
/**
* User facing name of the widget type. Each widget must use a unique value here.
*/
name: string;
/**
* Publisher Name of this kind of widget.
*/
publisherName: string;
/**
* Data contract required for the widget to function and to work in its container.
*/
supportedScopes: WidgetScope[];
/**
* Contribution target IDs
*/
targets: string[];
/**
* Dev-facing id of this kind of widget.
*/
typeId: string;
}
export interface WidgetMetadataResponse {
uri: string;
widgetMetadata: WidgetMetadata;
}
export interface WidgetPosition {
column: number;
row: number;
}
/**
* Response from RestAPI when saving and editing Widget
*/
export interface WidgetResponse extends Widget {
}
export enum WidgetScope {
Collection_User = 0,
Project_Team = 1,
}
export interface WidgetSize {
columnSpan: number;
rowSpan: number;
}
/**
* Wrapper class to support HTTP header generation using CreateResponse, ClientHeaderParameter and ClientResponseType in WidgetV2Controller
*/
export interface WidgetsVersionedList {
eTag: string[];
widgets: Widget[];
}
export interface WidgetTypesResponse {
_links: any;
uri: string;
widgetTypes: WidgetMetadata[];
}
export var TypeInfo = {
Dashboard: {
fields: <any>null
},
DashboardGroup: {
fields: <any>null
},
DashboardGroupEntry: {
fields: <any>null
},
DashboardGroupEntryResponse: {
fields: <any>null
},
DashboardResponse: {
fields: <any>null
},
DashboardScope: {
enumValues: {
"collection_User": 0,
"project_Team": 1,
}
},
GroupMemberPermission: {
enumValues: {
"none": 0,
"edit": 1,
"manage": 2,
"managePermissions": 3,
}
},
LightboxOptions: {
fields: <any>null
},
SemanticVersion: {
fields: <any>null
},
Widget: {
fields: <any>null
},
WidgetMetadata: {
fields: <any>null
},
WidgetMetadataResponse: {
fields: <any>null
},
WidgetPosition: {
fields: <any>null
},
WidgetResponse: {
fields: <any>null
},
WidgetScope: {
enumValues: {
"collection_User": 0,
"project_Team": 1,
}
},
WidgetSize: {
fields: <any>null
},
WidgetsVersionedList: {
fields: <any>null
},
WidgetTypesResponse: {
fields: <any>null
},
};
TypeInfo.Dashboard.fields = {
widgets: {
isArray: true,
typeInfo: TypeInfo.Widget
},
};
TypeInfo.DashboardGroup.fields = {
dashboardEntries: {
isArray: true,
typeInfo: TypeInfo.DashboardGroupEntry
},
permission: {
enumType: TypeInfo.GroupMemberPermission
},
};
TypeInfo.DashboardGroupEntry.fields = {
widgets: {
isArray: true,
typeInfo: TypeInfo.Widget
},
};
TypeInfo.DashboardGroupEntryResponse.fields = {
widgets: {
isArray: true,
typeInfo: TypeInfo.Widget
},
};
TypeInfo.DashboardResponse.fields = {
widgets: {
isArray: true,
typeInfo: TypeInfo.Widget
},
};
TypeInfo.LightboxOptions.fields = {
};
TypeInfo.SemanticVersion.fields = {
};
TypeInfo.Widget.fields = {
allowedSizes: {
isArray: true,
typeInfo: TypeInfo.WidgetSize
},
dashboard: {
typeInfo: TypeInfo.Dashboard
},
lightboxOptions: {
typeInfo: TypeInfo.LightboxOptions
},
position: {
typeInfo: TypeInfo.WidgetPosition
},
settingsVersion: {
typeInfo: TypeInfo.SemanticVersion
},
size: {
typeInfo: TypeInfo.WidgetSize
},
};
TypeInfo.WidgetMetadata.fields = {
allowedSizes: {
isArray: true,
typeInfo: TypeInfo.WidgetSize
},
lightboxOptions: {
typeInfo: TypeInfo.LightboxOptions
},
supportedScopes: {
isArray: true,
enumType: TypeInfo.WidgetScope
},
};
TypeInfo.WidgetMetadataResponse.fields = {
widgetMetadata: {
typeInfo: TypeInfo.WidgetMetadata
},
};
TypeInfo.WidgetPosition.fields = {
};
TypeInfo.WidgetResponse.fields = {
allowedSizes: {
isArray: true,
typeInfo: TypeInfo.WidgetSize
},
dashboard: {
typeInfo: TypeInfo.Dashboard
},
lightboxOptions: {
typeInfo: TypeInfo.LightboxOptions
},
position: {
typeInfo: TypeInfo.WidgetPosition
},
settingsVersion: {
typeInfo: TypeInfo.SemanticVersion
},
size: {
typeInfo: TypeInfo.WidgetSize
},
};
TypeInfo.WidgetSize.fields = {
};
TypeInfo.WidgetsVersionedList.fields = {
widgets: {
isArray: true,
typeInfo: TypeInfo.Widget
},
};
TypeInfo.WidgetTypesResponse.fields = {
widgetTypes: {
isArray: true,
typeInfo: TypeInfo.WidgetMetadata
},
};

Просмотреть файл

@ -0,0 +1,345 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface ActivateDataImportRequest extends FrameworkDataImportRequest {
/**
* Which host (if any should be moved) the move should have already happened.
*/
hostToMovePostImport: DataImportHostMove;
/**
* Tells to preserve registry settings for this import (used later during the dry-run import removal)
*/
keepRegistryData: boolean;
/**
* Dry Run or Production Run
*/
runType: DataImportRunType;
/**
* When moving the Account to the Target Database, the Target Database will be preserved And will need to be downgraded, this is the size to downgrade it too. It should be values from DatabaseServiceObjective enum
*/
targetDatabaseDowngradeSize: string;
}
export interface DatabaseDataImportRequest extends FrameworkDataImportRequest {
/**
* Read only connection string to the source database.
*/
connectionString: string;
/**
* Which host (if any should be moved) the move will happen later.
*/
hostToMovePostImport: DataImportHostMove;
/**
* When HostToMovePostImport is Both, this is the Host Id that will be used to select Database to move them too.
*/
neighborHostId: string;
/**
* Dry Run or Production Run
*/
runType: DataImportRunType;
/**
* When true, the file content is imported, otherwise empty files will be created.
*/
skipFileContentImport: boolean;
/**
* When true, no post import validation checks are done.
*/
skipPostImportValidation: boolean;
}
export interface DataImportDehydrateRequest extends FrameworkDataImportRequest {
}
export enum DataImportHostMove {
/**
* Make no host move (SPS for example)
*/
None = 0,
/**
* Move the Account from the golden database to the target database that is holding their Collection Host (Large TFS Customer that we want to leaving in a "single" tenant database)
*/
Account = 2,
/**
* Move the Collection host back into the golden database from the target database (Small Customers that don't need to be in a "single" tenant database)
*/
Collection = 4,
/**
* Move the Collection And Account hosts to existing database (Large TFS Customer that we want to group many of their collections into a single Database)
*/
Both = 6,
}
export interface DataImportRequestStatus extends ServicingOrchestrationRequestStatus {
}
export enum DataImportRunType {
None = 0,
DryRun = 1,
ProductionRun = 2,
}
export interface FrameworkDataImportRequest extends FrameworkServicingOrchestrationRequest {
}
export interface FrameworkServicingOrchestrationRequest extends ServicingOrchestrationRequest {
/**
* Host Id this request is targeting
*/
hostId: string;
}
export interface HostMoveDataImportRequest extends FrameworkDataImportRequest {
/**
* Host Id of the collection we are importing. OBSOLETE (remove after M100) TODO: TAKS 625726 - remove in M105
*/
collectionHostId: string;
/**
* Which host to move during this request
*/
hostToMove: DataImportHostMove;
/**
* Describes which host (or hosts) will be moved during the entire import.
*/
hostToMovePostImport: DataImportHostMove;
/**
* When HostToMovePostImport is Both, this is the Host Id that will be used to select Database to move them too.
*/
neighborHostId: string;
}
export interface PropertyCollection {
}
export interface PropertyPair {
name: string;
value: string;
}
export interface RemoveDataImportRequest extends FrameworkDataImportRequest {
/**
* When "true" would perform removal even if import successfully completed
*/
ignoreImportStatus: boolean;
}
export interface ServicingOrchestrationRequest {
/**
* The Servicing Job Id used to process this particular request
*/
jobId: string;
/**
* Property bag for the custom data
*/
properties: PropertyCollection;
/**
* Id of the import request (MUST be the same for all activities of the particular import)
*/
requestId: string;
/**
* Full type name of the payload used to construct proper object during the deserialization
*/
typeName: string;
}
export interface ServicingOrchestrationRequestStatus {
completedDate: Date;
completedStepCount: number;
createdDate: Date;
properties: PropertyCollection;
requestId: string;
servicingJobId: string;
startDate: Date;
status: ServicingOrchestrationStatus;
statusMessage: string;
totalStepCount: number;
}
export enum ServicingOrchestrationStatus {
Created = 0,
Queued = 1,
Running = 2,
Completed = 3,
Failed = 4,
}
export var TypeInfo = {
ActivateDataImportRequest: {
fields: <any>null
},
DatabaseDataImportRequest: {
fields: <any>null
},
DataImportDehydrateRequest: {
fields: <any>null
},
DataImportHostMove: {
enumValues: {
"none": 0,
"account": 2,
"collection": 4,
"both": 6,
}
},
DataImportRequestStatus: {
fields: <any>null
},
DataImportRunType: {
enumValues: {
"none": 0,
"dryRun": 1,
"productionRun": 2,
}
},
FrameworkDataImportRequest: {
fields: <any>null
},
FrameworkServicingOrchestrationRequest: {
fields: <any>null
},
HostMoveDataImportRequest: {
fields: <any>null
},
PropertyCollection: {
fields: <any>null
},
PropertyPair: {
fields: <any>null
},
RemoveDataImportRequest: {
fields: <any>null
},
ServicingOrchestrationRequest: {
fields: <any>null
},
ServicingOrchestrationRequestStatus: {
fields: <any>null
},
ServicingOrchestrationStatus: {
enumValues: {
"created": 0,
"queued": 1,
"running": 2,
"completed": 3,
"failed": 4,
}
},
};
TypeInfo.ActivateDataImportRequest.fields = {
hostToMovePostImport: {
enumType: TypeInfo.DataImportHostMove
},
properties: {
typeInfo: TypeInfo.PropertyCollection
},
runType: {
enumType: TypeInfo.DataImportRunType
},
};
TypeInfo.DatabaseDataImportRequest.fields = {
hostToMovePostImport: {
enumType: TypeInfo.DataImportHostMove
},
properties: {
typeInfo: TypeInfo.PropertyCollection
},
runType: {
enumType: TypeInfo.DataImportRunType
},
};
TypeInfo.DataImportDehydrateRequest.fields = {
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.DataImportRequestStatus.fields = {
completedDate: {
isDate: true,
},
createdDate: {
isDate: true,
},
properties: {
typeInfo: TypeInfo.PropertyCollection
},
startDate: {
isDate: true,
},
status: {
enumType: TypeInfo.ServicingOrchestrationStatus
},
};
TypeInfo.FrameworkDataImportRequest.fields = {
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.FrameworkServicingOrchestrationRequest.fields = {
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.HostMoveDataImportRequest.fields = {
hostToMove: {
enumType: TypeInfo.DataImportHostMove
},
hostToMovePostImport: {
enumType: TypeInfo.DataImportHostMove
},
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.PropertyCollection.fields = {
};
TypeInfo.PropertyPair.fields = {
};
TypeInfo.RemoveDataImportRequest.fields = {
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.ServicingOrchestrationRequest.fields = {
properties: {
typeInfo: TypeInfo.PropertyCollection
},
};
TypeInfo.ServicingOrchestrationRequestStatus.fields = {
completedDate: {
isDate: true,
},
createdDate: {
isDate: true,
},
properties: {
typeInfo: TypeInfo.PropertyCollection
},
startDate: {
isDate: true,
},
status: {
enumType: TypeInfo.ServicingOrchestrationStatus
},
};

Просмотреть файл

@ -0,0 +1,159 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
export interface AccessTokenResult {
accessToken: VSSInterfaces.JsonWebToken;
accessTokenError: TokenError;
authorizationId: string;
errorDescription: string;
hasError: boolean;
refreshToken: RefreshTokenGrant;
tokenType: string;
validTo: Date;
}
export interface AuthorizationGrant {
grantType: GrantType;
}
export enum GrantType {
None = 0,
JwtBearer = 1,
RefreshToken = 2,
Implicit = 3,
ClientCredentials = 4,
}
export interface RefreshTokenGrant extends AuthorizationGrant {
jwt: VSSInterfaces.JsonWebToken;
}
export enum TokenError {
None = 0,
GrantTypeRequired = 1,
AuthorizationGrantRequired = 2,
ClientSecretRequired = 3,
RedirectUriRequired = 4,
InvalidAuthorizationGrant = 5,
InvalidAuthorizationScopes = 6,
InvalidRefreshToken = 7,
AuthorizationNotFound = 8,
AuthorizationGrantExpired = 9,
AccessAlreadyIssued = 10,
InvalidRedirectUri = 11,
AccessTokenNotFound = 12,
InvalidAccessToken = 13,
AccessTokenAlreadyRefreshed = 14,
InvalidClientSecret = 15,
ClientSecretExpired = 16,
ServerError = 17,
AccessDenied = 18,
AccessTokenKeyRequired = 19,
InvalidAccessTokenKey = 20,
FailedToGetAccessToken = 21,
InvalidClientId = 22,
InvalidClient = 23,
InvalidValidTo = 24,
InvalidUserId = 25,
FailedToIssueAccessToken = 26,
AuthorizationGrantScopeMissing = 27,
InvalidPublicAccessTokenKey = 28,
InvalidPublicAccessToken = 29,
}
export var TypeInfo = {
AccessTokenResult: {
fields: <any>null
},
AuthorizationGrant: {
fields: <any>null
},
GrantType: {
enumValues: {
"none": 0,
"jwtBearer": 1,
"refreshToken": 2,
"implicit": 3,
"clientCredentials": 4,
}
},
RefreshTokenGrant: {
fields: <any>null
},
TokenError: {
enumValues: {
"none": 0,
"grantTypeRequired": 1,
"authorizationGrantRequired": 2,
"clientSecretRequired": 3,
"redirectUriRequired": 4,
"invalidAuthorizationGrant": 5,
"invalidAuthorizationScopes": 6,
"invalidRefreshToken": 7,
"authorizationNotFound": 8,
"authorizationGrantExpired": 9,
"accessAlreadyIssued": 10,
"invalidRedirectUri": 11,
"accessTokenNotFound": 12,
"invalidAccessToken": 13,
"accessTokenAlreadyRefreshed": 14,
"invalidClientSecret": 15,
"clientSecretExpired": 16,
"serverError": 17,
"accessDenied": 18,
"accessTokenKeyRequired": 19,
"invalidAccessTokenKey": 20,
"failedToGetAccessToken": 21,
"invalidClientId": 22,
"invalidClient": 23,
"invalidValidTo": 24,
"invalidUserId": 25,
"failedToIssueAccessToken": 26,
"authorizationGrantScopeMissing": 27,
"invalidPublicAccessTokenKey": 28,
"invalidPublicAccessToken": 29,
}
},
};
TypeInfo.AccessTokenResult.fields = {
accessToken: {
typeInfo: VSSInterfaces.TypeInfo.JsonWebToken
},
accessTokenError: {
enumType: TypeInfo.TokenError
},
refreshToken: {
typeInfo: TypeInfo.RefreshTokenGrant
},
validTo: {
isDate: true,
},
};
TypeInfo.AuthorizationGrant.fields = {
grantType: {
enumType: TypeInfo.GrantType
},
};
TypeInfo.RefreshTokenGrant.fields = {
grantType: {
enumType: TypeInfo.GrantType
},
jwt: {
typeInfo: VSSInterfaces.TypeInfo.JsonWebToken
},
};

Просмотреть файл

@ -0,0 +1,150 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
export enum CommentType {
Unknown = 0,
Text = 1,
CodeChange = 2,
System = 3,
}
export interface DiscussionComment {
_links: any;
author: VSSInterfaces.IdentityRef;
canDelete: boolean;
commentType: CommentType;
content: string;
/**
* CommentId in a thread always starting from 1.
*/
id: number;
isDeleted: boolean;
lastUpdatedDate: Date;
/**
* Used for comment replies. It must be a commentId of a comment in comment list of a thread.
*/
parentId: number;
publishedDate: Date;
threadId: number;
usersLiked: VSSInterfaces.IdentityRef[];
}
export interface DiscussionCommentCollection {
}
export enum DiscussionStatus {
Unknown = 0,
Active = 1,
Fixed = 2,
WontFix = 3,
Closed = 4,
ByDesign = 5,
Pending = 6,
}
export interface DiscussionThread {
_links: any;
artifactUri: string;
comments: DiscussionComment[];
commentsCount: number;
id: number;
/**
* A discussion is considered as deleted when all its comments are deleted. If thread has comments property set to null or Comments.Length is zero then return false. This property returns false by default because for all REST API calls comments property is not set.
*/
isDeleted: boolean;
lastUpdatedDate: Date;
properties: any;
publishedDate: Date;
status: DiscussionStatus;
workItemId: number;
}
export interface DiscussionThreadCollection {
}
export var TypeInfo = {
CommentType: {
enumValues: {
"unknown": 0,
"text": 1,
"codeChange": 2,
"system": 3,
}
},
DiscussionComment: {
fields: <any>null
},
DiscussionCommentCollection: {
fields: <any>null
},
DiscussionStatus: {
enumValues: {
"unknown": 0,
"active": 1,
"fixed": 2,
"wontFix": 3,
"closed": 4,
"byDesign": 5,
"pending": 6,
}
},
DiscussionThread: {
fields: <any>null
},
DiscussionThreadCollection: {
fields: <any>null
},
};
TypeInfo.DiscussionComment.fields = {
author: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
commentType: {
enumType: TypeInfo.CommentType
},
lastUpdatedDate: {
isDate: true,
},
publishedDate: {
isDate: true,
},
usersLiked: {
isArray: true,
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.DiscussionCommentCollection.fields = {
};
TypeInfo.DiscussionThread.fields = {
comments: {
isArray: true,
typeInfo: TypeInfo.DiscussionComment
},
lastUpdatedDate: {
isDate: true,
},
publishedDate: {
isDate: true,
},
status: {
enumType: TypeInfo.DiscussionStatus
},
};
TypeInfo.DiscussionThreadCollection.fields = {
};

Просмотреть файл

@ -0,0 +1,89 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface DataSourceBindingBase {
dataSourceName: string;
endpointId: string;
endpointUrl: string;
parameters: { [key: string] : string; };
resultSelector: string;
resultTemplate: string;
target: string;
}
export interface ProcessParameters {
dataSourceBindings: DataSourceBindingBase[];
inputs: TaskInputDefinitionBase[];
sourceDefinitions: TaskSourceDefinitionBase[];
}
export interface TaskInputDefinitionBase {
defaultValue: string;
groupName: string;
helpMarkDown: string;
label: string;
name: string;
options: { [key: string] : string; };
properties: { [key: string] : string; };
required: boolean;
type: string;
visibleRule: string;
}
export interface TaskSourceDefinitionBase {
authKey: string;
endpoint: string;
keySelector: string;
selector: string;
target: string;
}
export var TypeInfo = {
DataSourceBindingBase: {
fields: <any>null
},
ProcessParameters: {
fields: <any>null
},
TaskInputDefinitionBase: {
fields: <any>null
},
TaskSourceDefinitionBase: {
fields: <any>null
},
};
TypeInfo.DataSourceBindingBase.fields = {
};
TypeInfo.ProcessParameters.fields = {
dataSourceBindings: {
isArray: true,
typeInfo: TypeInfo.DataSourceBindingBase
},
inputs: {
isArray: true,
typeInfo: TypeInfo.TaskInputDefinitionBase
},
sourceDefinitions: {
isArray: true,
typeInfo: TypeInfo.TaskSourceDefinitionBase
},
};
TypeInfo.TaskInputDefinitionBase.fields = {
};
TypeInfo.TaskSourceDefinitionBase.fields = {
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,182 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
export interface ArtifactProperties {
}
/**
* Describes the scope a favorited Artifact resides in. e.g. A team project.
*/
export interface ArtifactScope {
/**
* The identifier of the scope the artifact resides in. For a TFS Project, this refers to the Project GUID string. For a Collection, marked this property with an empty string.
*/
id: string;
/**
* Name of the artifact scope (e.g. Project Name) Note: This property is a read-only extension over the stored favorite model. This value cannot be overridden on writes.
*/
name: string;
/**
* Type of scope the favorite artifact resides in. Known scopes include "Project" or "Collection"
*/
type: string;
}
/**
* Implementation of Favorite contract following modern storage
*/
export interface Favorite {
/**
* Links to the resources associated to the underlying artifact. Known Contents: -"page" refers to web access UI page for the Artifact
*/
_links: any;
/**
* ID of the favorited artifact, unique in context of this artifact type.
*/
artifactId: string;
/**
* Indicates if the artifact described by this favorite could not be located.
*/
artifactIsDeleted: boolean;
/**
* Last known name of the artifact.
*/
artifactName: string;
/**
* A dictionary of cached properties describing a Favorited artifact. Structure is generated by the service-side feature metadata provider handling this Artifact Type.
*/
artifactProperties: ArtifactProperties;
/**
* Artifact Scope - This object describes where an artifact is contained. e.g. Project Mandatory param for creating all favorites.
*/
artifactScope: ArtifactScope;
/**
* Type of artifact.
*/
artifactType: string;
/**
* Date and time this Favorite was created on server.
*/
creationDate: Date;
/**
* Unique Id of the favorite item, defined by server at creation time.
*/
id: string;
/**
* User identity, defined by server, based on active user context.
*/
owner: VSSInterfaces.IdentityRef;
/**
* Fully-Qualified link to this Resource
*/
url: string;
}
export interface FavoriteCreateParameters {
artifactId: string;
artifactName: string;
artifactProperties: ArtifactProperties;
artifactScope: ArtifactScope;
artifactType: string;
owner: VSSInterfaces.IdentityRef;
}
/**
* Exposes a provider of favorites.
*/
export interface FavoriteProvider {
/**
* Favorite artifact type
*/
artifactType: string;
/**
* URI for retrieving favorite artifacts
*/
artifactUri: string;
/**
* Contribution Id
*/
contributionId: string;
/**
* Group of favorites will be rendered in this order, 0 is top If 2 types share order, they will be coalesced into a single group
*/
order: number;
/**
* Name used for rendering the title of each group of favorites
*/
pluralName: string;
/**
* Service identifier of the service.
*/
serviceIdentifier: string;
/**
* Base URI of the service
*/
serviceUri: string;
}
export var TypeInfo = {
ArtifactProperties: {
fields: <any>null
},
ArtifactScope: {
fields: <any>null
},
Favorite: {
fields: <any>null
},
FavoriteCreateParameters: {
fields: <any>null
},
FavoriteProvider: {
fields: <any>null
},
};
TypeInfo.ArtifactProperties.fields = {
};
TypeInfo.ArtifactScope.fields = {
};
TypeInfo.Favorite.fields = {
artifactProperties: {
typeInfo: TypeInfo.ArtifactProperties
},
artifactScope: {
typeInfo: TypeInfo.ArtifactScope
},
creationDate: {
isDate: true,
},
owner: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.FavoriteCreateParameters.fields = {
artifactProperties: {
typeInfo: TypeInfo.ArtifactProperties
},
artifactScope: {
typeInfo: TypeInfo.ArtifactScope
},
owner: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.FavoriteProvider.fields = {
};

Просмотреть файл

@ -0,0 +1,43 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export interface FeatureFlag {
description: string;
effectiveState: string;
explicitState: string;
name: string;
uri: string;
}
/**
* This is passed to the FeatureFlagController to edit the status of a feature flag
*/
export interface FeatureFlagPatch {
state: string;
}
export var TypeInfo = {
FeatureFlag: {
fields: <any>null
},
FeatureFlagPatch: {
fields: <any>null
},
};
TypeInfo.FeatureFlag.fields = {
};
TypeInfo.FeatureFlagPatch.fields = {
};

Просмотреть файл

@ -1,152 +1,190 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
/**
* A feature that can be enabled or disabled
*/
export interface ContributedFeature {
/**
* If true, the feature is enabled unless overridden at some scope
*/
defaultState: boolean;
/**
* Rules for setting the default value if not specified by any setting/scope. Evaluated in order until a rule returns an Enabled or Disabled state (not Undefined)
*/
defaultValueRules: ContributedFeatureDefaultValueRule[];
/**
* The description of the feature
*/
description: string;
/**
* The full contribution id of the feature
*/
id: string;
/**
* The friendly name of the feature
*/
name: string;
/**
* The scopes/levels at which settings can set the enabled/disabled state of this feature
*/
scopes: ContributedFeatureSettingScope[];
}
/**
* A rules for setting the default value of a feature if not specified by any setting/scope
*/
export interface ContributedFeatureDefaultValueRule {
/**
* Name of the IContributedFeatureValuePlugin to run
*/
name: string;
/**
* Properties to feed to the IContributedFeatureValuePlugin
*/
properties: { [key: string] : any; };
}
export enum ContributedFeatureEnabledValue {
/**
* The state of the feature is not set for the specified scope
*/
Undefined = -1,
/**
* The feature is disabled at the specified scope
*/
Disabled = 0,
/**
* The feature is enabled at the specified scope
*/
Enabled = 1,
}
/**
* The scope to which a feature setting applies
*/
export interface ContributedFeatureSettingScope {
/**
* The name of the settings scope to use when reading/writing the setting
*/
settingScope: string;
/**
* Whether this is a user-scope or this is a host-wide (all users) setting
*/
userScoped: boolean;
}
/**
* A contributed feature/state pair
*/
export interface ContributedFeatureState {
/**
* The full contribution id of the feature
*/
featureId: string;
/**
* The scope at which this state applies
*/
scope: ContributedFeatureSettingScope;
/**
* The current state of this feature
*/
state: ContributedFeatureEnabledValue;
}
export var TypeInfo = {
ContributedFeature: {
fields: <any>null
},
ContributedFeatureDefaultValueRule: {
fields: <any>null
},
ContributedFeatureEnabledValue: {
enumValues: {
"undefined": -1,
"disabled": 0,
"enabled": 1,
}
},
ContributedFeatureSettingScope: {
fields: <any>null
},
ContributedFeatureState: {
fields: <any>null
},
};
TypeInfo.ContributedFeature.fields = {
defaultValueRules: {
isArray: true,
typeInfo: TypeInfo.ContributedFeatureDefaultValueRule
},
scopes: {
isArray: true,
typeInfo: TypeInfo.ContributedFeatureSettingScope
},
};
TypeInfo.ContributedFeatureDefaultValueRule.fields = {
};
TypeInfo.ContributedFeatureSettingScope.fields = {
};
TypeInfo.ContributedFeatureState.fields = {
scope: {
typeInfo: TypeInfo.ContributedFeatureSettingScope
},
state: {
enumType: TypeInfo.ContributedFeatureEnabledValue
},
};
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
/**
* A feature that can be enabled or disabled
*/
export interface ContributedFeature {
/**
* Named links describing the feature
*/
_links: any;
/**
* If true, the feature is enabled unless overridden at some scope
*/
defaultState: boolean;
/**
* Rules for setting the default value if not specified by any setting/scope. Evaluated in order until a rule returns an Enabled or Disabled state (not Undefined)
*/
defaultValueRules: ContributedFeatureValueRule[];
/**
* The description of the feature
*/
description: string;
/**
* The full contribution id of the feature
*/
id: string;
/**
* The friendly name of the feature
*/
name: string;
/**
* Rules for overriding a feature value. These rules are run before explicit user/host state values are checked. They are evaluated in order until a rule returns an Enabled or Disabled state (not Undefined)
*/
overrideRules: ContributedFeatureValueRule[];
/**
* The scopes/levels at which settings can set the enabled/disabled state of this feature
*/
scopes: ContributedFeatureSettingScope[];
}
export enum ContributedFeatureEnabledValue {
/**
* The state of the feature is not set for the specified scope
*/
Undefined = -1,
/**
* The feature is disabled at the specified scope
*/
Disabled = 0,
/**
* The feature is enabled at the specified scope
*/
Enabled = 1,
}
/**
* The scope to which a feature setting applies
*/
export interface ContributedFeatureSettingScope {
/**
* The name of the settings scope to use when reading/writing the setting
*/
settingScope: string;
/**
* Whether this is a user-scope or this is a host-wide (all users) setting
*/
userScoped: boolean;
}
/**
* A contributed feature/state pair
*/
export interface ContributedFeatureState {
/**
* The full contribution id of the feature
*/
featureId: string;
/**
* The scope at which this state applies
*/
scope: ContributedFeatureSettingScope;
/**
* The current state of this feature
*/
state: ContributedFeatureEnabledValue;
}
/**
* A query for the effective contributed feature states for a list of feature ids
*/
export interface ContributedFeatureStateQuery {
/**
* The list of feature ids to query
*/
featureIds: string[];
/**
* The query result containing the current feature states for each of the queried feature ids
*/
featureStates: { [key: string] : ContributedFeatureState; };
/**
* A dictionary of scope values (project name, etc.) to use in the query (if querying across scopes)
*/
scopeValues: { [key: string] : string; };
}
/**
* A rule for dynamically getting the enabled/disabled state of a feature
*/
export interface ContributedFeatureValueRule {
/**
* Name of the IContributedFeatureValuePlugin to run
*/
name: string;
/**
* Properties to feed to the IContributedFeatureValuePlugin
*/
properties: { [key: string] : any; };
}
export var TypeInfo = {
ContributedFeature: {
fields: <any>null
},
ContributedFeatureEnabledValue: {
enumValues: {
"undefined": -1,
"disabled": 0,
"enabled": 1,
}
},
ContributedFeatureSettingScope: {
fields: <any>null
},
ContributedFeatureState: {
fields: <any>null
},
ContributedFeatureStateQuery: {
fields: <any>null
},
ContributedFeatureValueRule: {
fields: <any>null
},
};
TypeInfo.ContributedFeature.fields = {
defaultValueRules: {
isArray: true,
typeInfo: TypeInfo.ContributedFeatureValueRule
},
overrideRules: {
isArray: true,
typeInfo: TypeInfo.ContributedFeatureValueRule
},
scopes: {
isArray: true,
typeInfo: TypeInfo.ContributedFeatureSettingScope
},
};
TypeInfo.ContributedFeatureSettingScope.fields = {
};
TypeInfo.ContributedFeatureState.fields = {
scope: {
typeInfo: TypeInfo.ContributedFeatureSettingScope
},
state: {
enumType: TypeInfo.ContributedFeatureEnabledValue
},
};
TypeInfo.ContributedFeatureStateQuery.fields = {
featureStates: {
},
};
TypeInfo.ContributedFeatureValueRule.fields = {
};

Просмотреть файл

@ -136,6 +136,10 @@ export interface FileContainerItem {
* Hash value of the file. Null if not a file.
*/
fileHash: number[];
/**
* Id of the file content.
*/
fileId: number;
/**
* Length of the file. Zero if not of a file.
*/

Просмотреть файл

@ -0,0 +1,366 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
export enum InputDataType {
/**
* No data type is specified.
*/
None = 0,
/**
* Represents a textual value.
*/
String = 10,
/**
* Represents a numberic value.
*/
Number = 20,
/**
* Represents a value of true or false.
*/
Boolean = 30,
/**
* Represents a Guid.
*/
Guid = 40,
/**
* Represents a URI.
*/
Uri = 50,
}
/**
* Describes an input for subscriptions.
*/
export interface InputDescriptor {
/**
* The ids of all inputs that the value of this input is dependent on.
*/
dependencyInputIds: string[];
/**
* Description of what this input is used for
*/
description: string;
/**
* The group localized name to which this input belongs and can be shown as a header for the container that will include all the inputs in the group.
*/
groupName: string;
/**
* If true, the value information for this input is dynamic and should be fetched when the value of dependency inputs change.
*/
hasDynamicValueInformation: boolean;
/**
* Identifier for the subscription input
*/
id: string;
/**
* Mode in which the value of this input should be entered
*/
inputMode: InputMode;
/**
* Gets whether this input is confidential, such as for a password or application key
*/
isConfidential: boolean;
/**
* Localized name which can be shown as a label for the subscription input
*/
name: string;
/**
* Custom properties for the input which can be used by the service provider
*/
properties: { [key: string] : any; };
/**
* Underlying data type for the input value. When this value is specified, InputMode, Validation and Values are optional.
*/
type: string;
/**
* Gets whether this input is included in the default generated action description.
*/
useInDefaultDescription: boolean;
/**
* Information to use to validate this input's value
*/
validation: InputValidation;
/**
* A hint for input value. It can be used in the UI as the input placeholder.
*/
valueHint: string;
/**
* Information about possible values for this input
*/
values: InputValues;
}
/**
* Defines a filter for subscription inputs. The filter matches a set of inputs if any (one or more) of the groups evaluates to true.
*/
export interface InputFilter {
/**
* Groups of input filter expressions. This filter matches a set of inputs if any (one or more) of the groups evaluates to true.
*/
conditions: InputFilterCondition[];
}
/**
* An expression which can be applied to filter a list of subscription inputs
*/
export interface InputFilterCondition {
/**
* Whether or not to do a case sensitive match
*/
caseSensitive: boolean;
/**
* The Id of the input to filter on
*/
inputId: string;
/**
* The "expected" input value to compare with the actual input value
*/
inputValue: string;
/**
* The operator applied between the expected and actual input value
*/
operator: InputFilterOperator;
}
export enum InputFilterOperator {
Equals = 0,
NotEquals = 1,
}
export enum InputMode {
/**
* This input should not be shown in the UI
*/
None = 0,
/**
* An input text box should be shown
*/
TextBox = 10,
/**
* An password input box should be shown
*/
PasswordBox = 20,
/**
* A select/combo control should be shown
*/
Combo = 30,
/**
* Radio buttons should be shown
*/
RadioButtons = 40,
/**
* Checkbox should be shown(for true/false values)
*/
CheckBox = 50,
/**
* A multi-line text area should be shown
*/
TextArea = 60,
}
/**
* Describes what values are valid for a subscription input
*/
export interface InputValidation {
dataType: InputDataType;
isRequired: boolean;
maxLength: number;
maxValue: number;
minLength: number;
minValue: number;
pattern: string;
patternMismatchErrorMessage: string;
}
/**
* Information about a single value for an input
*/
export interface InputValue {
/**
* Any other data about this input
*/
data: { [key: string] : any; };
/**
* The text to show for the display of this value
*/
displayValue: string;
/**
* The value to store for this input
*/
value: string;
}
/**
* Information about the possible/allowed values for a given subscription input
*/
export interface InputValues {
/**
* The default value to use for this input
*/
defaultValue: string;
/**
* Errors encountered while computing dynamic values.
*/
error: InputValuesError;
/**
* The id of the input
*/
inputId: string;
/**
* Should this input be disabled
*/
isDisabled: boolean;
/**
* Should the value be restricted to one of the values in the PossibleValues (True) or are the values in PossibleValues just a suggestion (False)
*/
isLimitedToPossibleValues: boolean;
/**
* Should this input be made read-only
*/
isReadOnly: boolean;
/**
* Possible values that this input can take
*/
possibleValues: InputValue[];
}
/**
* Error information related to a subscription input value.
*/
export interface InputValuesError {
/**
* The error message.
*/
message: string;
}
export interface InputValuesQuery {
currentValues: { [key: string] : string; };
/**
* The input values to return on input, and the result from the consumer on output.
*/
inputValues: InputValues[];
/**
* Subscription containing information about the publisher/consumer and the current input values
*/
resource: any;
}
export var TypeInfo = {
InputDataType: {
enumValues: {
"none": 0,
"string": 10,
"number": 20,
"boolean": 30,
"guid": 40,
"uri": 50,
}
},
InputDescriptor: {
fields: <any>null
},
InputFilter: {
fields: <any>null
},
InputFilterCondition: {
fields: <any>null
},
InputFilterOperator: {
enumValues: {
"equals": 0,
"notEquals": 1,
}
},
InputMode: {
enumValues: {
"none": 0,
"textBox": 10,
"passwordBox": 20,
"combo": 30,
"radioButtons": 40,
"checkBox": 50,
"textArea": 60,
}
},
InputValidation: {
fields: <any>null
},
InputValue: {
fields: <any>null
},
InputValues: {
fields: <any>null
},
InputValuesError: {
fields: <any>null
},
InputValuesQuery: {
fields: <any>null
},
};
TypeInfo.InputDescriptor.fields = {
inputMode: {
enumType: TypeInfo.InputMode
},
validation: {
typeInfo: TypeInfo.InputValidation
},
values: {
typeInfo: TypeInfo.InputValues
},
};
TypeInfo.InputFilter.fields = {
conditions: {
isArray: true,
typeInfo: TypeInfo.InputFilterCondition
},
};
TypeInfo.InputFilterCondition.fields = {
operator: {
enumType: TypeInfo.InputFilterOperator
},
};
TypeInfo.InputValidation.fields = {
dataType: {
enumType: TypeInfo.InputDataType
},
};
TypeInfo.InputValue.fields = {
};
TypeInfo.InputValues.fields = {
error: {
typeInfo: TypeInfo.InputValuesError
},
possibleValues: {
isArray: true,
typeInfo: TypeInfo.InputValue
},
};
TypeInfo.InputValuesError.fields = {
};
TypeInfo.InputValuesQuery.fields = {
inputValues: {
isArray: true,
typeInfo: TypeInfo.InputValues
},
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,187 @@
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
"use strict";
import VSSInterfaces = require("../interfaces/common/VSSInterfaces");
export enum ComponentType {
Unknown = 0,
Other = 1,
NuGet = 2,
Npm = 3,
}
export interface ComponentVersionReference {
comparisonName: string;
comparisonVersion: string;
componentId: string;
displayName: string;
displayVersion: string;
type: ComponentType;
versionId: string;
}
export enum EvaluationState {
Error = 0,
Initialized = 1,
Processing = 2,
Approved = 3,
Rejected = 4,
RequiresInformation = 5,
Intervention = 6,
}
export interface Policy {
configuration: PolicyConfiguration;
evaluatorId: string;
id: string;
name: string;
url: string;
}
export interface PolicyConfiguration {
data: any;
schemaVersion: number;
}
export interface PolicyEvaluationStatus {
errorRetryable: boolean;
evaluationState: EvaluationState;
evaluationStateReason: string;
modificationDate: Date;
policyId: string;
}
export interface Product {
id: string;
metadata: { [key: string] : string; };
name: string;
policies: Policy[];
url: string;
}
export interface Registration {
componentVersionReference: ComponentVersionReference;
createdDate: Date;
evaluationStatuses: PolicyEvaluationStatus[];
id: string;
metadata: { [key: string] : string; };
productId: string;
registrationState: EvaluationState;
requestedBy: VSSInterfaces.IdentityRef;
}
export interface RegistrationRequest {
componentName: string;
componentType: ComponentType;
componentVersion: string;
metadata: { [key: string] : string; };
}
export var TypeInfo = {
ComponentType: {
enumValues: {
"unknown": 0,
"other": 1,
"nuGet": 2,
"npm": 3,
}
},
ComponentVersionReference: {
fields: <any>null
},
EvaluationState: {
enumValues: {
"error": 0,
"initialized": 1,
"processing": 2,
"approved": 3,
"rejected": 4,
"requiresInformation": 5,
"intervention": 6,
}
},
Policy: {
fields: <any>null
},
PolicyConfiguration: {
fields: <any>null
},
PolicyEvaluationStatus: {
fields: <any>null
},
Product: {
fields: <any>null
},
Registration: {
fields: <any>null
},
RegistrationRequest: {
fields: <any>null
},
};
TypeInfo.ComponentVersionReference.fields = {
type: {
enumType: TypeInfo.ComponentType
},
};
TypeInfo.Policy.fields = {
configuration: {
typeInfo: TypeInfo.PolicyConfiguration
},
};
TypeInfo.PolicyConfiguration.fields = {
};
TypeInfo.PolicyEvaluationStatus.fields = {
evaluationState: {
enumType: TypeInfo.EvaluationState
},
modificationDate: {
isDate: true,
},
};
TypeInfo.Product.fields = {
policies: {
isArray: true,
typeInfo: TypeInfo.Policy
},
};
TypeInfo.Registration.fields = {
componentVersionReference: {
typeInfo: TypeInfo.ComponentVersionReference
},
createdDate: {
isDate: true,
},
evaluationStatuses: {
isArray: true,
typeInfo: TypeInfo.PolicyEvaluationStatus
},
registrationState: {
enumType: TypeInfo.EvaluationState
},
requestedBy: {
typeInfo: VSSInterfaces.TypeInfo.IdentityRef
},
};
TypeInfo.RegistrationRequest.fields = {
componentType: {
enumType: TypeInfo.ComponentType
},
};

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше