TfvcRestClient class

Base class that should be used (derived from) to make requests to VSS REST apis

Extends

Constructors

TfvcRestClient(IVssRestClientOptions)

Properties

RESOURCE_AREA_ID

Methods

createChangeset(TfvcChangeset, string)

Create a new changeset.

getBatchedChangesets(TfvcChangesetsRequestData)

Returns changesets for a given list of changeset Ids.

getBranch(string, string, boolean, boolean)

Get a single branch hierarchy at the given path with parents or children as specified.

getBranches(string, boolean, boolean, boolean, boolean)

Get a collection of branch roots -- first-level children, branches with no parents.

getBranchRefs(string, string, boolean, boolean)

Get branch hierarchies below the specified scopePath

getChangeset(number, string, number, boolean, boolean, number, boolean, number, number, string, TfvcChangesetSearchCriteria)

Retrieve a Tfvc Changeset

getChangesetChanges(number, number, number)

Retrieve Tfvc changes for a given changeset.

getChangesets(string, number, number, number, string, TfvcChangesetSearchCriteria)

Retrieve Tfvc Changesets

getChangesetWorkItems(number)

Retrieves the work items associated with a particular changeset.

getItem(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

getItemContent(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

getItems(string, string, VersionControlRecursionType, boolean, TfvcVersionDescriptor)

Get a list of Tfvc items

getItemsBatch(TfvcItemRequestData, string)

Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.

getItemsBatchZip(TfvcItemRequestData, string)

Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.

getItemText(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

getItemZip(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

getLabel(string, TfvcLabelRequestData, string)

Get a single deep label.

getLabelItems(string, number, number)

Get items under a label.

getLabels(TfvcLabelRequestData, string, number, number)

Get a collection of shallow label references.

getShelveset(string, TfvcShelvesetRequestData)

Get a single deep shelveset.

getShelvesetChanges(string, number, number)

Get changes included in a shelveset.

getShelvesets(TfvcShelvesetRequestData, number, number)

Return a collection of shallow shelveset references.

getShelvesetWorkItems(string)

Get work items associated with a shelveset.

getTfvcStatistics(string, string)

Provides File Count and Uncompressed Bytes for a Collection/Project at a particular scope for TFVC.

Constructor Details

TfvcRestClient(IVssRestClientOptions)

new TfvcRestClient(options: IVssRestClientOptions)

Parameters

Property Details

RESOURCE_AREA_ID

static RESOURCE_AREA_ID: string

Property Value

string

Method Details

createChangeset(TfvcChangeset, string)

Create a new changeset.

function createChangeset(changeset: TfvcChangeset, project?: string): Promise<TfvcChangesetRef>

Parameters

changeset
TfvcChangeset
project

string

Project ID or project name

Returns

Promise<TfvcChangesetRef>

getBatchedChangesets(TfvcChangesetsRequestData)

Returns changesets for a given list of changeset Ids.

function getBatchedChangesets(changesetsRequestData: TfvcChangesetsRequestData): Promise<TfvcChangesetRef[]>

Parameters

changesetsRequestData
TfvcChangesetsRequestData

List of changeset IDs.

Returns

Promise<TfvcChangesetRef[]>

getBranch(string, string, boolean, boolean)

Get a single branch hierarchy at the given path with parents or children as specified.

function getBranch(path: string, project?: string, includeParent?: boolean, includeChildren?: boolean): Promise<TfvcBranch>

Parameters

path

string

Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder.

project

string

Project ID or project name

includeParent

boolean

Return the parent branch, if there is one. Default: False

includeChildren

boolean

Return child branches, if there are any. Default: False

Returns

Promise<TfvcBranch>

getBranches(string, boolean, boolean, boolean, boolean)

Get a collection of branch roots -- first-level children, branches with no parents.

function getBranches(project?: string, includeParent?: boolean, includeChildren?: boolean, includeDeleted?: boolean, includeLinks?: boolean): Promise<TfvcBranch[]>

Parameters

project

string

Project ID or project name

includeParent

boolean

Return the parent branch, if there is one. Default: False

includeChildren

boolean

Return the child branches for each root branch. Default: False

includeDeleted

boolean

Return deleted branches. Default: False

includeLinks

boolean

Return links. Default: False

Returns

Promise<TfvcBranch[]>

getBranchRefs(string, string, boolean, boolean)

Get branch hierarchies below the specified scopePath

function getBranchRefs(scopePath: string, project?: string, includeDeleted?: boolean, includeLinks?: boolean): Promise<TfvcBranchRef[]>

Parameters

scopePath

string

Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder.

project

string

Project ID or project name

includeDeleted

boolean

Return deleted branches. Default: False

includeLinks

boolean

Return links. Default: False

Returns

Promise<TfvcBranchRef[]>

getChangeset(number, string, number, boolean, boolean, number, boolean, number, number, string, TfvcChangesetSearchCriteria)

Retrieve a Tfvc Changeset

function getChangeset(id: number, project?: string, maxChangeCount?: number, includeDetails?: boolean, includeWorkItems?: boolean, maxCommentLength?: number, includeSourceRename?: boolean, skip?: number, top?: number, orderby?: string, searchCriteria?: TfvcChangesetSearchCriteria): Promise<TfvcChangeset>

Parameters

id

number

Changeset Id to retrieve.

project

string

Project ID or project name

maxChangeCount

number

Number of changes to return (maximum 100 changes) Default: 0

includeDetails

boolean

Include policy details and check-in notes in the response. Default: false

includeWorkItems

boolean

Include workitems. Default: false

maxCommentLength

number

Include details about associated work items in the response. Default: null

includeSourceRename

boolean

Include renames. Default: false

skip

number

Number of results to skip. Default: null

top

number

The maximum number of results to return. Default: null

orderby

string

Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order.

searchCriteria
TfvcChangesetSearchCriteria

Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null

Returns

Promise<TfvcChangeset>

getChangesetChanges(number, number, number)

Retrieve Tfvc changes for a given changeset.

function getChangesetChanges(id?: number, skip?: number, top?: number): Promise<PagedList<TfvcChange>>

Parameters

id

number

ID of the changeset. Default: null

skip

number

Number of results to skip. Default: null

top

number

The maximum number of results to return. Default: null

Returns

Promise<PagedList<TfvcChange>>

getChangesets(string, number, number, number, string, TfvcChangesetSearchCriteria)

Retrieve Tfvc Changesets

function getChangesets(project?: string, maxCommentLength?: number, skip?: number, top?: number, orderby?: string, searchCriteria?: TfvcChangesetSearchCriteria): Promise<TfvcChangesetRef[]>

Parameters

project

string

Project ID or project name

maxCommentLength

number

Include details about associated work items in the response. Default: null

skip

number

Number of results to skip. Default: null

top

number

The maximum number of results to return. Default: null

orderby

string

Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order.

searchCriteria
TfvcChangesetSearchCriteria

Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null

Returns

Promise<TfvcChangesetRef[]>

getChangesetWorkItems(number)

Retrieves the work items associated with a particular changeset.

function getChangesetWorkItems(id?: number): Promise<AssociatedWorkItem[]>

Parameters

id

number

ID of the changeset.

Returns

Promise<AssociatedWorkItem[]>

getItem(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

function getItem(path: string, project?: string, fileName?: string, download?: boolean, scopePath?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: TfvcVersionDescriptor, includeContent?: boolean): Promise<TfvcItem>

Parameters

path

string

Version control path of an individual item to return.

project

string

Project ID or project name

fileName

string

file name of item returned.

download

boolean

If true, create a downloadable attachment.

scopePath

string

Version control path of a folder to return multiple items.

recursionLevel
VersionControlRecursionType

None (just the item), or OneLevel (contents of a folder).

versionDescriptor
TfvcVersionDescriptor

Version descriptor. Default is null.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

Returns

Promise<TfvcItem>

getItemContent(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

function getItemContent(path: string, project?: string, fileName?: string, download?: boolean, scopePath?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: TfvcVersionDescriptor, includeContent?: boolean): Promise<ArrayBuffer>

Parameters

path

string

Version control path of an individual item to return.

project

string

Project ID or project name

fileName

string

file name of item returned.

download

boolean

If true, create a downloadable attachment.

scopePath

string

Version control path of a folder to return multiple items.

recursionLevel
VersionControlRecursionType

None (just the item), or OneLevel (contents of a folder).

versionDescriptor
TfvcVersionDescriptor

Version descriptor. Default is null.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

Returns

Promise<ArrayBuffer>

getItems(string, string, VersionControlRecursionType, boolean, TfvcVersionDescriptor)

Get a list of Tfvc items

function getItems(project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeLinks?: boolean, versionDescriptor?: TfvcVersionDescriptor): Promise<TfvcItem[]>

Parameters

project

string

Project ID or project name

scopePath

string

Version control path of a folder to return multiple items.

recursionLevel
VersionControlRecursionType

None (just the item), or OneLevel (contents of a folder).

includeLinks

boolean

True to include links.

versionDescriptor
TfvcVersionDescriptor

Returns

Promise<TfvcItem[]>

getItemsBatch(TfvcItemRequestData, string)

Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.

function getItemsBatch(itemRequestData: TfvcItemRequestData, project?: string): Promise<TfvcItem[][]>

Parameters

itemRequestData
TfvcItemRequestData
project

string

Project ID or project name

Returns

Promise<TfvcItem[][]>

getItemsBatchZip(TfvcItemRequestData, string)

Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.

function getItemsBatchZip(itemRequestData: TfvcItemRequestData, project?: string): Promise<ArrayBuffer>

Parameters

itemRequestData
TfvcItemRequestData
project

string

Project ID or project name

Returns

Promise<ArrayBuffer>

getItemText(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

function getItemText(path: string, project?: string, fileName?: string, download?: boolean, scopePath?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: TfvcVersionDescriptor, includeContent?: boolean): Promise<string>

Parameters

path

string

Version control path of an individual item to return.

project

string

Project ID or project name

fileName

string

file name of item returned.

download

boolean

If true, create a downloadable attachment.

scopePath

string

Version control path of a folder to return multiple items.

recursionLevel
VersionControlRecursionType

None (just the item), or OneLevel (contents of a folder).

versionDescriptor
TfvcVersionDescriptor

Version descriptor. Default is null.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

Returns

Promise<string>

getItemZip(string, string, string, boolean, string, VersionControlRecursionType, TfvcVersionDescriptor, boolean)

Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.

function getItemZip(path: string, project?: string, fileName?: string, download?: boolean, scopePath?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: TfvcVersionDescriptor, includeContent?: boolean): Promise<ArrayBuffer>

Parameters

path

string

Version control path of an individual item to return.

project

string

Project ID or project name

fileName

string

file name of item returned.

download

boolean

If true, create a downloadable attachment.

scopePath

string

Version control path of a folder to return multiple items.

recursionLevel
VersionControlRecursionType

None (just the item), or OneLevel (contents of a folder).

versionDescriptor
TfvcVersionDescriptor

Version descriptor. Default is null.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

Returns

Promise<ArrayBuffer>

getLabel(string, TfvcLabelRequestData, string)

Get a single deep label.

function getLabel(labelId: string, requestData: TfvcLabelRequestData, project?: string): Promise<TfvcLabel>

Parameters

labelId

string

Unique identifier of label

requestData
TfvcLabelRequestData

maxItemCount

project

string

Project ID or project name

Returns

Promise<TfvcLabel>

getLabelItems(string, number, number)

Get items under a label.

function getLabelItems(labelId: string, top?: number, skip?: number): Promise<TfvcItem[]>

Parameters

labelId

string

Unique identifier of label

top

number

Max number of items to return

skip

number

Number of items to skip

Returns

Promise<TfvcItem[]>

getLabels(TfvcLabelRequestData, string, number, number)

Get a collection of shallow label references.

function getLabels(requestData: TfvcLabelRequestData, project?: string, top?: number, skip?: number): Promise<TfvcLabelRef[]>

Parameters

requestData
TfvcLabelRequestData

labelScope, name, owner, and itemLabelFilter

project

string

Project ID or project name

top

number

Max number of labels to return, defaults to 100 when undefined

skip

number

Number of labels to skip

Returns

Promise<TfvcLabelRef[]>

getShelveset(string, TfvcShelvesetRequestData)

Get a single deep shelveset.

function getShelveset(shelvesetId: string, requestData?: TfvcShelvesetRequestData): Promise<TfvcShelveset>

Parameters

shelvesetId

string

Shelveset's unique ID

requestData
TfvcShelvesetRequestData

includeDetails, includeWorkItems, maxChangeCount, and maxCommentLength

Returns

Promise<TfvcShelveset>

getShelvesetChanges(string, number, number)

Get changes included in a shelveset.

function getShelvesetChanges(shelvesetId: string, top?: number, skip?: number): Promise<TfvcChange[]>

Parameters

shelvesetId

string

Shelveset's unique ID

top

number

Max number of changes to return

skip

number

Number of changes to skip

Returns

Promise<TfvcChange[]>

getShelvesets(TfvcShelvesetRequestData, number, number)

Return a collection of shallow shelveset references.

function getShelvesets(requestData?: TfvcShelvesetRequestData, top?: number, skip?: number): Promise<TfvcShelvesetRef[]>

Parameters

requestData
TfvcShelvesetRequestData

name, owner, and maxCommentLength

top

number

Max number of shelvesets to return

skip

number

Number of shelvesets to skip

Returns

Promise<TfvcShelvesetRef[]>

getShelvesetWorkItems(string)

Get work items associated with a shelveset.

function getShelvesetWorkItems(shelvesetId: string): Promise<AssociatedWorkItem[]>

Parameters

shelvesetId

string

Shelveset's unique ID

Returns

Promise<AssociatedWorkItem[]>

getTfvcStatistics(string, string)

Provides File Count and Uncompressed Bytes for a Collection/Project at a particular scope for TFVC.

function getTfvcStatistics(project?: string, scopePath?: string): Promise<TfvcStatistics>

Parameters

project

string

Project ID or project name

scopePath

string

'$/' for collection, '$/project' for specific project

Returns

Promise<TfvcStatistics>