-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Atlassian Stash Connector is a library to work, handle and manage all features and options from any Atlassian Stash project or repository. Developed in TypeScipts to make it more robuts and easy to use.
The library is designed to make this use really easy. All endpoints and operations are grouped and named to make it more semantic and easy to understand.
Atlassian Stash Connector implement all REST API Endpoints to has a full controls of the Stash Projects, including peronal projects. To see all Atlassian Stash endpoints and operations, visit the Oficial Stash REST API Documentation
This is not an Official Atlassian Project but use and work with the Atlassian Official REST API developed for Stash.
// Import Stash Connector package
import { StashConnector } from 'stash-connector';
// Instance the connector with the Stash URL and User credentials
const connector = new StashConnector({
user: '<StashUserName>',
password: '<StashPassword>',
host: '<StashURLHost>',
});
// Use the connector...
connector.admin...
connector.projects...
connector.groups...
connector.users...
connector.markup...
The Stash API Rest work with paginated results, this means that the most of list commands return a Page<T>
whith a collection of values of the requested data types. For example, when retrieve projects, get a Page<Project>
with the paginated values.
The Page<T>
object has the page data, size, limit and next page start among other data to use the paginated API.
export class Page<T> {
size: number = 0; // The page size
limit: number = 0; // The page limit
isLastPage: boolean = true; // True if is the last page, false in otherwise
values: T[] = []; // Returned values collection.
start: number = 0; // First page record
filter?: any; // Page filter
nextPageStart?: number = 0; // First record of the next page
}
IMPORTANT: If more than one page exists (i.e. the response contains "isLastPage": false), the response object will also contain a nextPageStart attribute which must be used by the client as the start parameter on the next request. Identifiers of adjacent objects in a page may not be contiguous, so the start of the next page is not necessarily the start of the last page plus the last page's size. A client should always use nextPageStart to avoid unexpected results from a paged API.
All operations that support pagination, has a PageOptions
object as input to set the page options to the method execution and get the desired results. (In many cases, the PageOptions
is a property of another input data object with more data).
export interface PageOptions {
limit?: number; // Indicates how many results to return per page
start?: number; // Indicates which item should be used as the first item in the page of results
}