apify-client 3.0.0-beta.21 → 3.0.0-beta.22
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.
|
@@ -158,13 +158,14 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
158
158
|
/**
|
|
159
159
|
* Stores one or more items into the dataset.
|
|
160
160
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
161
|
+
* Each item will be stored as a separate record in the dataset. Objects are automatically
|
|
162
|
+
* serialized to JSON. If you provide an array, all items will be stored in order. This method
|
|
163
|
+
* is idempotent - calling it multiple times with the same data will not create duplicates, but
|
|
164
|
+
* will append items each time.
|
|
165
165
|
*
|
|
166
|
-
* @param items - A single item
|
|
167
|
-
*
|
|
166
|
+
* @param items - A single item, an array of items, or a string that is the JSON serialization of
|
|
167
|
+
* either - the API only accepts an object or an array of objects, so a plain string
|
|
168
|
+
* is not a valid item on its own.
|
|
168
169
|
* @param options - Request options
|
|
169
170
|
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
170
171
|
* @see https://docs.apify.com/api/v2/dataset-items-post
|
|
@@ -184,12 +185,9 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
184
185
|
* { url: 'https://test.com', title: 'Test' },
|
|
185
186
|
* { url: 'https://demo.com', title: 'Demo' }
|
|
186
187
|
* ]);
|
|
187
|
-
*
|
|
188
|
-
* // Store string items
|
|
189
|
-
* await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
|
|
190
188
|
* ```
|
|
191
189
|
*/
|
|
192
|
-
pushItems(items: Data | Data[] | string
|
|
190
|
+
pushItems(items: Data | Data[] | string, options?: TimeoutOptions): Promise<void>;
|
|
193
191
|
/**
|
|
194
192
|
* Gets statistical information about the dataset.
|
|
195
193
|
*
|
|
@@ -43,7 +43,7 @@ const downloadItemsOptionsSchema = z.strictObject({
|
|
|
43
43
|
signature: z.string().optional(),
|
|
44
44
|
...timeoutOptionsShape,
|
|
45
45
|
});
|
|
46
|
-
const pushItemsSchema = z.union([itemSchema, z.string(), z.array(
|
|
46
|
+
const pushItemsSchema = z.union([itemSchema, z.string(), z.array(itemSchema)]);
|
|
47
47
|
// Apart from `timeoutSecs` and `expiresInSecs`, every option becomes a query parameter of the generated URL, so
|
|
48
48
|
// `chunkSize` (client-side only) and `signature` (which this method produces) are left out. The options type
|
|
49
49
|
// omits both to match.
|
|
@@ -255,13 +255,14 @@ export class DatasetClient extends ResourceClient {
|
|
|
255
255
|
/**
|
|
256
256
|
* Stores one or more items into the dataset.
|
|
257
257
|
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
258
|
+
* Each item will be stored as a separate record in the dataset. Objects are automatically
|
|
259
|
+
* serialized to JSON. If you provide an array, all items will be stored in order. This method
|
|
260
|
+
* is idempotent - calling it multiple times with the same data will not create duplicates, but
|
|
261
|
+
* will append items each time.
|
|
262
262
|
*
|
|
263
|
-
* @param items - A single item
|
|
264
|
-
*
|
|
263
|
+
* @param items - A single item, an array of items, or a string that is the JSON serialization of
|
|
264
|
+
* either - the API only accepts an object or an array of objects, so a plain string
|
|
265
|
+
* is not a valid item on its own.
|
|
265
266
|
* @param options - Request options
|
|
266
267
|
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
267
268
|
* @see https://docs.apify.com/api/v2/dataset-items-post
|
|
@@ -281,9 +282,6 @@ export class DatasetClient extends ResourceClient {
|
|
|
281
282
|
* { url: 'https://test.com', title: 'Test' },
|
|
282
283
|
* { url: 'https://demo.com', title: 'Demo' }
|
|
283
284
|
* ]);
|
|
284
|
-
*
|
|
285
|
-
* // Store string items
|
|
286
|
-
* await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
|
|
287
285
|
* ```
|
|
288
286
|
*/
|
|
289
287
|
async pushItems(items, options = {}) {
|