calmlens 0.1.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.
data/sig/types.rbs ADDED
@@ -0,0 +1,682 @@
1
+ # Request and response shapes of the CalmLens API, mirroring the Zod schemas in packages/shared/src.
2
+ #
3
+ # Options (`*_options`, `*_input`) are the snake_case Symbol keys the SDK documents. At runtime the
4
+ # SDK also accepts camelCase and String keys, which these records do not describe.
5
+ #
6
+ # Responses keep the API's camelCase String keys. Fields marked optional (`?"key"`) can be missing
7
+ # from the JSON; `T?` values can be null. Records whose variants differ by `status` (category,
8
+ # qualifier and feature results) are one record with every variant's keys optional, because Steep
9
+ # cannot narrow a union of records on a key's value: read `status` first, then the keys it names.
10
+ module CalmLens
11
+ # Any JSON value the API returns where it allows arbitrary JSON (metadata values, error details).
12
+ type json_value = String | Integer | Float | bool | nil | Array[json_value] | Hash[String, json_value]
13
+ # Any value the SDK can encode as JSON.
14
+ type json_input = String | Integer | Float | bool | nil | Array[json_input] | Hash[String | Symbol, json_input]
15
+ # A JSON number: whole numbers parse as Integer, others as Float.
16
+ type number = Integer | Float
17
+
18
+ # Per-call settings every method accepts under `request_options:`.
19
+ type request_options = {
20
+ ?idempotency_key: String,
21
+ ?timeout: number,
22
+ ?open_timeout: number,
23
+ ?max_retries: Integer
24
+ }
25
+
26
+ # ---- Assets (Asset.ts) ----------------------------------------------------------------------
27
+
28
+ # Where the asset is in the pipeline.
29
+ type asset_processing_status = "uploading" | "processing" | "done" | "failed"
30
+ # The moderation decision in force: a reviewer's when there is one, else the automated one.
31
+ type asset_moderation_status = "pending" | "approved" | "rejected"
32
+ # What the policy did with flagged content (never `ignore`, unlike `flagged_content_action`).
33
+ type asset_moderation_action = "alert" | "hide" | "purge"
34
+ type asset_reviewer_action = "approved" | "rejected"
35
+ # Whether CalmLens holds the content: only until processing finishes, retained, or deleted.
36
+ type asset_content_status = "temporary" | "stored" | "removed"
37
+ type asset_content_removal_reason = "policy" | "retention" | "requested" | "parent-removed" | "disposed"
38
+ type asset_type = "image" | "video" | "audio" | "plaintext-document" | "multimedia-document" | "website" | "file"
39
+ type asset_visibility = "public" | "private"
40
+ # FLAGGED_CONTENT_ACTION_SCHEMA in Project.ts.
41
+ type flagged_content_action = "ignore" | "alert" | "hide" | "purge"
42
+
43
+ # A custom metadata item. `value` is any JSON value you chose.
44
+ type metadata_item = { "id" => String, "value" => json_value }
45
+ # A metadata item to send. Keys inside `metadata` are sent unchanged, so use `id:` and `value:`.
46
+ type metadata_item_input = { id: String, value: json_input }
47
+
48
+ # ProcessingFeatures.ts: optional analyses to run, keyed by feature. Every feature is off unless
49
+ # `enabled` is true.
50
+ type processing_features_input = {
51
+ ?ocr: { enabled: bool }?,
52
+ ?person_detection: { enabled: bool }?,
53
+ ?face_detection: { enabled: bool, ?age_estimation: bool }?
54
+ }
55
+ type processing_options_input = {
56
+ ?keep_content_after_processing: bool?,
57
+ ?flagged_content_policy: { action: flagged_content_action }?,
58
+ ?features: processing_features_input?
59
+ }
60
+
61
+ type processing_features = {
62
+ ?"ocr" => { "enabled" => bool }?,
63
+ ?"personDetection" => { "enabled" => bool }?,
64
+ ?"faceDetection" => { "enabled" => bool, ?"ageEstimation" => bool }?
65
+ }
66
+ # The processing options an asset was uploaded with.
67
+ type processing_options = {
68
+ ?"keepContentAfterProcessing" => bool?,
69
+ ?"flaggedContentPolicy" => { "action" => flagged_content_action }?,
70
+ ?"features" => processing_features?
71
+ }
72
+
73
+ type checksums = {
74
+ ?"md5" => String?,
75
+ ?"sha1" => String?,
76
+ ?"sha256" => String?,
77
+ ?"sha384" => String?,
78
+ ?"sha512" => String?
79
+ }
80
+ type image_data = { ?"perceptualHash" => String?, ?"width" => Integer?, ?"height" => Integer? }
81
+ type preview_image = {
82
+ "fileFormat" => String?,
83
+ "thumbhash" => String?,
84
+ "averageColor" => String?,
85
+ "width" => Integer?,
86
+ "height" => Integer?
87
+ }
88
+ type safety_hold = { "placedAt" => Integer, "reason" => "suspected-illegal-content", ?"disposedAt" => Integer? }
89
+ # `type: "string"` carries the text in `content`; `type: "document"` stores it under `id`.
90
+ type extracted_text = { "type" => "string" | "document", ?"content" => String, ?"id" => String }
91
+
92
+ # ASSET_PROCESSING_SCHEMA. Epoch times are milliseconds.
93
+ type asset_processing = {
94
+ "status" => asset_processing_status,
95
+ "updatedAt" => Integer?,
96
+ # Parts of a multipart upload received so far; null otherwise.
97
+ "uploadPartsReceived" => Integer?
98
+ }
99
+ # ASSET_MODERATION_SCHEMA. `action` is kept after a reviewer decides.
100
+ type asset_moderation = {
101
+ "status" => asset_moderation_status,
102
+ "action" => asset_moderation_action?,
103
+ # Why automated moderation rejected the asset.
104
+ "note" => String?,
105
+ "reviewerAction" => asset_reviewer_action?,
106
+ "reviewerNote" => String?,
107
+ "reviewerUserId" => String?,
108
+ "reviewedAt" => Integer?,
109
+ "decidedAt" => Integer?,
110
+ "report" => classification_report?
111
+ }
112
+ # ASSET_CONTENT_SCHEMA. `format` is the MIME type.
113
+ type asset_content = {
114
+ "status" => asset_content_status,
115
+ "removalReason" => asset_content_removal_reason?,
116
+ "updatedAt" => Integer?,
117
+ "safetyHold" => safety_hold?,
118
+ "format" => String?,
119
+ "extension" => String?,
120
+ "sizeInBytes" => Integer?,
121
+ "checksums" => checksums?,
122
+ "image" => image_data?,
123
+ "previewImage" => preview_image?,
124
+ "extractedText" => extracted_text?
125
+ }
126
+
127
+ type asset = {
128
+ "id" => String,
129
+ "projectId" => String,
130
+ ?"userId" => String?,
131
+ ?"parentId" => String?,
132
+ ?"folderId" => String?,
133
+ ?"uploadPresetId" => String?,
134
+ "createdAt" => Integer,
135
+ ?"updatedAt" => Integer,
136
+ "name" => String,
137
+ ?"description" => String?,
138
+ ?"externalId" => String?,
139
+ ?"externalUrl" => String?,
140
+ "type" => asset_type,
141
+ ?"metadata" => Array[metadata_item]?,
142
+ ?"tags" => Array[String]?,
143
+ ?"processingOptions" => processing_options?,
144
+ ?"visibility" => asset_visibility?,
145
+ "processing" => asset_processing,
146
+ "moderation" => asset_moderation,
147
+ "content" => asset_content
148
+ }
149
+
150
+ # ---- Moderation report (Classification.ts, ProcessingFeatures.ts) ----------------------------
151
+
152
+ type likelihood = "very-unlikely" | "unlikely" | "possible" | "likely" | "very-likely"
153
+ # not-supported: this processing path cannot assess the signal; unavailable: assessment failed.
154
+ type not_evaluated_reason = "not-supported" | "unavailable"
155
+ type classification_category = "sexual" | "violence" | "self-harm" | "harassment" | "hate" | "criminal-activity"
156
+
157
+ # `status: "evaluated"` carries `someScore`, `likelihood` and optionally `allScore`;
158
+ # `status: "not-evaluated"` carries `reason`.
159
+ type qualifier_result = {
160
+ "status" => "evaluated" | "not-evaluated",
161
+ ?"someScore" => number,
162
+ ?"allScore" => number,
163
+ ?"likelihood" => likelihood,
164
+ ?"reason" => not_evaluated_reason
165
+ }
166
+ # MODERATION_QUALIFIERS in ModerationPolicyDimensions.ts.
167
+ type qualifier_results = {
168
+ ?"sexual-nudity" => qualifier_result,
169
+ ?"sexual-activity" => qualifier_result,
170
+ ?"sexual-explicit-language" => qualifier_result,
171
+ ?"sexual-solicitation" => qualifier_result,
172
+ ?"sexual-historical" => qualifier_result,
173
+ ?"sexual-documentary" => qualifier_result,
174
+ ?"sexual-educational" => qualifier_result,
175
+ ?"sexual-fictional" => qualifier_result,
176
+ ?"sexual-support-prevention" => qualifier_result,
177
+ ?"violence-attack" => qualifier_result,
178
+ ?"violence-threat" => qualifier_result,
179
+ ?"violence-preparation" => qualifier_result,
180
+ ?"violence-encouragement" => qualifier_result,
181
+ ?"violence-injury" => qualifier_result,
182
+ ?"violence-violent-death" => qualifier_result,
183
+ ?"violence-natural-death" => qualifier_result,
184
+ ?"violence-graphic" => qualifier_result,
185
+ ?"violence-historical" => qualifier_result,
186
+ ?"violence-documentary" => qualifier_result,
187
+ ?"violence-educational" => qualifier_result,
188
+ ?"violence-fictional" => qualifier_result,
189
+ ?"violence-support-prevention" => qualifier_result,
190
+ ?"self-harm-thoughts" => qualifier_result,
191
+ ?"self-harm-preparation" => qualifier_result,
192
+ ?"self-harm-act" => qualifier_result,
193
+ ?"self-harm-methods" => qualifier_result,
194
+ ?"self-harm-encouragement" => qualifier_result,
195
+ ?"self-harm-documentary" => qualifier_result,
196
+ ?"self-harm-educational" => qualifier_result,
197
+ ?"self-harm-fictional" => qualifier_result,
198
+ ?"self-harm-support-prevention" => qualifier_result,
199
+ ?"harassment-abuse" => qualifier_result,
200
+ ?"harassment-intimidation" => qualifier_result,
201
+ ?"harassment-threat" => qualifier_result,
202
+ ?"harassment-sexual" => qualifier_result,
203
+ ?"harassment-encouragement" => qualifier_result,
204
+ ?"harassment-fictional" => qualifier_result,
205
+ ?"hate-abuse" => qualifier_result,
206
+ ?"hate-dehumanization" => qualifier_result,
207
+ ?"hate-inferiority" => qualifier_result,
208
+ ?"hate-exclusion" => qualifier_result,
209
+ ?"hate-threat" => qualifier_result,
210
+ ?"hate-historical" => qualifier_result,
211
+ ?"hate-fictional" => qualifier_result,
212
+ ?"criminal-activity-demonstration" => qualifier_result,
213
+ ?"criminal-activity-preparation" => qualifier_result,
214
+ ?"criminal-activity-request" => qualifier_result,
215
+ ?"criminal-activity-instructions" => qualifier_result,
216
+ ?"criminal-activity-promotion" => qualifier_result,
217
+ ?"criminal-activity-substances" => qualifier_result,
218
+ ?"criminal-activity-fraud" => qualifier_result,
219
+ ?"criminal-activity-fictional" => qualifier_result
220
+ }
221
+ # `status: "evaluated"` or `"partial"` carries `likelihood` and `score`; `"not-evaluated"`
222
+ # carries `reason`.
223
+ type category_report = {
224
+ "status" => "evaluated" | "partial" | "not-evaluated",
225
+ ?"likelihood" => likelihood,
226
+ ?"score" => number,
227
+ ?"reason" => not_evaluated_reason,
228
+ ?"qualifiers" => qualifier_results
229
+ }
230
+ type classification_categories = {
231
+ "sexual" => category_report,
232
+ "violence" => category_report,
233
+ "self-harm" => category_report,
234
+ "harassment" => category_report,
235
+ "hate" => category_report,
236
+ "criminal-activity" => category_report
237
+ }
238
+ type classification_label = {
239
+ "description" => String,
240
+ "score" => number,
241
+ ?"topicalityScore" => number?,
242
+ "likelihood" => likelihood,
243
+ ?"knowledgeBaseId" => String?
244
+ }
245
+ type media_segment = {
246
+ "source" => "frame" | "speech" | "frame-text" | "clip",
247
+ "startSeconds" => number,
248
+ "endSeconds" => number,
249
+ "categories" => classification_categories
250
+ }
251
+ type media_report = {
252
+ "durationSeconds" => number,
253
+ ?"frameIntervalSeconds" => number,
254
+ "sampledFrames" => Integer,
255
+ "audioTranscribed" => bool,
256
+ "segments" => Array[media_segment]
257
+ }
258
+
259
+ # Position and size as fractions of the image width and height, from 0 to 1.
260
+ type bounding_box = { "left" => number, "top" => number, "width" => number, "height" => number }
261
+ type age_range = { "low" => Integer, "high" => Integer }
262
+ type detected_person = { "box" => bounding_box, "confidence" => number }
263
+ type detected_face = { "box" => bounding_box, "confidence" => number, ?"ageRange" => age_range }
264
+ type processing_feature_stage = "beta" | "ga"
265
+ # `status: "evaluated"` carries `people`; `"not-evaluated"` carries `reason`.
266
+ type person_detection_result = {
267
+ "status" => "evaluated" | "not-evaluated",
268
+ "stage" => processing_feature_stage,
269
+ ?"people" => Array[detected_person],
270
+ ?"reason" => not_evaluated_reason
271
+ }
272
+ # `status: "evaluated"` carries `faces`; `"not-evaluated"` carries `reason`.
273
+ type face_detection_result = {
274
+ "status" => "evaluated" | "not-evaluated",
275
+ "stage" => processing_feature_stage,
276
+ ?"faces" => Array[detected_face],
277
+ ?"reason" => not_evaluated_reason
278
+ }
279
+ # Results of the features requested in `processingOptions.features`. OCR produces a text child
280
+ # asset instead of a result here.
281
+ type processing_feature_results = {
282
+ ?"personDetection" => person_detection_result,
283
+ ?"faceDetection" => face_detection_result
284
+ }
285
+
286
+ # How strongly each assessed category meets the policy and what the policy does with it.
287
+ type report_policy = {
288
+ "score" => number,
289
+ "categories" => Hash[String, { "score" => number, "action" => String }]
290
+ }
291
+
292
+ type classification_report = {
293
+ "processedAt" => Integer,
294
+ "categories" => classification_categories,
295
+ "score" => number,
296
+ ?"notes" => String?,
297
+ ?"media" => media_report,
298
+ ?"labels" => Array[classification_label]?,
299
+ ?"features" => processing_feature_results,
300
+ ?"policy" => report_policy
301
+ }
302
+
303
+ # ---- Pages and search (Page.ts, AssetSearch.ts) --------------------------------------------
304
+
305
+ type order_direction = "ASC" | "DESC"
306
+ type order_input = { field: String, direction: order_direction }
307
+ type order = { "field" => String, "direction" => order_direction }
308
+
309
+ type asset_page = {
310
+ "items" => Array[asset],
311
+ "hasMore" => bool,
312
+ "nextCursor" => String?,
313
+ "pageSize" => Integer,
314
+ "ordering" => Array[order]
315
+ }
316
+
317
+ type asset_search_mode = "keyword" | "semantic" | "hybrid"
318
+ type asset_search_match_field = "name" | "id" | "externalId" | "description" | "tags" | "type" | "content.format" |
319
+ "content.extension" | "moderation.status" | "visual" | "transcript"
320
+ type asset_search_result = { "asset" => asset, "score" => number, "matchedFields" => Array[asset_search_match_field] }
321
+ type asset_search_response = {
322
+ "query" => String,
323
+ "items" => Array[asset_search_result],
324
+ "semanticStatus" => "disabled" | "ready" | "indexing" | "unavailable"
325
+ }
326
+
327
+ type signed_url = { "url" => String, "expiresAt" => Integer }
328
+
329
+ # ---- Transforms and lenses (AssetTransform.ts, Lens.ts) -------------------------------------
330
+
331
+ type image_format = "jpg" | "png" | "webp" | "avif" | "gif"
332
+ type image_fit = "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop"
333
+ type image_gravity_side = "face" | "left" | "right" | "top" | "bottom" | "center" | "auto" | "entropy"
334
+
335
+ # IMAGE_TRANSFORM_OPTIONS_SCHEMA, as options to send.
336
+ type image_transform_options_input = {
337
+ ?format: image_format,
338
+ ?width: Integer,
339
+ ?height: Integer,
340
+ ?background: String,
341
+ ?blur: number,
342
+ ?border: { ?color: String, ?width: number },
343
+ ?brightness: number,
344
+ ?contrast: number,
345
+ ?quality: Integer,
346
+ ?fit: image_fit,
347
+ ?flip: "h" | "v" | "hv",
348
+ ?gamma: number,
349
+ ?segment: "foreground",
350
+ ?gravity: image_gravity_side | { mode: "remainder" | "box-center", ?x: number, ?y: number },
351
+ ?rotate: 0 | 90 | 180 | 270,
352
+ ?saturation: number,
353
+ ?sharpen: number,
354
+ ?trim: "border" | {
355
+ ?top: number,
356
+ ?bottom: number,
357
+ ?left: number,
358
+ ?right: number,
359
+ ?width: number,
360
+ ?height: number,
361
+ ?border: bool | { ?color: String, ?tolerance: number, ?keep: number }
362
+ }
363
+ }
364
+ # IMAGE_TRANSFORM_OPTIONS_SCHEMA, as the API returns it in a lens.
365
+ type image_transform_options = {
366
+ ?"format" => image_format,
367
+ ?"width" => Integer,
368
+ ?"height" => Integer,
369
+ ?"background" => String,
370
+ ?"blur" => number,
371
+ ?"border" => { ?"color" => String, ?"width" => number },
372
+ ?"brightness" => number,
373
+ ?"contrast" => number,
374
+ ?"quality" => Integer,
375
+ ?"fit" => image_fit,
376
+ ?"flip" => "h" | "v" | "hv",
377
+ ?"gamma" => number,
378
+ ?"segment" => "foreground",
379
+ ?"gravity" => image_gravity_side | { "mode" => "remainder" | "box-center", ?"x" => number, ?"y" => number },
380
+ ?"rotate" => 0 | 90 | 180 | 270,
381
+ ?"saturation" => number,
382
+ ?"sharpen" => number,
383
+ ?"trim" => "border" | {
384
+ ?"top" => number,
385
+ ?"bottom" => number,
386
+ ?"left" => number,
387
+ ?"right" => number,
388
+ ?"width" => number,
389
+ ?"height" => number,
390
+ ?"border" => bool | { ?"color" => String, ?"tolerance" => number, ?"keep" => number }
391
+ }
392
+ }
393
+
394
+ # One structured transform step. `imageTransform` is the only transform type.
395
+ type transform_step_input = { type: "imageTransform", ?options: image_transform_options_input }
396
+ type transform_step = { "type" => "imageTransform", ?"options" => image_transform_options }
397
+ # A selector String such as `imageTransform[format=png,width=1024]`, or structured steps, which
398
+ # the SDK serializes into a selector.
399
+ type transform_input = String | transform_step_input | Array[transform_step_input]
400
+
401
+ type lens_type = "image" | "video" | "audio" | "document" | "website"
402
+ # ENSURE_LENS_BODY_SCHEMA. Changing a saved lens needs a greater `version` (default 1).
403
+ type lens_definition = {
404
+ identifier: String,
405
+ name: String,
406
+ type: lens_type,
407
+ active: bool,
408
+ ?description: String?,
409
+ ?version: Integer,
410
+ ?transforms: Array[transform_step_input]?
411
+ }
412
+ type lens = {
413
+ "id" => String,
414
+ ?"projectId" => String?,
415
+ ?"userId" => String?,
416
+ "version" => Integer,
417
+ "identifier" => String,
418
+ "name" => String,
419
+ ?"description" => String?,
420
+ "type" => lens_type,
421
+ "active" => bool,
422
+ ?"transforms" => Array[transform_step]?,
423
+ "createdAt" => Integer,
424
+ ?"updatedAt" => Integer
425
+ }
426
+
427
+ # ---- Folders (Folder.ts) --------------------------------------------------------------------
428
+
429
+ type folder = {
430
+ "id" => String,
431
+ "projectId" => String,
432
+ ?"parentId" => String?,
433
+ "name" => String,
434
+ "createdAt" => Integer,
435
+ ?"updatedAt" => Integer
436
+ }
437
+
438
+ # ---- Events and webhooks (Event.ts, EventCatalog.ts, WebhookPayload.ts) ----------------------
439
+
440
+ # EVENT_TYPES in EventCatalog.ts. Ignore types your code does not handle. Webhook, Slack and email
441
+ # deliveries and the public events feed leave out facts that hold personal or account data.
442
+ type event_type = "asset.uploaded" | "asset.flagged" | "asset.approved" | "asset.rejected" |
443
+ "asset.failed" | "asset.deleted" | "asset.content-removed" | "asset.retried" |
444
+ "asset.review-requested" | "usage.limit-reached" | "usage.spend-limit-reached" |
445
+ "upload-preset.daily-limit-reached" | "project.member-joined" | "project.member-removed" |
446
+ "project.member-role-changed" | "project.invitation-sent" | "api-key.created" |
447
+ "api-key.revoked" | "connector.failing" | "appeal.submitted" | "appeal.resolved"
448
+ type event_severity = "low" | "high"
449
+ # A registered fact's value: text, an enum value, a count, a list of enum values, or null.
450
+ # Test sends carry `{ "key" => "test", "value" => true }`.
451
+ type event_fact_value = String | Integer | bool | Array[String] | nil
452
+ # A registered fact. `key` is a kebab-case key registered for the event's type, such as
453
+ # `asset-name` or `flagged-categories`. Render `url` only when it is an internal path or HTTP(S) URL.
454
+ type event_fact = { "key" => String, "value" => event_fact_value, ?"url" => String }
455
+ type event_fact_input = { key: String, value: event_fact_value, ?url: String }
456
+
457
+ # Snapshot of the asset's processing, moderation and content status when the event was created.
458
+ type event_asset = {
459
+ "id" => String,
460
+ ?"externalId" => String?,
461
+ "processing" => { "status" => asset_processing_status },
462
+ "moderation" => { "status" => asset_moderation_status, "action" => asset_moderation_action? },
463
+ "content" => { "status" => asset_content_status }
464
+ }
465
+ type event = {
466
+ "id" => String,
467
+ "projectId" => String,
468
+ ?"userId" => String?,
469
+ "type" => event_type,
470
+ "severity" => event_severity,
471
+ "title" => String,
472
+ ?"description" => String?,
473
+ ?"assetId" => String?,
474
+ ?"asset" => event_asset?,
475
+ "facts" => Array[event_fact],
476
+ ?"notify" => bool?,
477
+ "createdAt" => Integer,
478
+ ?"updatedAt" => Integer,
479
+ ?"readAt" => Integer?
480
+ }
481
+ type events_page = { "events" => Array[event], "cursor" => String, "hasMore" => bool }
482
+
483
+ # WEBHOOK_EVENT_DATA_SCHEMA: the event fields a webhook delivery carries under `data`.
484
+ type webhook_event_data = {
485
+ "severity" => event_severity,
486
+ "title" => String,
487
+ ?"description" => String?,
488
+ ?"assetId" => String?,
489
+ ?"asset" => event_asset?,
490
+ "facts" => Array[event_fact]
491
+ }
492
+
493
+ # ---- Method options -------------------------------------------------------------------------
494
+
495
+ type asset_id_options = { asset_id: String, ?request_options: request_options }
496
+ # `timeout` is the whole wait in seconds (default 60).
497
+ type wait_for_decision_options = { asset_id: String, ?timeout: number, ?request_options: request_options }
498
+
499
+ type asset_search_options = {
500
+ query: String,
501
+ ?mode: asset_search_mode,
502
+ ?limit: Integer,
503
+ ?request_options: request_options
504
+ }
505
+ type list_assets_options = {
506
+ ?cursor: String,
507
+ ?page_size: Integer,
508
+ ?ordering: Array[order_input],
509
+ # An RSQL filter such as `moderation.status==approved`.
510
+ ?filter: String?,
511
+ ?folder_id: String?,
512
+ ?request_options: request_options
513
+ }
514
+ type list_asset_children_options = {
515
+ asset_id: String,
516
+ ?cursor: String,
517
+ ?page_size: Integer,
518
+ ?ordering: Array[order_input],
519
+ ?request_options: request_options
520
+ }
521
+ type update_asset_options = {
522
+ asset_id: String,
523
+ ?name: String,
524
+ ?description: String?,
525
+ ?external_id: String?,
526
+ ?external_url: String?,
527
+ ?metadata: Array[metadata_item_input]?,
528
+ ?tags: Array[String]?,
529
+ ?visibility: asset_visibility?,
530
+ ?request_options: request_options
531
+ }
532
+ type move_asset_options = { asset_id: String, folder_id: String?, ?request_options: request_options }
533
+ type create_signed_url_options = {
534
+ asset_id: String,
535
+ ?resource: "content" | "preview",
536
+ ?expires_in_seconds: Integer,
537
+ # A lens runs before any additional transforms.
538
+ ?lens: String,
539
+ ?transform: transform_input,
540
+ ?request_options: request_options
541
+ }
542
+
543
+ # Upload content: exactly one of `plain_text`, `base64` (optionally a data URL) or `data` (a
544
+ # binary String or an IO, which streams). `size_in_bytes` is required for an IO of unknown length.
545
+ type upload_content = { type: String, plain_text: String, ?size_in_bytes: Integer }
546
+ | { type: String, base64: String, ?size_in_bytes: Integer }
547
+ | { type: String, data: String | Transport::_Reader, ?size_in_bytes: Integer }
548
+ # The first part of a multipart upload.
549
+ type upload_first_part = { type: String, plain_text: String, ?is_final: bool, ?size_in_bytes: Integer }
550
+ | { type: String, base64: String, ?is_final: bool, ?size_in_bytes: Integer }
551
+ | { type: String, data: String | Transport::_Reader, ?is_final: bool, ?size_in_bytes: Integer }
552
+ # A later part of a multipart upload; part numbers start at 2.
553
+ type upload_part = { part_number: Integer, plain_text: String, ?is_final: bool, ?size_in_bytes: Integer }
554
+ | { part_number: Integer, base64: String, ?is_final: bool, ?size_in_bytes: Integer }
555
+ | { part_number: Integer, data: String | Transport::_Reader, ?is_final: bool, ?size_in_bytes: Integer }
556
+
557
+ # Options of {Assets#create} and {Assets#moderate}: the shared asset fields with exactly one of
558
+ # `content:` (a whole file), `part:` (the first part of a multipart upload) or `url:` (a page or
559
+ # file CalmLens fetches).
560
+ type upload_options = {
561
+ name: String,
562
+ content: upload_content,
563
+ ?description: String?,
564
+ ?visibility: asset_visibility?,
565
+ ?metadata: Array[metadata_item_input]?,
566
+ ?external_id: String?,
567
+ ?external_url: String?,
568
+ ?folder_id: String?,
569
+ ?upload_preset_id: String,
570
+ ?processing_options: processing_options_input?,
571
+ ?request_options: request_options
572
+ }
573
+ | {
574
+ name: String,
575
+ part: upload_first_part,
576
+ ?total_size_in_bytes: Integer,
577
+ ?description: String?,
578
+ ?visibility: asset_visibility?,
579
+ ?metadata: Array[metadata_item_input]?,
580
+ ?external_id: String?,
581
+ ?external_url: String?,
582
+ ?folder_id: String?,
583
+ ?upload_preset_id: String,
584
+ ?processing_options: processing_options_input?,
585
+ ?request_options: request_options
586
+ }
587
+ | {
588
+ name: String,
589
+ url: String,
590
+ ?description: String?,
591
+ ?visibility: asset_visibility?,
592
+ ?metadata: Array[metadata_item_input]?,
593
+ ?external_id: String?,
594
+ ?external_url: String?,
595
+ ?folder_id: String?,
596
+ ?upload_preset_id: String,
597
+ ?processing_options: processing_options_input?,
598
+ ?request_options: request_options
599
+ }
600
+ type upload_part_options = { asset_id: String, part: upload_part, ?queue: bool, ?request_options: request_options }
601
+
602
+ # Options of {Text#moderate}: the text, with the shared asset fields. `name` defaults to `text`.
603
+ type moderate_text_options = {
604
+ text: String,
605
+ ?name: String,
606
+ ?description: String?,
607
+ ?visibility: asset_visibility?,
608
+ ?metadata: Array[metadata_item_input]?,
609
+ ?external_id: String?,
610
+ ?external_url: String?,
611
+ ?folder_id: String?,
612
+ ?upload_preset_id: String,
613
+ ?processing_options: processing_options_input?,
614
+ ?request_options: request_options
615
+ }
616
+
617
+ # Options of {UploadTokens#sign}.
618
+ type sign_upload_token_options = {
619
+ upload_preset_id: String,
620
+ ?external_id: String,
621
+ ?expires_in_seconds: Integer,
622
+ ?request_options: request_options
623
+ }
624
+ type signed_upload_token = { "token" => String, "expiresAt" => Integer }
625
+
626
+ type list_folders_options = { ?request_options: request_options }
627
+ type folder_id_options = { folder_id: String, ?request_options: request_options }
628
+ type create_folder_options = { name: String, ?parent_id: String?, ?request_options: request_options }
629
+ type update_folder_options = { folder_id: String, ?name: String, ?request_options: request_options }
630
+ type move_folder_options = { folder_id: String, parent_id: String?, ?request_options: request_options }
631
+
632
+ type list_events_options = { ?after: String, ?limit: Integer, ?request_options: request_options }
633
+
634
+ type ensure_lenses_options = { lenses: Array[lens_definition], ?request_options: request_options }
635
+ type ensure_lens_options = {
636
+ identifier: String,
637
+ name: String,
638
+ type: lens_type,
639
+ active: bool,
640
+ ?description: String?,
641
+ ?version: Integer,
642
+ ?transforms: Array[transform_step_input]?,
643
+ ?request_options: request_options
644
+ }
645
+
646
+ type asset_url_options = {
647
+ # The asset ID or external ID.
648
+ asset_identifier: String,
649
+ ?resource: "content" | "preview",
650
+ # A lens runs before any additional transforms.
651
+ ?lens: String,
652
+ ?transform: transform_input
653
+ }
654
+ type serve_options = {
655
+ asset_identifier: String,
656
+ ?resource: "content" | "preview",
657
+ ?lens: String,
658
+ ?transform: transform_input,
659
+ ?init: { ?method: "GET" | "HEAD", ?headers: Hash[String, String] },
660
+ ?request_options: request_options
661
+ }
662
+
663
+ # Options of {MockServerClient#enqueue_event}. Omitted fields are filled in.
664
+ type mock_event_input = {
665
+ type: event_type,
666
+ ?id: String,
667
+ ?project_id: String,
668
+ ?severity: event_severity,
669
+ ?title: String,
670
+ ?description: String?,
671
+ ?asset_id: String?,
672
+ ?asset: {
673
+ id: String,
674
+ ?external_id: String?,
675
+ processing: { status: asset_processing_status },
676
+ moderation: { status: asset_moderation_status, action: asset_moderation_action? },
677
+ content: { status: asset_content_status }
678
+ }?,
679
+ ?facts: Array[event_fact_input],
680
+ ?created_at: Integer
681
+ }
682
+ end