UNPKG

@paddle/paddle-node-sdk

Version:

A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.

52 lines (51 loc) 2.91 kB
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 { SimulationRunEvent, SimulationRunEventCollection } from '../../entities/index.js'; import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js'; export * from './operations/index.js'; const SimulationRunEventPaths = { list: '/simulations/{simulation_id}/runs/{simulation_run_id}/events', get: '/simulations/{simulation_id}/runs/{simulation_run_id}/events/{simulation_event_id}', replay: '/simulations/{simulation_id}/runs/{simulation_run_id}/events/{simulation_event_id}/replay', }; export class SimulationRunEventsResource extends BaseResource { list(simulationId, simulationRunId, queryParams) { const queryParameters = new QueryParameters(queryParams); const urlWithPathParams = new PathParameters(SimulationRunEventPaths.list, { simulation_id: simulationId, simulation_run_id: simulationRunId, }).deriveUrl(); return new SimulationRunEventCollection(this.client, urlWithPathParams + queryParameters.toQueryString()); } get(simulationId, simulationRunId, simulationEventId) { return __awaiter(this, void 0, void 0, function* () { const urlWithPathParams = new PathParameters(SimulationRunEventPaths.get, { simulation_id: simulationId, simulation_run_id: simulationRunId, simulation_event_id: simulationEventId, }).deriveUrl(); const response = yield this.client.get(urlWithPathParams); const data = this.handleResponse(response); return new SimulationRunEvent(data); }); } replay(simulationId, simulationRunId, simulationEventId) { return __awaiter(this, void 0, void 0, function* () { const urlWithPathParams = new PathParameters(SimulationRunEventPaths.replay, { simulation_id: simulationId, simulation_run_id: simulationRunId, simulation_event_id: simulationEventId, }).deriveUrl(); const response = yield this.client.post(urlWithPathParams, undefined); const data = this.handleResponse(response); return new SimulationRunEvent(data); }); } }