apify-client 2.24.1-beta.6 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +31 -1
- package/dist/bundle.js.map +1 -1
- package/dist/resource_clients/task.d.ts +49 -1
- package/dist/resource_clients/task.js +28 -0
- package/package.json +1 -1
|
@@ -45,6 +45,30 @@ export declare class TaskClient extends ResourceClient {
|
|
|
45
45
|
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
46
46
|
*/
|
|
47
47
|
update(newFields: TaskUpdateData): Promise<Task>;
|
|
48
|
+
/**
|
|
49
|
+
* Publishes the task on its public landing page, by setting `isPublic` through
|
|
50
|
+
* {@apilink TaskClient.update}.
|
|
51
|
+
*
|
|
52
|
+
* The task's Actor must be public and the task must have its public display configuration
|
|
53
|
+
* (`publicConfig`) set up first. Requires write permission to both the task and its Actor.
|
|
54
|
+
* Publishing an already published task does nothing.
|
|
55
|
+
*
|
|
56
|
+
* @returns The task object.
|
|
57
|
+
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
58
|
+
*/
|
|
59
|
+
publish(): Promise<Task>;
|
|
60
|
+
/**
|
|
61
|
+
* Unpublishes the task from its public landing page, by setting `isPublic` through
|
|
62
|
+
* {@apilink TaskClient.update}.
|
|
63
|
+
*
|
|
64
|
+
* The public display configuration (`publicConfig`) is preserved, so the task can be
|
|
65
|
+
* published again without re-entering it. Requires write permission to both the task and its
|
|
66
|
+
* Actor. Unpublishing a task that is not published does nothing.
|
|
67
|
+
*
|
|
68
|
+
* @returns The task object.
|
|
69
|
+
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
70
|
+
*/
|
|
71
|
+
unpublish(): Promise<Task>;
|
|
48
72
|
/**
|
|
49
73
|
* Deletes the Task.
|
|
50
74
|
*
|
|
@@ -146,6 +170,28 @@ export interface Task {
|
|
|
146
170
|
options?: TaskOptions;
|
|
147
171
|
input?: Dictionary | Dictionary[];
|
|
148
172
|
actorStandby?: Partial<ActorStandby>;
|
|
173
|
+
/**
|
|
174
|
+
* Whether the task is published on its public landing page. Derived from
|
|
175
|
+
* `publicConfig.publishedAt` — set it on update to publish or unpublish the task.
|
|
176
|
+
*/
|
|
177
|
+
isPublic?: boolean;
|
|
178
|
+
publicConfig?: TaskPublicConfig | null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Public-facing display configuration of a task's public landing page.
|
|
182
|
+
*
|
|
183
|
+
* The task is published when `publishedAt` is set and unpublished when it is `null`. The
|
|
184
|
+
* `publishedAt` field is read-only - use {@apilink TaskClient.publish} and
|
|
185
|
+
* {@apilink TaskClient.unpublish} to change the publication state.
|
|
186
|
+
*/
|
|
187
|
+
export interface TaskPublicConfig {
|
|
188
|
+
publishedAt: Date | null;
|
|
189
|
+
seoTitle?: string | null;
|
|
190
|
+
seoDescription?: string | null;
|
|
191
|
+
categorization?: string | null;
|
|
192
|
+
inputSchemaFields?: string[] | null;
|
|
193
|
+
datasetName?: string | null;
|
|
194
|
+
datasetView?: string | null;
|
|
149
195
|
}
|
|
150
196
|
/**
|
|
151
197
|
* Statistics about Actor task usage.
|
|
@@ -165,7 +211,9 @@ export interface TaskOptions {
|
|
|
165
211
|
/**
|
|
166
212
|
* Fields that can be updated when modifying a Task.
|
|
167
213
|
*/
|
|
168
|
-
export type TaskUpdateData = Partial<Pick<Task, 'name' | 'title' | 'description' | 'options' | 'input' | 'actorStandby'
|
|
214
|
+
export type TaskUpdateData = Partial<Pick<Task, 'name' | 'title' | 'description' | 'options' | 'input' | 'actorStandby' | 'isPublic'>> & {
|
|
215
|
+
publicConfig?: Omit<TaskPublicConfig, 'publishedAt'>;
|
|
216
|
+
};
|
|
169
217
|
/**
|
|
170
218
|
* Options for filtering the last run of a Task.
|
|
171
219
|
*/
|
|
@@ -59,6 +59,34 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
59
59
|
(0, ow_1.default)(newFields, ow_1.default.object);
|
|
60
60
|
return this._update(newFields);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Publishes the task on its public landing page, by setting `isPublic` through
|
|
64
|
+
* {@apilink TaskClient.update}.
|
|
65
|
+
*
|
|
66
|
+
* The task's Actor must be public and the task must have its public display configuration
|
|
67
|
+
* (`publicConfig`) set up first. Requires write permission to both the task and its Actor.
|
|
68
|
+
* Publishing an already published task does nothing.
|
|
69
|
+
*
|
|
70
|
+
* @returns The task object.
|
|
71
|
+
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
72
|
+
*/
|
|
73
|
+
async publish() {
|
|
74
|
+
return this.update({ isPublic: true });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Unpublishes the task from its public landing page, by setting `isPublic` through
|
|
78
|
+
* {@apilink TaskClient.update}.
|
|
79
|
+
*
|
|
80
|
+
* The public display configuration (`publicConfig`) is preserved, so the task can be
|
|
81
|
+
* published again without re-entering it. Requires write permission to both the task and its
|
|
82
|
+
* Actor. Unpublishing a task that is not published does nothing.
|
|
83
|
+
*
|
|
84
|
+
* @returns The task object.
|
|
85
|
+
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
86
|
+
*/
|
|
87
|
+
async unpublish() {
|
|
88
|
+
return this.update({ isPublic: false });
|
|
89
|
+
}
|
|
62
90
|
/**
|
|
63
91
|
* Deletes the Task.
|
|
64
92
|
*
|