stash-connector
Version:
Module to handle and work with Atlassian Stash projects and repositories throug REST API. Admin your repositories and projects in Stash easy. This project is not an Atlassian official project but use the Atlassian Stash REST API
32 lines (31 loc) • 947 B
TypeScript
export declare class HTTPRequest {
private readonly CONTENT_TYPE_HEADER;
private readonly JSON_CONTENT_TYPE;
private readonly FILE_TYPE;
private method;
private endpoint;
private headers?;
private queryParams?;
private body?;
constructor(method: 'GET' | 'POST' | 'PUT' | 'DELETE', endpoint: string);
withBody(body: any): this;
asJson(): this;
asFile(): this;
addHeader(key: string, value: any): this;
addQueryParam(key: string, value: any): this;
execute(): Promise<HTTPResponse>;
}
export declare class HTTPResponse {
data: any;
status: number;
headers?: {
[key: string]: string;
};
statusText: string;
}
export declare class HTTP {
static get(endpoint: string): HTTPRequest;
static post(endpoint: string): HTTPRequest;
static put(endpoint: string): HTTPRequest;
static delete(endpoint: string): HTTPRequest;
}