@filefreak.io/sdk 0.0.0-stage → 0.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.
@@ -0,0 +1,1060 @@
1
+ import type { CallOptions } from "./transport.js";
2
+ /** A file or folder. */
3
+ export interface Item {
4
+ /** Never changes, whatever is renamed or moved. */
5
+ id: string;
6
+ kind: "file" | "folder";
7
+ name: string;
8
+ /** The folder it is in. Null at the top of the app. */
9
+ parentId: string | null;
10
+ /** Zero for a folder. */
11
+ sizeBytes: number;
12
+ /** Null for a folder. */
13
+ contentType: string | null;
14
+ /** Its own setting. inherit follows the nearest folder above it that has one, and with none it is private. The nearest setting wins: a private file inside a public folder is private, and a public file inside a private folder is public. */
15
+ visibility: "private" | "public" | "inherit";
16
+ /** Whether anybody can see it now: by the nearest setting, with nothing above it in the trash, and the account's public page switched on. */
17
+ public: boolean;
18
+ /** An address anybody can fetch, that does not expire, while the file is public. Null for a folder and for anything that is not public. */
19
+ publicUrl: string | null;
20
+ /** When it was put in the trash, if it is there. */
21
+ trashedAt: string | null;
22
+ /** One more each time an upload replaces the file's content. Renaming or moving leaves it as it is. Always 1 for a folder. */
23
+ revision: number;
24
+ /** The SHA-256 the uploader gave when it completed the upload of this content, in lower-case hex, or null. The uploader's word: this service never sees a file's bytes and does not check it. */
25
+ clientSha256: string | null;
26
+ /** Whether the file is under Shard Protection: kept as sealed fragments, and read through its map (files.shards) rather than from an address. */
27
+ protected: boolean;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ }
31
+ /** One change to a file or folder, saying what it is now. */
32
+ export interface Change {
33
+ /** The file or folder's id. */
34
+ id: string;
35
+ kind: "file" | "folder";
36
+ /** What it is now. live: in the folder parentId names, called name. trashed: in the trash, with everything inside it. deleted: gone for good, with everything that was inside it. */
37
+ state: "live" | "trashed" | "deleted";
38
+ /** The folder it is in, or was in when it went. Null at the top of the app. */
39
+ parentId: string | null;
40
+ name: string;
41
+ /** Zero for a folder. */
42
+ sizeBytes: number;
43
+ revision: number;
44
+ clientSha256: string | null;
45
+ changedAt: string;
46
+ }
47
+ /** A file on its way to storage. */
48
+ export interface Upload {
49
+ id: string;
50
+ name: string;
51
+ parentId: string | null;
52
+ sizeBytes: number;
53
+ contentType: string | null;
54
+ status: "pending" | "completed" | "aborted" | "expired";
55
+ onConflict: "rename" | "replace" | "fail";
56
+ /** Every part is this many bytes, except the last, which is whatever remains. For an upload begun with blocks, each part is its block, and this is the largest of them. */
57
+ partBytes: number;
58
+ partCount: number;
59
+ /** The file this became, once it has. */
60
+ fileId: string | null;
61
+ /** The upload has to be completed by then. */
62
+ expiresAt: string;
63
+ createdAt: string;
64
+ }
65
+ /** Where to send one part of an upload. */
66
+ export interface Part {
67
+ /** Counted from zero. */
68
+ number: number;
69
+ method: "PUT";
70
+ /** Send this part's bytes here, as the body. No API key: the address is the permission. Add a Content-MD5 header, the part's MD5 in base64, and storage checks it and refuses a part that changed on the way. */
71
+ url: string;
72
+ /** Headers the request must carry. */
73
+ headers: Record<string, string>;
74
+ /** When this address stops working. Ask for the parts again to get fresh ones. */
75
+ expiresAt: string;
76
+ }
77
+ /** Not ready yet: ask again after retryAfterSeconds. */
78
+ export interface Pending {
79
+ pending: true;
80
+ retryAfterSeconds: number;
81
+ }
82
+ /** Done. */
83
+ export interface Ok {
84
+ ok: true;
85
+ }
86
+ /** A link that opens one file or folder for whoever holds it. */
87
+ export interface Share {
88
+ id: string;
89
+ /** The file or folder it opens. */
90
+ itemId: string;
91
+ /** The link to give. Whoever has it can open what it is for, with the password if it has one. */
92
+ url: string;
93
+ hasPassword: boolean;
94
+ /** When it stops working, or null for never. */
95
+ expiresAt: string | null;
96
+ /** How many downloads it allows, or null for any number. */
97
+ maxDownloads: number | null;
98
+ downloadCount: number;
99
+ lastUsedAt: string | null;
100
+ createdAt: string;
101
+ /** Whether it works now, and if not, why. */
102
+ state: "active" | "expired" | "used_up";
103
+ }
104
+ /** A static site: a name under the sites domain, and its deploys. */
105
+ export interface Site {
106
+ id: string;
107
+ /** Lower-case letters, digits and hyphens. The site's address is this name under the sites domain. */
108
+ name: string;
109
+ /** Where visitors reach it, or null while FileFreak serves no sites. */
110
+ address: string | null;
111
+ /** Whether a path with no file and no extension is served the site's /index.html, as an app that draws its own pages needs. */
112
+ singlePage: boolean;
113
+ /** What the site holds, across all its deploys, each file's bytes once. It counts as storage. */
114
+ storedBytes: number;
115
+ /** The deploy visitors are served, or null while the site is offline. */
116
+ live: SiteDeploy | null;
117
+ createdAt: string;
118
+ updatedAt: string;
119
+ }
120
+ /** One deploy of a site: a set of files, kept as they were sent. */
121
+ export interface SiteDeploy {
122
+ id: string;
123
+ /** 1 for a site's first deploy, and one more each time. */
124
+ number: number;
125
+ /** uploading: files are being declared and sent. ready: every file is stored, and it can be made live. cancelled or expired: given up on, and it holds nothing. */
126
+ state: "uploading" | "ready" | "cancelled" | "expired";
127
+ /** upload: sent from a computer, by the CLI or a program. folder: copied from a folder in the drive, on the website. */
128
+ source: "upload" | "folder";
129
+ fileCount: number;
130
+ /** What its files add up to. */
131
+ sizeBytes: number;
132
+ /** Whether visitors to the site's address are served this deploy. */
133
+ live: boolean;
134
+ /** This deploy's own address, whichever deploy is live. Null until it is ready, and while FileFreak serves no sites. */
135
+ address: string | null;
136
+ createdAt: string;
137
+ /** When it became ready. */
138
+ finishedAt: string | null;
139
+ }
140
+ /** Where to send one file's bytes for a deploy. */
141
+ export interface SendTo {
142
+ sha256: string;
143
+ sizeBytes: number;
144
+ method: "PUT";
145
+ /** PUT the file's bytes here, whole, as the body. No key: the address is the permission. */
146
+ url: string;
147
+ /** Headers the request must carry. */
148
+ headers: Record<string, string>;
149
+ /** When the address stops working. sites.sendAgain gives fresh ones. */
150
+ expiresAt: string;
151
+ }
152
+ /** A page of a protected file's map: its key, and where each fragment is. */
153
+ export interface ShardMap {
154
+ /** The content's own id, which each fragment's check is bound to with its place and the count. */
155
+ contentId: string;
156
+ /** The file's size. */
157
+ sizeBytes: number;
158
+ /** How many bytes of the file each fragment holds, except the last, which holds what remains. */
159
+ fragmentBytes: number;
160
+ /** How many fragments the file is. */
161
+ count: number;
162
+ /** The file's own key, in base64: 32 bytes, which open its fragments. In this answer and nowhere else. */
163
+ key: string;
164
+ name: string;
165
+ contentType: string | null;
166
+ /** The file's revision whose content this is. Its fragments never change, however late they are read. */
167
+ revision: number;
168
+ /** The first place on this page. */
169
+ from: number;
170
+ /** Up to 1000, in order of place. */
171
+ fragments: Array<{
172
+ /** Counted from zero. Its bytes of the file begin at place times fragmentBytes. */
173
+ place: number;
174
+ /** Where to fetch the stored fragment, with a plain GET and no key: the address is the permission. */
175
+ url: string;
176
+ }>;
177
+ /** The from of the next page, or null when this page reaches the last fragment. */
178
+ next: number | null;
179
+ /** When this page's addresses stop working. Ask for the page again before then, from the first fragment not yet fetched. */
180
+ expiresAt: string;
181
+ }
182
+ /** What GET /v1/files takes in its query. */
183
+ export type FilesListQuery = {
184
+ /** The folder to list. Left out, the top of the app (or of the folder the key is confined to). */
185
+ parent?: string;
186
+ /** nextCursor from the page before. */
187
+ cursor?: string;
188
+ /** How many to return, 1 to 200. */
189
+ limit?: number;
190
+ };
191
+ /** What GET /v1/files answers with. */
192
+ export type FilesListAnswer = {
193
+ items: Array<Item>;
194
+ nextCursor: string | null;
195
+ };
196
+ /** What GET /v1/files/by-path takes in its query. */
197
+ export type FilesByPathQuery = {
198
+ /** Such as Photos/2024/beach.jpg. */
199
+ path: string;
200
+ };
201
+ /** What GET /v1/files/by-path answers with. */
202
+ export type FilesByPathAnswer = {
203
+ item: Item;
204
+ };
205
+ /** What GET /v1/files/:id answers with. */
206
+ export type FilesGetAnswer = {
207
+ item: Item;
208
+ };
209
+ /** What PATCH /v1/files/:id takes as its body. */
210
+ export type FilesUpdateBody = {
211
+ /** A new name. Refused with name_taken if the folder already has something called that. */
212
+ name?: string;
213
+ /** The folder to move it into, or null for the top of the app. */
214
+ parentId?: string | null;
215
+ /** public, private, or inherit to follow the folder it is in. */
216
+ visibility?: "private" | "public" | "inherit";
217
+ };
218
+ /** What PATCH /v1/files/:id answers with. */
219
+ export type FilesUpdateAnswer = {
220
+ item: Item;
221
+ };
222
+ /** What DELETE /v1/files/:id takes in its query. */
223
+ export type FilesDeleteQuery = {
224
+ /** true to delete for good instead of putting in the trash. */
225
+ permanent?: boolean;
226
+ /** Only if it is still at this revision. A file given new content since it was read is left alone, and the answer is 409 revision_changed: for a program keeping a copy, which must not remove a change it has not seen. */
227
+ ifRevision?: number;
228
+ };
229
+ /** What DELETE /v1/files/:id answers with. */
230
+ export type FilesDeleteAnswer = Ok;
231
+ /** What POST /v1/files/:id/restore answers with. */
232
+ export type FilesRestoreAnswer = {
233
+ item: Item;
234
+ };
235
+ /** What POST /v1/folders takes as its body. */
236
+ export type FoldersCreateBody = {
237
+ name: string;
238
+ /** The folder to make it in. Null, or left out, for the top of the app. */
239
+ parentId?: string | null;
240
+ /** What to do if the folder already has one of that name. */
241
+ ifExists?: "fail" | "use";
242
+ };
243
+ /** What POST /v1/folders answers with. */
244
+ export type FoldersCreateAnswer = {
245
+ item: Item;
246
+ };
247
+ /** What GET /v1/tree takes in its query. */
248
+ export type TreeListQuery = {
249
+ /** The folder to list under. Left out, the top of the app (or of the folder the key is confined to). */
250
+ parent?: string;
251
+ /** nextCursor from the page before. */
252
+ cursor?: string;
253
+ /** How many to return, 1 to 1000. */
254
+ limit?: number;
255
+ };
256
+ /** What GET /v1/tree answers with. */
257
+ export type TreeListAnswer = {
258
+ items: Array<Item>;
259
+ nextCursor: string | null;
260
+ /** Where to follow GET /v1/changes from once every page has been read. */
261
+ changesCursor: string | null;
262
+ };
263
+ /** What GET /v1/changes takes in its query. */
264
+ export type ChangesListQuery = {
265
+ /** cursor from the answer before, or changesCursor from GET /v1/tree. */
266
+ cursor?: string;
267
+ /** Seconds to wait for a change when there is none yet, 0 to 200. */
268
+ wait?: number;
269
+ /** How many changes to return, 1 to 1000. */
270
+ limit?: number;
271
+ };
272
+ /** What GET /v1/changes answers with. */
273
+ export type ChangesListAnswer = {
274
+ changes: Array<Change>;
275
+ /** Where to ask from next time. */
276
+ cursor: string;
277
+ /** True when there are more changes already: ask again at once. */
278
+ more: boolean;
279
+ };
280
+ /** What POST /v1/uploads takes as its body. */
281
+ export type UploadsBeginBody = {
282
+ name: string;
283
+ /** Exactly how many bytes will be sent. What arrives is measured, and that is what is counted. */
284
+ sizeBytes: number;
285
+ /** Left out, it is worked out from the name. */
286
+ contentType?: string;
287
+ /** The folder to put it in. Null, or left out, for the top of the app. */
288
+ parentId?: string | null;
289
+ /** What to do if the folder already has a file of that name. replace keeps the file's id and its public address. */
290
+ onConflict?: "rename" | "replace" | "fail";
291
+ /** Sizes to make of it, if it is an image, so they are ready when wanted: any of 64, 128, 256, 512, 1024. */
292
+ imageSizes?: Array<number>;
293
+ /** With onConflict replace: the file this is meant to replace, as you read it, by its id and revision. If the folder's file of that name is any other file, or this one at another revision, the upload is refused with 409 revision_changed, when it begins and again when it completes, and nothing is replaced. For a program keeping a copy, which must not write over a change it has not seen. */
294
+ replacing?: {
295
+ id: string;
296
+ revision: number;
297
+ };
298
+ /** How many bytes each part should be, from 8388608 (8 MiB) to 67108864 (64 MiB). Larger parts go faster on a fast line, because every request costs a round trip; smaller ones lose less when one fails on a slow line. Left out, a part is 8 MiB. A file so large that it would need more than 10,000 parts gets larger ones, and the answer's partBytes is what to cut it by. */
299
+ partBytes?: number;
300
+ /** Instead of partBytes: the file cut into blocks of your choosing, in order, each its size and SHA-256, adding up to sizeBytes. Up to 10000 blocks of up to 67108864 bytes (64 MiB). Each part is then one block. Cut where the content says (content-defined chunking), so that an edit changes few blocks, and an upload with onConflict replace sends only the blocks the file does not have already: those it has are copied inside storage, and listed in the answer's reused. Kept with the file, so its next replacement can do the same. The hashes are your word, as sha256 on completing is. */
301
+ blocks?: Array<{
302
+ /** How many bytes the block is. */
303
+ size: number;
304
+ /** The block's SHA-256 in hex. */
305
+ sha256: string;
306
+ }>;
307
+ };
308
+ /** What POST /v1/uploads answers with. */
309
+ export type UploadsBeginAnswer = {
310
+ upload: Upload;
311
+ /** Addresses for the first parts to send. Parts listed in reused are not among them. */
312
+ parts: Array<Part>;
313
+ /** For an upload begun with blocks: the parts not to send, because storage has them already, from the file this replaces, or because they repeat a block an earlier part sends. Empty otherwise. Nothing is taken from the file this replaces when the key may not read it, when the file has not been opened or changed in 90 days, or when copying it would take the account past 1000 GB copied this way in an hour: every block is sent then. */
314
+ reused: Array<number>;
315
+ };
316
+ /** What GET /v1/uploads/:id answers with. */
317
+ export type UploadsGetAnswer = {
318
+ upload: Upload;
319
+ /** The numbers of the parts storage has, counting those it has without their being sent: what is left to send is every other part not in reused. */
320
+ uploadedParts: Array<number>;
321
+ /** The blocks the upload was begun with, in order, so each can be checked against the file before it is sent. Null for an upload cut by partBytes. */
322
+ blocks: Array<{
323
+ size: number;
324
+ sha256: string;
325
+ }> | null;
326
+ /** As in the answer that began the upload: the parts not to send. */
327
+ reused: Array<number>;
328
+ };
329
+ /** What GET /v1/uploads/:id/parts takes in its query. */
330
+ export type UploadsPartsQuery = {
331
+ /** The first part wanted, counted from zero. */
332
+ from?: number;
333
+ count?: number;
334
+ };
335
+ /** What GET /v1/uploads/:id/parts answers with. */
336
+ export type UploadsPartsAnswer = {
337
+ parts: Array<Part>;
338
+ };
339
+ /** What POST /v1/uploads/:id/complete takes as its body. */
340
+ export type UploadsCompleteBody = {
341
+ /** The file's SHA-256 in hex, as you worked it out. Kept with the file as your word, since this service never sees the bytes, and given back as clientSha256, so a copy can be checked later without reading the file again. */
342
+ sha256?: string;
343
+ };
344
+ /** What POST /v1/uploads/:id/complete answers with. */
345
+ export type UploadsCompleteAnswer = {
346
+ item: Item;
347
+ } | Pending;
348
+ /** What DELETE /v1/uploads/:id answers with. */
349
+ export type UploadsCancelAnswer = Ok;
350
+ /** What GET /v1/files/:id/download takes in its query. */
351
+ export type FilesDownloadUrlQuery = {
352
+ /** true to have a browser show it, for the types that are safe to show. Anything else is saved, whatever is asked. */
353
+ inline?: boolean;
354
+ };
355
+ /** What GET /v1/files/:id/download answers with. */
356
+ export type FilesDownloadUrlAnswer = {
357
+ url: string;
358
+ expiresAt: string;
359
+ /** Whether the address will show the file or save it. */
360
+ inline: boolean;
361
+ contentType: string | null;
362
+ };
363
+ /** What GET /v1/files/:id/shards takes in its query. */
364
+ export type FilesShardsQuery = {
365
+ /** The first fragment wanted, counted from zero: 0, or the `next` of the page before. */
366
+ from?: number;
367
+ };
368
+ /** What GET /v1/files/:id/shards answers with. */
369
+ export type FilesShardsAnswer = ShardMap;
370
+ /** What GET /v1/files/:id/image takes in its query. */
371
+ export type FilesImageQuery = {
372
+ /** One of 64, 128, 256, 512, 1024. */
373
+ size: number;
374
+ };
375
+ /** What GET /v1/files/:id/image answers with. */
376
+ export type FilesImageAnswer = {
377
+ status: "ready";
378
+ url: string;
379
+ width: number;
380
+ height: number;
381
+ expiresAt: string;
382
+ } | {
383
+ status: "pending";
384
+ retryAfterSeconds: number;
385
+ };
386
+ /** What GET /v1/usage answers with. */
387
+ export type UsageGetAnswer = {
388
+ app: {
389
+ storedBytes: number;
390
+ fileCount: number;
391
+ /** The ceiling set for this app, or null for none. */
392
+ storageCapBytes: number | null;
393
+ apiCallsThisMonth: number;
394
+ } | null;
395
+ account: {
396
+ plan: string;
397
+ storageUsedBytes: number;
398
+ storageIncludedBytes: number;
399
+ /** Where uploads are refused: what the plan includes, plus what the account's spending limit allows beyond it. */
400
+ storageLimitBytes: number;
401
+ downloadedBytesThisMonth: number;
402
+ downloadsIncludedBytes: number;
403
+ apiCallsThisMonth: number;
404
+ apiCallsIncluded: number;
405
+ };
406
+ };
407
+ /** What GET /v1/me answers with. */
408
+ export type MeGetAnswer = {
409
+ /** key: an app's key, on a server. token: a token a key made for a web page. device: a person, signed in with filefreak login. */
410
+ via: "key" | "token" | "device";
411
+ account: {
412
+ username: string;
413
+ /** For a device only. Null for a key and a token. */
414
+ email: string | null;
415
+ plan: string;
416
+ };
417
+ /** The app a key or a token acts for. Null for a device, which uses the personal drive. */
418
+ app: {
419
+ id: string;
420
+ name: string;
421
+ } | null;
422
+ /** The device, by the name it signed in with. Null for a key and a token. */
423
+ device: {
424
+ id: string;
425
+ name: string;
426
+ } | null;
427
+ /** What it may do. A device may do everything its person may. */
428
+ scopes: Array<"files:read" | "files:write" | "files:delete" | "usage:read">;
429
+ /** The folder it is kept to, or null for everything its app holds, or the whole drive for a device. */
430
+ folderId: string | null;
431
+ };
432
+ /** What POST /v1/shares takes as its body. */
433
+ export type SharesCreateBody = {
434
+ /** The file or folder to open. */
435
+ itemId: string;
436
+ /** Asked for before anything is shown. */
437
+ password?: string | null;
438
+ /** Days from now. Left out, it does not end by date. */
439
+ expiresInDays?: number | null;
440
+ /** Left out, any number. */
441
+ maxDownloads?: number | null;
442
+ };
443
+ /** What POST /v1/shares answers with. */
444
+ export type SharesCreateAnswer = {
445
+ share: Share;
446
+ };
447
+ /** What GET /v1/shares takes in its query. */
448
+ export type SharesListQuery = {
449
+ /** Only the links on this file or folder. */
450
+ itemId?: string;
451
+ };
452
+ /** What GET /v1/shares answers with. */
453
+ export type SharesListAnswer = {
454
+ shares: Array<Share>;
455
+ };
456
+ /** What DELETE /v1/shares/:id answers with. */
457
+ export type SharesRevokeAnswer = Ok;
458
+ /** What GET /v1/sites answers with. */
459
+ export type SitesListAnswer = {
460
+ sites: Array<Site>;
461
+ /** How many sites the account's plan allows. 0 on a plan without sites. */
462
+ maxSites: number;
463
+ /** The domain sites are served under, or null while FileFreak serves none. */
464
+ domain: string | null;
465
+ };
466
+ /** What POST /v1/sites takes as its body. */
467
+ export type SitesCreateBody = {
468
+ name: string;
469
+ /** Serve /index.html for a path with no file and no extension, as an app that draws its own pages needs. */
470
+ singlePage?: boolean;
471
+ };
472
+ /** What POST /v1/sites answers with. */
473
+ export type SitesCreateAnswer = {
474
+ site: Site;
475
+ };
476
+ /** What GET /v1/sites/:id answers with. */
477
+ export type SitesGetAnswer = {
478
+ site: Site;
479
+ deploys: Array<SiteDeploy>;
480
+ };
481
+ /** What POST /v1/sites/:id/deploys takes as its body. */
482
+ export type SitesStartDeployBody = {
483
+ files: Array<{
484
+ /** Relative to the folder being deployed, with forward slashes: "index.html", "docs/a.html". */
485
+ path: string;
486
+ sizeBytes: number;
487
+ /** The file's SHA-256 in hex. Bytes the site has stored already, under this SHA-256, are not sent again. */
488
+ sha256: string;
489
+ }>;
490
+ /** True when further files will be declared with sites.declareFiles. */
491
+ more: boolean;
492
+ };
493
+ /** What POST /v1/sites/:id/deploys answers with. */
494
+ export type SitesStartDeployAnswer = {
495
+ deploy: SiteDeploy;
496
+ /** The files whose bytes the site does not have yet, one for each SHA-256. Empty files are never in it: there is nothing to send. */
497
+ send: Array<SendTo>;
498
+ };
499
+ /** What POST /v1/sites/deploys/:id/files takes as its body. */
500
+ export type SitesDeclareFilesBody = {
501
+ files: Array<{
502
+ /** Relative to the folder being deployed, with forward slashes: "index.html", "docs/a.html". */
503
+ path: string;
504
+ sizeBytes: number;
505
+ /** The file's SHA-256 in hex. Bytes the site has stored already, under this SHA-256, are not sent again. */
506
+ sha256: string;
507
+ }>;
508
+ /** False on the last list. */
509
+ more: boolean;
510
+ };
511
+ /** What POST /v1/sites/deploys/:id/files answers with. */
512
+ export type SitesDeclareFilesAnswer = {
513
+ deploy: SiteDeploy;
514
+ /** The files whose bytes the site does not have yet, one for each SHA-256. Empty files are never in it: there is nothing to send. */
515
+ send: Array<SendTo>;
516
+ };
517
+ /** What POST /v1/sites/deploys/:id/send takes as its body. */
518
+ export type SitesSendAgainBody = {
519
+ sha256: Array<string>;
520
+ };
521
+ /** What POST /v1/sites/deploys/:id/send answers with. */
522
+ export type SitesSendAgainAnswer = {
523
+ send: Array<SendTo>;
524
+ };
525
+ /** What POST /v1/sites/deploys/:id/finish takes as its body. */
526
+ export type SitesFinishDeployBody = {
527
+ /** Make it the deploy visitors are served. Left out, it is. */
528
+ live?: boolean;
529
+ };
530
+ /** What POST /v1/sites/deploys/:id/finish answers with. */
531
+ export type SitesFinishDeployAnswer = {
532
+ deploy: SiteDeploy;
533
+ } | Pending;
534
+ /** What DELETE /v1/sites/deploys/:id answers with. */
535
+ export type SitesRemoveDeployAnswer = Ok;
536
+ /** What POST /v1/sites/:id/live takes as its body. */
537
+ export type SitesSetLiveBody = {
538
+ deployId: string | null;
539
+ };
540
+ /** What POST /v1/sites/:id/live answers with. */
541
+ export type SitesSetLiveAnswer = {
542
+ site: Site;
543
+ };
544
+ /** What POST /v1/tokens takes as its body. */
545
+ export type TokensCreateBody = {
546
+ /** What the token may do, of what the key may. Left out, all the key may. */
547
+ scopes?: Array<"files:read" | "files:write" | "files:delete" | "usage:read">;
548
+ /** A folder to keep the token to: the key's own, or one inside it. Left out, everything the key reaches. */
549
+ folderId?: string | null;
550
+ /** How long it works, from 60 seconds to 3600. */
551
+ expiresInSeconds?: number;
552
+ };
553
+ /** What POST /v1/tokens answers with. */
554
+ export type TokensCreateAnswer = {
555
+ /** Sent as a key is: Authorization: Bearer fft_... */
556
+ token: string;
557
+ expiresAt: string;
558
+ scopes: Array<"files:read" | "files:write" | "files:delete" | "usage:read">;
559
+ /** The folder it is kept to, or null for everything its key reaches. */
560
+ folderId: string | null;
561
+ };
562
+ export interface Operation {
563
+ method: "GET" | "POST" | "PATCH" | "DELETE";
564
+ /** With :id where an id goes. */
565
+ path: string;
566
+ /** An Idempotency-Key is honoured: the same request sent again with the same key makes nothing twice. */
567
+ idempotent: boolean;
568
+ /** Sending it again after no answer can do nothing twice, with no Idempotency-Key. */
569
+ repeatable: boolean;
570
+ }
571
+ /** Every endpoint, by the name its entry gives it. */
572
+ export declare const OPERATIONS: {
573
+ readonly "files.list": {
574
+ readonly method: "GET";
575
+ readonly path: "/v1/files";
576
+ readonly idempotent: false;
577
+ readonly repeatable: false;
578
+ };
579
+ readonly "files.byPath": {
580
+ readonly method: "GET";
581
+ readonly path: "/v1/files/by-path";
582
+ readonly idempotent: false;
583
+ readonly repeatable: false;
584
+ };
585
+ readonly "files.get": {
586
+ readonly method: "GET";
587
+ readonly path: "/v1/files/:id";
588
+ readonly idempotent: false;
589
+ readonly repeatable: false;
590
+ };
591
+ readonly "files.update": {
592
+ readonly method: "PATCH";
593
+ readonly path: "/v1/files/:id";
594
+ readonly idempotent: false;
595
+ readonly repeatable: false;
596
+ };
597
+ readonly "files.delete": {
598
+ readonly method: "DELETE";
599
+ readonly path: "/v1/files/:id";
600
+ readonly idempotent: false;
601
+ readonly repeatable: false;
602
+ };
603
+ readonly "files.restore": {
604
+ readonly method: "POST";
605
+ readonly path: "/v1/files/:id/restore";
606
+ readonly idempotent: false;
607
+ readonly repeatable: false;
608
+ };
609
+ readonly "folders.create": {
610
+ readonly method: "POST";
611
+ readonly path: "/v1/folders";
612
+ readonly idempotent: true;
613
+ readonly repeatable: false;
614
+ };
615
+ readonly "tree.list": {
616
+ readonly method: "GET";
617
+ readonly path: "/v1/tree";
618
+ readonly idempotent: false;
619
+ readonly repeatable: false;
620
+ };
621
+ readonly "changes.list": {
622
+ readonly method: "GET";
623
+ readonly path: "/v1/changes";
624
+ readonly idempotent: false;
625
+ readonly repeatable: false;
626
+ };
627
+ readonly "uploads.begin": {
628
+ readonly method: "POST";
629
+ readonly path: "/v1/uploads";
630
+ readonly idempotent: true;
631
+ readonly repeatable: false;
632
+ };
633
+ readonly "uploads.get": {
634
+ readonly method: "GET";
635
+ readonly path: "/v1/uploads/:id";
636
+ readonly idempotent: false;
637
+ readonly repeatable: false;
638
+ };
639
+ readonly "uploads.parts": {
640
+ readonly method: "GET";
641
+ readonly path: "/v1/uploads/:id/parts";
642
+ readonly idempotent: false;
643
+ readonly repeatable: false;
644
+ };
645
+ readonly "uploads.complete": {
646
+ readonly method: "POST";
647
+ readonly path: "/v1/uploads/:id/complete";
648
+ readonly idempotent: false;
649
+ readonly repeatable: true;
650
+ };
651
+ readonly "uploads.cancel": {
652
+ readonly method: "DELETE";
653
+ readonly path: "/v1/uploads/:id";
654
+ readonly idempotent: false;
655
+ readonly repeatable: false;
656
+ };
657
+ readonly "files.downloadUrl": {
658
+ readonly method: "GET";
659
+ readonly path: "/v1/files/:id/download";
660
+ readonly idempotent: false;
661
+ readonly repeatable: false;
662
+ };
663
+ readonly "files.shards": {
664
+ readonly method: "GET";
665
+ readonly path: "/v1/files/:id/shards";
666
+ readonly idempotent: false;
667
+ readonly repeatable: false;
668
+ };
669
+ readonly "files.image": {
670
+ readonly method: "GET";
671
+ readonly path: "/v1/files/:id/image";
672
+ readonly idempotent: false;
673
+ readonly repeatable: false;
674
+ };
675
+ readonly "usage.get": {
676
+ readonly method: "GET";
677
+ readonly path: "/v1/usage";
678
+ readonly idempotent: false;
679
+ readonly repeatable: false;
680
+ };
681
+ readonly "me.get": {
682
+ readonly method: "GET";
683
+ readonly path: "/v1/me";
684
+ readonly idempotent: false;
685
+ readonly repeatable: false;
686
+ };
687
+ readonly "shares.create": {
688
+ readonly method: "POST";
689
+ readonly path: "/v1/shares";
690
+ readonly idempotent: true;
691
+ readonly repeatable: false;
692
+ };
693
+ readonly "shares.list": {
694
+ readonly method: "GET";
695
+ readonly path: "/v1/shares";
696
+ readonly idempotent: false;
697
+ readonly repeatable: false;
698
+ };
699
+ readonly "shares.revoke": {
700
+ readonly method: "DELETE";
701
+ readonly path: "/v1/shares/:id";
702
+ readonly idempotent: false;
703
+ readonly repeatable: false;
704
+ };
705
+ readonly "sites.list": {
706
+ readonly method: "GET";
707
+ readonly path: "/v1/sites";
708
+ readonly idempotent: false;
709
+ readonly repeatable: false;
710
+ };
711
+ readonly "sites.create": {
712
+ readonly method: "POST";
713
+ readonly path: "/v1/sites";
714
+ readonly idempotent: true;
715
+ readonly repeatable: false;
716
+ };
717
+ readonly "sites.get": {
718
+ readonly method: "GET";
719
+ readonly path: "/v1/sites/:id";
720
+ readonly idempotent: false;
721
+ readonly repeatable: false;
722
+ };
723
+ readonly "sites.startDeploy": {
724
+ readonly method: "POST";
725
+ readonly path: "/v1/sites/:id/deploys";
726
+ readonly idempotent: true;
727
+ readonly repeatable: false;
728
+ };
729
+ readonly "sites.declareFiles": {
730
+ readonly method: "POST";
731
+ readonly path: "/v1/sites/deploys/:id/files";
732
+ readonly idempotent: true;
733
+ readonly repeatable: false;
734
+ };
735
+ readonly "sites.sendAgain": {
736
+ readonly method: "POST";
737
+ readonly path: "/v1/sites/deploys/:id/send";
738
+ readonly idempotent: false;
739
+ readonly repeatable: true;
740
+ };
741
+ readonly "sites.finishDeploy": {
742
+ readonly method: "POST";
743
+ readonly path: "/v1/sites/deploys/:id/finish";
744
+ readonly idempotent: false;
745
+ readonly repeatable: true;
746
+ };
747
+ readonly "sites.removeDeploy": {
748
+ readonly method: "DELETE";
749
+ readonly path: "/v1/sites/deploys/:id";
750
+ readonly idempotent: false;
751
+ readonly repeatable: false;
752
+ };
753
+ readonly "sites.setLive": {
754
+ readonly method: "POST";
755
+ readonly path: "/v1/sites/:id/live";
756
+ readonly idempotent: false;
757
+ readonly repeatable: true;
758
+ };
759
+ readonly "tokens.create": {
760
+ readonly method: "POST";
761
+ readonly path: "/v1/tokens";
762
+ readonly idempotent: false;
763
+ readonly repeatable: true;
764
+ };
765
+ };
766
+ export type OperationName = keyof typeof OPERATIONS;
767
+ /** What a function below hands the client: what goes in the address, the query and the body. */
768
+ export interface Input {
769
+ params?: Record<string, string>;
770
+ query?: object | undefined;
771
+ body?: object | undefined;
772
+ }
773
+ export type Call = (operation: OperationName, input: Input, options?: CallOptions) => Promise<unknown>;
774
+ /** Every endpoint as a function, grouped by what it is about. */
775
+ export declare function bind(call: Call): {
776
+ files: {
777
+ /**
778
+ * List a folder.
779
+ *
780
+ * What is in a folder, a page at a time: folders first, then files, each by name. Pass nextCursor back as cursor for the next page; when it is null there is no more. Things in the trash are not listed. A page never repeats or skips something because of what was added or removed between two requests.
781
+ *
782
+ * GET /v1/files. Needs the scope files:read.
783
+ */
784
+ list: (query?: FilesListQuery, options?: CallOptions) => Promise<FilesListAnswer>;
785
+ /**
786
+ * A file or folder by its path.
787
+ *
788
+ * Found by the names of the folders down to it from the top of the app (or of the folder the key is confined to), separated by /. A name matches whatever its case, as names in one folder do. Nothing in the trash is found, nor anything inside something that is.
789
+ *
790
+ * GET /v1/files/by-path. Needs the scope files:read.
791
+ */
792
+ byPath: (query: FilesByPathQuery, options?: CallOptions) => Promise<FilesByPathAnswer>;
793
+ /**
794
+ * One file or folder.
795
+ *
796
+ * By its id. Something in the trash is still returned, with trashedAt set.
797
+ *
798
+ * GET /v1/files/:id. Needs the scope files:read.
799
+ */
800
+ get: (id: string, options?: CallOptions) => Promise<FilesGetAnswer>;
801
+ /**
802
+ * Rename, move, or make public.
803
+ *
804
+ * Any of the three, in one request. They are applied in that order, each as its own change: if the second is refused the first has still happened, and the answer says which was refused. Moving a folder moves everything in it and is one change however much that is. Making a folder public makes everything in it public, except what has a setting of its own.
805
+ *
806
+ * PATCH /v1/files/:id. Needs the scope files:write.
807
+ */
808
+ update: (id: string, body: FilesUpdateBody, options?: CallOptions) => Promise<FilesUpdateAnswer>;
809
+ /**
810
+ * Put in the trash, or delete for good.
811
+ *
812
+ * Without permanent, the file or folder goes to the trash: it can be restored, it still counts toward storage, and it is removed for good after thirty days. With permanent=true it is removed now, with everything inside it, and cannot be brought back.
813
+ *
814
+ * DELETE /v1/files/:id. Needs the scope files:delete.
815
+ */
816
+ delete: (id: string, query?: FilesDeleteQuery, options?: CallOptions) => Promise<FilesDeleteAnswer>;
817
+ /**
818
+ * Take out of the trash.
819
+ *
820
+ * It goes back where it was. If that folder has gone it goes to the top, and if its name has been taken in the meantime it comes back with a number after it.
821
+ *
822
+ * POST /v1/files/:id/restore. Needs the scope files:write.
823
+ */
824
+ restore: (id: string, options?: CallOptions) => Promise<FilesRestoreAnswer>;
825
+ /**
826
+ * An address to download a file from.
827
+ *
828
+ * A short-lived address on storage itself. Anybody holding it can fetch the file until it expires, with no key, so it can be handed to a browser. Each one issued counts the file's size toward the month's downloads. For an address that does not expire, make the file public and use its publicUrl. A file under Shard Protection has no address: it is answered with 409 shard_protected, and read through its map with files.shards.
829
+ *
830
+ * GET /v1/files/:id/download. Needs the scope files:read.
831
+ */
832
+ downloadUrl: (id: string, query?: FilesDownloadUrlQuery, options?: CallOptions) => Promise<FilesDownloadUrlAnswer>;
833
+ /**
834
+ * A protected file's map.
835
+ *
836
+ * A file under Shard Protection is kept as fragments, each sealed with the file's own key and stored across several storage accounts. Its map says where each fragment is, up to 1,000 at a time, with the key. Fetch each fragment from its address (no key: the address is the permission), check and open it as the SDK's openFragment does, and write it at its place. The first page counts the file's size toward the month's downloads; later pages count nothing. Addresses work for four hours: before then, ask for the page again from the first fragment not yet fetched. The key is in this answer and nowhere else. This API never keeps it, and neither should a program, beyond the read.
837
+ *
838
+ * GET /v1/files/:id/shards. Needs the scope files:read.
839
+ */
840
+ shards: (id: string, query?: FilesShardsQuery, options?: CallOptions) => Promise<FilesShardsAnswer>;
841
+ /**
842
+ * An image at a smaller size.
843
+ *
844
+ * A copy of an image no more than size pixels on its longest side, as WebP, with the camera's metadata removed. The sizes are 64, 128, 256, 512, 1024 and no others. Each is made once, the first time it is asked for, and kept: until it has been made the answer is 202. Name the sizes when the image is uploaded and they are ready by the time they are wanted. For a public file, add ?size= to its publicUrl. A file under Shard Protection has no smaller copies, and is answered with 409 shard_protected.
845
+ *
846
+ * GET /v1/files/:id/image. Needs the scope files:read.
847
+ */
848
+ image: (id: string, query: FilesImageQuery, options?: CallOptions) => Promise<FilesImageAnswer>;
849
+ };
850
+ folders: {
851
+ /**
852
+ * Make a folder.
853
+ *
854
+ * Folders can be nested up to 32 deep. With ifExists=use, a folder of that name that is already there is returned and nothing is made, which is what a program that makes its folders on every start wants.
855
+ *
856
+ * POST /v1/folders. Needs the scope files:write. Honours an Idempotency-Key.
857
+ */
858
+ create: (body: FoldersCreateBody, options?: CallOptions) => Promise<FoldersCreateAnswer>;
859
+ };
860
+ tree: {
861
+ /**
862
+ * Everything under a folder.
863
+ *
864
+ * Every file and folder under a folder, at every level, a page at a time, each folder before what is inside it. Pass nextCursor back as cursor for the next page; when it is null there is no more. Things in the trash are not listed. Every page carries changesCursor: the place in GET /v1/changes from before the first page was read. Something that changes while the pages are being read may be listed or not, and is in the changes after that place either way. It is null for a key confined to a folder, which cannot follow the changes.
865
+ *
866
+ * GET /v1/tree. Needs the scope files:read.
867
+ */
868
+ list: (query?: TreeListQuery, options?: CallOptions) => Promise<TreeListAnswer>;
869
+ };
870
+ changes: {
871
+ /**
872
+ * What has changed.
873
+ *
874
+ * Every change to the app's files and folders after cursor, oldest first, each saying what the thing is now. A folder's change stands for everything in it: a folder moved, put in the trash or deleted is one change, and what is inside goes with it. Without cursor, no changes and the cursor for now. Pass cursor back each time; while more is true, ask again at once. With wait, an answer that would be empty waits up to that many seconds for something to change, and comes back empty, with the same cursor, if nothing does.
875
+ *
876
+ * To keep a copy: list everything with GET /v1/tree and keep its changesCursor, then apply each change in order. A change that is not live, or whose parentId is a folder the copy does not have, takes that thing and everything inside it out of the copy. A live change puts it in, or moves or renames it; a folder that was not in the copy is then listed with GET /v1/tree?parent= for what it holds, and if that is answered 404 the folder has gone since, which a later change says. A file whose revision has gone up has new content. Changes are kept for 30 days, and a cursor from before that is answered 410 cursor_expired: start again from a listing. A key confined to a folder cannot follow the changes, and lists its folder again instead.
877
+ *
878
+ * While the service is asleep, after a while with nobody using it, nothing can change, and a question with a cursor is answered without waking it: no changes, the same cursor, after the wait asked for. Asking is not counted as using the service, so a program that asks all night does not keep it awake.
879
+ *
880
+ * GET /v1/changes. Needs the scope files:read.
881
+ */
882
+ list: (query?: ChangesListQuery, options?: CallOptions) => Promise<ChangesListAnswer>;
883
+ };
884
+ uploads: {
885
+ /**
886
+ * Begin an upload.
887
+ *
888
+ * Says what is about to be sent, and answers with where to send it. A file's bytes never pass through this API: they go straight to storage, in parts, each with a plain PUT to the address given for it. The first addresses come back here; ask for the rest as they are needed. Then complete the upload, and it becomes a file.
889
+ *
890
+ * The room is set aside now, so an upload that would not fit is refused before a byte is sent. The parts can be sent by anything that can make a PUT request, including a browser that has never seen the API key: hand it the addresses.
891
+ *
892
+ * Into a folder under Shard Protection, which its owner turns on from the website, a file lands as an ordinary file, as it would anywhere else, and the service protects it within a few minutes: its content, and every kept version, are spread over the storage lanes as fragments. Until then it can be read like any other file. From then on it is read through its map (files.shards), and its clientSha256 is null. An upload from a program is not sealed as it is sent yet.
893
+ *
894
+ * POST /v1/uploads. Needs the scope files:write. Honours an Idempotency-Key.
895
+ */
896
+ begin: (body: UploadsBeginBody, options?: CallOptions) => Promise<UploadsBeginAnswer>;
897
+ /**
898
+ * An upload, and which parts have arrived.
899
+ *
900
+ * For carrying on after an interruption: storage itself says which parts it has, so nothing the client remembered is needed.
901
+ *
902
+ * GET /v1/uploads/:id. Needs the scope files:write.
903
+ */
904
+ get: (id: string, options?: CallOptions) => Promise<UploadsGetAnswer>;
905
+ /**
906
+ * Addresses for more parts.
907
+ *
908
+ * Addresses are given out a window at a time and each lasts half an hour. Ask again for any that have run out.
909
+ *
910
+ * GET /v1/uploads/:id/parts. Needs the scope files:write.
911
+ */
912
+ parts: (id: string, query?: UploadsPartsQuery, options?: CallOptions) => Promise<UploadsPartsAnswer>;
913
+ /**
914
+ * Finish an upload.
915
+ *
916
+ * Turns the parts into a file. Safe to call again: a second call for an upload that has finished answers with the same file. For a very large file storage may still be putting it together, and the answer is then 202 with how long to wait before asking again.
917
+ *
918
+ * POST /v1/uploads/:id/complete. Needs the scope files:write. Safe to send again.
919
+ */
920
+ complete: (id: string, body?: UploadsCompleteBody, options?: CallOptions) => Promise<UploadsCompleteAnswer>;
921
+ /**
922
+ * Cancel an upload.
923
+ *
924
+ * Whatever had arrived is deleted, and the room it held comes back at once.
925
+ *
926
+ * DELETE /v1/uploads/:id. Needs the scope files:write.
927
+ */
928
+ cancel: (id: string, options?: CallOptions) => Promise<UploadsCancelAnswer>;
929
+ };
930
+ usage: {
931
+ /**
932
+ * What the app is using.
933
+ *
934
+ * What this app holds, against the ceiling set for it if there is one; and what the account it belongs to has used this calendar month, across its personal files and all its apps, against what its plan includes. An app's files count toward the account's one storage allowance. For a device signed in with filefreak login, which uses the personal drive, app is null.
935
+ *
936
+ * GET /v1/usage. Needs the scope usage:read.
937
+ */
938
+ get: (options?: CallOptions) => Promise<UsageGetAnswer>;
939
+ };
940
+ me: {
941
+ /**
942
+ * Who this is.
943
+ *
944
+ * The account a key, a token or a device acts for, and what it may do there. A key's program and a page's token are told the account's username and plan, never its email address: only a device signed in with filefreak login, which is the person, is told that.
945
+ *
946
+ * GET /v1/me. Any key may call it.
947
+ */
948
+ get: (options?: CallOptions) => Promise<MeGetAnswer>;
949
+ };
950
+ shares: {
951
+ /**
952
+ * Make a share link.
953
+ *
954
+ * A link that opens one file or folder for whoever holds it, separate from making it public: a private file can have one. It can have a password, an end date and a number of downloads after which it stops. Share links are a person's, so only a device signed in with filefreak login can make them here, as on the website; an app's key cannot. A link to a file under Shard Protection is a shard link: whoever opens it is given the file's key with its map, so their browser can put the file back together, show it and save it. The storage it is kept in still gives nobody anything on its own.
955
+ *
956
+ * POST /v1/shares. Only a device signed in with filefreak login may call it. Honours an Idempotency-Key.
957
+ */
958
+ create: (body: SharesCreateBody, options?: CallOptions) => Promise<SharesCreateAnswer>;
959
+ /**
960
+ * List share links.
961
+ *
962
+ * The links on one file or folder, or every link the account has, newest first. Removed links are not listed. Only a device signed in with filefreak login.
963
+ *
964
+ * GET /v1/shares. Only a device signed in with filefreak login may call it.
965
+ */
966
+ list: (query?: SharesListQuery, options?: CallOptions) => Promise<SharesListAnswer>;
967
+ /**
968
+ * Remove a share link.
969
+ *
970
+ * It stops working with the next request, and cannot be brought back. Only a device signed in with filefreak login.
971
+ *
972
+ * DELETE /v1/shares/:id. Only a device signed in with filefreak login may call it.
973
+ */
974
+ revoke: (id: string, options?: CallOptions) => Promise<SharesRevokeAnswer>;
975
+ };
976
+ sites: {
977
+ /**
978
+ * List sites.
979
+ *
980
+ * The account's static sites, by name, with the deploy each serves. A site is a person's, so only a device signed in with filefreak login reaches sites, as on the website; an app's key cannot. Sites are part of Pro.
981
+ *
982
+ * GET /v1/sites. Only a device signed in with filefreak login may call it.
983
+ */
984
+ list: (options?: CallOptions) => Promise<SitesListAnswer>;
985
+ /**
986
+ * Make a site.
987
+ *
988
+ * A site with no deploy yet. Its name is its address: 3 to 40 lower-case letters, digits and single hyphens, and not a name FileFreak keeps, another account's username, or one that looks like another company's (invalid_site_name, site_name_taken). Refused with sites_need_pro on a plan without sites.
989
+ *
990
+ * POST /v1/sites. Only a device signed in with filefreak login may call it. Honours an Idempotency-Key.
991
+ */
992
+ create: (body: SitesCreateBody, options?: CallOptions) => Promise<SitesCreateAnswer>;
993
+ /**
994
+ * A site and its deploys.
995
+ *
996
+ * A site, and its deploys newest first. A site keeps its 10 newest deploys that have ended besides the live one.
997
+ *
998
+ * GET /v1/sites/:id. Only a device signed in with filefreak login may call it.
999
+ */
1000
+ get: (id: string, options?: CallOptions) => Promise<SitesGetAnswer>;
1001
+ /**
1002
+ * Begin a deploy.
1003
+ *
1004
+ * Begins a deploy with up to 1000 of its files: each one's path, size and SHA-256. Declare the rest with sites.declareFiles, more set to false on the last list. The answer says which files to send: PUT each one's bytes to its address, then call sites.finishDeploy. Bytes the site has stored already are not asked for. A deploy may have 20000 files, 100 MB each and 1 GB together, and what it adds counts as storage from the moment it is declared (quota_exceeded). An unfinished deploy nothing has asked about for an hour is given up on.
1005
+ *
1006
+ * POST /v1/sites/:id/deploys. Only a device signed in with filefreak login may call it. Honours an Idempotency-Key.
1007
+ */
1008
+ startDeploy: (id: string, body: SitesStartDeployBody, options?: CallOptions) => Promise<SitesStartDeployAnswer>;
1009
+ /**
1010
+ * Declare more of a deploy's files.
1011
+ *
1012
+ * The next 1000 files of a deploy at most, as sites.startDeploy takes them. A path declared twice is refused (path_declared_twice).
1013
+ *
1014
+ * POST /v1/sites/deploys/:id/files. Only a device signed in with filefreak login may call it. Honours an Idempotency-Key.
1015
+ */
1016
+ declareFiles: (id: string, body: SitesDeclareFilesBody, options?: CallOptions) => Promise<SitesDeclareFilesAnswer>;
1017
+ /**
1018
+ * Fresh addresses for a deploy's files.
1019
+ *
1020
+ * New addresses for files of an unfinished deploy whose bytes have not arrived, when the first ones ran out or a finish answered deploy_incomplete. Files whose bytes have arrived are left out.
1021
+ *
1022
+ * POST /v1/sites/deploys/:id/send. Only a device signed in with filefreak login may call it. Safe to send again.
1023
+ */
1024
+ sendAgain: (id: string, body: SitesSendAgainBody, options?: CallOptions) => Promise<SitesSendAgainAnswer>;
1025
+ /**
1026
+ * Finish a deploy.
1027
+ *
1028
+ * Storage puts each file in place and is asked its size, and the deploy is ready, and live if live is true. Safe to call again: storage may take longer than one request waits, and the answer is then 202 with how long to wait before asking again. A file whose bytes have not arrived, or arrived at another size, is answered with deploy_incomplete and the SHA-256s to send again.
1029
+ *
1030
+ * POST /v1/sites/deploys/:id/finish. Only a device signed in with filefreak login may call it. Safe to send again.
1031
+ */
1032
+ finishDeploy: (id: string, body?: SitesFinishDeployBody, options?: CallOptions) => Promise<SitesFinishDeployAnswer>;
1033
+ /**
1034
+ * Cancel or delete a deploy.
1035
+ *
1036
+ * Cancels a deploy that is uploading, and what it set aside is given back at once. Deletes one that has ended, with whatever bytes no other deploy of the site uses. Never the live one (deploy_live).
1037
+ *
1038
+ * DELETE /v1/sites/deploys/:id. Only a device signed in with filefreak login may call it.
1039
+ */
1040
+ removeDeploy: (id: string, options?: CallOptions) => Promise<SitesRemoveDeployAnswer>;
1041
+ /**
1042
+ * Choose the live deploy.
1043
+ *
1044
+ * Makes a ready deploy the one visitors are served, which is also how a site is rolled back; null takes the site offline. Visitors see the change within a minute.
1045
+ *
1046
+ * POST /v1/sites/:id/live. Only a device signed in with filefreak login may call it. Safe to send again.
1047
+ */
1048
+ setLive: (id: string, body: SitesSetLiveBody, options?: CallOptions) => Promise<SitesSetLiveAnswer>;
1049
+ };
1050
+ tokens: {
1051
+ /**
1052
+ * A token for a web page.
1053
+ *
1054
+ * A key belongs on a server, and one sent from a web page is refused, because anybody who opens the page can read it. A page that should reach this API itself, to upload straight from the browser or to list a folder, is given a token instead: the server makes one with its key and hands it to the page, which sends it as it would a key. A token may do what its key may, or less: the scopes asked for, inside the folder asked for, until it expires. It is checked against its key on every request, so revoking the key stops its tokens at once, and its calls count as the key's. Nothing about a token is kept, so making one is safe to send again. A token cannot make another. Once Pro has ended and a key can only read, it can still make tokens, which can only read too.
1055
+ *
1056
+ * POST /v1/tokens. Any key may call it. Safe to send again.
1057
+ */
1058
+ create: (body?: TokensCreateBody, options?: CallOptions) => Promise<TokensCreateAnswer>;
1059
+ };
1060
+ };