fix: add eslint and configure it

This commit is contained in:
StevanFreeborn
2023-02-03 00:16:38 -06:00
parent 54b0668e4a
commit bd55381dc9
16 changed files with 4259 additions and 70 deletions
+4
View File
@@ -133,4 +133,8 @@ export class ApiResponse<T> {
field
);
}
public AsFieldCollectionType(): ApiResponse<CollectionResponse<Field>> {
throw new Error('Method not implemented.');
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { AxiosResponse } from 'axios';
import { type AxiosResponse } from 'axios';
import { HttpStatusCode } from '../enums/HttpStatusCode';
import { ApiResponse } from './ApiResponse';
+1 -1
View File
@@ -1,4 +1,4 @@
import { PagingRequest } from './PagingRequest';
import { type PagingRequest } from './PagingRequest';
/**
* @class EndpointFactory - A factory class for creating endpoints.
+1 -1
View File
@@ -1,5 +1,5 @@
import { PagedResponse } from './PagedResponse';
import { App } from './App';
import { type App } from './App';
/**
* @class GetPagedAppsResponse - A paged response model for the GetApps method.
+21 -8
View File
@@ -1,14 +1,14 @@
import axios from 'axios';
import { AxiosInstance, AxiosRequestConfig } from 'axios';
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
import { ArgumentValidator } from './ArgumentValidator';
import { EndpointFactory } from './EndpointFactory';
import { ApiResponseFactory } from './ApiResponseFactory';
import { ApiResponse } from './ApiResponse';
import { type ApiResponse } from './ApiResponse';
import { PagingRequest } from './PagingRequest';
import { GetPagedAppsResponse } from './GetPagedAppsResponse';
import { App } from './App';
import { CollectionResponse } from './CollectionResponse';
import { Field } from './Field';
import { type GetPagedAppsResponse } from './GetPagedAppsResponse';
import { type App } from './App';
import { type CollectionResponse } from './CollectionResponse';
import { type Field } from './Field';
/**
* @class OnspringClient - A client that can communicate with the Onspring API.
@@ -66,7 +66,7 @@ export class OnspringClient {
): Promise<ApiResponse<GetPagedAppsResponse>> {
const endpoint = EndpointFactory.getAppsEndpoint(pagingRequest);
var apiResponse = await this.get<any>(endpoint);
const apiResponse = await this.get<any>(endpoint);
if (apiResponse.isSuccessful === false) {
return apiResponse;
@@ -83,7 +83,7 @@ export class OnspringClient {
public async getAppById(appId: number): Promise<ApiResponse<App>> {
const endpoint = EndpointFactory.getAppByIdEndpoint(appId);
var apiResponse = await this.get<any>(endpoint);
const apiResponse = await this.get<any>(endpoint);
if (apiResponse.isSuccessful === false) {
return apiResponse;
@@ -125,6 +125,19 @@ export class OnspringClient {
return apiResponse.AsFieldType();
}
public async getFieldsByIds(
fieldIds: number[]
): Promise<ApiResponse<CollectionResponse<Field>>> {
const endpoint = EndpointFactory.getFieldsByIdsEndpoint();
const apiResponse = await this.post<any>(endpoint, fieldIds);
if (apiResponse.isSuccessful === false) {
return apiResponse;
}
return apiResponse.AsFieldCollectionType();
}
/**
* @method get - Makes a GET request to the specified endpoint.
* @param {string} endpoint - The endpoint that will be used to make the request.