# SchedulesAPI

**Kind**: interface | **Module**: [Platform](https://docs.interop.io/desktop/reference/javascript/platform/index.md) | **Access**: `io.platform.schedules`

**Source**: https://docs.interop.io/desktop/reference/javascript/platform/schedulesapi/index.html

Provides methods for retrieving, updating, and resetting the predefined platform schedules for restart and shutdown, as well as for handling schedule changes.

>  *Note that the Platform Schedules API requires **io.Connect Desktop** 10.6 or later.*

*Since: io.Connect Desktop 10.6, @interopio/desktop 6.24.0*

## Methods

### get

Retrieves the specified platform schedule.

```ts
(name: ScheduleName) => Promise<Schedule>
```

**Parameters**

- **`name`** (`ScheduleName`, required)
  Name of the schedule to retrieve.

**Returns**: `Promise<Schedule>`

### list

Retrieves the platform restart and shutdown schedules, in that order.

```ts
() => Promise<Schedule[]>
```

**Returns**: `Promise<Schedule[]>`

### onChanged

Notifies when a platform schedule is changed. Returns an unsubscribe function.

```ts
(callback: (schedule: Schedule) => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(schedule: Schedule) => void`, required)
  Callback function for handling the event. Receives the changed schedule as an argument.
  The callback will be invoked separately for each changed schedule and won't be invoked when registered.

**Returns**: `UnsubscribeFunction`

### reset

Removes user overrides, the custom cron expression, and custom schedule options.
Administrator settings and defaults provided by the platform will apply to the reset fields. Locked fields will remain unchanged.
Resolves with an object describing the reset schedule.

```ts
(name: ScheduleName) => Promise<Schedule>
```

**Parameters**

- **`name`** (`ScheduleName`, required)
  Name of the schedule to reset.

**Returns**: `Promise<Schedule>`

### update

Updates the specified platform schedule. Unspecified and locked fields will remain unchanged.
Changing `time`, `repeat`, or `day` will replace the custom cron expression unless a new `cron` value is supplied.
Timing values equal to their current values will be ignored. Resolves with an object describing the updated schedule.

```ts
(name: ScheduleName, changes: ScheduleUpdate) => Promise<Schedule>
```

**Parameters**

- **`name`** (`ScheduleName`, required)
  Name of the schedule to update.
- **`changes`** (`ScheduleUpdate`, required)
  Settings to update in the schedule.

**Returns**: `Promise<Schedule>`

## Related types

- [Schedule](https://docs.interop.io/desktop/reference/javascript/platform/schedule/index.md)
- [ScheduleName](https://docs.interop.io/desktop/reference/javascript/platform/schedulename/index.md)
- [ScheduleUpdate](https://docs.interop.io/desktop/reference/javascript/platform/scheduleupdate/index.md)
- [UnsubscribeFunction](https://docs.interop.io/desktop/reference/javascript/search/unsubscribefunction/index.md)
