UNPKG

@basetime/a2w-api-ts

Version:

Client library that communicates with the addtowallet API.

71 lines (70 loc) 2.21 kB
import { Exporter, ExporterInput } from '../../types/Exporter'; import { ExporterLog } from '../../types/ExporterLog'; import Endpoint from '../Endpoint'; /** * Communicate with the `/organization/exporters*` sub-endpoints. * * Accessed via `client.organizations.exporters`. CRUD on exporters plus the ability to * run an exporter on demand and tail its execution logs. */ export default class OrganizationExportersEndpoint extends Endpoint { /** * Constructor. * * @param parent The parent `OrganizationsEndpoint` whose `req`, `do`, and `qb` are * reused. */ constructor(parent: Endpoint); /** * Returns all exporters for the authenticated organization. */ getAll: () => Promise<Exporter[]>; /** * Returns a single exporter by ID. * * @param id The ID of the exporter. */ getById: (id: string) => Promise<Exporter>; /** * Creates a new exporter. * * The backend uses `PUT` for create on this collection (the corresponding `POST` is the * update verb), matching the route definitions. Returns the full list of exporters after * creation, mirroring the backend response. * * @param body The exporter to create. */ create: (body: ExporterInput) => Promise<Exporter[]>; /** * Updates an existing exporter. * * @param id The ID of the exporter. * @param body The new exporter values. */ update: (id: string, body: ExporterInput) => Promise<Exporter>; /** * Deletes an exporter. * * @param id The ID of the exporter to delete. */ delete: (id: string) => Promise<string>; /** * Runs an exporter on demand. * * @param id The ID of the exporter to run. */ run: (id: string) => Promise<string>; /** * Returns the execution logs for an exporter. * * @param id The ID of the exporter. */ getLogs: (id: string) => Promise<ExporterLog[]>; /** * Returns a single execution log entry for an exporter. * * @param id The ID of the exporter. * @param logId The ID of the log entry. */ getLog: (id: string, logId: string) => Promise<ExporterLog>; }