feat: implement getFieldsByAppId method
This commit is contained in:
@@ -9,6 +9,7 @@ import { type GetPagedAppsResponse } from './GetPagedAppsResponse';
|
||||
import { type App } from './App';
|
||||
import { type CollectionResponse } from './CollectionResponse';
|
||||
import { type Field } from './Field';
|
||||
import { type GetPagedFieldsResponse } from './GetPagedFieldsResponse';
|
||||
|
||||
/**
|
||||
* @class OnspringClient - A client that can communicate with the Onspring API.
|
||||
@@ -145,6 +146,23 @@ export class OnspringClient {
|
||||
return apiResponse.AsFieldCollectionType();
|
||||
}
|
||||
|
||||
public async getFieldsByAppId(
|
||||
appId: number,
|
||||
pagingRequest: PagingRequest = new PagingRequest(1, 50)
|
||||
): Promise<ApiResponse<GetPagedFieldsResponse>> {
|
||||
const endpoint = EndpointFactory.getFieldsByAppIdEndpoint(
|
||||
appId,
|
||||
pagingRequest
|
||||
);
|
||||
const apiResponse = await this.get<any>(endpoint);
|
||||
|
||||
if (apiResponse.isSuccessful === false) {
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
return apiResponse.AsGetPagedFieldsResponseType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @method get - Makes a GET request to the specified endpoint.
|
||||
* @param {string} endpoint - The endpoint that will be used to make the request.
|
||||
|
||||
Reference in New Issue
Block a user