diff --git a/src/parser/query_operation.ts b/src/parser/query_operation.ts index 98b9396..39fb1ad 100644 --- a/src/parser/query_operation.ts +++ b/src/parser/query_operation.ts @@ -1,4 +1,4 @@ -import { QueryOperationInterface, XBTEKGSOperationObject, XBTEParametersObject } from "./types"; +import { PaginationData, QueryOperationInterface, XBTEKGSOperationObject, XBTEParametersObject } from "./types"; export default class QueryOperationObject implements QueryOperationInterface { private _params: XBTEParametersObject; @@ -14,6 +14,8 @@ export default class QueryOperationObject implements QueryOperationInterface { private _tags: string[]; private _pathParams: string[]; private _templateInputs: any; + private _paginated: boolean; + private _paginationData: PaginationData; static unfreeze(obj: any) { const newObj = new QueryOperationObject(); @@ -42,6 +44,8 @@ export default class QueryOperationObject implements QueryOperationInterface { this._inputSeparator = newOp.inputSeparator; this._templateInputs = newOp.templateInputs; this._batchSize = newOp.batchSize; + this._paginated = !!newOp.pagination?.countField && !!newOp.pagination?.pageSize && !!newOp.pagination?.totalField; + this._paginationData = newOp.pagination; } get templateInputs(): any { @@ -115,4 +119,12 @@ export default class QueryOperationObject implements QueryOperationInterface { set path_params(newPathParams: string[]) { this._pathParams = newPathParams; } + + get paginated(): boolean { + return this._paginated; + } + + get paginationData(): PaginationData { + return this._paginationData; + } } diff --git a/src/parser/types.ts b/src/parser/types.ts index c8a2f3e..909e808 100644 --- a/src/parser/types.ts +++ b/src/parser/types.ts @@ -107,6 +107,12 @@ export interface XBTEKGSOperationBioEntityObject { semantic: string; } +export interface PaginationData { + countField: string; + totalField: string; + pageSize: number; +} + export interface XBTEKGSOperationObject { inputs: XBTEKGSOperationBioEntityObject[]; outputs: XBTEKGSOperationBioEntityObject[]; @@ -125,6 +131,7 @@ export interface XBTEKGSOperationObject { batchSize?: number; knowledge_level?: string; agent_type?: string; + pagination?: PaginationData; } export interface SmartAPISpec { @@ -184,6 +191,8 @@ export interface QueryOperationInterface { inputSeparator: string; useTemplating?: boolean; templateInputs?: any; + paginated?: boolean; + paginationData?: PaginationData; } export interface SmartAPIKGOperationObject {