UNPKG

@fairmint/canton-node-sdk

Version:
48 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiOperation = void 0; const zod_1 = require("zod"); const errors_1 = require("../errors"); /** Abstract base class for API operations with parameter validation and request handling */ class ApiOperation { constructor(client) { this.client = client; } validateParams(params, schema) { try { return schema.parse(params); } catch (error) { if (error instanceof zod_1.z.ZodError) { throw new errors_1.ValidationError(`Parameter validation failed: ${error.issues.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`); } throw error; } } async makeGetRequest(url, config = {}) { return this.client.makeGetRequest(url, config); } async makePostRequest(url, data, config = {}) { return this.client.makePostRequest(url, data, config); } async makeDeleteRequest(url, config = {}) { return this.client.makeDeleteRequest(url, config); } async makePatchRequest(url, data, config = {}) { return this.client.makePatchRequest(url, data, config); } getManagedParties() { return this.client.getManagedParties(); } getPartyId() { return this.client.getPartyId(); } getApiUrl() { return this.client.getApiUrl(); } buildPartyList(additionalParties = []) { return this.client.buildPartyList(additionalParties); } } exports.ApiOperation = ApiOperation; //# sourceMappingURL=ApiOperation.js.map