@qbraid-core/jobs
Version:
Client for the qBraid Quantum Jobs service.
45 lines • 1.58 kB
JavaScript
;
// Copyright (c) 2025, qBraid Development Team
// All rights reserved.
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuantumJobsClient = void 0;
const base_1 = require("@qbraid-core/base");
class QuantumJobsClient extends base_1.QbraidClient {
constructor(session) {
super(session);
}
async getJobs(params) {
const queryTags = params?.tags?.reduce((accumulator, tag) => {
// reducer function for tags
accumulator[`tags.${tag.key}`] = tag.value;
return accumulator;
},
// object definition and type
{});
if (params) {
delete params.tags;
}
const finalParams = { ...params, ...queryTags };
const response = await this.session.client.get(`/quantum-jobs`, {
params: finalParams,
});
return response.data;
}
async deleteJob(jobId) {
const response = await this.session.client.delete(`/quantum-jobs/${jobId}`);
return response.data;
}
async deleteMultipleJobs(jobIdArray) {
const commaSeparatedIds = jobIdArray.join(',');
const response = await this.session.client.delete(`/quantum-jobs?ids=${commaSeparatedIds}`, {
data: { jobIdArray },
});
return response.data;
}
async cancelJobs(jobId) {
const response = await this.session.client.put(`/quantum-jobs/cancel/${jobId}`);
return response.data;
}
}
exports.QuantumJobsClient = QuantumJobsClient;
//# sourceMappingURL=client.js.map