@valtown/sdk 0.30.0 → 0.32.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 (66) hide show
  1. package/CHANGELOG.md +21 -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/index.d.ts +1 -0
  10. package/resources/alias/username/index.d.ts.map +1 -1
  11. package/resources/alias/username/index.js +3 -1
  12. package/resources/alias/username/index.js.map +1 -1
  13. package/resources/alias/username/index.mjs +1 -0
  14. package/resources/alias/username/index.mjs.map +1 -1
  15. package/resources/alias/username/project-name.d.ts +51 -0
  16. package/resources/alias/username/project-name.d.ts.map +1 -0
  17. package/resources/alias/username/project-name.js +15 -0
  18. package/resources/alias/username/project-name.js.map +1 -0
  19. package/resources/alias/username/project-name.mjs +11 -0
  20. package/resources/alias/username/project-name.mjs.map +1 -0
  21. package/resources/alias/username/username.d.ts +4 -0
  22. package/resources/alias/username/username.d.ts.map +1 -1
  23. package/resources/alias/username/username.js +4 -0
  24. package/resources/alias/username/username.js.map +1 -1
  25. package/resources/alias/username/username.mjs +4 -0
  26. package/resources/alias/username/username.mjs.map +1 -1
  27. package/resources/index.d.ts +1 -1
  28. package/resources/index.d.ts.map +1 -1
  29. package/resources/index.js.map +1 -1
  30. package/resources/index.mjs.map +1 -1
  31. package/resources/projects/branches.d.ts +43 -1
  32. package/resources/projects/branches.d.ts.map +1 -1
  33. package/resources/projects/branches.js +6 -0
  34. package/resources/projects/branches.js.map +1 -1
  35. package/resources/projects/branches.mjs +6 -0
  36. package/resources/projects/branches.mjs.map +1 -1
  37. package/resources/projects/files.d.ts +107 -1
  38. package/resources/projects/files.d.ts.map +1 -1
  39. package/resources/projects/files.js +27 -0
  40. package/resources/projects/files.js.map +1 -1
  41. package/resources/projects/files.mjs +27 -0
  42. package/resources/projects/files.mjs.map +1 -1
  43. package/resources/projects/index.d.ts +3 -3
  44. package/resources/projects/index.d.ts.map +1 -1
  45. package/resources/projects/index.js.map +1 -1
  46. package/resources/projects/index.mjs +1 -1
  47. package/resources/projects/index.mjs.map +1 -1
  48. package/resources/projects/projects.d.ts +54 -5
  49. package/resources/projects/projects.d.ts.map +1 -1
  50. package/resources/projects/projects.js +6 -0
  51. package/resources/projects/projects.js.map +1 -1
  52. package/resources/projects/projects.mjs +7 -1
  53. package/resources/projects/projects.mjs.map +1 -1
  54. package/src/index.ts +4 -0
  55. package/src/resources/alias/username/index.ts +1 -0
  56. package/src/resources/alias/username/project-name.ts +72 -0
  57. package/src/resources/alias/username/username.ts +6 -0
  58. package/src/resources/index.ts +2 -0
  59. package/src/resources/projects/branches.ts +62 -0
  60. package/src/resources/projects/files.ts +180 -0
  61. package/src/resources/projects/index.ts +13 -1
  62. package/src/resources/projects/projects.ts +86 -1
  63. package/src/version.ts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -5,6 +5,17 @@ import * as Core from '../../core';
5
5
  import { PageCursorURL, type PageCursorURLParams } from '../../pagination';
6
6
 
7
7
  export class Branches extends APIResource {
8
+ /**
9
+ * [BETA] Create a new branch
10
+ */
11
+ create(
12
+ projectId: string,
13
+ body: BranchCreateParams,
14
+ options?: Core.RequestOptions,
15
+ ): Core.APIPromise<BranchCreateResponse> {
16
+ return this._client.post(`/v1/projects/${projectId}/branches`, { body, ...options });
17
+ }
18
+
8
19
  /**
9
20
  * [BETA] Get a branch by id
10
21
  */
@@ -33,6 +44,45 @@ export class Branches extends APIResource {
33
44
 
34
45
  export class BranchListResponsesPageCursorURL extends PageCursorURL<BranchListResponse> {}
35
46
 
47
+ /**
48
+ * A Branch
49
+ */
50
+ export interface BranchCreateResponse {
51
+ /**
52
+ * The id of the branch
53
+ */
54
+ id: string;
55
+
56
+ createdAt: string;
57
+
58
+ /**
59
+ * The id of the branch this branch was forked from
60
+ */
61
+ forkedBranchId: string | null;
62
+
63
+ links: BranchCreateResponse.Links;
64
+
65
+ name: string;
66
+
67
+ updatedAt: string;
68
+
69
+ version: number;
70
+ }
71
+
72
+ export namespace BranchCreateResponse {
73
+ export interface Links {
74
+ /**
75
+ * The URL of this resource on Val Town
76
+ */
77
+ html: string;
78
+
79
+ /**
80
+ * The URL of this resource on this API
81
+ */
82
+ self: string;
83
+ }
84
+ }
85
+
36
86
  /**
37
87
  * A Branch
38
88
  */
@@ -111,15 +161,27 @@ export namespace BranchListResponse {
111
161
  }
112
162
  }
113
163
 
164
+ export interface BranchCreateParams {
165
+ name: string;
166
+
167
+ /**
168
+ * The branch ID to fork from. If this is not specified, the new branch will be
169
+ * forked from main.
170
+ */
171
+ branchId?: string;
172
+ }
173
+
114
174
  export interface BranchListParams extends PageCursorURLParams {}
115
175
 
116
176
  Branches.BranchListResponsesPageCursorURL = BranchListResponsesPageCursorURL;
117
177
 
118
178
  export declare namespace Branches {
119
179
  export {
180
+ type BranchCreateResponse as BranchCreateResponse,
120
181
  type BranchRetrieveResponse as BranchRetrieveResponse,
121
182
  type BranchListResponse as BranchListResponse,
122
183
  BranchListResponsesPageCursorURL as BranchListResponsesPageCursorURL,
184
+ type BranchCreateParams as BranchCreateParams,
123
185
  type BranchListParams as BranchListParams,
124
186
  };
125
187
  }
@@ -1,10 +1,25 @@
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';
6
+ import * as Shared from '../shared';
5
7
  import { PageCursorURL, type PageCursorURLParams } from '../../pagination';
8
+ import { type Response } from '../../_shims/index';
6
9
 
7
10
  export class Files extends APIResource {
11
+ /**
12
+ * Get metadata for files and directories in a project at the specified path
13
+ */
14
+ retrieve(
15
+ projectId: string,
16
+ path: string,
17
+ query: FileRetrieveParams,
18
+ options?: Core.RequestOptions,
19
+ ): Core.APIPromise<FileRetrieveResponse> {
20
+ return this._client.get(`/v1/projects/${projectId}/files/${path}`, { query, ...options });
21
+ }
22
+
8
23
  /**
9
24
  * Get metadata for files and directories in a project at the root directory
10
25
  */
@@ -18,10 +33,113 @@ export class Files extends APIResource {
18
33
  ...options,
19
34
  });
20
35
  }
36
+
37
+ /**
38
+ * Download file content
39
+ */
40
+ content(
41
+ projectId: string,
42
+ path: string,
43
+ params?: FileContentParams,
44
+ options?: Core.RequestOptions,
45
+ ): Core.APIPromise<Response>;
46
+ content(projectId: string, path: string, options?: Core.RequestOptions): Core.APIPromise<Response>;
47
+ content(
48
+ projectId: string,
49
+ path: string,
50
+ params: FileContentParams | Core.RequestOptions = {},
51
+ options?: Core.RequestOptions,
52
+ ): Core.APIPromise<Response> {
53
+ if (isRequestOptions(params)) {
54
+ return this.content(projectId, path, {}, params);
55
+ }
56
+ const {
57
+ 'Cache-Control': cacheControl,
58
+ 'If-Match': ifMatch,
59
+ 'If-Modified-Since': ifModifiedSince,
60
+ 'If-None-Match': ifNoneMatch,
61
+ 'If-Unmodified-Since': ifUnmodifiedSince,
62
+ ...query
63
+ } = params;
64
+ return this._client.get(`/v1/projects/${projectId}/files/${path}/content`, {
65
+ query,
66
+ ...options,
67
+ headers: {
68
+ Accept: 'application/octet-stream',
69
+ ...(cacheControl != null ? { 'Cache-Control': cacheControl } : undefined),
70
+ ...(ifMatch != null ? { 'If-Match': ifMatch } : undefined),
71
+ ...(ifModifiedSince != null ? { 'If-Modified-Since': ifModifiedSince } : undefined),
72
+ ...(ifNoneMatch != null ? { 'If-None-Match': ifNoneMatch } : undefined),
73
+ ...(ifUnmodifiedSince != null ? { 'If-Unmodified-Since': ifUnmodifiedSince } : undefined),
74
+ ...options?.headers,
75
+ },
76
+ __binaryResponse: true,
77
+ });
78
+ }
21
79
  }
22
80
 
23
81
  export class FileListResponsesPageCursorURL extends PageCursorURL<FileListResponse> {}
24
82
 
83
+ /**
84
+ * A paginated result set
85
+ */
86
+ export interface FileRetrieveResponse {
87
+ data: Array<FileRetrieveResponse.Data>;
88
+
89
+ /**
90
+ * Links to use for pagination
91
+ */
92
+ links: Shared.PaginationLinks;
93
+ }
94
+
95
+ export namespace FileRetrieveResponse {
96
+ /**
97
+ * A File or Directory's Metadata
98
+ */
99
+ export interface Data {
100
+ /**
101
+ * The id of the resource
102
+ */
103
+ id: string;
104
+
105
+ links: Data.Links;
106
+
107
+ name: string;
108
+
109
+ path: string;
110
+
111
+ type: 'directory' | 'file' | 'interval' | 'http' | 'email' | 'script';
112
+
113
+ updatedAt: string;
114
+
115
+ version: number;
116
+ }
117
+
118
+ export namespace Data {
119
+ export interface Links {
120
+ /**
121
+ * The URL of this resource on Val Town
122
+ */
123
+ html: string;
124
+
125
+ /**
126
+ * The URL of this resource's source code as a module
127
+ */
128
+ module: string;
129
+
130
+ /**
131
+ * The URL of this resource on this API
132
+ */
133
+ self: string;
134
+
135
+ /**
136
+ * This resource's web endpoint, where it serves a website or API
137
+ */
138
+ endpoint?: string;
139
+ }
140
+ }
141
+ }
142
+
25
143
  /**
26
144
  * A File or Directory's Metadata
27
145
  */
@@ -68,6 +186,28 @@ export namespace FileListResponse {
68
186
  }
69
187
  }
70
188
 
189
+ export interface FileRetrieveParams {
190
+ /**
191
+ * Maximum items to return in each paginated response
192
+ */
193
+ limit: number;
194
+
195
+ /**
196
+ * Number of items to skip in order to deliver paginated results
197
+ */
198
+ offset: number;
199
+
200
+ /**
201
+ * Id to query
202
+ */
203
+ branch_id?: string;
204
+
205
+ /**
206
+ * Specific branch version to query
207
+ */
208
+ version?: number;
209
+ }
210
+
71
211
  export interface FileListParams extends PageCursorURLParams {
72
212
  /**
73
213
  * Id to query
@@ -85,12 +225,52 @@ export interface FileListParams extends PageCursorURLParams {
85
225
  version?: number;
86
226
  }
87
227
 
228
+ export interface FileContentParams {
229
+ /**
230
+ * Query param: Id to query
231
+ */
232
+ branch_id?: string;
233
+
234
+ /**
235
+ * Query param: Specific branch version to query
236
+ */
237
+ version?: number;
238
+
239
+ /**
240
+ * Header param:
241
+ */
242
+ 'Cache-Control'?: string;
243
+
244
+ /**
245
+ * Header param:
246
+ */
247
+ 'If-Match'?: string;
248
+
249
+ /**
250
+ * Header param:
251
+ */
252
+ 'If-Modified-Since'?: string;
253
+
254
+ /**
255
+ * Header param:
256
+ */
257
+ 'If-None-Match'?: string;
258
+
259
+ /**
260
+ * Header param:
261
+ */
262
+ 'If-Unmodified-Since'?: string;
263
+ }
264
+
88
265
  Files.FileListResponsesPageCursorURL = FileListResponsesPageCursorURL;
89
266
 
90
267
  export declare namespace Files {
91
268
  export {
269
+ type FileRetrieveResponse as FileRetrieveResponse,
92
270
  type FileListResponse as FileListResponse,
93
271
  FileListResponsesPageCursorURL as FileListResponsesPageCursorURL,
272
+ type FileRetrieveParams as FileRetrieveParams,
94
273
  type FileListParams as FileListParams,
274
+ type FileContentParams as FileContentParams,
95
275
  };
96
276
  }
@@ -3,15 +3,27 @@
3
3
  export {
4
4
  BranchListResponsesPageCursorURL,
5
5
  Branches,
6
+ type BranchCreateResponse,
6
7
  type BranchRetrieveResponse,
7
8
  type BranchListResponse,
9
+ type BranchCreateParams,
8
10
  type BranchListParams,
9
11
  } from './branches';
10
- export { FileListResponsesPageCursorURL, Files, type FileListResponse, type FileListParams } from './files';
12
+ export {
13
+ FileListResponsesPageCursorURL,
14
+ Files,
15
+ type FileRetrieveResponse,
16
+ type FileListResponse,
17
+ type FileRetrieveParams,
18
+ type FileListParams,
19
+ type FileContentParams,
20
+ } from './files';
11
21
  export {
12
22
  ProjectListResponsesPageCursorURL,
13
23
  Projects,
24
+ type ProjectCreateResponse,
14
25
  type ProjectRetrieveResponse,
15
26
  type ProjectListResponse,
27
+ type ProjectCreateParams,
16
28
  type ProjectListParams,
17
29
  } from './projects';
@@ -4,6 +4,8 @@ import { APIResource } from '../../resource';
4
4
  import * as Core from '../../core';
5
5
  import * as BranchesAPI from './branches';
6
6
  import {
7
+ BranchCreateParams,
8
+ BranchCreateResponse,
7
9
  BranchListParams,
8
10
  BranchListResponse,
9
11
  BranchListResponsesPageCursorURL,
@@ -11,7 +13,15 @@ import {
11
13
  Branches,
12
14
  } from './branches';
13
15
  import * as FilesAPI from './files';
14
- import { FileListParams, FileListResponse, FileListResponsesPageCursorURL, Files } from './files';
16
+ import {
17
+ FileContentParams,
18
+ FileListParams,
19
+ FileListResponse,
20
+ FileListResponsesPageCursorURL,
21
+ FileRetrieveParams,
22
+ FileRetrieveResponse,
23
+ Files,
24
+ } from './files';
15
25
  import { PageCursorURL, type PageCursorURLParams } from '../../pagination';
16
26
 
17
27
  /**
@@ -21,6 +31,13 @@ export class Projects extends APIResource {
21
31
  branches: BranchesAPI.Branches = new BranchesAPI.Branches(this._client);
22
32
  files: FilesAPI.Files = new FilesAPI.Files(this._client);
23
33
 
34
+ /**
35
+ * [BETA] Create a new project
36
+ */
37
+ create(body: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise<ProjectCreateResponse> {
38
+ return this._client.post('/v1/projects', { body, ...options });
39
+ }
40
+
24
41
  /**
25
42
  * [BETA] Get a project by id
26
43
  */
@@ -41,6 +58,57 @@ export class Projects extends APIResource {
41
58
 
42
59
  export class ProjectListResponsesPageCursorURL extends PageCursorURL<ProjectListResponse> {}
43
60
 
61
+ /**
62
+ * A Project
63
+ */
64
+ export interface ProjectCreateResponse {
65
+ /**
66
+ * The id of the project
67
+ */
68
+ id: string;
69
+
70
+ author: ProjectCreateResponse.Author;
71
+
72
+ createdAt: string;
73
+
74
+ description: string | null;
75
+
76
+ /**
77
+ * The URL of this project's image
78
+ */
79
+ imageUrl: string | null;
80
+
81
+ links: ProjectCreateResponse.Links;
82
+
83
+ name: string;
84
+
85
+ /**
86
+ * This resource's privacy setting. Unlisted resources do not appear on profile
87
+ * pages or elsewhere, but you can link to them.
88
+ */
89
+ privacy: 'public' | 'unlisted' | 'private';
90
+ }
91
+
92
+ export namespace ProjectCreateResponse {
93
+ export interface Author {
94
+ id: string;
95
+
96
+ username: string | null;
97
+ }
98
+
99
+ export interface Links {
100
+ /**
101
+ * The URL of this resource on Val Town
102
+ */
103
+ html: string;
104
+
105
+ /**
106
+ * The URL of this resource on this API
107
+ */
108
+ self: string;
109
+ }
110
+ }
111
+
44
112
  /**
45
113
  * A Project
46
114
  */
@@ -143,6 +211,16 @@ export namespace ProjectListResponse {
143
211
  }
144
212
  }
145
213
 
214
+ export interface ProjectCreateParams {
215
+ name: string;
216
+
217
+ privacy: 'public' | 'unlisted' | 'private';
218
+
219
+ description?: string;
220
+
221
+ imageUrl?: string;
222
+ }
223
+
146
224
  export interface ProjectListParams extends PageCursorURLParams {}
147
225
 
148
226
  Projects.ProjectListResponsesPageCursorURL = ProjectListResponsesPageCursorURL;
@@ -153,24 +231,31 @@ Projects.FileListResponsesPageCursorURL = FileListResponsesPageCursorURL;
153
231
 
154
232
  export declare namespace Projects {
155
233
  export {
234
+ type ProjectCreateResponse as ProjectCreateResponse,
156
235
  type ProjectRetrieveResponse as ProjectRetrieveResponse,
157
236
  type ProjectListResponse as ProjectListResponse,
158
237
  ProjectListResponsesPageCursorURL as ProjectListResponsesPageCursorURL,
238
+ type ProjectCreateParams as ProjectCreateParams,
159
239
  type ProjectListParams as ProjectListParams,
160
240
  };
161
241
 
162
242
  export {
163
243
  Branches as Branches,
244
+ type BranchCreateResponse as BranchCreateResponse,
164
245
  type BranchRetrieveResponse as BranchRetrieveResponse,
165
246
  type BranchListResponse as BranchListResponse,
166
247
  BranchListResponsesPageCursorURL as BranchListResponsesPageCursorURL,
248
+ type BranchCreateParams as BranchCreateParams,
167
249
  type BranchListParams as BranchListParams,
168
250
  };
169
251
 
170
252
  export {
171
253
  Files as Files,
254
+ type FileRetrieveResponse as FileRetrieveResponse,
172
255
  type FileListResponse as FileListResponse,
173
256
  FileListResponsesPageCursorURL as FileListResponsesPageCursorURL,
257
+ type FileRetrieveParams as FileRetrieveParams,
174
258
  type FileListParams as FileListParams,
259
+ type FileContentParams as FileContentParams,
175
260
  };
176
261
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.30.0'; // x-release-please-version
1
+ export const VERSION = '0.32.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.30.0";
1
+ export declare const VERSION = "0.32.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 = '0.30.0'; // x-release-please-version
4
+ exports.VERSION = '0.32.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.30.0'; // x-release-please-version
1
+ export const VERSION = '0.32.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map