feat: implement getReportById method
This commit is contained in:
@@ -15,6 +15,8 @@ import { ListItemResponse } from './ListItemResponse';
|
||||
import { ListValue } from './ListValue';
|
||||
import { ReferenceField } from './ReferenceField';
|
||||
import { Report } from './Report';
|
||||
import { ReportData } from './ReportData';
|
||||
import { Row } from './Row';
|
||||
|
||||
/**
|
||||
* @class ApiResponse - A generic response object for API requests.
|
||||
@@ -303,6 +305,22 @@ export class ApiResponse<T> {
|
||||
);
|
||||
}
|
||||
|
||||
asReportDataType(): ApiResponse<ReportData> {
|
||||
const apiResponse = this as ApiResponse<any>;
|
||||
|
||||
const rows = apiResponse.data.rows.map((row) => {
|
||||
return new Row(row.recordId, row.cells);
|
||||
});
|
||||
|
||||
const reportData = new ReportData(apiResponse.data.columns, rows);
|
||||
|
||||
return new ApiResponse<ReportData>(
|
||||
apiResponse.statusCode,
|
||||
apiResponse.message,
|
||||
reportData
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @method asFileCollectionType - Converts the field item to the appropriate field object based upon the field item's type.
|
||||
* @param {any} fieldItem - The field item to convert.
|
||||
|
||||
Reference in New Issue
Block a user