lustro-cli 0.1.0__py3-none-any.whl

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 (60) hide show
  1. lustro_cli/__init__.py +29 -0
  2. lustro_cli/cli.py +2460 -0
  3. lustro_cli/client.py +434 -0
  4. lustro_cli/discovery.py +1033 -0
  5. lustro_cli/exitcodes.py +25 -0
  6. lustro_cli/mcp.py +867 -0
  7. lustro_cli/wire/__init__.py +62 -0
  8. lustro_cli/wire/_schema.json +97 -0
  9. lustro_cli/wire/cursor-envelope.schema.json +28 -0
  10. lustro_cli/wire/error-envelope.schema.json +46 -0
  11. lustro_cli/wire/golden/cursor-delta.json +91 -0
  12. lustro_cli/wire/golden/cursor-reset.json +65 -0
  13. lustro_cli/wire/golden/cursor-unchanged.json +15 -0
  14. lustro_cli/wire/golden/error-envelope.json +7 -0
  15. lustro_cli/wire/golden/export-har-websocket.json +148 -0
  16. lustro_cli/wire/golden/export-har.json +359 -0
  17. lustro_cli/wire/golden/logs-delta.json +44 -0
  18. lustro_cli/wire/golden/logs-reset.json +73 -0
  19. lustro_cli/wire/golden/logs-unchanged.json +9 -0
  20. lustro_cli/wire/golden/meta.json +12 -0
  21. lustro_cli/wire/golden/prefs-delta.json +58 -0
  22. lustro_cli/wire/golden/prefs-files.json +64 -0
  23. lustro_cli/wire/golden/prefs-reset.json +58 -0
  24. lustro_cli/wire/golden/prefs-unchanged.json +4 -0
  25. lustro_cli/wire/golden/rules-list.json +44 -0
  26. lustro_cli/wire/golden/screen-tree-views.json +596 -0
  27. lustro_cli/wire/golden/screen-tree.json +689 -0
  28. lustro_cli/wire/golden/send-result.json +7 -0
  29. lustro_cli/wire/golden/senders-list.json +6 -0
  30. lustro_cli/wire/golden/sqlite-databases.json +37 -0
  31. lustro_cli/wire/golden/sqlite-exec.json +4 -0
  32. lustro_cli/wire/golden/sqlite-query.json +109 -0
  33. lustro_cli/wire/golden/sqlite-rows.json +109 -0
  34. lustro_cli/wire/golden/sqlite-schema.json +98 -0
  35. lustro_cli/wire/golden/sqlite-tables.json +57 -0
  36. lustro_cli/wire/golden/stream-delta.json +48 -0
  37. lustro_cli/wire/golden/stream-reset.json +66 -0
  38. lustro_cli/wire/golden/stream-unchanged.json +4 -0
  39. lustro_cli/wire/golden/transaction-image.json +43 -0
  40. lustro_cli/wire/golden/transaction.json +41 -0
  41. lustro_cli/wire/golden/websocket.json +37 -0
  42. lustro_cli/wire/golden/websockets-reset.json +89 -0
  43. lustro_cli/wire/golden/work-events.json +152 -0
  44. lustro_cli/wire/golden/work-item.json +118 -0
  45. lustro_cli/wire/golden/work-items.json +129 -0
  46. lustro_cli/wire/golden/work-metrics.json +40 -0
  47. lustro_cli/wire/logs.openapi.json +622 -0
  48. lustro_cli/wire/meta.schema.json +47 -0
  49. lustro_cli/wire/network.openapi.json +2458 -0
  50. lustro_cli/wire/pagination.schema.json +20 -0
  51. lustro_cli/wire/prefs.openapi.json +699 -0
  52. lustro_cli/wire/screen.openapi.json +512 -0
  53. lustro_cli/wire/sqlite.openapi.json +1233 -0
  54. lustro_cli/wire/stream-envelope.schema.json +33 -0
  55. lustro_cli/wire/sync.py +80 -0
  56. lustro_cli/wire/work.openapi.json +1188 -0
  57. lustro_cli-0.1.0.dist-info/METADATA +585 -0
  58. lustro_cli-0.1.0.dist-info/RECORD +60 -0
  59. lustro_cli-0.1.0.dist-info/WHEEL +4 -0
  60. lustro_cli-0.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,699 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Lustro Preferences debug tab",
5
+ "version": "1.2",
6
+ "description": "The app's SharedPreferences files and Preferences DataStores: the ones that the app registers, each with a value policy and a read-only flag, and, with discovery on, the other files in its shared_prefs directory, which are read-only by default, and the other Preferences DataStore files in its files/datastore directory, which are always read-only. A file's store says which kind it is: shared_prefs or preferences_datastore. The tab reads and writes a registered DataStore through the app's own instance; it reads a discovered one from its .preferences_pb file, because the app's DataStore would not see an edit to the file. A value policy says what the tab shows of the values: visible shows every value; mask_sensitive leaves out the value of a key that looks like it holds a secret, such as auth_token or password, as the Network tab's redaction finds them, except a boolean, float, or double value, which an app does not use for a secret, and shows a string value that is a JSON object or array with the values of its sensitive fields replaced by [REDACTED], at any depth, as the Network tab's redaction does in a JSON body; keys_only leaves out every value. A registered file can list keys whose values every policy leaves out, and, under mask_sensitive, keys whose values show whole although they look sensitive. A file that has the keysets of EncryptedSharedPreferences, read by a plain instance, shows its keys only and is read-only. Each file has a cursor that moves when a value changes, through the tab or through the app. The tab sees the app's changes to a registered file while Lustro is started; before API 30, a clear of a SharedPreferences file by the app shows only with the next change to the file. A discovered DataStore file's cursor moves when its bytes change. All routes are token-authenticated (Bearer header or HttpOnly cookie) and live under /api/v1/prefs. Errors use the shared error envelope."
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "/",
11
+ "description": "The Lustro debug server (loopback by default)."
12
+ }
13
+ ],
14
+ "paths": {
15
+ "/api/v1/prefs/files": {
16
+ "get": {
17
+ "operationId": "listPrefsFiles",
18
+ "summary": "List the files, with their policies and cursors.",
19
+ "description": "The registered SharedPreferences files and then the registered DataStores, in the order the app registered them, then the discovered SharedPreferences files and then the discovered DataStore files, each by name. Each one reads its file, to count the keys and to find an encrypted one. A file that can't be read, such as an EncryptedSharedPreferences whose key is gone, or a .preferences_pb file that is not a Preferences DataStore file, is listed with keyCount 0 and the reason in error.",
20
+ "responses": {
21
+ "200": {
22
+ "description": "The files.",
23
+ "content": {
24
+ "application/json": {
25
+ "schema": {
26
+ "type": "object",
27
+ "required": [
28
+ "items"
29
+ ],
30
+ "properties": {
31
+ "items": {
32
+ "type": "array",
33
+ "items": {
34
+ "$ref": "#/components/schemas/PrefsFile"
35
+ }
36
+ }
37
+ },
38
+ "additionalProperties": false
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "401": {
44
+ "$ref": "#/components/responses/Error"
45
+ },
46
+ "403": {
47
+ "$ref": "#/components/responses/Error"
48
+ },
49
+ "413": {
50
+ "$ref": "#/components/responses/Error"
51
+ },
52
+ "503": {
53
+ "$ref": "#/components/responses/Error"
54
+ }
55
+ }
56
+ }
57
+ },
58
+ "/api/v1/prefs/entries": {
59
+ "get": {
60
+ "operationId": "listPrefEntries",
61
+ "summary": "Poll a file: every entry, after its value policy.",
62
+ "description": "A cursor envelope. The first poll (no cursor, or a cursor of another file or from before an app restart) gets status=reset with every entry of the file, by key. A poll with the returned cursor gets status=unchanged with no items while the file stays the same, and status=delta with every entry again after a change. A value longer than 4096 characters (for a string set, all its strings together; for bytes, their base64) is cut, with truncated; GET entry returns it whole. 500 when the file can't be read.",
63
+ "parameters": [
64
+ {
65
+ "name": "store",
66
+ "in": "query",
67
+ "required": false,
68
+ "schema": {
69
+ "$ref": "#/components/schemas/PrefsStore"
70
+ },
71
+ "description": "The file's store, as GET files lists it. Without it, shared_prefs. 400 with field store when it is not one of the stores."
72
+ },
73
+ {
74
+ "name": "file",
75
+ "in": "query",
76
+ "required": true,
77
+ "schema": {
78
+ "type": "string",
79
+ "minLength": 1
80
+ },
81
+ "description": "The file's name, as GET files lists it. 400 with field file when it is missing or contains / or \\; 404 with field file when the store has no file of this name."
82
+ },
83
+ {
84
+ "name": "cursor",
85
+ "in": "query",
86
+ "required": false,
87
+ "schema": {
88
+ "type": "string"
89
+ },
90
+ "description": "Opaque cursor from the previous response for this file. Omit on the first poll."
91
+ }
92
+ ],
93
+ "responses": {
94
+ "200": {
95
+ "description": "Cursor envelope.",
96
+ "content": {
97
+ "application/json": {
98
+ "schema": {
99
+ "$ref": "#/components/schemas/PrefsCursorEnvelope"
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "400": {
105
+ "$ref": "#/components/responses/Error"
106
+ },
107
+ "401": {
108
+ "$ref": "#/components/responses/Error"
109
+ },
110
+ "403": {
111
+ "$ref": "#/components/responses/Error"
112
+ },
113
+ "404": {
114
+ "$ref": "#/components/responses/Error"
115
+ },
116
+ "413": {
117
+ "$ref": "#/components/responses/Error"
118
+ },
119
+ "500": {
120
+ "$ref": "#/components/responses/Error"
121
+ },
122
+ "503": {
123
+ "$ref": "#/components/responses/Error"
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "/api/v1/prefs/entry": {
129
+ "get": {
130
+ "operationId": "getPrefEntry",
131
+ "summary": "Get one entry, with its whole value.",
132
+ "description": "The same item as in entries, after the value policy, but never cut. 404 with field key when the file has no such key.",
133
+ "parameters": [
134
+ {
135
+ "name": "store",
136
+ "in": "query",
137
+ "required": false,
138
+ "schema": {
139
+ "$ref": "#/components/schemas/PrefsStore"
140
+ },
141
+ "description": "The file's store, as GET files lists it. Without it, shared_prefs. 400 with field store when it is not one of the stores."
142
+ },
143
+ {
144
+ "name": "file",
145
+ "in": "query",
146
+ "required": true,
147
+ "schema": {
148
+ "type": "string",
149
+ "minLength": 1
150
+ },
151
+ "description": "The file's name, as GET files lists it. 400 with field file when it is missing or contains / or \\; 404 with field file when the store has no file of this name."
152
+ },
153
+ {
154
+ "name": "key",
155
+ "in": "query",
156
+ "required": true,
157
+ "schema": {
158
+ "type": "string"
159
+ },
160
+ "description": "The key. It can be empty. 400 with field key when it is missing."
161
+ }
162
+ ],
163
+ "responses": {
164
+ "200": {
165
+ "description": "The entry.",
166
+ "content": {
167
+ "application/json": {
168
+ "schema": {
169
+ "type": "object",
170
+ "required": [
171
+ "item"
172
+ ],
173
+ "properties": {
174
+ "item": {
175
+ "$ref": "#/components/schemas/PrefEntry"
176
+ }
177
+ },
178
+ "additionalProperties": false
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "400": {
184
+ "$ref": "#/components/responses/Error"
185
+ },
186
+ "401": {
187
+ "$ref": "#/components/responses/Error"
188
+ },
189
+ "403": {
190
+ "$ref": "#/components/responses/Error"
191
+ },
192
+ "404": {
193
+ "$ref": "#/components/responses/Error"
194
+ },
195
+ "413": {
196
+ "$ref": "#/components/responses/Error"
197
+ },
198
+ "500": {
199
+ "$ref": "#/components/responses/Error"
200
+ },
201
+ "503": {
202
+ "$ref": "#/components/responses/Error"
203
+ }
204
+ }
205
+ }
206
+ },
207
+ "/api/v1/prefs/edit": {
208
+ "post": {
209
+ "operationId": "editPref",
210
+ "summary": "Write one value, with its type.",
211
+ "description": "Puts the value with the type's setter and waits until the file on disk has it, so the response shows what the file holds: a SharedPreferences file commits, and a DataStore updates its data through the app's instance. It adds the key, or replaces its value, also with a value of another type: then the app's getter of the old type throws a ClassCastException. The cursor moves when the value changes. A value that is masked or redacted for reading can still be written. 403 with code read_only and field file when the file is read-only. 400 with field key when the key is empty, and with field key, type, or value when one is missing or the value is not of the type, and with field type for a type that the file's store can't write. 500 when the write fails: for a SharedPreferences file, the instance's memory holds the value, and the app sees it until the process ends; a DataStore keeps what it had.",
212
+ "requestBody": {
213
+ "required": true,
214
+ "description": "The value to write.",
215
+ "content": {
216
+ "application/json": {
217
+ "schema": {
218
+ "type": "object",
219
+ "required": [
220
+ "file",
221
+ "key",
222
+ "type",
223
+ "value"
224
+ ],
225
+ "properties": {
226
+ "store": {
227
+ "$ref": "#/components/schemas/PrefsStore"
228
+ },
229
+ "file": {
230
+ "type": "string",
231
+ "description": "The file's name, as GET files lists it. 400 with field file when it is missing or contains / or \\; 404 with field file when the store has no file of this name."
232
+ },
233
+ "key": {
234
+ "type": "string",
235
+ "description": "The key. It can't be empty: an empty key is most often a client's mistake, such as a shell variable that did not expand. POST delete takes an empty key, to remove one that is already there."
236
+ },
237
+ "type": {
238
+ "$ref": "#/components/schemas/PrefWriteType"
239
+ },
240
+ "value": {
241
+ "type": [
242
+ "string",
243
+ "number",
244
+ "boolean",
245
+ "array"
246
+ ],
247
+ "items": {
248
+ "type": "string"
249
+ },
250
+ "description": "For string, a JSON string. For int and long, a whole number, or a string of one, in the type's range. For float and double, a number, or a string of one, in the type's range, or \"NaN\", \"Infinity\", or \"-Infinity\". For boolean, true or false, or a string of one. For string_set, a JSON array of strings; a repeated string is kept once. For bytes, a padded base64 string (RFC 4648); white space in it is dropped. null is not a value: POST delete removes a key."
251
+ }
252
+ }
253
+ }
254
+ }
255
+ }
256
+ },
257
+ "responses": {
258
+ "200": {
259
+ "description": "The entry as the file now holds it, after the value policy. A value longer than 4096 characters is cut, as in entries: read it whole with GET entry.",
260
+ "content": {
261
+ "application/json": {
262
+ "schema": {
263
+ "type": "object",
264
+ "required": [
265
+ "status",
266
+ "item"
267
+ ],
268
+ "properties": {
269
+ "status": {
270
+ "const": "ok"
271
+ },
272
+ "item": {
273
+ "$ref": "#/components/schemas/PrefEntry"
274
+ }
275
+ },
276
+ "additionalProperties": false
277
+ }
278
+ }
279
+ }
280
+ },
281
+ "400": {
282
+ "$ref": "#/components/responses/Error"
283
+ },
284
+ "401": {
285
+ "$ref": "#/components/responses/Error"
286
+ },
287
+ "403": {
288
+ "$ref": "#/components/responses/Error"
289
+ },
290
+ "404": {
291
+ "$ref": "#/components/responses/Error"
292
+ },
293
+ "413": {
294
+ "$ref": "#/components/responses/Error"
295
+ },
296
+ "500": {
297
+ "$ref": "#/components/responses/Error"
298
+ },
299
+ "503": {
300
+ "$ref": "#/components/responses/Error"
301
+ }
302
+ }
303
+ }
304
+ },
305
+ "/api/v1/prefs/delete": {
306
+ "post": {
307
+ "operationId": "deletePref",
308
+ "summary": "Remove one key.",
309
+ "description": "Removes the key, and waits until the file on disk has the change. The cursor moves when the key was there. 403 with code read_only and field file when the file is read-only.",
310
+ "requestBody": {
311
+ "required": true,
312
+ "description": "The key to remove.",
313
+ "content": {
314
+ "application/json": {
315
+ "schema": {
316
+ "type": "object",
317
+ "required": [
318
+ "file",
319
+ "key"
320
+ ],
321
+ "properties": {
322
+ "store": {
323
+ "$ref": "#/components/schemas/PrefsStore"
324
+ },
325
+ "file": {
326
+ "type": "string",
327
+ "description": "The file's name, as GET files lists it. 400 with field file when it is missing or contains / or \\; 404 with field file when the store has no file of this name."
328
+ },
329
+ "key": {
330
+ "type": "string",
331
+ "description": "The key. It can be empty."
332
+ }
333
+ }
334
+ }
335
+ }
336
+ }
337
+ },
338
+ "responses": {
339
+ "200": {
340
+ "description": "Removed, or not there.",
341
+ "content": {
342
+ "application/json": {
343
+ "schema": {
344
+ "type": "object",
345
+ "required": [
346
+ "status",
347
+ "deleted"
348
+ ],
349
+ "properties": {
350
+ "status": {
351
+ "const": "ok"
352
+ },
353
+ "deleted": {
354
+ "type": "boolean",
355
+ "description": "Whether the file had the key."
356
+ }
357
+ },
358
+ "additionalProperties": false
359
+ }
360
+ }
361
+ }
362
+ },
363
+ "400": {
364
+ "$ref": "#/components/responses/Error"
365
+ },
366
+ "401": {
367
+ "$ref": "#/components/responses/Error"
368
+ },
369
+ "403": {
370
+ "$ref": "#/components/responses/Error"
371
+ },
372
+ "404": {
373
+ "$ref": "#/components/responses/Error"
374
+ },
375
+ "413": {
376
+ "$ref": "#/components/responses/Error"
377
+ },
378
+ "500": {
379
+ "$ref": "#/components/responses/Error"
380
+ },
381
+ "503": {
382
+ "$ref": "#/components/responses/Error"
383
+ }
384
+ }
385
+ }
386
+ },
387
+ "/api/v1/prefs/clear": {
388
+ "post": {
389
+ "operationId": "clearPrefs",
390
+ "summary": "Remove every key of a file.",
391
+ "description": "Removes every key of the file, and waits until the file on disk has the change. The cursor moves when the file had a key, on every API level. 403 with code read_only and field file when the file is read-only. 400 with field confirm unless confirm is true.",
392
+ "requestBody": {
393
+ "required": true,
394
+ "description": "The file to clear.",
395
+ "content": {
396
+ "application/json": {
397
+ "schema": {
398
+ "type": "object",
399
+ "required": [
400
+ "file",
401
+ "confirm"
402
+ ],
403
+ "properties": {
404
+ "store": {
405
+ "$ref": "#/components/schemas/PrefsStore"
406
+ },
407
+ "file": {
408
+ "type": "string",
409
+ "description": "The file's name, as GET files lists it. 400 with field file when it is missing or contains / or \\; 404 with field file when the store has no file of this name."
410
+ },
411
+ "confirm": {
412
+ "const": true,
413
+ "description": "Must be true: clear removes every key of the file."
414
+ }
415
+ }
416
+ }
417
+ }
418
+ }
419
+ },
420
+ "responses": {
421
+ "200": {
422
+ "description": "The file is empty.",
423
+ "content": {
424
+ "application/json": {
425
+ "schema": {
426
+ "type": "object",
427
+ "required": [
428
+ "status",
429
+ "removed"
430
+ ],
431
+ "properties": {
432
+ "status": {
433
+ "const": "ok"
434
+ },
435
+ "removed": {
436
+ "type": "integer",
437
+ "minimum": 0,
438
+ "description": "How many keys the file had."
439
+ }
440
+ },
441
+ "additionalProperties": false
442
+ }
443
+ }
444
+ }
445
+ },
446
+ "400": {
447
+ "$ref": "#/components/responses/Error"
448
+ },
449
+ "401": {
450
+ "$ref": "#/components/responses/Error"
451
+ },
452
+ "403": {
453
+ "$ref": "#/components/responses/Error"
454
+ },
455
+ "404": {
456
+ "$ref": "#/components/responses/Error"
457
+ },
458
+ "413": {
459
+ "$ref": "#/components/responses/Error"
460
+ },
461
+ "500": {
462
+ "$ref": "#/components/responses/Error"
463
+ },
464
+ "503": {
465
+ "$ref": "#/components/responses/Error"
466
+ }
467
+ }
468
+ }
469
+ }
470
+ },
471
+ "components": {
472
+ "responses": {
473
+ "Error": {
474
+ "description": "Error envelope.",
475
+ "content": {
476
+ "application/json": {
477
+ "schema": {
478
+ "$ref": "#/components/schemas/ErrorEnvelope"
479
+ }
480
+ }
481
+ }
482
+ }
483
+ },
484
+ "schemas": {
485
+ "ErrorEnvelope": {
486
+ "type": "object",
487
+ "required": [
488
+ "error",
489
+ "message"
490
+ ],
491
+ "properties": {
492
+ "error": {
493
+ "type": "string",
494
+ "enum": [
495
+ "bad_request",
496
+ "unauthorized",
497
+ "forbidden",
498
+ "not_found",
499
+ "method_not_allowed",
500
+ "conflict",
501
+ "payload_too_large",
502
+ "unprocessable_entity",
503
+ "too_many_requests",
504
+ "internal_error",
505
+ "unavailable",
506
+ "timeout",
507
+ "error"
508
+ ],
509
+ "description": "Machine error type, e.g. bad_request, not_found, timeout."
510
+ },
511
+ "message": {
512
+ "type": "string"
513
+ },
514
+ "code": {
515
+ "type": "string"
516
+ },
517
+ "field": {
518
+ "type": "string"
519
+ },
520
+ "hint": {
521
+ "type": "string"
522
+ }
523
+ },
524
+ "additionalProperties": false
525
+ },
526
+ "ValuePolicy": {
527
+ "type": "string",
528
+ "enum": [
529
+ "visible",
530
+ "mask_sensitive",
531
+ "keys_only"
532
+ ],
533
+ "description": "What the tab shows of the values. visible: every value. mask_sensitive: every value but those of keys that look like they hold a secret; a boolean, float, or double value always shows. keys_only: no value."
534
+ },
535
+ "PrefsStore": {
536
+ "type": "string",
537
+ "enum": [
538
+ "shared_prefs",
539
+ "preferences_datastore"
540
+ ],
541
+ "description": "The kind of file. shared_prefs: a SharedPreferences file, shared_prefs/<name>.xml. preferences_datastore: a Preferences DataStore, files/datastore/<name>.preferences_pb for a discovered one."
542
+ },
543
+ "PrefsFile": {
544
+ "type": "object",
545
+ "required": [
546
+ "name",
547
+ "store",
548
+ "registered",
549
+ "policy",
550
+ "readOnly",
551
+ "encrypted",
552
+ "keyCount",
553
+ "cursor"
554
+ ],
555
+ "properties": {
556
+ "name": {
557
+ "type": "string",
558
+ "description": "The file's name, as the app passes it to getSharedPreferences or preferencesDataStore. With store, it picks the file in the other routes."
559
+ },
560
+ "store": {
561
+ "$ref": "#/components/schemas/PrefsStore"
562
+ },
563
+ "registered": {
564
+ "type": "boolean",
565
+ "description": "true for a file that the app registered, false for one that discovery found."
566
+ },
567
+ "policy": {
568
+ "$ref": "#/components/schemas/ValuePolicy"
569
+ },
570
+ "readOnly": {
571
+ "type": "boolean",
572
+ "description": "Whether edit, delete, and clear answer 403. Always true for a discovered DataStore file."
573
+ },
574
+ "encrypted": {
575
+ "type": "boolean",
576
+ "description": "Whether the file on disk is encrypted: the app registered an EncryptedSharedPreferences, or the file has its keysets. A file read without its keys is keys_only and read-only. Always false for a DataStore."
577
+ },
578
+ "keyCount": {
579
+ "type": "integer",
580
+ "minimum": 0
581
+ },
582
+ "cursor": {
583
+ "type": "string",
584
+ "description": "The file's cursor now. It is the cursor that entries returns, so a client can compare it with the one it polled with, to see that the file changed."
585
+ },
586
+ "error": {
587
+ "type": "string",
588
+ "description": "Only for a file that can't be read: why."
589
+ }
590
+ },
591
+ "additionalProperties": false
592
+ },
593
+ "PrefsCursorEnvelope": {
594
+ "type": "object",
595
+ "required": [
596
+ "cursor",
597
+ "status"
598
+ ],
599
+ "properties": {
600
+ "cursor": {
601
+ "type": "string",
602
+ "description": "Opaque cursor token. Echo it on the next poll of the same file."
603
+ },
604
+ "status": {
605
+ "type": "string",
606
+ "enum": [
607
+ "delta",
608
+ "unchanged",
609
+ "reset"
610
+ ]
611
+ },
612
+ "items": {
613
+ "type": "array",
614
+ "items": {
615
+ "$ref": "#/components/schemas/PrefEntry"
616
+ },
617
+ "description": "Every entry of the file, by key. Omitted for unchanged."
618
+ }
619
+ },
620
+ "additionalProperties": false
621
+ },
622
+ "PrefType": {
623
+ "type": "string",
624
+ "enum": [
625
+ "string",
626
+ "int",
627
+ "long",
628
+ "float",
629
+ "double",
630
+ "boolean",
631
+ "string_set",
632
+ "bytes",
633
+ "unknown"
634
+ ],
635
+ "description": "The type of a value: a SharedPreferences getter's, or for a Preferences DataStore also double and bytes (a byte array, DataStore 1.1 and newer). string_set is a Set<String>. unknown is a value that only a custom SharedPreferences implementation can hold, written as its text."
636
+ },
637
+ "PrefWriteType": {
638
+ "type": "string",
639
+ "enum": [
640
+ "string",
641
+ "int",
642
+ "long",
643
+ "float",
644
+ "double",
645
+ "boolean",
646
+ "string_set",
647
+ "bytes"
648
+ ],
649
+ "description": "The type to write the value with. A shared_prefs file takes string, int, long, float, boolean, and string_set, its setters' types; a preferences_datastore file takes double and bytes too. A DataStore before 1.1 can't write bytes: the edit is then a 500."
650
+ },
651
+ "PrefEntry": {
652
+ "type": "object",
653
+ "required": [
654
+ "key",
655
+ "type",
656
+ "bytes"
657
+ ],
658
+ "properties": {
659
+ "key": {
660
+ "type": "string"
661
+ },
662
+ "type": {
663
+ "$ref": "#/components/schemas/PrefType"
664
+ },
665
+ "value": {
666
+ "description": "Absent when masked, and for an unknown value that is null. When redacted, the string with the values of its sensitive JSON fields replaced. A string, a number, a boolean, or for string_set an array of strings, sorted. A long beyond 2^53 - 1 either way, which a JavaScript number can't hold, is the string of its digits. A float or a double that is not finite is the string \"NaN\", \"Infinity\", or \"-Infinity\". Bytes are a padded base64 string.",
667
+ "type": [
668
+ "string",
669
+ "number",
670
+ "boolean",
671
+ "array"
672
+ ],
673
+ "items": {
674
+ "type": "string"
675
+ }
676
+ },
677
+ "bytes": {
678
+ "type": "integer",
679
+ "minimum": 0,
680
+ "description": "The size of the whole value: a string's UTF-8 bytes, the sum of those of a set's strings, a byte array's length, or 4 for int and float, 8 for long and double, and 1 for boolean."
681
+ },
682
+ "masked": {
683
+ "const": true,
684
+ "description": "Only when the value policy leaves the value out."
685
+ },
686
+ "redacted": {
687
+ "const": true,
688
+ "description": "Only under mask_sensitive, for a string value that is a JSON object or array with a sensitive field: value has the values of those fields, at any depth, replaced by [REDACTED], except a boolean or a null, and is rebuilt from the parse, so it is compact, and a number in it comes as the parser read it: 1.0 as 1, and an integer outside the range of a 64-bit long as a double, with fewer digits. bytes is the size of the value in the file. Never with masked. A client must not write the value back: it would replace the secrets with the placeholder."
689
+ },
690
+ "truncated": {
691
+ "const": true,
692
+ "description": "Only in entries and in the item of the POST edit response, when the value was cut at 4096 characters; bytes are cut at a whole base64 quantum, so the cut text still decodes. GET entry returns it whole."
693
+ }
694
+ },
695
+ "additionalProperties": false
696
+ }
697
+ }
698
+ }
699
+ }