/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { scheduledTasksCreateScheduledTask } from "../funcs/scheduled-tasks-create-scheduled-task.js"; import { scheduledTasksDeleteScheduledTask } from "../funcs/scheduled-tasks-delete-scheduled-task.js"; import { scheduledTasksGetScheduledTask } from "../funcs/scheduled-tasks-get-scheduled-task.js"; import { scheduledTasksListScheduledTasks } from "../funcs/scheduled-tasks-list-scheduled-tasks.js"; import { scheduledTasksScheduleDraftFinalization } from "../funcs/scheduled-tasks-schedule-draft-finalization.js"; import { scheduledTasksScheduleUpdateBillingPeriod } from "../funcs/scheduled-tasks-schedule-update-billing-period.js"; import { scheduledTasksTriggerScheduledTaskRun } from "../funcs/scheduled-tasks-trigger-scheduled-task-run.js"; import { scheduledTasksUpdateScheduledTask } from "../funcs/scheduled-tasks-update-scheduled-task.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class ScheduledTasks extends ClientSDK { /** * List scheduled tasks * * @remarks * Use when listing or managing scheduled tasks in an admin UI. Returns a list; supports filtering by status, type, and pagination. */ async listScheduledTasks( request?: models.ListScheduledTasksRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksListScheduledTasks( this, request, options, )); } /** * Create scheduled task * * @remarks * Use when setting up recurring data exports or other scheduled jobs. Ideal for report generation or syncing data on a schedule. */ async createScheduledTask( request: models.CreateScheduledTaskRequest, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksCreateScheduledTask( this, request, options, )); } /** * Schedule draft finalization * * @remarks * Triggers the draft invoice finalization workflow that scans computed draft invoices whose finalization delay has elapsed and finalizes them (assign invoice number, sync to vendors, attempt payment). */ async scheduleDraftFinalization( options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksScheduleDraftFinalization( this, options, )); } /** * Schedule update billing period * * @remarks * Use when you need to trigger a billing-period update workflow (e.g. to recalculate or sync billing windows). */ async scheduleUpdateBillingPeriod( request: models.ScheduleUpdateBillingPeriodRequest, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksScheduleUpdateBillingPeriod( this, request, options, )); } /** * Get scheduled task * * @remarks * Use when you need to load a single scheduled task (e.g. to show details in a UI or check its configuration). */ async getScheduledTask( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksGetScheduledTask( this, id, options, )); } /** * Update a scheduled task * * @remarks * Use when pausing or resuming a scheduled task. Only the enabled field can be changed. */ async updateScheduledTask( id: string, body: models.UpdateScheduledTaskRequest, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksUpdateScheduledTask( this, id, body, options, )); } /** * Delete a scheduled task * * @remarks * Use when removing a scheduled task from the active roster. Archives the task and removes it from the scheduler (soft delete). */ async deleteScheduledTask( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksDeleteScheduledTask( this, id, options, )); } /** * Trigger force run * * @remarks * Use when you need to run a scheduled export immediately (e.g. on-demand report or catch-up). Supports optional custom time range. */ async triggerScheduledTaskRun( id: string, body?: models.TriggerForceRunRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(scheduledTasksTriggerScheduledTaskRun( this, id, body, options, )); } }