import { __awaiter } from "tslib";
import BaseListGetterApiConsumer from '../base-list-getter-api-consumer/base-list-getter-api-consumer';
export default class SdkListGetterApiConsumer extends BaseListGetterApiConsumer {
    constructor(SDKMethod, params) {
        super(params);
        this.SDKMethod = SDKMethod;
    }
    getList({ page = 1, size = 10, search, sort, fields, id, }) {
        return this._getList([page, size, search, sort, fields, id]);
    }
    getNestedList({ parentId, page = 1, size = 10, search, sort, fields, id, }) {
        return this._getList([parentId, page, size, search, sort, fields, id]);
    }
    _getList(args) {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                // @ts-ignore
                let response = yield this.SDKMethod(...args);
                response = this.responseHandler(response);
                if (this.userResponseHandler) {
                    response = this.userResponseHandler(response);
                }
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
}
//# sourceMappingURL=sdk-list-getter-api-consumer.js.map