Developer Portal for YouTrack and Hub 2021.3 Help

DemoClient

A demo class implementing an API client interface.

Properties

Name

Type

Description

connection

Connection

The HTTP connection that can be used to retrieve data from the import source.

sslKeyName

string

The name of the SSL key if it is selected.

token

string

The authorization token or the password entered by the user.

url

string

The URL of the import source entered by the user.

Constructors


DemoClient

DemoClient(context)

Creating a DemoClient instance.

Parameters

Name

Type

Description

context

Object

The object holding parameters entered via the UI.

 

Methods


getArticles

getArticles(projectInfo, after, top)

Returns articles from the specified project.

Parameters

Name

Type

Description

projectInfo

ProjectInfo

The project where the specified articles belong to.

after

DocumentInfo

The article that the returned articles follow.

top

number

The number of articles to be returned. If there are fewer articles left to import, the method returns them all. If the method returns more articles than it was requested, those extra articles are not processed, and the next time the method is called, the last of the processed articles is passed into `after` parameter.

Return Value

Type

Description

Array.<Article>

Articles following the specified one in the specified project.

 

getAttachmentContent

getAttachmentContent(project, document, attachment)

Returns the content of the specified attachment.

Parameters

Name

Type

Description

project

ProjectInfo

The project where the attachment belongs to.

document

DocumentInfo

The type of the entity where the attachment belongs to (issue or article).

attachment

Attachment

The specified attachment.

Return Value

Type

Description

AttachmentContentWithMetadata

The content of the specified attachment.

 

getIssueUpdates

getIssueUpdates(projectInfo, after, updatedAfter, top)

The method is only required if the client supports continuous import mode. The issues should be ordered either by internal id or created date ascending. Returns issues that were updated after the specified timestamp.

Parameters

Name

Type

Description

projectInfo

ProjectInfo

The project where the requested issues belong.

after

DocumentInfo

The issue that the requested issues follow.

updatedAfter

string

The requested issues are expected to be updated after this timestamp.

top

number

The number of issues to be returned. If there are fewer issues left to import, the method returns them all. If the method returns more issues than it was requested, those extra issues are not processed, and the next time the method is called, the last of the processed issues is passed into `after` parameter.

Return Value

Type

Description

Array.<Issue>

Issues following the specified one in the specified project that were updated after the specified timestamp.

 

getIssues

getIssues(projectInfo, after, top)

This method is invoked during the initial issues loading phase to load issues in chunks. It's recommended that the issues are ordered by either internal id or created date ascending. The returned issues will be imported one by one in the same order. Returns issues from the specified project.

Parameters

Name

Type

Description

projectInfo

ProjectInfo

The project the returned issues belong to.

after

DocumentInfo

The issue that the returned issues follow.

top

number

The number of issues to be returned. If there are fewer issues left to import, the method returns them all, if the method returns more issues than it was requested, those extra issues are not processed, and the next time the method is called, the last of the processed issues is passed into `after` parameter.

Return Value

Type

Description

Array.<Issue>

A list of issues that follow the specified one in the specified project.

 

getLinkTypes

getLinkTypes()

Returns all link types available in the import source.

Return Value

Type

Description

Array.<LinkType>

A list of link types.

 

getProject

getProject(projectInfo)

Returns an object containing a detailed description of a project including its custom fields schema. In case the method is not defined by a client, the custom fields schema (types, values, cardinality) will be defined based on the values provided in the `Issue` objects.

Parameters

Name

Type

Description

projectInfo

ProjectInfo

Information allowing the client to locate the project.

Return Value

Type

Description

Project

The detailed project description.

 

getProjects

getProjects()

Returns information about all projects available in the import source.

Return Value

Type

Description

Array.<ProjectInfo>

A list of projects available in the import source.

 

getServerInfo

getServerInfo()

Returns the version and the time of the server.

Return Value

Type

Description

ServerInfo

An object with the version and time of the server set as its properties.

 

getTimestampFormats

getTimestampFormats()

Returns timestamp formats (for example, `yyyy-MM-dd'T'HH:mm:ss.SSSX`) that are used by the import source. The first of the returned values will be used to format the timestamp passed into the `updateAfter` parameter in the `getIssueUpdates` function. If the list is `null` or empty, the import implementation will behave as if `DEFAULT_TIME_FORMATS` object was returned. The string presentations matching against the formats containing timezone (for example, `yyyy-MM-dd'T'HH:mm:ss.SSSX` or `yyyy-MM-dd'T'HH:mm:ss.SSSZ`) will be converted to timestamps in the timezone from the presentation, otherwise the timezone returning by #getUserTimeZoneId() getUserTimeZoneId method is used.

Return Value

Type

Description

Array.<string>

A list of timestamp formats.

 

getUserTimeZoneId

getUserTimeZoneId()

Id of the timezone of the user that the import runs on behalf of. If `null` or empty, YouTrack user timezone id will be taken.

Return Value

Type

Description

string

The ID of the user timezone.

 

getUsers

getUsers(group, skip, top)

Returns users belonging to the specified group.

Parameters

Name

Type

Description

group

UserGroup

The user group to retrieve members of.

skip

number

Number of heading records to skip.

top

number

Maximum number of records to be returned. If more records are returned, only `top` number of these records will be processed and the rest will be ignored.

Return Value

Type

Description

Array.<User>

A list of users that belong to the specified project.

 

prepareToImport

prepareToImport()

A function that is invoked right before an import round is started. A client can perform any necessary initialization here.

 

Last modified: 14 September 2021