UNPKG

haystack-nclient

Version:

Project Haystack Network Client

128 lines (127 loc) 4.61 kB
import { HDict, HGrid, HRef } from 'haystack-core'; import { ScheduleEventsReadOptions, SchedulePointUpdate, ScheduleReadOptions } from './types'; import { ClientServiceConfig } from '../ClientServiceConfig'; /** * An implementation of the FIN schedule service. */ export declare class ScheduleService { #private; /** * Constructs a new record service object. * * @param serviceConfig Service configuration. */ constructor(serviceConfig: ClientServiceConfig); /** * Query all schedules. * * @param options Optional options for reading schedules. * @returns A grid of schedules. */ readAllSchedules<Schedule extends HDict>(options?: ScheduleReadOptions): Promise<HGrid<Schedule>>; /** * Creates single or multiple schedules. * * @param schedules The schedules to create. * @returns A grid of the created schedules. */ createSchedules<Schedule extends HDict>(schedules: Schedule | HGrid<Schedule>): Promise<HGrid<Schedule>>; /** * Read a schedule by its id. * * @param id The record id. * @returns A schedule. */ readScheduleById<Schedule extends HDict>(id: string | HRef): Promise<Schedule>; /** * Updates a schedule. * * @param id The record id. * @param schedule The schedule. * @returns The updated schedule record. */ updateSchedule<Schedule extends HDict>(id: string | HRef, schedule: HDict): Promise<Schedule>; /** * Deletes a schedule by its id. * * @param id The record id. * @returns The deleted schedule. */ deleteScheduleById<Schedule extends HDict>(id: string | HRef): Promise<Schedule>; /** * Reads the calendars associated to a schedule. * * @param id The record id. * @returns A grid of calendars. */ readScheduleCalendarsById<Calendar extends HDict>(id: string | HRef): Promise<HGrid<Calendar>>; /** * Reads all the schedulable points associated to a schedule. * * @param id The record id. * @param options Schedule read options. * @returns A grid of points. */ readSchedulablePoints<SchedulablePoint extends HDict>(id: string | HRef, options?: ScheduleReadOptions): Promise<HGrid<SchedulablePoint>>; /** * Adds or Removes schedulable points to/from a schedule. * * @param id The record id. * @param pointUpdates The schedule point updates. * @returns A grid with the schedule points added/removed. */ updateSchedulePoints<SchedulablePoint extends HDict>(id: string | HRef, pointUpdates: SchedulePointUpdate): Promise<HGrid<SchedulablePoint>>; /** * Query all calendars. * * @param options Optional options for reading calendars. * @returns A grid of calendars. */ readAllCalendars<Calendar extends HDict>(options?: ScheduleReadOptions): Promise<HGrid<Calendar>>; /** * Creates single or multiple calendars. * * @param calendars The calendars to create. * @returns A grid containing the created calendar(s). */ createCalendars<Calendar extends HDict>(calendars: Calendar | HGrid<Calendar>): Promise<HGrid<Calendar>>; /** * Read a calendar by its id. * * @param id The record id. * @returns The calendar record. */ readCalendarById<Calendar extends HDict>(id: string | HRef): Promise<Calendar>; /** * Updates a calendar. * * @param calendar The calendar record. * @returns The updated calendar record. */ updateCalendar<Calendar extends HDict>(id: string | HRef, calendar: HDict): Promise<Calendar>; /** * Deletes a calendar by its id. * * @param id The record id. * @returns The deleted calendar. */ deleteCalendarById<Calendar extends HDict>(id: string | HRef): Promise<Calendar>; /** * Reads the schedules associated to a calendar. * * @param id The record id. * @returns A grid of schedules. */ readCalendarSchedulesById<Schedule extends HDict>(id: string | HRef): Promise<HGrid<Schedule>>; /** * Reads the events associated with a schedule. * * Returns the events within the start -> end range, * or, if no end provided, will return the next scheduled event. * * @param id The record id. * @param options The range to use for event lookup. * @returns The events for the Schedule. */ readScheduleEvents<ScheduleEventsResponse extends HDict>(id: string | HRef, options: ScheduleEventsReadOptions): Promise<ScheduleEventsResponse>; }