apify-client
Version:
Apify API client for JavaScript
67 lines • 2.35 kB
TypeScript
import type { ApiClientSubResourceOptions } from '../base/api_client';
import { ResourceCollectionClient } from '../base/resource_collection_client';
import type { PaginatedIterator, PaginationOptions } from '../utils';
import type { Schedule, ScheduleCreateOrUpdateData } from './schedule';
/**
* Client for managing the collection of Schedules in your account.
*
* Schedules are used to automatically start Actors or tasks at specified times.
* This client provides methods to list and create schedules.
*
* @example
* ```javascript
* const client = new ApifyClient({ token: 'my-token' });
* const schedulesClient = client.schedules();
*
* // List all schedules
* const { items } = await schedulesClient.list();
*
* // Create a new schedule
* const newSchedule = await schedulesClient.create({
* actorId: 'my-actor-id',
* cronExpression: '0 9 * * *',
* isEnabled: true
* });
* ```
*
* @see https://docs.apify.com/platform/schedules
*/
export declare class ScheduleCollectionClient extends ResourceCollectionClient {
/**
* @hidden
*/
constructor(options: ApiClientSubResourceOptions);
/**
* Lists all schedules.
*
* Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched
* items in a single API call is limited.
* ```javascript
* const paginatedList = await client.list(options);
* ```
*
* Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are
* retrieved.
*
* ```javascript
* for await (const singleItem of client.list(options)) {...}
* ```
*
* @param options - Pagination and sorting options.
* @returns A paginated iterator of schedules.
* @see https://docs.apify.com/api/v2/schedules-get
*/
list(options?: ScheduleCollectionListOptions): PaginatedIterator<Schedule>;
/**
* Creates a new schedule.
*
* @param schedule - The schedule data.
* @returns The created schedule object.
* @see https://docs.apify.com/api/v2/schedules-post
*/
create(schedule?: ScheduleCreateOrUpdateData): Promise<Schedule>;
}
export interface ScheduleCollectionListOptions extends PaginationOptions {
desc?: boolean;
}
//# sourceMappingURL=schedule_collection.d.ts.map