@valtown/sdk 1.1.0 → 1.3.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 +32 -0
- package/index.d.mts +9 -2
- package/index.d.ts +9 -2
- package/index.d.ts.map +1 -1
- package/index.js +11 -0
- package/index.js.map +1 -1
- package/index.mjs +11 -0
- package/index.mjs.map +1 -1
- package/internal/qs/formats.d.ts +6 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +11 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +8 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +280 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +276 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.ts +14 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +229 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/alias/username/username.d.ts +7 -0
- package/resources/alias/username/username.d.ts.map +1 -1
- package/resources/alias/username/username.js +7 -0
- package/resources/alias/username/username.js.map +1 -1
- package/resources/alias/username/username.mjs +7 -0
- package/resources/alias/username/username.mjs.map +1 -1
- package/resources/alias/username/val-name.d.ts +8 -0
- package/resources/alias/username/val-name.d.ts.map +1 -1
- package/resources/alias/username/val-name.js +8 -0
- package/resources/alias/username/val-name.js.map +1 -1
- package/resources/alias/username/val-name.mjs +8 -0
- package/resources/alias/username/val-name.mjs.map +1 -1
- package/resources/emails.d.ts +9 -0
- package/resources/emails.d.ts.map +1 -1
- package/resources/emails.js.map +1 -1
- package/resources/emails.mjs.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/sqlite.d.ts +15 -0
- package/resources/sqlite.d.ts.map +1 -1
- package/resources/sqlite.js +15 -0
- package/resources/sqlite.js.map +1 -1
- package/resources/sqlite.mjs +15 -0
- package/resources/sqlite.mjs.map +1 -1
- package/resources/telemetry.d.ts +66 -0
- package/resources/telemetry.d.ts.map +1 -0
- package/resources/telemetry.js +27 -0
- package/resources/telemetry.js.map +1 -0
- package/resources/telemetry.mjs +22 -0
- package/resources/telemetry.mjs.map +1 -0
- package/resources/users.d.ts +7 -0
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +7 -0
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +7 -0
- package/resources/users.mjs.map +1 -1
- package/resources/vals/branches.d.ts +38 -0
- package/resources/vals/branches.d.ts.map +1 -1
- package/resources/vals/branches.js +38 -0
- package/resources/vals/branches.js.map +1 -1
- package/resources/vals/branches.mjs +38 -0
- package/resources/vals/branches.mjs.map +1 -1
- package/resources/vals/files.d.ts +46 -0
- package/resources/vals/files.d.ts.map +1 -1
- package/resources/vals/files.js +46 -0
- package/resources/vals/files.js.map +1 -1
- package/resources/vals/files.mjs +46 -0
- package/resources/vals/files.mjs.map +1 -1
- package/resources/vals/index.d.ts +1 -1
- package/resources/vals/index.d.ts.map +1 -1
- package/resources/vals/index.js.map +1 -1
- package/resources/vals/index.mjs.map +1 -1
- package/resources/vals/vals.d.ts +59 -7
- package/resources/vals/vals.d.ts.map +1 -1
- package/resources/vals/vals.js +31 -5
- package/resources/vals/vals.js.map +1 -1
- package/resources/vals/vals.mjs +30 -4
- package/resources/vals/vals.mjs.map +1 -1
- package/src/index.ts +31 -2
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +9 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +388 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/resources/alias/username/username.ts +7 -0
- package/src/resources/alias/username/val-name.ts +8 -0
- package/src/resources/emails.ts +9 -0
- package/src/resources/index.ts +7 -1
- package/src/resources/sqlite.ts +15 -0
- package/src/resources/telemetry.ts +104 -0
- package/src/resources/users.ts +7 -0
- package/src/resources/vals/branches.ts +38 -0
- package/src/resources/vals/files.ts +46 -0
- package/src/resources/vals/index.ts +1 -1
- package/src/resources/vals/vals.ts +70 -9
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { RFC1738 } from './formats';
|
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
|
3
|
+
|
|
4
|
+
const has = Object.prototype.hasOwnProperty;
|
|
5
|
+
const is_array = Array.isArray;
|
|
6
|
+
|
|
7
|
+
const hex_table = (() => {
|
|
8
|
+
const array = [];
|
|
9
|
+
for (let i = 0; i < 256; ++i) {
|
|
10
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return array;
|
|
14
|
+
})();
|
|
15
|
+
|
|
16
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
|
17
|
+
while (queue.length > 1) {
|
|
18
|
+
const item = queue.pop();
|
|
19
|
+
if (!item) continue;
|
|
20
|
+
|
|
21
|
+
const obj = item.obj[item.prop];
|
|
22
|
+
|
|
23
|
+
if (is_array(obj)) {
|
|
24
|
+
const compacted: unknown[] = [];
|
|
25
|
+
|
|
26
|
+
for (let j = 0; j < obj.length; ++j) {
|
|
27
|
+
if (typeof obj[j] !== 'undefined') {
|
|
28
|
+
compacted.push(obj[j]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
item.obj[item.prop] = compacted;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
|
39
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
|
40
|
+
for (let i = 0; i < source.length; ++i) {
|
|
41
|
+
if (typeof source[i] !== 'undefined') {
|
|
42
|
+
obj[i] = source[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function merge(
|
|
50
|
+
target: any,
|
|
51
|
+
source: any,
|
|
52
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
|
53
|
+
) {
|
|
54
|
+
if (!source) {
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof source !== 'object') {
|
|
59
|
+
if (is_array(target)) {
|
|
60
|
+
target.push(source);
|
|
61
|
+
} else if (target && typeof target === 'object') {
|
|
62
|
+
if (
|
|
63
|
+
(options && (options.plainObjects || options.allowPrototypes)) ||
|
|
64
|
+
!has.call(Object.prototype, source)
|
|
65
|
+
) {
|
|
66
|
+
target[source] = true;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
return [target, source];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!target || typeof target !== 'object') {
|
|
76
|
+
return [target].concat(source);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mergeTarget = target;
|
|
80
|
+
if (is_array(target) && !is_array(source)) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
mergeTarget = array_to_object(target, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (is_array(target) && is_array(source)) {
|
|
86
|
+
source.forEach(function (item, i) {
|
|
87
|
+
if (has.call(target, i)) {
|
|
88
|
+
const targetItem = target[i];
|
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
90
|
+
target[i] = merge(targetItem, item, options);
|
|
91
|
+
} else {
|
|
92
|
+
target.push(item);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
target[i] = item;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
102
|
+
const value = source[key];
|
|
103
|
+
|
|
104
|
+
if (has.call(acc, key)) {
|
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
|
106
|
+
} else {
|
|
107
|
+
acc[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return acc;
|
|
110
|
+
}, mergeTarget);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
115
|
+
acc[key] = source[key];
|
|
116
|
+
return acc;
|
|
117
|
+
}, target);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
|
122
|
+
if (charset === 'iso-8859-1') {
|
|
123
|
+
// unescape never throws, no try...catch needed:
|
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
125
|
+
}
|
|
126
|
+
// utf-8
|
|
127
|
+
try {
|
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
return strWithoutPlus;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const limit = 1024;
|
|
135
|
+
|
|
136
|
+
export const encode: (
|
|
137
|
+
str: any,
|
|
138
|
+
defaultEncoder: DefaultEncoder,
|
|
139
|
+
charset: string,
|
|
140
|
+
type: 'key' | 'value',
|
|
141
|
+
format: Format,
|
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
145
|
+
if (str.length === 0) {
|
|
146
|
+
return str;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let string = str;
|
|
150
|
+
if (typeof str === 'symbol') {
|
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
|
152
|
+
} else if (typeof str !== 'string') {
|
|
153
|
+
string = String(str);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (charset === 'iso-8859-1') {
|
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let out = '';
|
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
165
|
+
const arr = [];
|
|
166
|
+
|
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
|
168
|
+
let c = segment.charCodeAt(i);
|
|
169
|
+
if (
|
|
170
|
+
c === 0x2d || // -
|
|
171
|
+
c === 0x2e || // .
|
|
172
|
+
c === 0x5f || // _
|
|
173
|
+
c === 0x7e || // ~
|
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
178
|
+
) {
|
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (c < 0x80) {
|
|
184
|
+
arr[arr.length] = hex_table[c];
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (c < 0x800) {
|
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
194
|
+
arr[arr.length] =
|
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i += 1;
|
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
|
201
|
+
|
|
202
|
+
arr[arr.length] =
|
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
out += arr.join('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export function compact(value: any) {
|
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
|
217
|
+
const refs = [];
|
|
218
|
+
|
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
|
220
|
+
const item = queue[i];
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
const obj = item.obj[item.prop];
|
|
223
|
+
|
|
224
|
+
const keys = Object.keys(obj);
|
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
226
|
+
const key = keys[j]!;
|
|
227
|
+
const val = obj[key];
|
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
229
|
+
queue.push({ obj: obj, prop: key });
|
|
230
|
+
refs.push(val);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
compact_queue(queue);
|
|
236
|
+
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function is_regexp(obj: any) {
|
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function is_buffer(obj: any) {
|
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function combine(a: any, b: any) {
|
|
253
|
+
return [].concat(a, b);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
|
257
|
+
if (is_array(val)) {
|
|
258
|
+
const mapped = [];
|
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
|
260
|
+
mapped.push(fn(val[i]!));
|
|
261
|
+
}
|
|
262
|
+
return mapped;
|
|
263
|
+
}
|
|
264
|
+
return fn(val);
|
|
265
|
+
}
|
|
@@ -11,6 +11,13 @@ export class Username extends APIResource {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Get basic details about a user, given their username
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const user = await client.alias.username.retrieve(
|
|
18
|
+
* 'username',
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
14
21
|
*/
|
|
15
22
|
retrieve(username: string, options?: Core.RequestOptions): Core.APIPromise<Shared.User> {
|
|
16
23
|
return this._client.get(`/v1/alias/${username}`, options);
|
|
@@ -7,6 +7,14 @@ import * as Shared from '../../shared';
|
|
|
7
7
|
export class ValName extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Get a val
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const val = await client.alias.username.valName.retrieve(
|
|
14
|
+
* 'username',
|
|
15
|
+
* 'val_name',
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
10
18
|
*/
|
|
11
19
|
retrieve(username: string, valName: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Val> {
|
|
12
20
|
return this._client.get(`/v2/alias/vals/${username}/${valName}`, options);
|
package/src/resources/emails.ts
CHANGED
|
@@ -10,6 +10,15 @@ import * as Core from '../core';
|
|
|
10
10
|
export class Emails extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Send emails
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.emails.send({
|
|
17
|
+
* html: 'Hello <strong>world</strong>',
|
|
18
|
+
* subject: 'An important message',
|
|
19
|
+
* text: 'Hello world',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
13
22
|
*/
|
|
14
23
|
send(body?: EmailSendParams, options?: Core.RequestOptions): Core.APIPromise<EmailSendResponse>;
|
|
15
24
|
send(options?: Core.RequestOptions): Core.APIPromise<EmailSendResponse>;
|
package/src/resources/index.ts
CHANGED
|
@@ -7,5 +7,11 @@ export { Emails, type EmailSendResponse, type EmailSendParams } from './emails';
|
|
|
7
7
|
export { Me } from './me/me';
|
|
8
8
|
export { Search } from './search/search';
|
|
9
9
|
export { Sqlite, type SqliteBatchResponse, type SqliteBatchParams, type SqliteExecuteParams } from './sqlite';
|
|
10
|
+
export {
|
|
11
|
+
TelemetryListResponsesPageCursorURL,
|
|
12
|
+
Telemetry,
|
|
13
|
+
type TelemetryListResponse,
|
|
14
|
+
type TelemetryListParams,
|
|
15
|
+
} from './telemetry';
|
|
10
16
|
export { Users } from './users';
|
|
11
|
-
export { Vals, type ValCreateParams, type ValListParams } from './vals/vals';
|
|
17
|
+
export { Vals, type ValListResponse, type ValCreateParams, type ValListParams } from './vals/vals';
|
package/src/resources/sqlite.ts
CHANGED
|
@@ -10,6 +10,14 @@ import * as Shared from './shared';
|
|
|
10
10
|
export class Sqlite extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Execute a batch of SQLite statements and return results for all of them
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const resultSets = await client.sqlite.batch({
|
|
17
|
+
* statements: ['SELECT 1;'],
|
|
18
|
+
* mode: 'read',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
batch(body: SqliteBatchParams, options?: Core.RequestOptions): Core.APIPromise<SqliteBatchResponse> {
|
|
15
23
|
return this._client.post('/v1/sqlite/batch', { body, ...options });
|
|
@@ -17,6 +25,13 @@ export class Sqlite extends APIResource {
|
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* Execute a single SQLite statement and return results
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const resultSet = await client.sqlite.execute({
|
|
32
|
+
* statement: 'SELECT 1;',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
20
35
|
*/
|
|
21
36
|
execute(body: SqliteExecuteParams, options?: Core.RequestOptions): Core.APIPromise<Shared.ResultSet> {
|
|
22
37
|
return this._client.post('/v1/sqlite/execute', { body, ...options });
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../resource';
|
|
4
|
+
import * as Core from '../core';
|
|
5
|
+
import { PageCursorURL, type PageCursorURLParams } from '../pagination';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* OpenTelemetry traces for your val executions
|
|
9
|
+
*/
|
|
10
|
+
export class Telemetry extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Get OpenTelemetry traces for a given time window and filter by branch_id or
|
|
13
|
+
* file_id
|
|
14
|
+
*/
|
|
15
|
+
list(
|
|
16
|
+
query: TelemetryListParams,
|
|
17
|
+
options?: Core.RequestOptions,
|
|
18
|
+
): Core.PagePromise<TelemetryListResponsesPageCursorURL, TelemetryListResponse> {
|
|
19
|
+
return this._client.getAPIList('/v1/telemetry/traces', TelemetryListResponsesPageCursorURL, {
|
|
20
|
+
query,
|
|
21
|
+
...options,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class TelemetryListResponsesPageCursorURL extends PageCursorURL<TelemetryListResponse> {}
|
|
27
|
+
|
|
28
|
+
export interface TelemetryListResponse {
|
|
29
|
+
attributes: Array<TelemetryListResponse.Attribute>;
|
|
30
|
+
|
|
31
|
+
endTimeUnixNano: string;
|
|
32
|
+
|
|
33
|
+
name: string;
|
|
34
|
+
|
|
35
|
+
startTimeUnixNano: string;
|
|
36
|
+
|
|
37
|
+
status: TelemetryListResponse.Status;
|
|
38
|
+
|
|
39
|
+
traceId: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export namespace TelemetryListResponse {
|
|
43
|
+
export interface Attribute {
|
|
44
|
+
key: string;
|
|
45
|
+
|
|
46
|
+
value: Attribute.Value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export namespace Attribute {
|
|
50
|
+
export interface Value {
|
|
51
|
+
arrayValue?: unknown;
|
|
52
|
+
|
|
53
|
+
boolValue?: boolean;
|
|
54
|
+
|
|
55
|
+
bytesValue?: string;
|
|
56
|
+
|
|
57
|
+
doubleValue?: number;
|
|
58
|
+
|
|
59
|
+
intValue?: string;
|
|
60
|
+
|
|
61
|
+
kvlistValue?: unknown;
|
|
62
|
+
|
|
63
|
+
stringValue?: string;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface Status {
|
|
68
|
+
code: number;
|
|
69
|
+
|
|
70
|
+
message: string;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface TelemetryListParams extends PageCursorURLParams {
|
|
75
|
+
/**
|
|
76
|
+
* End date of the time window
|
|
77
|
+
*/
|
|
78
|
+
end_timestamp: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Start date of the time window
|
|
82
|
+
*/
|
|
83
|
+
start_timestamp: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Branch IDs to filter by
|
|
87
|
+
*/
|
|
88
|
+
branch_ids?: Array<string>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Include only traces from a given file identified by its ID
|
|
92
|
+
*/
|
|
93
|
+
file_id?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Telemetry.TelemetryListResponsesPageCursorURL = TelemetryListResponsesPageCursorURL;
|
|
97
|
+
|
|
98
|
+
export declare namespace Telemetry {
|
|
99
|
+
export {
|
|
100
|
+
type TelemetryListResponse as TelemetryListResponse,
|
|
101
|
+
TelemetryListResponsesPageCursorURL as TelemetryListResponsesPageCursorURL,
|
|
102
|
+
type TelemetryListParams as TelemetryListParams,
|
|
103
|
+
};
|
|
104
|
+
}
|
package/src/resources/users.ts
CHANGED
|
@@ -10,6 +10,13 @@ import * as Shared from './shared';
|
|
|
10
10
|
export class Users extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Get basic information about a user
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const user = await client.users.retrieve(
|
|
17
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
13
20
|
*/
|
|
14
21
|
retrieve(userId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.User> {
|
|
15
22
|
return this._client.get(`/v1/users/${userId}`, options);
|
|
@@ -7,6 +7,17 @@ import { PageCursorURL, type PageCursorURLParams } from '../../pagination';
|
|
|
7
7
|
export class Branches extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Create a new branch
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const branch = await client.vals.branches.create(
|
|
14
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
15
|
+
* {
|
|
16
|
+
* name: 'my-branch',
|
|
17
|
+
* branchId: '00000000-0000-0000-0000-000000000000',
|
|
18
|
+
* },
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
10
21
|
*/
|
|
11
22
|
create(
|
|
12
23
|
valId: string,
|
|
@@ -18,6 +29,14 @@ export class Branches extends APIResource {
|
|
|
18
29
|
|
|
19
30
|
/**
|
|
20
31
|
* Get a branch by id
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const branch = await client.vals.branches.retrieve(
|
|
36
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
37
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
21
40
|
*/
|
|
22
41
|
retrieve(
|
|
23
42
|
valId: string,
|
|
@@ -29,6 +48,17 @@ export class Branches extends APIResource {
|
|
|
29
48
|
|
|
30
49
|
/**
|
|
31
50
|
* List all branches for a val
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* // Automatically fetches more pages as needed.
|
|
55
|
+
* for await (const branchListResponse of client.vals.branches.list(
|
|
56
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
57
|
+
* { limit: 1, offset: 0 },
|
|
58
|
+
* )) {
|
|
59
|
+
* // ...
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
32
62
|
*/
|
|
33
63
|
list(
|
|
34
64
|
valId: string,
|
|
@@ -43,6 +73,14 @@ export class Branches extends APIResource {
|
|
|
43
73
|
|
|
44
74
|
/**
|
|
45
75
|
* Delete a branch
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* await client.vals.branches.delete(
|
|
80
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
81
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
82
|
+
* );
|
|
83
|
+
* ```
|
|
46
84
|
*/
|
|
47
85
|
delete(valId: string, branchId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
48
86
|
return this._client.delete(`/v2/vals/${valId}/branches/${branchId}`, {
|
|
@@ -8,6 +8,14 @@ import { type Response } from '../../_shims/index';
|
|
|
8
8
|
export class Files extends APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* Create a new file, project val or directory
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const file = await client.vals.files.create(
|
|
15
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
16
|
+
* { path: 'path', type: 'directory' },
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
11
19
|
*/
|
|
12
20
|
create(
|
|
13
21
|
valId: string,
|
|
@@ -21,6 +29,17 @@ export class Files extends APIResource {
|
|
|
21
29
|
/**
|
|
22
30
|
* Get metadata for files and directories in a val. If path is an empty string,
|
|
23
31
|
* returns files at the root directory.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Automatically fetches more pages as needed.
|
|
36
|
+
* for await (const fileRetrieveResponse of client.vals.files.retrieve(
|
|
37
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
38
|
+
* { limit: 1, offset: 0, path: 'path', recursive: true },
|
|
39
|
+
* )) {
|
|
40
|
+
* // ...
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
24
43
|
*/
|
|
25
44
|
retrieve(
|
|
26
45
|
valId: string,
|
|
@@ -35,6 +54,14 @@ export class Files extends APIResource {
|
|
|
35
54
|
|
|
36
55
|
/**
|
|
37
56
|
* Update a file's content
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const file = await client.vals.files.update(
|
|
61
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
62
|
+
* { path: 'path' },
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
38
65
|
*/
|
|
39
66
|
update(
|
|
40
67
|
valId: string,
|
|
@@ -49,6 +76,14 @@ export class Files extends APIResource {
|
|
|
49
76
|
* Deletes a file or a directory. To delete a directory and all of its children,
|
|
50
77
|
* use the recursive flag. To delete all files, pass in an empty path and the
|
|
51
78
|
* recursive flag.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* await client.vals.files.delete(
|
|
83
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
84
|
+
* { path: 'path', recursive: true },
|
|
85
|
+
* );
|
|
86
|
+
* ```
|
|
52
87
|
*/
|
|
53
88
|
delete(valId: string, params: FileDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
54
89
|
const { path, recursive, branch_id } = params;
|
|
@@ -61,6 +96,17 @@ export class Files extends APIResource {
|
|
|
61
96
|
|
|
62
97
|
/**
|
|
63
98
|
* Download file content
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const response = await client.vals.files.getContent(
|
|
103
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
104
|
+
* { path: 'path' },
|
|
105
|
+
* );
|
|
106
|
+
*
|
|
107
|
+
* const content = await response.blob();
|
|
108
|
+
* console.log(content);
|
|
109
|
+
* ```
|
|
64
110
|
*/
|
|
65
111
|
getContent(
|
|
66
112
|
valId: string,
|