@paddle/paddle-node-sdk
Version:
A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.
49 lines (48 loc) • 2.56 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { SimulationRun, SimulationRunCollection } from '../../entities/index.js';
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js';
export * from './operations/index.js';
const SimulationRunPaths = {
list: '/simulations/{simulation_id}/runs',
create: '/simulations/{simulation_id}/runs',
get: '/simulations/{simulation_id}/runs/{simulation_run_id}',
};
export class SimulationRunsResource extends BaseResource {
list(simulationId, queryParams) {
const queryParameters = new QueryParameters(queryParams);
const urlWithPathParams = new PathParameters(SimulationRunPaths.list, {
simulation_id: simulationId,
}).deriveUrl();
return new SimulationRunCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
}
create(simulationId) {
return __awaiter(this, void 0, void 0, function* () {
const urlWithPathParams = new PathParameters(SimulationRunPaths.create, {
simulation_id: simulationId,
}).deriveUrl();
const response = yield this.client.post(urlWithPathParams, undefined);
const data = this.handleResponse(response);
return new SimulationRun(data);
});
}
get(simulationId, simulationRunId, queryParams) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = new QueryParameters(queryParams);
const urlWithPathParams = new PathParameters(SimulationRunPaths.get, {
simulation_id: simulationId,
simulation_run_id: simulationRunId,
}).deriveUrl();
const response = yield this.client.get(urlWithPathParams, queryParameters);
const data = this.handleResponse(response);
return new SimulationRun(data);
});
}
}