apify-client 3.0.0-beta.0 → 3.0.0-beta.2
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/README.md +2 -2
- package/dist/apify_api_error.js +5 -9
- package/dist/apify_client.d.ts +27 -27
- package/dist/apify_client.js +86 -91
- package/dist/argument_validation_error.js +1 -5
- package/dist/base/api_client.d.ts +3 -3
- package/dist/base/api_client.js +6 -10
- package/dist/base/resource_client.d.ts +1 -1
- package/dist/base/resource_client.js +14 -18
- package/dist/base/resource_collection_client.d.ts +2 -2
- package/dist/base/resource_collection_client.js +6 -10
- package/dist/body_parser.js +6 -11
- package/dist/bundle.js +8 -8
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +20522 -0
- package/dist/generated/api.js +5 -0
- package/dist/http_client.d.ts +2 -2
- package/dist/http_client.js +23 -28
- package/dist/index.d.ts +32 -32
- package/dist/index.js +31 -36
- package/dist/interceptors.d.ts +1 -1
- package/dist/interceptors.js +14 -19
- package/dist/models.d.ts +1072 -0
- package/dist/models.js +86 -0
- package/dist/resource_clients/actor.d.ts +13 -459
- package/dist/resource_clients/actor.js +67 -71
- package/dist/resource_clients/actor_collection.d.ts +7 -12
- package/dist/resource_clients/actor_collection.js +14 -18
- package/dist/resource_clients/actor_env_var.d.ts +3 -3
- package/dist/resource_clients/actor_env_var.js +4 -8
- package/dist/resource_clients/actor_env_var_collection.d.ts +4 -4
- package/dist/resource_clients/actor_env_var_collection.js +5 -9
- package/dist/resource_clients/actor_version.d.ts +7 -44
- package/dist/resource_clients/actor_version.js +12 -22
- package/dist/resource_clients/actor_version_collection.d.ts +4 -4
- package/dist/resource_clients/actor_version_collection.js +5 -9
- package/dist/resource_clients/build.d.ts +5 -80
- package/dist/resource_clients/build.js +11 -15
- package/dist/resource_clients/build_collection.d.ts +5 -5
- package/dist/resource_clients/build_collection.js +8 -12
- package/dist/resource_clients/dataset.d.ts +5 -71
- package/dist/resource_clients/dataset.js +72 -76
- package/dist/resource_clients/dataset_collection.d.ts +4 -4
- package/dist/resource_clients/dataset_collection.js +15 -19
- package/dist/resource_clients/key_value_store.d.ts +4 -73
- package/dist/resource_clients/key_value_store.js +60 -63
- package/dist/resource_clients/key_value_store_collection.d.ts +4 -4
- package/dist/resource_clients/key_value_store_collection.js +15 -19
- package/dist/resource_clients/log.d.ts +2 -2
- package/dist/resource_clients/log.js +15 -22
- package/dist/resource_clients/request_queue.d.ts +17 -176
- package/dist/resource_clients/request_queue.js +93 -98
- package/dist/resource_clients/request_queue_collection.d.ts +4 -4
- package/dist/resource_clients/request_queue_collection.js +13 -17
- package/dist/resource_clients/run.d.ts +8 -8
- package/dist/resource_clients/run.js +46 -50
- package/dist/resource_clients/run_collection.d.ts +4 -4
- package/dist/resource_clients/run_collection.js +13 -17
- package/dist/resource_clients/schedule.d.ts +6 -84
- package/dist/resource_clients/schedule.js +7 -18
- package/dist/resource_clients/schedule_collection.d.ts +4 -4
- package/dist/resource_clients/schedule_collection.js +10 -14
- package/dist/resource_clients/store_collection.d.ts +5 -33
- package/dist/resource_clients/store_collection.js +13 -17
- package/dist/resource_clients/task.d.ts +9 -79
- package/dist/resource_clients/task.js +44 -48
- package/dist/resource_clients/task_collection.d.ts +6 -5
- package/dist/resource_clients/task_collection.js +9 -13
- package/dist/resource_clients/user.d.ts +5 -181
- package/dist/resource_clients/user.js +8 -21
- package/dist/resource_clients/webhook.d.ts +6 -65
- package/dist/resource_clients/webhook.js +8 -12
- package/dist/resource_clients/webhook_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_collection.js +10 -14
- package/dist/resource_clients/webhook_dispatch.d.ts +5 -38
- package/dist/resource_clients/webhook_dispatch.js +3 -12
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_dispatch_collection.js +8 -12
- package/dist/statistics.js +5 -9
- package/dist/timezones.js +1 -2
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +41 -56
- package/package.json +16 -9
- package/dist/index.mjs +0 -42
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceClient } from '../base/resource_client';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { Task, TaskPublicConfig } from '../models.js';
|
|
4
|
+
import type { Dictionary } from '../utils.js';
|
|
5
|
+
import type { ActorLastRunOptions, ActorRun, ActorStartOptions } from './actor.js';
|
|
6
|
+
import { RunClient } from './run.js';
|
|
7
|
+
import { RunCollectionClient } from './run_collection.js';
|
|
8
|
+
import { WebhookCollectionClient } from './webhook_collection.js';
|
|
9
|
+
export type { Task, TaskOptions, TaskPublicConfig, TaskStats } from '../models.js';
|
|
8
10
|
/**
|
|
9
11
|
* Client for managing a specific Actor task.
|
|
10
12
|
*
|
|
@@ -152,78 +154,6 @@ export declare class TaskClient extends ResourceClient {
|
|
|
152
154
|
*/
|
|
153
155
|
webhooks(): WebhookCollectionClient;
|
|
154
156
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Represents an Actor task.
|
|
157
|
-
*
|
|
158
|
-
* Tasks are saved Actor configurations with input and settings that can be executed
|
|
159
|
-
* repeatedly without having to specify the full input each time.
|
|
160
|
-
*/
|
|
161
|
-
export interface Task {
|
|
162
|
-
id: string;
|
|
163
|
-
userId: string;
|
|
164
|
-
actId: string;
|
|
165
|
-
name: string;
|
|
166
|
-
/**
|
|
167
|
-
* @since Added in 2.6.1
|
|
168
|
-
*/
|
|
169
|
-
title?: string;
|
|
170
|
-
description?: string;
|
|
171
|
-
username?: string;
|
|
172
|
-
createdAt: Date;
|
|
173
|
-
modifiedAt: Date;
|
|
174
|
-
stats: TaskStats;
|
|
175
|
-
options?: TaskOptions;
|
|
176
|
-
input?: Dictionary | Dictionary[];
|
|
177
|
-
/**
|
|
178
|
-
* @since Added in 2.9.5
|
|
179
|
-
*/
|
|
180
|
-
actorStandby?: Partial<ActorStandby>;
|
|
181
|
-
/**
|
|
182
|
-
* Whether the task is published on its public landing page. Derived from
|
|
183
|
-
* `publicConfig.publishedAt` — set it on update to publish or unpublish the task.
|
|
184
|
-
* @since Added in 2.25.0
|
|
185
|
-
*/
|
|
186
|
-
isPublic?: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* @since Added in 2.25.0
|
|
189
|
-
*/
|
|
190
|
-
publicConfig?: TaskPublicConfig | null;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Public-facing display configuration of a task's public landing page.
|
|
194
|
-
*
|
|
195
|
-
* The task is published when `publishedAt` is set and unpublished when it is `null`. The
|
|
196
|
-
* `publishedAt` field is read-only - use {@apilink TaskClient.publish} and
|
|
197
|
-
* {@apilink TaskClient.unpublish} to change the publication state.
|
|
198
|
-
* @since Added in 2.25.0
|
|
199
|
-
*/
|
|
200
|
-
export interface TaskPublicConfig {
|
|
201
|
-
publishedAt: Date | null;
|
|
202
|
-
seoTitle?: string | null;
|
|
203
|
-
seoDescription?: string | null;
|
|
204
|
-
categorization?: string | null;
|
|
205
|
-
inputSchemaFields?: string[] | null;
|
|
206
|
-
datasetName?: string | null;
|
|
207
|
-
datasetView?: string | null;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Statistics about Actor task usage.
|
|
211
|
-
*/
|
|
212
|
-
export interface TaskStats {
|
|
213
|
-
totalRuns: number;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Configuration options for an Actor task.
|
|
217
|
-
*/
|
|
218
|
-
export interface TaskOptions {
|
|
219
|
-
build?: string;
|
|
220
|
-
timeoutSecs?: number;
|
|
221
|
-
memoryMbytes?: number;
|
|
222
|
-
/**
|
|
223
|
-
* @since Added in 2.19.0
|
|
224
|
-
*/
|
|
225
|
-
restartOnError?: boolean;
|
|
226
|
-
}
|
|
227
157
|
/**
|
|
228
158
|
* Fields that can be updated when modifying a Task.
|
|
229
159
|
*/
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
maxItems: zod_1.z.number().min(0).optional(),
|
|
19
|
-
maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
|
|
20
|
-
restartOnError: zod_1.z.boolean().optional(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ACT_JOB_STATUSES, META_ORIGINS } from '@apify/consts';
|
|
3
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
4
|
+
import { anyObjectSchema, cast, catchNotFoundOrThrow, parseArgument, parseDateFields, pluckData, stringifyWebhooksToBase64, } from '../utils.js';
|
|
5
|
+
import { RunClient } from './run.js';
|
|
6
|
+
import { RunCollectionClient } from './run_collection.js';
|
|
7
|
+
import { WebhookCollectionClient } from './webhook_collection.js';
|
|
8
|
+
const inputSchema = anyObjectSchema.optional();
|
|
9
|
+
const startOptionsSchema = z.strictObject({
|
|
10
|
+
build: z.string().optional(),
|
|
11
|
+
memory: z.number().optional(),
|
|
12
|
+
timeout: z.number().optional(),
|
|
13
|
+
waitForFinish: z.number().optional(),
|
|
14
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
15
|
+
maxItems: z.number().min(0).optional(),
|
|
16
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
17
|
+
restartOnError: z.boolean().optional(),
|
|
21
18
|
});
|
|
22
|
-
const callOptionsSchema =
|
|
23
|
-
build:
|
|
24
|
-
memory:
|
|
25
|
-
timeout:
|
|
26
|
-
waitSecs:
|
|
27
|
-
webhooks:
|
|
28
|
-
maxItems:
|
|
29
|
-
maxTotalChargeUsd:
|
|
30
|
-
restartOnError:
|
|
19
|
+
const callOptionsSchema = z.strictObject({
|
|
20
|
+
build: z.string().optional(),
|
|
21
|
+
memory: z.number().optional(),
|
|
22
|
+
timeout: z.number().min(0).optional(),
|
|
23
|
+
waitSecs: z.number().min(0).optional(),
|
|
24
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
25
|
+
maxItems: z.number().min(0).optional(),
|
|
26
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
27
|
+
restartOnError: z.boolean().optional(),
|
|
31
28
|
});
|
|
32
|
-
const lastRunOptionsSchema =
|
|
33
|
-
status:
|
|
34
|
-
origin:
|
|
29
|
+
const lastRunOptionsSchema = z.strictObject({
|
|
30
|
+
status: z.enum(ACT_JOB_STATUSES).optional(),
|
|
31
|
+
origin: z.enum(META_ORIGINS).optional(),
|
|
35
32
|
});
|
|
36
33
|
/**
|
|
37
34
|
* Client for managing a specific Actor task.
|
|
@@ -53,7 +50,7 @@ const lastRunOptionsSchema = zod_1.z.strictObject({
|
|
|
53
50
|
*
|
|
54
51
|
* @see https://docs.apify.com/platform/actors/running/tasks
|
|
55
52
|
*/
|
|
56
|
-
class TaskClient extends
|
|
53
|
+
export class TaskClient extends ResourceClient {
|
|
57
54
|
/**
|
|
58
55
|
* @hidden
|
|
59
56
|
*/
|
|
@@ -80,7 +77,7 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
80
77
|
* @see https://docs.apify.com/api/v2/actor-task-put
|
|
81
78
|
*/
|
|
82
79
|
async update(newFields) {
|
|
83
|
-
|
|
80
|
+
parseArgument(newFields, anyObjectSchema);
|
|
84
81
|
return this._update(newFields);
|
|
85
82
|
}
|
|
86
83
|
/**
|
|
@@ -138,15 +135,15 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
138
135
|
* @see https://docs.apify.com/api/v2/actor-task-runs-post
|
|
139
136
|
*/
|
|
140
137
|
async start(input, options = {}) {
|
|
141
|
-
|
|
142
|
-
const parsed =
|
|
138
|
+
parseArgument(input, inputSchema);
|
|
139
|
+
const parsed = parseArgument(options, startOptionsSchema, 'TaskStartOptions');
|
|
143
140
|
const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError } = parsed;
|
|
144
141
|
const params = {
|
|
145
142
|
waitForFinish,
|
|
146
143
|
timeout,
|
|
147
144
|
memory,
|
|
148
145
|
build,
|
|
149
|
-
webhooks:
|
|
146
|
+
webhooks: stringifyWebhooksToBase64(parsed.webhooks),
|
|
150
147
|
maxItems,
|
|
151
148
|
maxTotalChargeUsd,
|
|
152
149
|
restartOnError,
|
|
@@ -164,7 +161,7 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
164
161
|
},
|
|
165
162
|
};
|
|
166
163
|
const response = await this.httpClient.call(request);
|
|
167
|
-
return
|
|
164
|
+
return cast(parseDateFields(pluckData(response.data)));
|
|
168
165
|
}
|
|
169
166
|
/**
|
|
170
167
|
* Starts a task and waits for it to finish before returning the Run object.
|
|
@@ -184,8 +181,8 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
184
181
|
* @see https://docs.apify.com/api/v2/actor-task-runs-post
|
|
185
182
|
*/
|
|
186
183
|
async call(input, options = {}) {
|
|
187
|
-
|
|
188
|
-
const parsed =
|
|
184
|
+
parseArgument(input, inputSchema);
|
|
185
|
+
const parsed = parseArgument(options, callOptionsSchema, 'TaskCallOptions');
|
|
189
186
|
const { waitSecs, ...startOptions } = parsed;
|
|
190
187
|
const { id } = await this.start(input, startOptions);
|
|
191
188
|
// Calling root client because we need access to top level API.
|
|
@@ -207,10 +204,10 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
207
204
|
};
|
|
208
205
|
try {
|
|
209
206
|
const response = await this.httpClient.call(requestOpts);
|
|
210
|
-
return
|
|
207
|
+
return cast(response.data);
|
|
211
208
|
}
|
|
212
209
|
catch (err) {
|
|
213
|
-
|
|
210
|
+
catchNotFoundOrThrow(err);
|
|
214
211
|
}
|
|
215
212
|
return undefined;
|
|
216
213
|
}
|
|
@@ -228,7 +225,7 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
228
225
|
params: this._params(),
|
|
229
226
|
data: newFields,
|
|
230
227
|
});
|
|
231
|
-
return
|
|
228
|
+
return cast(response.data);
|
|
232
229
|
}
|
|
233
230
|
/**
|
|
234
231
|
* Returns a client for the last run of this task.
|
|
@@ -240,8 +237,8 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
240
237
|
* @see https://docs.apify.com/api/v2/actor-task-runs-last-get
|
|
241
238
|
*/
|
|
242
239
|
lastRun(options = {}) {
|
|
243
|
-
const parsed =
|
|
244
|
-
return new
|
|
240
|
+
const parsed = parseArgument(options, lastRunOptionsSchema, 'TaskLastRunOptions');
|
|
241
|
+
return new RunClient(this._subResourceOptions({
|
|
245
242
|
id: 'last',
|
|
246
243
|
params: this._params(parsed),
|
|
247
244
|
resourcePath: 'runs',
|
|
@@ -254,7 +251,7 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
254
251
|
* @see https://docs.apify.com/api/v2/actor-task-runs-get
|
|
255
252
|
*/
|
|
256
253
|
runs() {
|
|
257
|
-
return new
|
|
254
|
+
return new RunCollectionClient(this._subResourceOptions({
|
|
258
255
|
resourcePath: 'runs',
|
|
259
256
|
}));
|
|
260
257
|
}
|
|
@@ -265,7 +262,6 @@ class TaskClient extends resource_client_1.ResourceClient {
|
|
|
265
262
|
* @see https://docs.apify.com/api/v2/actor-task-webhooks-get
|
|
266
263
|
*/
|
|
267
264
|
webhooks() {
|
|
268
|
-
return new
|
|
265
|
+
return new WebhookCollectionClient(this._subResourceOptions());
|
|
269
266
|
}
|
|
270
267
|
}
|
|
271
|
-
exports.TaskClient = TaskClient;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import type { TaskList } from '../models.js';
|
|
4
|
+
import type { PaginatedIterator, PaginationOptions } from '../utils.js';
|
|
5
|
+
import type { Task, TaskUpdateData } from './task.js';
|
|
6
|
+
export type { TaskList } from '../models.js';
|
|
5
7
|
/**
|
|
6
8
|
* Client for managing the collection of Actor tasks in your account.
|
|
7
9
|
*
|
|
@@ -64,7 +66,6 @@ export declare class TaskCollectionClient extends ResourceCollectionClient {
|
|
|
64
66
|
export interface TaskCollectionListOptions extends PaginationOptions {
|
|
65
67
|
desc?: boolean;
|
|
66
68
|
}
|
|
67
|
-
export type TaskList = Omit<Task, 'options' | 'input'>;
|
|
68
69
|
/**
|
|
69
70
|
* @since Added in 2.3.0
|
|
70
71
|
*/
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const listOptionsSchema = zod_1.z.strictObject({
|
|
8
|
-
...utils_1.paginationOptionsShape,
|
|
9
|
-
desc: zod_1.z.boolean().optional(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
|
|
4
|
+
const listOptionsSchema = z.strictObject({
|
|
5
|
+
...paginationOptionsShape,
|
|
6
|
+
desc: z.boolean().optional(),
|
|
10
7
|
});
|
|
11
8
|
/**
|
|
12
9
|
* Client for managing the collection of Actor tasks in your account.
|
|
@@ -32,7 +29,7 @@ const listOptionsSchema = zod_1.z.strictObject({
|
|
|
32
29
|
*
|
|
33
30
|
* @see https://docs.apify.com/platform/actors/running/tasks
|
|
34
31
|
*/
|
|
35
|
-
class TaskCollectionClient extends
|
|
32
|
+
export class TaskCollectionClient extends ResourceCollectionClient {
|
|
36
33
|
/**
|
|
37
34
|
* @hidden
|
|
38
35
|
*/
|
|
@@ -63,7 +60,7 @@ class TaskCollectionClient extends resource_collection_client_1.ResourceCollecti
|
|
|
63
60
|
* @see https://docs.apify.com/api/v2/actor-tasks-get
|
|
64
61
|
*/
|
|
65
62
|
list(options = {}) {
|
|
66
|
-
const parsed =
|
|
63
|
+
const parsed = parseArgument(options, listOptionsSchema, 'TaskCollectionListOptions');
|
|
67
64
|
return this._listPaginated(parsed);
|
|
68
65
|
}
|
|
69
66
|
/**
|
|
@@ -74,8 +71,7 @@ class TaskCollectionClient extends resource_collection_client_1.ResourceCollecti
|
|
|
74
71
|
* @see https://docs.apify.com/api/v2/actor-tasks-post
|
|
75
72
|
*/
|
|
76
73
|
async create(task) {
|
|
77
|
-
|
|
74
|
+
parseArgument(task, anyObjectSchema);
|
|
78
75
|
return this._create(task);
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
|
-
exports.TaskCollectionClient = TaskCollectionClient;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceClient } from '../base/resource_client';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { AccountAndUsageLimits, MonthlyUsage, User } from '../models.js';
|
|
4
|
+
export type { AccountAndUsageLimits, Current, DailyServiceUsage, EffectivePlatformFeature, EffectivePlatformFeatures, Limits, MonthlyUsage, MonthlyUsageCycle, PriceTier, ProxyGroup, ServiceUsage, UsageCycle, UsageItem, User, UserPlan, UserProfile, UserProxy, } from '../models.js';
|
|
5
|
+
export { PlatformFeature } from '../models.js';
|
|
3
6
|
/**
|
|
4
7
|
* Client for managing user account information.
|
|
5
8
|
*
|
|
@@ -64,169 +67,6 @@ export declare class UserClient extends ResourceClient {
|
|
|
64
67
|
*/
|
|
65
68
|
updateLimits(options: LimitsUpdateOptions): Promise<void>;
|
|
66
69
|
}
|
|
67
|
-
export interface User {
|
|
68
|
-
username: string;
|
|
69
|
-
profile: {
|
|
70
|
-
bio?: string;
|
|
71
|
-
name?: string;
|
|
72
|
-
pictureUrl?: string;
|
|
73
|
-
githubUsername?: string;
|
|
74
|
-
websiteUrl?: string;
|
|
75
|
-
twitterUsername?: string;
|
|
76
|
-
};
|
|
77
|
-
id?: string;
|
|
78
|
-
email?: string;
|
|
79
|
-
proxy?: UserProxy;
|
|
80
|
-
plan?: UserPlan;
|
|
81
|
-
/**
|
|
82
|
-
* @since Added in 2.12.5
|
|
83
|
-
*/
|
|
84
|
-
effectivePlatformFeatures?: EffectivePlatformFeatures;
|
|
85
|
-
/**
|
|
86
|
-
* @since Added in 2.12.5
|
|
87
|
-
*/
|
|
88
|
-
createdAt?: Date;
|
|
89
|
-
/**
|
|
90
|
-
* @since Added in 2.12.5
|
|
91
|
-
*/
|
|
92
|
-
isPaying?: boolean;
|
|
93
|
-
}
|
|
94
|
-
export interface UserProxy {
|
|
95
|
-
password: string;
|
|
96
|
-
groups: ProxyGroup[];
|
|
97
|
-
}
|
|
98
|
-
export interface ProxyGroup {
|
|
99
|
-
name: string;
|
|
100
|
-
description: string;
|
|
101
|
-
availableCount: number;
|
|
102
|
-
}
|
|
103
|
-
export interface UserPlan {
|
|
104
|
-
id: string;
|
|
105
|
-
description: string;
|
|
106
|
-
isEnabled: boolean;
|
|
107
|
-
monthlyBasePriceUsd: number;
|
|
108
|
-
monthlyUsageCreditsUsd: number;
|
|
109
|
-
usageDiscountPercent: number;
|
|
110
|
-
enabledPlatformFeatures: PlatformFeature[];
|
|
111
|
-
maxMonthlyUsageUsd: number;
|
|
112
|
-
maxActorMemoryGbytes: number;
|
|
113
|
-
maxMonthlyActorComputeUnits: number;
|
|
114
|
-
maxMonthlyResidentialProxyGbytes: number;
|
|
115
|
-
maxMonthlyProxySerps: number;
|
|
116
|
-
maxMonthlyExternalDataTransferGbytes: number;
|
|
117
|
-
maxActorCount: number;
|
|
118
|
-
maxActorTaskCount: number;
|
|
119
|
-
dataRetentionDays: number;
|
|
120
|
-
availableProxyGroups: Record<string, number>;
|
|
121
|
-
teamAccountSeatCount: number;
|
|
122
|
-
supportLevel: string;
|
|
123
|
-
availableAddOns: unknown[];
|
|
124
|
-
}
|
|
125
|
-
export declare enum PlatformFeature {
|
|
126
|
-
Actors = "ACTORS",
|
|
127
|
-
Storage = "STORAGE",
|
|
128
|
-
ProxySERPS = "PROXY_SERPS",
|
|
129
|
-
Scheduler = "SCHEDULER",
|
|
130
|
-
Webhooks = "WEBHOOKS",
|
|
131
|
-
Proxy = "PROXY",
|
|
132
|
-
ProxyExternalAccess = "PROXY_EXTERNAL_ACCESS"
|
|
133
|
-
}
|
|
134
|
-
interface EffectivePlatformFeature {
|
|
135
|
-
isEnabled: boolean;
|
|
136
|
-
disabledReason: string | null;
|
|
137
|
-
disabledReasonType: string | null;
|
|
138
|
-
isTrial: boolean;
|
|
139
|
-
trialExpirationAt: Date | null;
|
|
140
|
-
}
|
|
141
|
-
interface EffectivePlatformFeatures {
|
|
142
|
-
ACTORS: EffectivePlatformFeature;
|
|
143
|
-
STORAGE: EffectivePlatformFeature;
|
|
144
|
-
SCHEDULER: EffectivePlatformFeature;
|
|
145
|
-
PROXY: EffectivePlatformFeature;
|
|
146
|
-
PROXY_EXTERNAL_ACCESS: EffectivePlatformFeature;
|
|
147
|
-
PROXY_RESIDENTIAL: EffectivePlatformFeature;
|
|
148
|
-
PROXY_SERPS: EffectivePlatformFeature;
|
|
149
|
-
WEBHOOKS: EffectivePlatformFeature;
|
|
150
|
-
ACTORS_PUBLIC_ALL: EffectivePlatformFeature;
|
|
151
|
-
ACTORS_PUBLIC_DEVELOPER: EffectivePlatformFeature;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* @since Added in 2.9.2
|
|
155
|
-
*/
|
|
156
|
-
export interface MonthlyUsage {
|
|
157
|
-
usageCycle: UsageCycle;
|
|
158
|
-
monthlyServiceUsage: {
|
|
159
|
-
[key: string]: MonthlyServiceUsageData;
|
|
160
|
-
};
|
|
161
|
-
dailyServiceUsages: DailyServiceUsage[];
|
|
162
|
-
totalUsageCreditsUsdBeforeVolumeDiscount: number;
|
|
163
|
-
totalUsageCreditsUsdAfterVolumeDiscount: number;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* @since Added in 2.9.2
|
|
167
|
-
*/
|
|
168
|
-
export interface UsageCycle {
|
|
169
|
-
startAt: Date;
|
|
170
|
-
endAt: Date;
|
|
171
|
-
}
|
|
172
|
-
/** Monthly usage of a single service */
|
|
173
|
-
interface MonthlyServiceUsageData {
|
|
174
|
-
quantity: number;
|
|
175
|
-
baseAmountUsd: number;
|
|
176
|
-
baseUnitPriceUsd: number;
|
|
177
|
-
amountAfterVolumeDiscountUsd: number;
|
|
178
|
-
priceTiers: PriceTier[];
|
|
179
|
-
}
|
|
180
|
-
interface PriceTier {
|
|
181
|
-
quantityAbove: number;
|
|
182
|
-
discountPercent: number;
|
|
183
|
-
tierQuantity: number;
|
|
184
|
-
unitPriceUsd: number;
|
|
185
|
-
priceUsd: number;
|
|
186
|
-
}
|
|
187
|
-
interface DailyServiceUsage {
|
|
188
|
-
date: Date;
|
|
189
|
-
serviceUsage: {
|
|
190
|
-
[key: string]: DailyServiceUsageData;
|
|
191
|
-
};
|
|
192
|
-
totalUsageCreditsUsd: number;
|
|
193
|
-
}
|
|
194
|
-
/** Daily usage of a single service */
|
|
195
|
-
interface DailyServiceUsageData {
|
|
196
|
-
quantity: number;
|
|
197
|
-
baseAmountUsd: number;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* @since Added in 2.9.2
|
|
201
|
-
*/
|
|
202
|
-
export interface AccountAndUsageLimits {
|
|
203
|
-
monthlyUsageCycle: MonthlyUsageCycle;
|
|
204
|
-
limits: Limits;
|
|
205
|
-
current: Current;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @since Added in 2.9.2
|
|
209
|
-
*/
|
|
210
|
-
export interface MonthlyUsageCycle {
|
|
211
|
-
startAt: Date;
|
|
212
|
-
endAt: Date;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* @since Added in 2.9.2
|
|
216
|
-
*/
|
|
217
|
-
export interface Limits {
|
|
218
|
-
maxMonthlyUsageUsd: number;
|
|
219
|
-
maxMonthlyActorComputeUnits: number;
|
|
220
|
-
maxMonthlyExternalDataTransferGbytes: number;
|
|
221
|
-
maxMonthlyProxySerps: number;
|
|
222
|
-
maxMonthlyResidentialProxyGbytes: number;
|
|
223
|
-
maxActorMemoryGbytes: number;
|
|
224
|
-
maxActorCount: number;
|
|
225
|
-
maxActorTaskCount: number;
|
|
226
|
-
maxConcurrentActorJobs: number;
|
|
227
|
-
maxTeamAccountSeatCount: number;
|
|
228
|
-
dataRetentionDays: number;
|
|
229
|
-
}
|
|
230
70
|
/**
|
|
231
71
|
* @since Added in 2.10.0
|
|
232
72
|
*/
|
|
@@ -235,19 +75,3 @@ export type LimitsUpdateOptions = {
|
|
|
235
75
|
} | {
|
|
236
76
|
dataRetentionDays: number;
|
|
237
77
|
};
|
|
238
|
-
/**
|
|
239
|
-
* @since Added in 2.9.2
|
|
240
|
-
*/
|
|
241
|
-
export interface Current {
|
|
242
|
-
monthlyUsageUsd: number;
|
|
243
|
-
monthlyActorComputeUnits: number;
|
|
244
|
-
monthlyExternalDataTransferGbytes: number;
|
|
245
|
-
monthlyProxySerps: number;
|
|
246
|
-
monthlyResidentialProxyGbytes: number;
|
|
247
|
-
actorMemoryGbytes: number;
|
|
248
|
-
actorCount: number;
|
|
249
|
-
actorTaskCount: number;
|
|
250
|
-
activeActorJobCount: number;
|
|
251
|
-
teamAccountSeatCount: number;
|
|
252
|
-
}
|
|
253
|
-
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const resource_client_1 = require("../base/resource_client");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
2
|
+
import { cast, catchNotFoundOrThrow, parseDateFields, pluckData } from '../utils.js';
|
|
3
|
+
export { PlatformFeature } from '../models.js';
|
|
6
4
|
/**
|
|
7
5
|
* Client for managing user account information.
|
|
8
6
|
*
|
|
@@ -27,7 +25,7 @@ const utils_1 = require("../utils");
|
|
|
27
25
|
*
|
|
28
26
|
* @see https://docs.apify.com/platform/actors/running
|
|
29
27
|
*/
|
|
30
|
-
class UserClient extends
|
|
28
|
+
export class UserClient extends ResourceClient {
|
|
31
29
|
/**
|
|
32
30
|
* @hidden
|
|
33
31
|
*/
|
|
@@ -64,12 +62,12 @@ class UserClient extends resource_client_1.ResourceClient {
|
|
|
64
62
|
};
|
|
65
63
|
try {
|
|
66
64
|
const response = await this.httpClient.call(requestOpts);
|
|
67
|
-
return
|
|
65
|
+
return cast(parseDateFields(pluckData(response.data),
|
|
68
66
|
// Convert monthlyUsage.dailyServiceUsages[].date to Date (by default it's ignored by parseDateFields)
|
|
69
67
|
/* shouldParseField = */ (key) => key === 'date'));
|
|
70
68
|
}
|
|
71
69
|
catch (err) {
|
|
72
|
-
|
|
70
|
+
catchNotFoundOrThrow(err);
|
|
73
71
|
}
|
|
74
72
|
return undefined;
|
|
75
73
|
}
|
|
@@ -88,10 +86,10 @@ class UserClient extends resource_client_1.ResourceClient {
|
|
|
88
86
|
};
|
|
89
87
|
try {
|
|
90
88
|
const response = await this.httpClient.call(requestOpts);
|
|
91
|
-
return
|
|
89
|
+
return cast(parseDateFields(pluckData(response.data)));
|
|
92
90
|
}
|
|
93
91
|
catch (err) {
|
|
94
|
-
|
|
92
|
+
catchNotFoundOrThrow(err);
|
|
95
93
|
}
|
|
96
94
|
return undefined;
|
|
97
95
|
}
|
|
@@ -112,14 +110,3 @@ class UserClient extends resource_client_1.ResourceClient {
|
|
|
112
110
|
await this.httpClient.call(requestOpts);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
exports.UserClient = UserClient;
|
|
116
|
-
var PlatformFeature;
|
|
117
|
-
(function (PlatformFeature) {
|
|
118
|
-
PlatformFeature["Actors"] = "ACTORS";
|
|
119
|
-
PlatformFeature["Storage"] = "STORAGE";
|
|
120
|
-
PlatformFeature["ProxySERPS"] = "PROXY_SERPS";
|
|
121
|
-
PlatformFeature["Scheduler"] = "SCHEDULER";
|
|
122
|
-
PlatformFeature["Webhooks"] = "WEBHOOKS";
|
|
123
|
-
PlatformFeature["Proxy"] = "PROXY";
|
|
124
|
-
PlatformFeature["ProxyExternalAccess"] = "PROXY_EXTERNAL_ACCESS";
|
|
125
|
-
})(PlatformFeature || (exports.PlatformFeature = PlatformFeature = {}));
|