@valtown/sdk 1.0.0 → 1.2.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +1 -1
  3. package/index.d.mts +2 -2
  4. package/index.d.ts +2 -2
  5. package/index.d.ts.map +1 -1
  6. package/index.js.map +1 -1
  7. package/index.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/alias/username/username.d.ts +7 -0
  10. package/resources/alias/username/username.d.ts.map +1 -1
  11. package/resources/alias/username/username.js +7 -0
  12. package/resources/alias/username/username.js.map +1 -1
  13. package/resources/alias/username/username.mjs +7 -0
  14. package/resources/alias/username/username.mjs.map +1 -1
  15. package/resources/alias/username/val-name.d.ts +8 -0
  16. package/resources/alias/username/val-name.d.ts.map +1 -1
  17. package/resources/alias/username/val-name.js +8 -0
  18. package/resources/alias/username/val-name.js.map +1 -1
  19. package/resources/alias/username/val-name.mjs +8 -0
  20. package/resources/alias/username/val-name.mjs.map +1 -1
  21. package/resources/emails.d.ts +9 -0
  22. package/resources/emails.d.ts.map +1 -1
  23. package/resources/emails.js.map +1 -1
  24. package/resources/emails.mjs.map +1 -1
  25. package/resources/index.d.ts +1 -1
  26. package/resources/index.d.ts.map +1 -1
  27. package/resources/index.js.map +1 -1
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/shared.d.ts +4 -0
  30. package/resources/shared.d.ts.map +1 -1
  31. package/resources/shared.js.map +1 -1
  32. package/resources/shared.mjs.map +1 -1
  33. package/resources/sqlite.d.ts +15 -0
  34. package/resources/sqlite.d.ts.map +1 -1
  35. package/resources/sqlite.js +15 -0
  36. package/resources/sqlite.js.map +1 -1
  37. package/resources/sqlite.mjs +15 -0
  38. package/resources/sqlite.mjs.map +1 -1
  39. package/resources/users.d.ts +7 -0
  40. package/resources/users.d.ts.map +1 -1
  41. package/resources/users.js +7 -0
  42. package/resources/users.js.map +1 -1
  43. package/resources/users.mjs +7 -0
  44. package/resources/users.mjs.map +1 -1
  45. package/resources/vals/branches.d.ts +38 -0
  46. package/resources/vals/branches.d.ts.map +1 -1
  47. package/resources/vals/branches.js +38 -0
  48. package/resources/vals/branches.js.map +1 -1
  49. package/resources/vals/branches.mjs +38 -0
  50. package/resources/vals/branches.mjs.map +1 -1
  51. package/resources/vals/files.d.ts +46 -0
  52. package/resources/vals/files.d.ts.map +1 -1
  53. package/resources/vals/files.js +46 -0
  54. package/resources/vals/files.js.map +1 -1
  55. package/resources/vals/files.mjs +46 -0
  56. package/resources/vals/files.mjs.map +1 -1
  57. package/resources/vals/index.d.ts +1 -1
  58. package/resources/vals/index.d.ts.map +1 -1
  59. package/resources/vals/index.js.map +1 -1
  60. package/resources/vals/index.mjs.map +1 -1
  61. package/resources/vals/vals.d.ts +59 -7
  62. package/resources/vals/vals.d.ts.map +1 -1
  63. package/resources/vals/vals.js +31 -5
  64. package/resources/vals/vals.js.map +1 -1
  65. package/resources/vals/vals.mjs +30 -4
  66. package/resources/vals/vals.mjs.map +1 -1
  67. package/src/index.ts +7 -2
  68. package/src/resources/alias/username/username.ts +7 -0
  69. package/src/resources/alias/username/val-name.ts +8 -0
  70. package/src/resources/emails.ts +9 -0
  71. package/src/resources/index.ts +1 -1
  72. package/src/resources/shared.ts +5 -0
  73. package/src/resources/sqlite.ts +15 -0
  74. package/src/resources/users.ts +7 -0
  75. package/src/resources/vals/branches.ts +38 -0
  76. package/src/resources/vals/files.ts +46 -0
  77. package/src/resources/vals/index.ts +1 -1
  78. package/src/resources/vals/vals.ts +70 -9
  79. package/src/version.ts +1 -1
  80. package/version.d.ts +1 -1
  81. package/version.js +1 -1
  82. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vals.js","sourceRoot":"","sources":["../../src/resources/vals/vals.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAG7C,yCAA8C;AA2GrC,kGA3GA,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A9DD,oBA8DC;AA6CD,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AACzB,IAAI,CAAC,gCAAgC,GAAG,2CAAgC,CAAC;AACzE,IAAI,CAAC,KAAK,GAAG,aAAK,CAAC;AACnB,IAAI,CAAC,kCAAkC,GAAG,0CAAkC,CAAC"}
@@ -1,6 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../resource.mjs";
3
- import { ValsPageCursorURL } from "../shared.mjs";
4
3
  import * as BranchesAPI from "./branches.mjs";
5
4
  import { BranchListResponsesPageCursorURL, Branches, } from "./branches.mjs";
6
5
  import * as FilesAPI from "./files.mjs";
@@ -16,24 +15,52 @@ export class Vals extends APIResource {
16
15
  }
17
16
  /**
18
17
  * Create a new val
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const val = await client.vals.create({
22
+ * name: 'myVal',
23
+ * privacy: 'public',
24
+ * description: 'My val',
25
+ * });
26
+ * ```
19
27
  */
20
28
  create(body, options) {
21
29
  return this._client.post('/v2/vals', { body, ...options });
22
30
  }
23
31
  /**
24
32
  * Get a val by id
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const val = await client.vals.retrieve(
37
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
38
+ * );
39
+ * ```
25
40
  */
26
41
  retrieve(valId, options) {
27
42
  return this._client.get(`/v2/vals/${valId}`, options);
28
43
  }
29
44
  /**
30
- * Lists all public vals
45
+ * Lists all vals including all public vals and your unlisted and private vals
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const vals = await client.vals.list({ limit: 1 });
50
+ * ```
31
51
  */
32
52
  list(query, options) {
33
- return this._client.getAPIList('/v2/vals', ValsPageCursorURL, { query, ...options });
53
+ return this._client.get('/v2/vals', { query, ...options });
34
54
  }
35
55
  /**
36
56
  * Delete a project
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * await client.vals.delete(
61
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
62
+ * );
63
+ * ```
37
64
  */
38
65
  delete(valId, options) {
39
66
  return this._client.delete(`/v2/vals/${valId}`, {
@@ -46,5 +73,4 @@ Vals.Branches = Branches;
46
73
  Vals.BranchListResponsesPageCursorURL = BranchListResponsesPageCursorURL;
47
74
  Vals.Files = Files;
48
75
  Vals.FileRetrieveResponsesPageCursorURL = FileRetrieveResponsesPageCursorURL;
49
- export { ValsPageCursorURL };
50
76
  //# sourceMappingURL=vals.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vals.mjs","sourceRoot":"","sources":["../../src/resources/vals/vals.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,iBAAiB,EAAE;OACrB,KAAK,WAAW;OAChB,EAKL,gCAAgC,EAEhC,QAAQ,GACT;OACM,KAAK,QAAQ;OACb,EAOL,kCAAkC,EAGlC,KAAK,GACN;AAGD;;GAEG;AACH,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAgC3D,CAAC;IA9BC;;OAEG;IACH,MAAM,CAAC,IAAqB,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,KAAoB,EAAE,OAA6B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU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H,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,KAAoB,EAAE,OAA6B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAa,EAAE,OAA6B;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,KAAK,EAAE,EAAE;YAC9C,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AA6CD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,IAAI,CAAC,gCAAgC,GAAG,gCAAgC,CAAC;AACzE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,IAAI,CAAC,kCAAkC,GAAG,kCAAkC,CAAC"}
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ import { Users } from './resources/users';
14
14
  import { Alias } from './resources/alias/alias';
15
15
  import { Me } from './resources/me/me';
16
16
  import { Search } from './resources/search/search';
17
- import { ValCreateParams, ValListParams, Vals } from './resources/vals/vals';
17
+ import { ValCreateParams, ValListParams, ValListResponse, Vals } from './resources/vals/vals';
18
18
 
19
19
  export interface ClientOptions {
20
20
  /**
@@ -237,7 +237,12 @@ export declare namespace ValTown {
237
237
  type SqliteExecuteParams as SqliteExecuteParams,
238
238
  };
239
239
 
240
- export { Vals as Vals, type ValCreateParams as ValCreateParams, type ValListParams as ValListParams };
240
+ export {
241
+ Vals as Vals,
242
+ type ValListResponse as ValListResponse,
243
+ type ValCreateParams as ValCreateParams,
244
+ type ValListParams as ValListParams,
245
+ };
241
246
 
242
247
  export {
243
248
  Emails as Emails,
@@ -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);
@@ -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>;
@@ -8,4 +8,4 @@ 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
10
  export { Users } from './users';
11
- export { Vals, type ValCreateParams, type ValListParams } from './vals/vals';
11
+ export { Vals, type ValListResponse, type ValCreateParams, type ValListParams } from './vals/vals';
@@ -122,6 +122,11 @@ export interface Val {
122
122
 
123
123
  description: string | null;
124
124
 
125
+ /**
126
+ * The URL of this val's image
127
+ */
128
+ imageUrl: string | null;
129
+
125
130
  links: Val.Links;
126
131
 
127
132
  name: string;
@@ -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 });
@@ -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,
@@ -21,4 +21,4 @@ export {
21
21
  type FileDeleteParams,
22
22
  type FileGetContentParams,
23
23
  } from './files';
24
- export { Vals, type ValCreateParams, type ValListParams } from './vals';
24
+ export { Vals, type ValListResponse, type ValCreateParams, type ValListParams } from './vals';
@@ -3,7 +3,6 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import * as Core from '../../core';
5
5
  import * as Shared from '../shared';
6
- import { ValsPageCursorURL } from '../shared';
7
6
  import * as BranchesAPI from './branches';
8
7
  import {
9
8
  BranchCreateParams,
@@ -27,7 +26,6 @@ import {
27
26
  FileUpdateResponse,
28
27
  Files,
29
28
  } from './files';
30
- import { type PageCursorURLParams } from '../../pagination';
31
29
 
32
30
  /**
33
31
  * Vals are a collaborative folder of runnable JavaScript, TypeScript, and JSX modules
@@ -38,6 +36,15 @@ export class Vals extends APIResource {
38
36
 
39
37
  /**
40
38
  * Create a new val
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const val = await client.vals.create({
43
+ * name: 'myVal',
44
+ * privacy: 'public',
45
+ * description: 'My val',
46
+ * });
47
+ * ```
41
48
  */
42
49
  create(body: ValCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.Val> {
43
50
  return this._client.post('/v2/vals', { body, ...options });
@@ -45,20 +52,39 @@ export class Vals extends APIResource {
45
52
 
46
53
  /**
47
54
  * Get a val by id
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const val = await client.vals.retrieve(
59
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
60
+ * );
61
+ * ```
48
62
  */
49
63
  retrieve(valId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Val> {
50
64
  return this._client.get(`/v2/vals/${valId}`, options);
51
65
  }
52
66
 
53
67
  /**
54
- * Lists all public vals
68
+ * Lists all vals including all public vals and your unlisted and private vals
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const vals = await client.vals.list({ limit: 1 });
73
+ * ```
55
74
  */
56
- list(query: ValListParams, options?: Core.RequestOptions): Core.PagePromise<ValsPageCursorURL, Shared.Val> {
57
- return this._client.getAPIList('/v2/vals', ValsPageCursorURL, { query, ...options });
75
+ list(query: ValListParams, options?: Core.RequestOptions): Core.APIPromise<ValListResponse> {
76
+ return this._client.get('/v2/vals', { query, ...options });
58
77
  }
59
78
 
60
79
  /**
61
80
  * Delete a project
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * await client.vals.delete(
85
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
86
+ * );
87
+ * ```
62
88
  */
63
89
  delete(valId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
64
90
  return this._client.delete(`/v2/vals/${valId}`, {
@@ -68,6 +94,18 @@ export class Vals extends APIResource {
68
94
  }
69
95
  }
70
96
 
97
+ /**
98
+ * A paginated result set
99
+ */
100
+ export interface ValListResponse {
101
+ data: Array<Shared.Val>;
102
+
103
+ /**
104
+ * Links to use for pagination
105
+ */
106
+ links: Shared.PaginationLinks;
107
+ }
108
+
71
109
  export interface ValCreateParams {
72
110
  name: string;
73
111
 
@@ -76,7 +114,28 @@ export interface ValCreateParams {
76
114
  description?: string;
77
115
  }
78
116
 
79
- export interface ValListParams extends PageCursorURLParams {}
117
+ export interface ValListParams {
118
+ /**
119
+ * Maximum items to return in each paginated response
120
+ */
121
+ limit: number;
122
+
123
+ /**
124
+ * Cursor to start the pagination from
125
+ */
126
+ cursor?: string;
127
+
128
+ /**
129
+ * This resource's privacy setting. Unlisted resources do not appear on profile
130
+ * pages or elsewhere, but you can link to them.
131
+ */
132
+ privacy?: 'public' | 'unlisted' | 'private';
133
+
134
+ /**
135
+ * User ID to filter by
136
+ */
137
+ user_id?: string;
138
+ }
80
139
 
81
140
  Vals.Branches = Branches;
82
141
  Vals.BranchListResponsesPageCursorURL = BranchListResponsesPageCursorURL;
@@ -84,7 +143,11 @@ Vals.Files = Files;
84
143
  Vals.FileRetrieveResponsesPageCursorURL = FileRetrieveResponsesPageCursorURL;
85
144
 
86
145
  export declare namespace Vals {
87
- export { type ValCreateParams as ValCreateParams, type ValListParams as ValListParams };
146
+ export {
147
+ type ValListResponse as ValListResponse,
148
+ type ValCreateParams as ValCreateParams,
149
+ type ValListParams as ValListParams,
150
+ };
88
151
 
89
152
  export {
90
153
  Branches as Branches,
@@ -109,5 +172,3 @@ export declare namespace Vals {
109
172
  type FileGetContentParams as FileGetContentParams,
110
173
  };
111
174
  }
112
-
113
- export { ValsPageCursorURL };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.0.0'; // x-release-please-version
1
+ export const VERSION = '1.2.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0";
1
+ export declare const VERSION = "1.2.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.0.0'; // x-release-please-version
4
+ exports.VERSION = '1.2.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.0.0'; // x-release-please-version
1
+ export const VERSION = '1.2.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map