@arcadeai/arcadejs 0.2.2 → 1.0.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 +39 -0
- package/README.md +3 -4
- package/core.d.ts.map +1 -1
- package/core.js +10 -1
- package/core.js.map +1 -1
- package/core.mjs +10 -1
- package/core.mjs.map +1 -1
- package/index.d.mts +9 -8
- package/index.d.ts +9 -8
- package/index.d.ts.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/index.mjs +4 -4
- package/index.mjs.map +1 -1
- package/package.json +2 -2
- package/resources/auth.d.ts +71 -7
- package/resources/auth.d.ts.map +1 -1
- package/resources/auth.js +81 -1
- package/resources/auth.js.map +1 -1
- package/resources/auth.mjs +79 -0
- package/resources/auth.mjs.map +1 -1
- package/resources/chat/chat.d.ts +4 -1
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.ts +4 -1
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.ts +7 -9
- package/resources/shared.d.ts.map +1 -1
- package/resources/tools/formatted.d.ts +2 -5
- package/resources/tools/formatted.d.ts.map +1 -1
- package/resources/tools/formatted.js +6 -6
- package/resources/tools/formatted.js.map +1 -1
- package/resources/tools/formatted.mjs +6 -6
- package/resources/tools/formatted.mjs.map +1 -1
- package/resources/tools/index.d.ts +2 -2
- package/resources/tools/index.d.ts.map +1 -1
- package/resources/tools/index.js +3 -2
- package/resources/tools/index.js.map +1 -1
- package/resources/tools/index.mjs +1 -1
- package/resources/tools/index.mjs.map +1 -1
- package/resources/tools/scheduled.d.ts +15 -33
- package/resources/tools/scheduled.d.ts.map +1 -1
- package/resources/tools/scheduled.js +11 -8
- package/resources/tools/scheduled.js.map +1 -1
- package/resources/tools/scheduled.mjs +10 -7
- package/resources/tools/scheduled.mjs.map +1 -1
- package/resources/tools/tools.d.ts +86 -186
- package/resources/tools/tools.d.ts.map +1 -1
- package/resources/tools/tools.js +10 -7
- package/resources/tools/tools.js.map +1 -1
- package/resources/tools/tools.mjs +7 -5
- package/resources/tools/tools.mjs.map +1 -1
- package/src/core.ts +11 -1
- package/src/index.ts +15 -18
- package/src/resources/auth.ts +125 -6
- package/src/resources/chat/chat.ts +5 -1
- package/src/resources/chat/completions.ts +5 -1
- package/src/resources/index.ts +4 -5
- package/src/resources/shared.ts +10 -12
- package/src/resources/tools/formatted.ts +12 -8
- package/src/resources/tools/index.ts +5 -6
- package/src/resources/tools/scheduled.ts +30 -46
- package/src/resources/tools/tools.ts +100 -238
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/index.ts
CHANGED
|
@@ -14,17 +14,15 @@ import {
|
|
|
14
14
|
AuthorizeToolRequest,
|
|
15
15
|
ExecuteToolRequest,
|
|
16
16
|
ExecuteToolResponse,
|
|
17
|
-
ResponseOutput,
|
|
18
17
|
ToolAuthorizeParams,
|
|
18
|
+
ToolDefinition,
|
|
19
|
+
ToolDefinitionsOffsetPage,
|
|
19
20
|
ToolExecuteParams,
|
|
20
21
|
ToolExecution,
|
|
21
22
|
ToolExecutionAttempt,
|
|
22
|
-
ToolGetParams,
|
|
23
|
-
ToolGetResponse,
|
|
24
23
|
ToolListParams,
|
|
25
|
-
ToolListResponse,
|
|
26
|
-
ToolListResponsesOffsetPage,
|
|
27
24
|
Tools,
|
|
25
|
+
ValueSchema,
|
|
28
26
|
} from './resources/tools/tools';
|
|
29
27
|
|
|
30
28
|
export interface ClientOptions {
|
|
@@ -47,7 +45,7 @@ export interface ClientOptions {
|
|
|
47
45
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
48
46
|
* much longer than this timeout before the promise succeeds or fails.
|
|
49
47
|
*/
|
|
50
|
-
timeout?: number;
|
|
48
|
+
timeout?: number | undefined;
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* An HTTP agent used to manage HTTP(S) connections.
|
|
@@ -55,7 +53,7 @@ export interface ClientOptions {
|
|
|
55
53
|
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
56
54
|
* otherwise no agent is used.
|
|
57
55
|
*/
|
|
58
|
-
httpAgent?: Agent;
|
|
56
|
+
httpAgent?: Agent | undefined;
|
|
59
57
|
|
|
60
58
|
/**
|
|
61
59
|
* Specify a custom `fetch` function implementation.
|
|
@@ -71,7 +69,7 @@ export interface ClientOptions {
|
|
|
71
69
|
*
|
|
72
70
|
* @default 2
|
|
73
71
|
*/
|
|
74
|
-
maxRetries?: number;
|
|
72
|
+
maxRetries?: number | undefined;
|
|
75
73
|
|
|
76
74
|
/**
|
|
77
75
|
* Default headers to include with every request to the API.
|
|
@@ -79,7 +77,7 @@ export interface ClientOptions {
|
|
|
79
77
|
* These can be removed in individual requests by explicitly setting the
|
|
80
78
|
* header to `undefined` or `null` in request options.
|
|
81
79
|
*/
|
|
82
|
-
defaultHeaders?: Core.Headers;
|
|
80
|
+
defaultHeaders?: Core.Headers | undefined;
|
|
83
81
|
|
|
84
82
|
/**
|
|
85
83
|
* Default query parameters to include with every request to the API.
|
|
@@ -87,7 +85,7 @@ export interface ClientOptions {
|
|
|
87
85
|
* These can be removed in individual requests by explicitly setting the
|
|
88
86
|
* param to `undefined` in request options.
|
|
89
87
|
*/
|
|
90
|
-
defaultQuery?: Core.DefaultQuery;
|
|
88
|
+
defaultQuery?: Core.DefaultQuery | undefined;
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
/**
|
|
@@ -102,7 +100,7 @@ export class Arcade extends Core.APIClient {
|
|
|
102
100
|
* API Client for interfacing with the Arcade API.
|
|
103
101
|
*
|
|
104
102
|
* @param {string | undefined} [opts.apiKey=process.env['ARCADE_API_KEY'] ?? undefined]
|
|
105
|
-
* @param {string} [opts.baseURL=process.env['ARCADE_BASE_URL'] ?? https://api.arcade
|
|
103
|
+
* @param {string} [opts.baseURL=process.env['ARCADE_BASE_URL'] ?? https://api.arcade.dev] - Override the default base URL for the API.
|
|
106
104
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
107
105
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
108
106
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -124,7 +122,7 @@ export class Arcade extends Core.APIClient {
|
|
|
124
122
|
const options: ClientOptions = {
|
|
125
123
|
apiKey,
|
|
126
124
|
...opts,
|
|
127
|
-
baseURL: baseURL || `https://api.arcade
|
|
125
|
+
baseURL: baseURL || `https://api.arcade.dev`,
|
|
128
126
|
};
|
|
129
127
|
|
|
130
128
|
super({
|
|
@@ -186,7 +184,7 @@ Arcade.Auth = Auth;
|
|
|
186
184
|
Arcade.Health = Health;
|
|
187
185
|
Arcade.Chat = Chat;
|
|
188
186
|
Arcade.Tools = Tools;
|
|
189
|
-
Arcade.
|
|
187
|
+
Arcade.ToolDefinitionsOffsetPage = ToolDefinitionsOffsetPage;
|
|
190
188
|
export declare namespace Arcade {
|
|
191
189
|
export type RequestOptions = Core.RequestOptions;
|
|
192
190
|
|
|
@@ -216,18 +214,17 @@ export declare namespace Arcade {
|
|
|
216
214
|
type AuthorizeToolRequest as AuthorizeToolRequest,
|
|
217
215
|
type ExecuteToolRequest as ExecuteToolRequest,
|
|
218
216
|
type ExecuteToolResponse as ExecuteToolResponse,
|
|
219
|
-
type
|
|
217
|
+
type ToolDefinition as ToolDefinition,
|
|
220
218
|
type ToolExecution as ToolExecution,
|
|
221
219
|
type ToolExecutionAttempt as ToolExecutionAttempt,
|
|
222
|
-
type
|
|
223
|
-
|
|
224
|
-
ToolListResponsesOffsetPage as ToolListResponsesOffsetPage,
|
|
220
|
+
type ValueSchema as ValueSchema,
|
|
221
|
+
ToolDefinitionsOffsetPage as ToolDefinitionsOffsetPage,
|
|
225
222
|
type ToolListParams as ToolListParams,
|
|
226
223
|
type ToolAuthorizeParams as ToolAuthorizeParams,
|
|
227
224
|
type ToolExecuteParams as ToolExecuteParams,
|
|
228
|
-
type ToolGetParams as ToolGetParams,
|
|
229
225
|
};
|
|
230
226
|
|
|
227
|
+
export type AuthorizationContext = API.AuthorizationContext;
|
|
231
228
|
export type AuthorizationResponse = API.AuthorizationResponse;
|
|
232
229
|
export type Error = API.Error;
|
|
233
230
|
}
|
package/src/resources/auth.ts
CHANGED
|
@@ -1,10 +1,57 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
|
-
import * as Core from '../core';
|
|
5
4
|
import * as Shared from './shared';
|
|
5
|
+
import * as Core from '../core';
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_LONGPOLL_WAIT_TIME = 45;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when authorization-related operations fail
|
|
11
|
+
*/
|
|
12
|
+
export class AuthorizationError extends Error {
|
|
13
|
+
constructor(message: string) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'AuthorizationError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
|
|
7
19
|
export class Auth extends APIResource {
|
|
20
|
+
/**
|
|
21
|
+
* Starts the authorization process for a given provider and scopes.
|
|
22
|
+
* @param userId - The user ID for which authorization is being requested
|
|
23
|
+
* @param provider - The authorization provider (e.g., 'github', 'google', 'linkedin', 'microsoft', 'slack', 'spotify', 'x', 'zoom')
|
|
24
|
+
* @param options - Optional parameters
|
|
25
|
+
* @param options.providerType - The type of authorization provider. Defaults to 'oauth2'
|
|
26
|
+
* @param options.scopes - A list of scopes required for authorization, if any. Defaults to []
|
|
27
|
+
* @returns The authorization response
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* ```ts
|
|
31
|
+
* const authResponse = await client.auth.start("user@example.com", "github");
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
start(
|
|
35
|
+
userId: string,
|
|
36
|
+
provider: string,
|
|
37
|
+
options: AuthStartOptions = {},
|
|
38
|
+
): Core.APIPromise<Shared.AuthorizationResponse> {
|
|
39
|
+
const { providerType = 'oauth2', scopes = [] } = options;
|
|
40
|
+
|
|
41
|
+
const authRequirement: AuthAuthorizeParams.AuthRequirement = {
|
|
42
|
+
provider_id: provider,
|
|
43
|
+
provider_type: providerType,
|
|
44
|
+
oauth2: {
|
|
45
|
+
scopes,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return this.authorize({
|
|
50
|
+
auth_requirement: authRequirement,
|
|
51
|
+
user_id: userId,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
8
55
|
/**
|
|
9
56
|
* Starts the authorization process for given authorization requirements
|
|
10
57
|
*/
|
|
@@ -26,6 +73,52 @@ export class Auth extends APIResource {
|
|
|
26
73
|
): Core.APIPromise<Shared.AuthorizationResponse> {
|
|
27
74
|
return this._client.get('/v1/auth/status', { query, ...options });
|
|
28
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Waits for the authorization process to complete.
|
|
79
|
+
* @param authResponseOrId - The authorization response or ID to wait for completion
|
|
80
|
+
* @returns The completed authorization response
|
|
81
|
+
* @throws {AuthorizationError} When the authorization ID is missing or invalid
|
|
82
|
+
*
|
|
83
|
+
* Example:
|
|
84
|
+
* ```ts
|
|
85
|
+
* const authResponse = await client.auth.start("user@example.com", "github");
|
|
86
|
+
* try {
|
|
87
|
+
* const completedAuth = await client.auth.waitForCompletion(authResponse);
|
|
88
|
+
* console.log('Authorization completed:', completedAuth);
|
|
89
|
+
* } catch (error) {
|
|
90
|
+
* if (error instanceof AuthorizationError) {
|
|
91
|
+
* console.error('Authorization failed:', error.message);
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
async waitForCompletion(
|
|
97
|
+
authResponseOrId: Shared.AuthorizationResponse | string,
|
|
98
|
+
): Promise<Shared.AuthorizationResponse> {
|
|
99
|
+
let authId: string;
|
|
100
|
+
let authResponse: Shared.AuthorizationResponse;
|
|
101
|
+
|
|
102
|
+
if (typeof authResponseOrId === 'string') {
|
|
103
|
+
authId = authResponseOrId;
|
|
104
|
+
authResponse = { status: 'pending' } as Shared.AuthorizationResponse;
|
|
105
|
+
} else {
|
|
106
|
+
if (!authResponseOrId.id) {
|
|
107
|
+
throw new AuthorizationError('Authorization ID is required');
|
|
108
|
+
}
|
|
109
|
+
authId = authResponseOrId.id;
|
|
110
|
+
authResponse = authResponseOrId;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
while (authResponse.status !== 'completed') {
|
|
114
|
+
authResponse = await this.status({
|
|
115
|
+
id: authId,
|
|
116
|
+
wait: DEFAULT_LONGPOLL_WAIT_TIME,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return authResponse;
|
|
121
|
+
}
|
|
29
122
|
}
|
|
30
123
|
|
|
31
124
|
export interface AuthRequest {
|
|
@@ -36,8 +129,16 @@ export interface AuthRequest {
|
|
|
36
129
|
|
|
37
130
|
export namespace AuthRequest {
|
|
38
131
|
export interface AuthRequirement {
|
|
132
|
+
/**
|
|
133
|
+
* one of ID or ProviderID must be set
|
|
134
|
+
*/
|
|
135
|
+
id?: string;
|
|
136
|
+
|
|
39
137
|
oauth2?: AuthRequirement.Oauth2;
|
|
40
138
|
|
|
139
|
+
/**
|
|
140
|
+
* one of ID or ProviderID must be set
|
|
141
|
+
*/
|
|
41
142
|
provider_id?: string;
|
|
42
143
|
|
|
43
144
|
provider_type?: string;
|
|
@@ -58,8 +159,16 @@ export interface AuthAuthorizeParams {
|
|
|
58
159
|
|
|
59
160
|
export namespace AuthAuthorizeParams {
|
|
60
161
|
export interface AuthRequirement {
|
|
162
|
+
/**
|
|
163
|
+
* one of ID or ProviderID must be set
|
|
164
|
+
*/
|
|
165
|
+
id?: string;
|
|
166
|
+
|
|
61
167
|
oauth2?: AuthRequirement.Oauth2;
|
|
62
168
|
|
|
169
|
+
/**
|
|
170
|
+
* one of ID or ProviderID must be set
|
|
171
|
+
*/
|
|
63
172
|
provider_id?: string;
|
|
64
173
|
|
|
65
174
|
provider_type?: string;
|
|
@@ -76,17 +185,26 @@ export interface AuthStatusParams {
|
|
|
76
185
|
/**
|
|
77
186
|
* Authorization ID
|
|
78
187
|
*/
|
|
79
|
-
|
|
188
|
+
id: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Timeout in seconds (max 59)
|
|
192
|
+
*/
|
|
193
|
+
wait?: number;
|
|
194
|
+
}
|
|
80
195
|
|
|
196
|
+
export interface AuthStartOptions {
|
|
81
197
|
/**
|
|
82
|
-
*
|
|
198
|
+
* The type of authorization provider
|
|
199
|
+
* @default 'oauth2'
|
|
83
200
|
*/
|
|
84
|
-
|
|
201
|
+
providerType?: string;
|
|
85
202
|
|
|
86
203
|
/**
|
|
87
|
-
*
|
|
204
|
+
* A list of scopes required for authorization
|
|
205
|
+
* @default []
|
|
88
206
|
*/
|
|
89
|
-
|
|
207
|
+
scopes?: string[];
|
|
90
208
|
}
|
|
91
209
|
|
|
92
210
|
export declare namespace Auth {
|
|
@@ -94,5 +212,6 @@ export declare namespace Auth {
|
|
|
94
212
|
type AuthRequest as AuthRequest,
|
|
95
213
|
type AuthAuthorizeParams as AuthAuthorizeParams,
|
|
96
214
|
type AuthStatusParams as AuthStatusParams,
|
|
215
|
+
type AuthStartOptions as AuthStartOptions,
|
|
97
216
|
};
|
|
98
217
|
}
|
|
@@ -88,7 +88,7 @@ export interface ChatRequest {
|
|
|
88
88
|
|
|
89
89
|
presence_penalty?: number;
|
|
90
90
|
|
|
91
|
-
response_format?:
|
|
91
|
+
response_format?: ChatRequest.ResponseFormat;
|
|
92
92
|
|
|
93
93
|
seed?: number;
|
|
94
94
|
|
|
@@ -123,6 +123,10 @@ export interface ChatRequest {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export namespace ChatRequest {
|
|
126
|
+
export interface ResponseFormat {
|
|
127
|
+
type?: 'json_object' | 'text';
|
|
128
|
+
}
|
|
129
|
+
|
|
126
130
|
/**
|
|
127
131
|
* Options for streaming response. Only set this when you set stream: true.
|
|
128
132
|
*/
|
|
@@ -47,7 +47,7 @@ export interface CompletionCreateParams {
|
|
|
47
47
|
|
|
48
48
|
presence_penalty?: number;
|
|
49
49
|
|
|
50
|
-
response_format?:
|
|
50
|
+
response_format?: CompletionCreateParams.ResponseFormat;
|
|
51
51
|
|
|
52
52
|
seed?: number;
|
|
53
53
|
|
|
@@ -82,6 +82,10 @@ export interface CompletionCreateParams {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export namespace CompletionCreateParams {
|
|
85
|
+
export interface ResponseFormat {
|
|
86
|
+
type?: 'json_object' | 'text';
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
/**
|
|
86
90
|
* Options for streaming response. Only set this when you set stream: true.
|
|
87
91
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -12,18 +12,17 @@ export {
|
|
|
12
12
|
} from './chat/chat';
|
|
13
13
|
export { Health, type HealthSchema } from './health';
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
ToolExecutionsOffsetPage,
|
|
16
|
+
ToolDefinitionsOffsetPage,
|
|
16
17
|
Tools,
|
|
17
18
|
type AuthorizeToolRequest,
|
|
18
19
|
type ExecuteToolRequest,
|
|
19
20
|
type ExecuteToolResponse,
|
|
20
|
-
type
|
|
21
|
+
type ToolDefinition,
|
|
21
22
|
type ToolExecution,
|
|
22
23
|
type ToolExecutionAttempt,
|
|
23
|
-
type
|
|
24
|
-
type ToolGetResponse,
|
|
24
|
+
type ValueSchema,
|
|
25
25
|
type ToolListParams,
|
|
26
26
|
type ToolAuthorizeParams,
|
|
27
27
|
type ToolExecuteParams,
|
|
28
|
-
type ToolGetParams,
|
|
29
28
|
} from './tools/tools';
|
package/src/resources/shared.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
3
|
+
export interface AuthorizationContext {
|
|
4
|
+
token?: string;
|
|
5
|
+
|
|
6
|
+
user_info?: Record<string, unknown>;
|
|
7
|
+
}
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
export interface AuthorizationResponse {
|
|
10
|
+
id?: string;
|
|
7
11
|
|
|
8
|
-
context?:
|
|
12
|
+
context?: AuthorizationContext;
|
|
9
13
|
|
|
10
14
|
provider_id?: string;
|
|
11
15
|
|
|
@@ -13,15 +17,9 @@ export interface AuthorizationResponse {
|
|
|
13
17
|
|
|
14
18
|
status?: 'pending' | 'completed' | 'failed';
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
}
|
|
20
|
+
url?: string;
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
export interface Context {
|
|
21
|
-
token?: string;
|
|
22
|
-
|
|
23
|
-
user_info?: Record<string, unknown>;
|
|
24
|
-
}
|
|
22
|
+
user_id?: string;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export interface Error {
|
|
@@ -24,7 +24,7 @@ export class Formatted extends APIResource {
|
|
|
24
24
|
if (isRequestOptions(query)) {
|
|
25
25
|
return this.list({}, query);
|
|
26
26
|
}
|
|
27
|
-
return this._client.getAPIList('/v1/
|
|
27
|
+
return this._client.getAPIList('/v1/formatted_tools', FormattedListResponsesOffsetPage, {
|
|
28
28
|
query,
|
|
29
29
|
...options,
|
|
30
30
|
});
|
|
@@ -33,8 +33,17 @@ export class Formatted extends APIResource {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the formatted tool specification for a specific tool, given a provider
|
|
35
35
|
*/
|
|
36
|
-
get(
|
|
37
|
-
|
|
36
|
+
get(name: string, query?: FormattedGetParams, options?: Core.RequestOptions): Core.APIPromise<unknown>;
|
|
37
|
+
get(name: string, options?: Core.RequestOptions): Core.APIPromise<unknown>;
|
|
38
|
+
get(
|
|
39
|
+
name: string,
|
|
40
|
+
query: FormattedGetParams | Core.RequestOptions = {},
|
|
41
|
+
options?: Core.RequestOptions,
|
|
42
|
+
): Core.APIPromise<unknown> {
|
|
43
|
+
if (isRequestOptions(query)) {
|
|
44
|
+
return this.get(name, {}, query);
|
|
45
|
+
}
|
|
46
|
+
return this._client.get(`/v1/formatted_tools/${name}`, { query, ...options });
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -57,11 +66,6 @@ export interface FormattedListParams extends OffsetPageParams {
|
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export interface FormattedGetParams {
|
|
60
|
-
/**
|
|
61
|
-
* Tool ID
|
|
62
|
-
*/
|
|
63
|
-
toolId: string;
|
|
64
|
-
|
|
65
69
|
/**
|
|
66
70
|
* Provider format
|
|
67
71
|
*/
|
|
@@ -8,20 +8,19 @@ export {
|
|
|
8
8
|
type FormattedListParams,
|
|
9
9
|
type FormattedGetParams,
|
|
10
10
|
} from './formatted';
|
|
11
|
-
export { Scheduled, type
|
|
11
|
+
export { Scheduled, type ScheduledGetResponse, type ScheduledListParams } from './scheduled';
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
ToolExecutionsOffsetPage,
|
|
14
|
+
ToolDefinitionsOffsetPage,
|
|
14
15
|
Tools,
|
|
15
16
|
type AuthorizeToolRequest,
|
|
16
17
|
type ExecuteToolRequest,
|
|
17
18
|
type ExecuteToolResponse,
|
|
18
|
-
type
|
|
19
|
+
type ToolDefinition,
|
|
19
20
|
type ToolExecution,
|
|
20
21
|
type ToolExecutionAttempt,
|
|
21
|
-
type
|
|
22
|
-
type ToolGetResponse,
|
|
22
|
+
type ValueSchema,
|
|
23
23
|
type ToolListParams,
|
|
24
24
|
type ToolAuthorizeParams,
|
|
25
25
|
type ToolExecuteParams,
|
|
26
|
-
type ToolGetParams,
|
|
27
26
|
} from './tools';
|
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
|
+
import { isRequestOptions } from '../../core';
|
|
4
5
|
import * as Core from '../../core';
|
|
5
6
|
import * as ToolsAPI from './tools';
|
|
7
|
+
import { ToolExecutionsOffsetPage } from './tools';
|
|
8
|
+
import { type OffsetPageParams } from '../../pagination';
|
|
6
9
|
|
|
7
10
|
export class Scheduled extends APIResource {
|
|
8
11
|
/**
|
|
9
12
|
* Returns a page of scheduled tool executions
|
|
10
13
|
*/
|
|
11
|
-
list(
|
|
12
|
-
|
|
14
|
+
list(
|
|
15
|
+
query?: ScheduledListParams,
|
|
16
|
+
options?: Core.RequestOptions,
|
|
17
|
+
): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution>;
|
|
18
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution>;
|
|
19
|
+
list(
|
|
20
|
+
query: ScheduledListParams | Core.RequestOptions = {},
|
|
21
|
+
options?: Core.RequestOptions,
|
|
22
|
+
): Core.PagePromise<ToolExecutionsOffsetPage, ToolsAPI.ToolExecution> {
|
|
23
|
+
if (isRequestOptions(query)) {
|
|
24
|
+
return this.list({}, query);
|
|
25
|
+
}
|
|
26
|
+
return this._client.getAPIList('/v1/scheduled_tools', ToolExecutionsOffsetPage, { query, ...options });
|
|
13
27
|
}
|
|
14
28
|
|
|
15
29
|
/**
|
|
16
30
|
* Returns the details for a specific scheduled tool execution
|
|
17
31
|
*/
|
|
18
|
-
|
|
19
|
-
return this._client.get(`/v1/
|
|
32
|
+
get(id: string, options?: Core.RequestOptions): Core.APIPromise<ScheduledGetResponse> {
|
|
33
|
+
return this._client.get(`/v1/scheduled_tools/${id}`, options);
|
|
20
34
|
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
|
-
export interface
|
|
24
|
-
items?: Array<ToolsAPI.ToolExecution>;
|
|
25
|
-
|
|
26
|
-
limit?: number;
|
|
27
|
-
|
|
28
|
-
offset?: number;
|
|
29
|
-
|
|
30
|
-
page_count?: number;
|
|
31
|
-
|
|
32
|
-
total_count?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ScheduledDetailsResponse {
|
|
37
|
+
export interface ScheduledGetResponse {
|
|
36
38
|
id?: string;
|
|
37
39
|
|
|
38
40
|
attempts?: Array<ToolsAPI.ToolExecutionAttempt>;
|
|
39
41
|
|
|
40
|
-
created_at?:
|
|
42
|
+
created_at?: string;
|
|
41
43
|
|
|
42
44
|
execution_status?: string;
|
|
43
45
|
|
|
44
46
|
execution_type?: string;
|
|
45
47
|
|
|
46
|
-
finished_at?:
|
|
48
|
+
finished_at?: string;
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
input?: Record<string, unknown>;
|
|
49
51
|
|
|
50
|
-
run_at?:
|
|
52
|
+
run_at?: string;
|
|
51
53
|
|
|
52
|
-
started_at?:
|
|
54
|
+
started_at?: string;
|
|
53
55
|
|
|
54
56
|
tool_name?: string;
|
|
55
57
|
|
|
@@ -57,36 +59,18 @@ export interface ScheduledDetailsResponse {
|
|
|
57
59
|
|
|
58
60
|
toolkit_version?: string;
|
|
59
61
|
|
|
60
|
-
updated_at?:
|
|
62
|
+
updated_at?: string;
|
|
61
63
|
|
|
62
64
|
user_id?: string;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
export
|
|
66
|
-
export interface CreatedAt {
|
|
67
|
-
'time.Time'?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface FinishedAt {
|
|
71
|
-
'time.Time'?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface RunAt {
|
|
75
|
-
'time.Time'?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface StartedAt {
|
|
79
|
-
'time.Time'?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface UpdatedAt {
|
|
83
|
-
'time.Time'?: string;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
67
|
+
export interface ScheduledListParams extends OffsetPageParams {}
|
|
86
68
|
|
|
87
69
|
export declare namespace Scheduled {
|
|
88
70
|
export {
|
|
89
|
-
type
|
|
90
|
-
type
|
|
71
|
+
type ScheduledGetResponse as ScheduledGetResponse,
|
|
72
|
+
type ScheduledListParams as ScheduledListParams,
|
|
91
73
|
};
|
|
92
74
|
}
|
|
75
|
+
|
|
76
|
+
export { ToolExecutionsOffsetPage };
|