WikiRestClient class

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

Extends

Constructors

WikiRestClient(IVssRestClientOptions)

Properties

RESOURCE_AREA_ID

Methods

addComment(CommentCreateParameters, string, string, number)

Add a comment on a wiki page.

addCommentReaction(string, string, number, number, CommentReactionType)

Add a reaction on a wiki page comment.

createCommentAttachment(any, string, string, number)

Uploads an attachment on a comment on a wiki page.

createOrUpdatePageViewStats(string, string, GitVersionDescriptor, string, string)

Creates a new page view stats resource or updates an existing page view stats resource.

createWiki(WikiCreateParametersV2, string)

Creates the wiki resource.

deleteComment(string, string, number, number)

Delete a comment on a wiki page.

deleteCommentReaction(string, string, number, number, CommentReactionType)

Delete a reaction on a wiki page comment.

deleteWiki(string, string)

Deletes the wiki corresponding to the wiki ID or wiki name provided.

getAllWikis(string)

Gets all wikis in a project or collection.

getAttachmentContent(string, string, number, string)

Downloads an attachment on a comment on a wiki page.

getComment(string, string, number, number, boolean, CommentExpandOptions)

Returns a comment associated with the Wiki Page.

getEngagedUsers(string, string, number, number, CommentReactionType, number, number)

Gets a list of users who have reacted for the given wiki comment with a given reaction type. Supports paging, with a default page size of 100 users at a time.

getPageByIdText(string, string, number, VersionControlRecursionType, boolean)

Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the Accept header sent in the request.

getPageByIdZip(string, string, number, VersionControlRecursionType, boolean)

Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the Accept header sent in the request.

getPageData(string, string, number, number)

Returns page detail corresponding to Page ID.

getPagesBatch(WikiPagesBatchRequest, string, string, GitVersionDescriptor)

Returns pageable list of Wiki Pages

getPageText(string, string, string, VersionControlRecursionType, GitVersionDescriptor, boolean)

Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the Accept header sent in the request.

getPageZip(string, string, string, VersionControlRecursionType, GitVersionDescriptor, boolean)

Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the Accept header sent in the request.

getWiki(string, string)

Gets the wiki corresponding to the wiki ID or wiki name provided.

listComments(string, string, number, number, string, boolean, CommentExpandOptions, CommentSortOrder, number)

Returns a pageable list of comments.

updateComment(CommentUpdateParameters, string, string, number, number)

Update a comment on a wiki page.

updateWiki(WikiUpdateParameters, string, string)

Updates the wiki corresponding to the wiki ID or wiki name provided using the update parameters.

Constructor Details

WikiRestClient(IVssRestClientOptions)

new WikiRestClient(options: IVssRestClientOptions)

Parameters

Property Details

RESOURCE_AREA_ID

static RESOURCE_AREA_ID: string

Property Value

string

Method Details

addComment(CommentCreateParameters, string, string, number)

Add a comment on a wiki page.

function addComment(request: CommentCreateParameters, project: string, wikiIdentifier: string, pageId: number): Promise<Comment>

Parameters

request
CommentCreateParameters

Comment create request.

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

Returns

Promise<Comment>

addCommentReaction(string, string, number, number, CommentReactionType)

Add a reaction on a wiki page comment.

function addCommentReaction(project: string, wikiIdentifier: string, pageId: number, commentId: number, type: CommentReactionType): Promise<CommentReaction>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name

pageId

number

Wiki page ID

commentId

number

ID of the associated comment

type
CommentReactionType

Type of the reaction being added

Returns

Promise<CommentReaction>

createCommentAttachment(any, string, string, number)

Uploads an attachment on a comment on a wiki page.

function createCommentAttachment(content: any, project: string, wikiIdentifier: string, pageId: number): Promise<CommentAttachment>

Parameters

content

any

Content to upload

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

Returns

createOrUpdatePageViewStats(string, string, GitVersionDescriptor, string, string)

Creates a new page view stats resource or updates an existing page view stats resource.

function createOrUpdatePageViewStats(project: string, wikiIdentifier: string, wikiVersion: GitVersionDescriptor, path: string, oldPath?: string): Promise<WikiPageViewStats>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

wikiVersion
GitVersionDescriptor

Wiki version.

path

string

Wiki page path.

oldPath

string

Old page path. This is optional and required to rename path in existing page view stats.

Returns

createWiki(WikiCreateParametersV2, string)

Creates the wiki resource.

function createWiki(wikiCreateParams: WikiCreateParametersV2, project?: string): Promise<WikiV2>

Parameters

wikiCreateParams
WikiCreateParametersV2

Parameters for the wiki creation.

project

string

Project ID or project name

Returns

Promise<WikiV2>

deleteComment(string, string, number, number)

Delete a comment on a wiki page.

function deleteComment(project: string, wikiIdentifier: string, pageId: number, id: number): Promise<void>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or name.

pageId

number

Wiki page ID.

id

number

Comment ID.

Returns

Promise<void>

deleteCommentReaction(string, string, number, number, CommentReactionType)

Delete a reaction on a wiki page comment.

function deleteCommentReaction(project: string, wikiIdentifier: string, pageId: number, commentId: number, type: CommentReactionType): Promise<CommentReaction>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or name

pageId

number

Wiki page ID

commentId

number

ID of the associated comment

type
CommentReactionType

Type of the reaction being deleted

Returns

Promise<CommentReaction>

deleteWiki(string, string)

Deletes the wiki corresponding to the wiki ID or wiki name provided.

function deleteWiki(wikiIdentifier: string, project?: string): Promise<WikiV2>

Parameters

wikiIdentifier

string

Wiki ID or wiki name.

project

string

Project ID or project name

Returns

Promise<WikiV2>

getAllWikis(string)

Gets all wikis in a project or collection.

function getAllWikis(project?: string): Promise<WikiV2[]>

Parameters

project

string

Project ID or project name

Returns

Promise<WikiV2[]>

getAttachmentContent(string, string, number, string)

Downloads an attachment on a comment on a wiki page.

function getAttachmentContent(project: string, wikiIdentifier: string, pageId: number, attachmentId: string): Promise<ArrayBuffer>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

attachmentId

string

Attachment ID.

Returns

Promise<ArrayBuffer>

getComment(string, string, number, number, boolean, CommentExpandOptions)

Returns a comment associated with the Wiki Page.

function getComment(project: string, wikiIdentifier: string, pageId: number, id: number, excludeDeleted?: boolean, expand?: CommentExpandOptions): Promise<Comment>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

id

number

ID of the comment to return.

excludeDeleted

boolean

Specify if the deleted comment should be skipped.

expand
CommentExpandOptions

Specifies the additional data retrieval options for comments.

Returns

Promise<Comment>

getEngagedUsers(string, string, number, number, CommentReactionType, number, number)

Gets a list of users who have reacted for the given wiki comment with a given reaction type. Supports paging, with a default page size of 100 users at a time.

function getEngagedUsers(project: string, wikiIdentifier: string, pageId: number, commentId: number, type: CommentReactionType, top?: number, skip?: number): Promise<IdentityRef[]>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

commentId

number

ID of the associated comment

type
CommentReactionType

Type of the reaction for which the engaged users are being requested

top

number

Number of enagaged users to be returned in a given page. Optional, defaults to 100

skip

number

Number of engaged users to be skipped to page the next set of engaged users, defaults to 0

Returns

Promise<IdentityRef[]>

getPageByIdText(string, string, number, VersionControlRecursionType, boolean)

Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the Accept header sent in the request.

function getPageByIdText(project: string, wikiIdentifier: string, id: number, recursionLevel?: VersionControlRecursionType, includeContent?: boolean): Promise<string>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name..

id

number

Wiki page ID.

recursionLevel
VersionControlRecursionType

Recursion level for subpages retrieval. Defaults to None (Optional).

includeContent

boolean

True to include the content of the page in the response for Json content type. Defaults to false (Optional)

Returns

Promise<string>

getPageByIdZip(string, string, number, VersionControlRecursionType, boolean)

Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the Accept header sent in the request.

function getPageByIdZip(project: string, wikiIdentifier: string, id: number, recursionLevel?: VersionControlRecursionType, includeContent?: boolean): Promise<ArrayBuffer>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name..

id

number

Wiki page ID.

recursionLevel
VersionControlRecursionType

Recursion level for subpages retrieval. Defaults to None (Optional).

includeContent

boolean

True to include the content of the page in the response for Json content type. Defaults to false (Optional)

Returns

Promise<ArrayBuffer>

getPageData(string, string, number, number)

Returns page detail corresponding to Page ID.

function getPageData(project: string, wikiIdentifier: string, pageId: number, pageViewsForDays?: number): Promise<WikiPageDetail>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

pageViewsForDays

number

last N days from the current day for which page views is to be returned. It's inclusive of current day.

Returns

Promise<WikiPageDetail>

getPagesBatch(WikiPagesBatchRequest, string, string, GitVersionDescriptor)

Returns pageable list of Wiki Pages

function getPagesBatch(pagesBatchRequest: WikiPagesBatchRequest, project: string, wikiIdentifier: string, versionDescriptor?: GitVersionDescriptor): Promise<PagedList<WikiPageDetail>>

Parameters

pagesBatchRequest
WikiPagesBatchRequest

Wiki batch page request.

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

versionDescriptor
GitVersionDescriptor

GitVersionDescriptor for the page. (Optional in case of ProjectWiki).

Returns

getPageText(string, string, string, VersionControlRecursionType, GitVersionDescriptor, boolean)

Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the Accept header sent in the request.

function getPageText(project: string, wikiIdentifier: string, path?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean): Promise<string>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

path

string

Wiki page path.

recursionLevel
VersionControlRecursionType

Recursion level for subpages retrieval. Defaults to None (Optional).

versionDescriptor
GitVersionDescriptor

GitVersionDescriptor for the page. Defaults to the default branch (Optional).

includeContent

boolean

True to include the content of the page in the response for Json content type. Defaults to false (Optional)

Returns

Promise<string>

getPageZip(string, string, string, VersionControlRecursionType, GitVersionDescriptor, boolean)

Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the Accept header sent in the request.

function getPageZip(project: string, wikiIdentifier: string, path?: string, recursionLevel?: VersionControlRecursionType, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean): Promise<ArrayBuffer>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

path

string

Wiki page path.

recursionLevel
VersionControlRecursionType

Recursion level for subpages retrieval. Defaults to None (Optional).

versionDescriptor
GitVersionDescriptor

GitVersionDescriptor for the page. Defaults to the default branch (Optional).

includeContent

boolean

True to include the content of the page in the response for Json content type. Defaults to false (Optional)

Returns

Promise<ArrayBuffer>

getWiki(string, string)

Gets the wiki corresponding to the wiki ID or wiki name provided.

function getWiki(wikiIdentifier: string, project?: string): Promise<WikiV2>

Parameters

wikiIdentifier

string

Wiki ID or wiki name.

project

string

Project ID or project name

Returns

Promise<WikiV2>

listComments(string, string, number, number, string, boolean, CommentExpandOptions, CommentSortOrder, number)

Returns a pageable list of comments.

function listComments(project: string, wikiIdentifier: string, pageId: number, top?: number, continuationToken?: string, excludeDeleted?: boolean, expand?: CommentExpandOptions, order?: CommentSortOrder, parentId?: number): Promise<CommentList>

Parameters

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

top

number

Max number of comments to return.

continuationToken

string

Used to query for the next page of comments.

excludeDeleted

boolean

Specify if the deleted comments should be skipped.

expand
CommentExpandOptions

Specifies the additional data retrieval options for comments.

order
CommentSortOrder

Order in which the comments should be returned.

parentId

number

CommentId of the parent comment.

Returns

Promise<CommentList>

updateComment(CommentUpdateParameters, string, string, number, number)

Update a comment on a wiki page.

function updateComment(comment: CommentUpdateParameters, project: string, wikiIdentifier: string, pageId: number, id: number): Promise<Comment>

Parameters

comment
CommentUpdateParameters

Comment update request.

project

string

Project ID or project name

wikiIdentifier

string

Wiki ID or wiki name.

pageId

number

Wiki page ID.

id

number

Comment ID.

Returns

Promise<Comment>

updateWiki(WikiUpdateParameters, string, string)

Updates the wiki corresponding to the wiki ID or wiki name provided using the update parameters.

function updateWiki(updateParameters: WikiUpdateParameters, wikiIdentifier: string, project?: string): Promise<WikiV2>

Parameters

updateParameters
WikiUpdateParameters

Update parameters.

wikiIdentifier

string

Wiki ID or wiki name.

project

string

Project ID or project name

Returns

Promise<WikiV2>