fix: test formatting
This commit is contained in:
+11
-5
@@ -37,7 +37,10 @@ export class OnspringClient {
|
||||
throw new Error('apiKey cannot be null/empty/whitespace.');
|
||||
}
|
||||
|
||||
this._client = axios.create({ baseURL: baseUrl, headers: { 'x-apikey': apiKey, 'x-api-version': '2',},});
|
||||
this._client = axios.create({
|
||||
baseURL: baseUrl,
|
||||
headers: { 'x-apikey': apiKey, 'x-api-version': '2' },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,9 +98,12 @@ export class OnspringClient {
|
||||
* @param {string} endpoint - The endpoint that will be used to make the request.
|
||||
* @returns {Promise<ApiResponse<T>>} - A promise that resolves to an ApiResponse of type T.
|
||||
*/
|
||||
private async get<T>(endpoint: string, config: AxiosRequestConfig = {}): Promise<ApiResponse<T>> {
|
||||
const response = await this._client.get(endpoint, config);
|
||||
const apiResponse = ApiResponseFactory.getApiResponse<T>(response);
|
||||
return apiResponse;
|
||||
private async get<T>(
|
||||
endpoint: string,
|
||||
config: AxiosRequestConfig = {}
|
||||
): Promise<ApiResponse<T>> {
|
||||
const response = await this._client.get(endpoint, config);
|
||||
const apiResponse = ApiResponseFactory.getApiResponse<T>(response);
|
||||
return apiResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export enum FieldType {
|
||||
* @type {string}
|
||||
*/
|
||||
AutoNumber = 'AutoNumber',
|
||||
|
||||
|
||||
/**
|
||||
* @constant Date - The field is a date field.
|
||||
* @type {string}
|
||||
|
||||
@@ -13,7 +13,7 @@ export enum ResultValueType {
|
||||
* @type {string}
|
||||
*/
|
||||
Integer = 'Integer',
|
||||
|
||||
|
||||
/**
|
||||
* @constant Decimal - The result value is a decimal.
|
||||
* @type {string}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PagingRequest } from "./PagingRequest";
|
||||
import { PagingRequest } from './PagingRequest';
|
||||
|
||||
/**
|
||||
* @class EndpointFactory - A factory class for creating endpoints.
|
||||
@@ -16,7 +16,10 @@ export class EndpointFactory {
|
||||
* @param {string} baseUrl - The base url that will be used to create the apps endpoint.
|
||||
* @returns {string} - The apps endpoint.
|
||||
*/
|
||||
public static getAppsEndpoint(baseUrl: string, pagingRequest: PagingRequest): string {
|
||||
public static getAppsEndpoint(
|
||||
baseUrl: string,
|
||||
pagingRequest: PagingRequest
|
||||
): string {
|
||||
return `${baseUrl}/Apps?pageSize=${pagingRequest.pageSize}&pageNumber=${pagingRequest.pageNumber}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { PagedResponse } from "./PagedResponse";
|
||||
import { App } from "./App";
|
||||
import { PagedResponse } from './PagedResponse';
|
||||
import { App } from './App';
|
||||
|
||||
export class GetPagedAppsResponse extends PagedResponse<App> {
|
||||
constructor(items: App[], pageNumber: number, pageSize: number, totalPages: number, totalRecords: number) {
|
||||
constructor(
|
||||
items: App[],
|
||||
pageNumber: number,
|
||||
pageSize: number,
|
||||
totalPages: number,
|
||||
totalRecords: number
|
||||
) {
|
||||
super(items, pageNumber, pageSize, totalPages, totalRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,17 @@ export class PagedResponse<T> {
|
||||
public totalPages: number;
|
||||
public totalRecords: number;
|
||||
|
||||
constructor(items: T[], pageNumber: number, pageSize: number, totalPages: number, totalRecords: number) {
|
||||
constructor(
|
||||
items: T[],
|
||||
pageNumber: number,
|
||||
pageSize: number,
|
||||
totalPages: number,
|
||||
totalRecords: number
|
||||
) {
|
||||
this.items = items;
|
||||
this.pageNumber = pageNumber;
|
||||
this.pageSize = pageSize;
|
||||
this.totalPages = totalPages;
|
||||
this.totalRecords = totalRecords;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ArgumentValidator } from "./ArgumentValidator";
|
||||
import { ArgumentValidator } from './ArgumentValidator';
|
||||
|
||||
/**
|
||||
* @class PagingRequest - Paging request model
|
||||
@@ -24,11 +24,11 @@ export class PagingRequest {
|
||||
*/
|
||||
constructor(pageNumber: number, pageSize: number) {
|
||||
if (ArgumentValidator.isValidPageNumber(pageNumber) === false) {
|
||||
throw new Error("pageNumber must be greater than 0.");
|
||||
throw new Error('pageNumber must be greater than 0.');
|
||||
}
|
||||
|
||||
if (ArgumentValidator.isValidPageSize(pageSize) === false) {
|
||||
throw new Error("pageSize must be greater than 0 and less than 1001.");
|
||||
throw new Error('pageSize must be greater than 0 and less than 1001.');
|
||||
}
|
||||
|
||||
this.pageNumber = pageNumber;
|
||||
|
||||
Reference in New Issue
Block a user