@nimble-way/nimble-js 0.8.0 → 0.10.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/CHANGELOG.md +27 -0
- package/client.d.mts +4 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -1
- package/client.d.ts.map +1 -1
- package/client.js +4 -1
- package/client.js.map +1 -1
- package/client.mjs +4 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/batches.d.mts +140 -0
- package/resources/batches.d.mts.map +1 -0
- package/resources/batches.d.ts +140 -0
- package/resources/batches.d.ts.map +1 -0
- package/resources/batches.js +33 -0
- package/resources/batches.js.map +1 -0
- package/resources/batches.mjs +29 -0
- package/resources/batches.mjs.map +1 -0
- package/resources/crawl.d.mts +1 -1
- package/resources/crawl.d.mts.map +1 -1
- package/resources/crawl.d.ts +1 -1
- package/resources/crawl.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/top-level.d.mts +201 -22
- package/resources/top-level.d.mts.map +1 -1
- package/resources/top-level.d.ts +201 -22
- package/resources/top-level.d.ts.map +1 -1
- package/src/client.ts +10 -1
- package/src/resources/batches.ts +185 -0
- package/src/resources/crawl.ts +1 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/top-level.ts +1130 -31
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/src/client.ts
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
AgentRunParams,
|
|
41
41
|
AgentRunResponse,
|
|
42
42
|
} from './resources/agent';
|
|
43
|
+
import { BatchGetResponse, BatchProgressResponse, Batches } from './resources/batches';
|
|
43
44
|
import {
|
|
44
45
|
Crawl,
|
|
45
46
|
CrawlListParams,
|
|
@@ -267,7 +268,7 @@ export class Nimble {
|
|
|
267
268
|
* @example
|
|
268
269
|
* ```ts
|
|
269
270
|
* const response = await client.extractBatch({
|
|
270
|
-
*
|
|
271
|
+
* inputs: [{}],
|
|
271
272
|
* });
|
|
272
273
|
* ```
|
|
273
274
|
*/
|
|
@@ -836,11 +837,13 @@ export class Nimble {
|
|
|
836
837
|
agent: API.Agent = new API.Agent(this);
|
|
837
838
|
crawl: API.Crawl = new API.Crawl(this);
|
|
838
839
|
tasks: API.Tasks = new API.Tasks(this);
|
|
840
|
+
batches: API.Batches = new API.Batches(this);
|
|
839
841
|
}
|
|
840
842
|
|
|
841
843
|
Nimble.Agent = Agent;
|
|
842
844
|
Nimble.Crawl = Crawl;
|
|
843
845
|
Nimble.Tasks = Tasks;
|
|
846
|
+
Nimble.Batches = Batches;
|
|
844
847
|
|
|
845
848
|
export declare namespace Nimble {
|
|
846
849
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -887,6 +890,12 @@ export declare namespace Nimble {
|
|
|
887
890
|
type TaskListParams as TaskListParams,
|
|
888
891
|
};
|
|
889
892
|
|
|
893
|
+
export {
|
|
894
|
+
Batches as Batches,
|
|
895
|
+
type BatchGetResponse as BatchGetResponse,
|
|
896
|
+
type BatchProgressResponse as BatchProgressResponse,
|
|
897
|
+
};
|
|
898
|
+
|
|
890
899
|
export type AutoScrollAction = API.AutoScrollAction;
|
|
891
900
|
export type ClickAction = API.ClickAction;
|
|
892
901
|
export type EvalAction = API.EvalAction;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Batches extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve a paginated list of batches for the authenticated account.
|
|
12
|
+
*/
|
|
13
|
+
list(options?: RequestOptions): APIPromise<void> {
|
|
14
|
+
return this._client.get('/v1/batches', {
|
|
15
|
+
...options,
|
|
16
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve the details of a batch including all its tasks and completion status.
|
|
22
|
+
*/
|
|
23
|
+
get(batchID: string, options?: RequestOptions): APIPromise<BatchGetResponse> {
|
|
24
|
+
return this._client.get(path`/v1/batches/${batchID}`, options);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve lightweight progress information for a batch without fetching all task
|
|
29
|
+
* details.
|
|
30
|
+
*/
|
|
31
|
+
progress(batchID: string, options?: RequestOptions): APIPromise<BatchProgressResponse> {
|
|
32
|
+
return this._client.get(path`/v1/batches/${batchID}/progress`, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Response containing batch details with all tasks.
|
|
38
|
+
*/
|
|
39
|
+
export interface BatchGetResponse {
|
|
40
|
+
/**
|
|
41
|
+
* Unique identifier for the batch.
|
|
42
|
+
*/
|
|
43
|
+
id: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether all tasks in the batch have finished.
|
|
47
|
+
*/
|
|
48
|
+
completed: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Number of tasks that have completed so far.
|
|
52
|
+
*/
|
|
53
|
+
completed_count: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* ISO timestamp when the batch was created.
|
|
57
|
+
*/
|
|
58
|
+
created_at: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Completion ratio between 0 and 1.
|
|
62
|
+
*/
|
|
63
|
+
progress: number;
|
|
64
|
+
|
|
65
|
+
status: 'success';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* List of tasks in the batch.
|
|
69
|
+
*/
|
|
70
|
+
tasks: Array<BatchGetResponse.Task | null>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* ISO timestamp when the batch completed.
|
|
74
|
+
*/
|
|
75
|
+
completed_at?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export namespace BatchGetResponse {
|
|
79
|
+
export interface Task {
|
|
80
|
+
/**
|
|
81
|
+
* Unique task identifier.
|
|
82
|
+
*/
|
|
83
|
+
id: string;
|
|
84
|
+
|
|
85
|
+
_query: unknown;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Timestamp when the task was created.
|
|
89
|
+
*/
|
|
90
|
+
created_at: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Original input data for the task.
|
|
94
|
+
*/
|
|
95
|
+
input: unknown;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Current state of the task.
|
|
99
|
+
*/
|
|
100
|
+
state: 'pending' | 'success' | 'error';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* URL for checking the task status.
|
|
104
|
+
*/
|
|
105
|
+
status_url: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Account name that owns the task.
|
|
109
|
+
*/
|
|
110
|
+
account_name?: string;
|
|
111
|
+
|
|
112
|
+
api_type?: 'web' | 'serp' | 'ecommerce' | 'social' | 'media' | 'agent' | 'extract';
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Batch ID if this task is part of a batch.
|
|
116
|
+
*/
|
|
117
|
+
batch_id?: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* URL for downloading the task results.
|
|
121
|
+
*/
|
|
122
|
+
download_url?: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Error message if the task failed.
|
|
126
|
+
*/
|
|
127
|
+
error?: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Classification of the error type.
|
|
131
|
+
*/
|
|
132
|
+
error_type?: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Timestamp when the task was last modified.
|
|
136
|
+
*/
|
|
137
|
+
modified_at?: string;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Storage location of the output data.
|
|
141
|
+
*/
|
|
142
|
+
output_url?: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* HTTP status code from the task execution.
|
|
146
|
+
*/
|
|
147
|
+
status_code?: number;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Lightweight batch progress without task details.
|
|
153
|
+
*/
|
|
154
|
+
export interface BatchProgressResponse {
|
|
155
|
+
/**
|
|
156
|
+
* Unique identifier for the batch.
|
|
157
|
+
*/
|
|
158
|
+
id: string;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Whether all tasks in the batch have finished.
|
|
162
|
+
*/
|
|
163
|
+
completed: boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Number of tasks that have completed so far.
|
|
167
|
+
*/
|
|
168
|
+
completed_count: number;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Completion ratio between 0 and 1.
|
|
172
|
+
*/
|
|
173
|
+
progress: number;
|
|
174
|
+
|
|
175
|
+
status: 'success';
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* ISO timestamp when the batch completed.
|
|
179
|
+
*/
|
|
180
|
+
completed_at?: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export declare namespace Batches {
|
|
184
|
+
export { type BatchGetResponse as BatchGetResponse, type BatchProgressResponse as BatchProgressResponse };
|
|
185
|
+
}
|
package/src/resources/crawl.ts
CHANGED
|
@@ -718,7 +718,7 @@ export namespace CrawlRunParams {
|
|
|
718
718
|
/**
|
|
719
719
|
* List of acceptable response formats in order of preference
|
|
720
720
|
*/
|
|
721
|
-
formats?: Array<'html' | 'markdown' | 'screenshot'>;
|
|
721
|
+
formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
|
|
722
722
|
|
|
723
723
|
/**
|
|
724
724
|
* Custom HTTP headers to include in the request
|