Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ScheduleManager

Index

Constructors

Properties

cache: Dict<string, Dict<number, Schedule>>
client: PteroClient

Methods

  • _patch(id: string, data: any): any
  • Transforms the raw schedule object(s) into class objects.

    Parameters

    • id: string
    • data: any

      The resolvable schedule object(s).

    Returns any

    The resolved schedule object(s).

  • Creates a schedule for a specified server.

    see

    CreateScheduleOptions.

    example
    client.schedules.create(
    '411d2eb9',
    {
    name: 'Weekly backup',
    active: false,
    month: '1',
    hour: '*',
    minute: '*'
    }
    )
    .then(console.log)
    .catch(console.error);

    Parameters

    Returns Promise<Schedule>

    The new schedule.

  • delete(server: string, id: number): Promise<void>
  • Deletes a schedule from a specified server.

    example
    client.schedules.delete('411d2eb9', 3).catch(console.error);
    

    Parameters

    • server: string

      The identifier of the server.

    • id: number

      The ID of the schedule.

    Returns Promise<void>

  • Fetches a schedule from the API by its ID. This will check the cache first unless the force option is specified.

    example
    client.schedules.fetch('411d2eb9', 12)
    .then(console.log)
    .catch(console.error);

    Parameters

    • server: string

      The identifier of the server.

    • id: number

      The ID of the schedule.

    • Optional options: FetchOptions

    Returns Promise<Schedule>

    The fetched schedule.

  • Fetches a list of schedules from the API with the given options (default is undefined).

    example
    client.schedules.fetch('411d2eb9', { perPage: 10 })
    .then(console.log)
    .catch(console.error);

    Parameters

    • server: string

      The identifier of the server.

    • Optional options: FetchOptions

    Returns Promise<Dict<number, Schedule>>

    The fetched schedule.

  • Updates a schedule on the specified server.

    see

    CreateScheduleOptions.

    example
    client.schedules.update('411d2eb9', 5, { onlyWhenOnline: true })
    .then(console.log)
    .catch(console.error);

    Parameters

    • server: string

      The identifier of the server.

    • id: number

      The ID of the schedule.

    • options: Partial<CreateScheduleOptions>

      Update schedule options.

    Returns Promise<Schedule>

    The updated schedule.

Generated using TypeDoc