repzo 1.0.291 → 1.0.293
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.
- package/changelog.md +28 -0
- package/lib/index.d.ts +244 -2
- package/lib/index.js +541 -0
- package/lib/types/index.d.ts +4533 -1
- package/package.json +1 -1
- package/src/index.ts +1270 -0
- package/src/oas/activity-ai-object-detection-session-frame.yaml +600 -0
- package/src/oas/ai-object-detection-assigned-missions.yaml +283 -0
- package/src/oas/ai-object-detection-assignment-rule.yaml +357 -0
- package/src/oas/ai-object-detection-category.yaml +338 -0
- package/src/oas/ai-object-detection-dataset.yaml +342 -0
- package/src/oas/ai-object-detection-detection-settings.yaml +410 -0
- package/src/oas/ai-object-detection-inference.yaml +818 -0
- package/src/oas/ai-object-detection-label-group.yaml +265 -0
- package/src/oas/ai-object-detection-label-report.yaml +366 -0
- package/src/oas/ai-object-detection-label.yaml +395 -0
- package/src/oas/ai-object-detection-metric-result.yaml +734 -0
- package/src/oas/ai-object-detection-metric.yaml +559 -0
- package/src/oas/ai-object-detection-mission-results.yaml +370 -0
- package/src/oas/ai-object-detection-mission-set.yaml +250 -0
- package/src/oas/ai-object-detection-mission.yaml +349 -0
- package/src/oas/ai-object-detection-model-version-epoch.yaml +214 -0
- package/src/oas/ai-object-detection-model-version-train-agent.yaml +88 -0
- package/src/oas/ai-object-detection-model-version.yaml +567 -0
- package/src/oas/ai-object-detection-model.yaml +369 -0
- package/src/oas/ai-object-detection-segment.yaml +301 -0
- package/src/oas/ai-object-detection-session-analysis.yaml +1306 -0
- package/src/oas/ai-object-detection-session-election.yaml +193 -0
- package/src/oas/ai-object-detection-session-insight.yaml +418 -0
- package/src/oas/ai-object-detection-session.yaml +840 -0
- package/src/oas/ai-object-detection-settings.yaml +249 -0
- package/src/oas/ai-object-detection-task.yaml +1007 -0
- package/src/oas/object-detection-analytics-report.yaml +674 -0
- package/src/types/index.ts +5159 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Repzo API - AI Object Detection Model
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: |
|
|
6
|
+
Configures an **object-detection ML model** — its train/predict settings
|
|
7
|
+
(`train_settings[]` / `predict_settings[]`), train/validation split
|
|
8
|
+
(`test_size` / `validation_size`), and its `current_model_version`. Versions
|
|
9
|
+
are managed via `ai-object-detection-model-version`.
|
|
10
|
+
|
|
11
|
+
**`current_model_version` is the resolution target for every unpinned
|
|
12
|
+
("latest") reference** — `ai-object-detection-dataset.default_model_version`
|
|
13
|
+
when null, category `model_settings` items with no `model_version`, and the
|
|
14
|
+
inference lambda's fallback. It **auto-advances** to the newest version each
|
|
15
|
+
time one finishes training (its weights upload), forward-only, so "latest"
|
|
16
|
+
always tracks the most recently trained version without manual promotion.
|
|
17
|
+
Populate it with `populatedKeys[]=current_model_version`: the version
|
|
18
|
+
document is returned under `current_model_version_populated` with its
|
|
19
|
+
`weight_best` / `weight_last` / `train_data` / `confusion_matrix` /
|
|
20
|
+
`confusion_matrix_normalized` media documents populated in place (the
|
|
21
|
+
inference lambda reads these for the XAI confusion-matrix part).
|
|
22
|
+
|
|
23
|
+
**Settings semantics.** `train_settings[0]` (`epochs`, `imgsz`, ...) is what
|
|
24
|
+
the Ultralytics HUB endpoint hands to the trainer; `predict_settings[0]`
|
|
25
|
+
(`conf`, `iou`, `agnostic_nms`) are the inference defaults a caller can
|
|
26
|
+
override per request. `validation_size` must be in (0.05, 0.4) and
|
|
27
|
+
`test_size` in (0, 0.2); the model-version prep job uses them to split
|
|
28
|
+
tasks into train/val/test. `name` must match `^[a-zA-Z_][a-zA-Z0-9_\s]*$`
|
|
29
|
+
and is unique per namespace.
|
|
30
|
+
|
|
31
|
+
**Who calls it.** Back-office admins. Scoped by `company_namespace[]`;
|
|
32
|
+
soft-delete via `disabled`. `PATCH` is not allowed (400).
|
|
33
|
+
servers:
|
|
34
|
+
- url: https://sv.api.repzo.me
|
|
35
|
+
security:
|
|
36
|
+
- ApiKeyAuth: []
|
|
37
|
+
- JwtAuth: []
|
|
38
|
+
paths:
|
|
39
|
+
/ai-object-detection-model:
|
|
40
|
+
get:
|
|
41
|
+
summary: Find models
|
|
42
|
+
operationId: findAiObjectDetectionModels
|
|
43
|
+
parameters:
|
|
44
|
+
- in: query
|
|
45
|
+
name: _id
|
|
46
|
+
description: "Filter by model `_id`. Pass once or as `?_id[]=...` for multiple."
|
|
47
|
+
schema:
|
|
48
|
+
oneOf:
|
|
49
|
+
- type: string
|
|
50
|
+
- type: array
|
|
51
|
+
items: { type: string }
|
|
52
|
+
- in: query
|
|
53
|
+
name: name
|
|
54
|
+
description: Exact-match on `name` (one or many).
|
|
55
|
+
schema:
|
|
56
|
+
oneOf:
|
|
57
|
+
- type: string
|
|
58
|
+
- type: array
|
|
59
|
+
items: { type: string }
|
|
60
|
+
- in: query
|
|
61
|
+
name: current_model_version
|
|
62
|
+
description: Filter by the currently promoted version id (one or many).
|
|
63
|
+
schema:
|
|
64
|
+
oneOf:
|
|
65
|
+
- type: string
|
|
66
|
+
- type: array
|
|
67
|
+
items: { type: string }
|
|
68
|
+
- in: query
|
|
69
|
+
name: search
|
|
70
|
+
description: Case-insensitive regex match on `name` (whitespace matches any run of characters).
|
|
71
|
+
schema: { type: string }
|
|
72
|
+
- in: query
|
|
73
|
+
name: disabled
|
|
74
|
+
description: Include soft-deleted models. Defaults to `false`.
|
|
75
|
+
schema: { type: boolean, default: false }
|
|
76
|
+
- in: query
|
|
77
|
+
name: from_updatedAt
|
|
78
|
+
description: Only models with `updatedAt` on/after this Unix timestamp (ms), start of that day in the caller's timezone.
|
|
79
|
+
schema: { type: number }
|
|
80
|
+
- in: query
|
|
81
|
+
name: to_updatedAt
|
|
82
|
+
description: Only models with `updatedAt` on/before this Unix timestamp (ms), end of that day.
|
|
83
|
+
schema: { type: number }
|
|
84
|
+
- in: query
|
|
85
|
+
name: from_createdAt
|
|
86
|
+
description: Only models with `createdAt` on/after this Unix timestamp (ms).
|
|
87
|
+
schema: { type: number }
|
|
88
|
+
- in: query
|
|
89
|
+
name: to_createdAt
|
|
90
|
+
description: Only models with `createdAt` on/before this Unix timestamp (ms).
|
|
91
|
+
schema: { type: number }
|
|
92
|
+
- in: query
|
|
93
|
+
name: populatedKeys
|
|
94
|
+
description: "Refs to populate. `current_model_version` is returned under `current_model_version_populated` (with its weight / train-data / confusion-matrix media populated in place); the original field keeps the id."
|
|
95
|
+
schema:
|
|
96
|
+
type: array
|
|
97
|
+
items:
|
|
98
|
+
type: string
|
|
99
|
+
enum: [current_model_version]
|
|
100
|
+
- in: query
|
|
101
|
+
name: per_page
|
|
102
|
+
schema: { type: integer, minimum: 1, maximum: 50000 }
|
|
103
|
+
example: 20
|
|
104
|
+
- in: query
|
|
105
|
+
name: page
|
|
106
|
+
schema: { type: integer, minimum: 1 }
|
|
107
|
+
example: 1
|
|
108
|
+
- in: query
|
|
109
|
+
name: sort
|
|
110
|
+
description: Field to sort by. Defaults to `_id`.
|
|
111
|
+
schema: { type: string }
|
|
112
|
+
- in: query
|
|
113
|
+
name: sortPageOrder
|
|
114
|
+
description: Sort direction. Defaults to descending.
|
|
115
|
+
schema: { type: string, enum: [asc, dsc] }
|
|
116
|
+
responses:
|
|
117
|
+
"200":
|
|
118
|
+
{
|
|
119
|
+
description: Paginated list of models.,
|
|
120
|
+
content:
|
|
121
|
+
{
|
|
122
|
+
application/json:
|
|
123
|
+
{
|
|
124
|
+
schema: { $ref: "#/components/schemas/OdModelFindResult" },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
post:
|
|
129
|
+
summary: Create a model
|
|
130
|
+
operationId: createAiObjectDetectionModel
|
|
131
|
+
requestBody:
|
|
132
|
+
{
|
|
133
|
+
required: true,
|
|
134
|
+
content:
|
|
135
|
+
{
|
|
136
|
+
application/json:
|
|
137
|
+
{ schema: { $ref: "#/components/schemas/OdModelCreateBody" } },
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
responses:
|
|
141
|
+
"201":
|
|
142
|
+
{
|
|
143
|
+
description: The created model.,
|
|
144
|
+
content:
|
|
145
|
+
{
|
|
146
|
+
application/json:
|
|
147
|
+
{ schema: { $ref: "#/components/schemas/OdModelSchema" } },
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
/ai-object-detection-model/{id}:
|
|
151
|
+
get:
|
|
152
|
+
summary: Get a model by id
|
|
153
|
+
operationId: getAiObjectDetectionModel
|
|
154
|
+
parameters:
|
|
155
|
+
- { in: path, name: id, required: true, schema: { type: string } }
|
|
156
|
+
- in: query
|
|
157
|
+
name: populatedKeys
|
|
158
|
+
description: Refs to populate (same semantics as on find).
|
|
159
|
+
schema:
|
|
160
|
+
type: array
|
|
161
|
+
items:
|
|
162
|
+
type: string
|
|
163
|
+
enum: [current_model_version]
|
|
164
|
+
responses:
|
|
165
|
+
"200":
|
|
166
|
+
{
|
|
167
|
+
description: The model.,
|
|
168
|
+
content:
|
|
169
|
+
{
|
|
170
|
+
application/json:
|
|
171
|
+
{ schema: { $ref: "#/components/schemas/OdModelSchema" } },
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
"400": { description: No model with that id. }
|
|
175
|
+
put:
|
|
176
|
+
summary: Update a model
|
|
177
|
+
description: "Full-document style update (`updateOne` with validators). Set `disabled: true` to soft-delete."
|
|
178
|
+
operationId: updateAiObjectDetectionModel
|
|
179
|
+
parameters:
|
|
180
|
+
[{ in: path, name: id, required: true, schema: { type: string } }]
|
|
181
|
+
requestBody:
|
|
182
|
+
{
|
|
183
|
+
required: true,
|
|
184
|
+
content:
|
|
185
|
+
{
|
|
186
|
+
application/json:
|
|
187
|
+
{ schema: { $ref: "#/components/schemas/OdModelUpdateBody" } },
|
|
188
|
+
},
|
|
189
|
+
}
|
|
190
|
+
responses:
|
|
191
|
+
"200":
|
|
192
|
+
{
|
|
193
|
+
description: The model after the update.,
|
|
194
|
+
content:
|
|
195
|
+
{
|
|
196
|
+
application/json:
|
|
197
|
+
{ schema: { $ref: "#/components/schemas/OdModelSchema" } },
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
"404": { description: No model with that id. }
|
|
201
|
+
delete:
|
|
202
|
+
summary: Soft-delete a model
|
|
203
|
+
description: "Sets `disabled: true`."
|
|
204
|
+
operationId: removeAiObjectDetectionModel
|
|
205
|
+
parameters:
|
|
206
|
+
[{ in: path, name: id, required: true, schema: { type: string } }]
|
|
207
|
+
responses:
|
|
208
|
+
"200":
|
|
209
|
+
{
|
|
210
|
+
description: The model after soft-deletion.,
|
|
211
|
+
content:
|
|
212
|
+
{
|
|
213
|
+
application/json:
|
|
214
|
+
{ schema: { $ref: "#/components/schemas/OdModelSchema" } },
|
|
215
|
+
},
|
|
216
|
+
}
|
|
217
|
+
components:
|
|
218
|
+
securitySchemes:
|
|
219
|
+
ApiKeyAuth:
|
|
220
|
+
{
|
|
221
|
+
type: apiKey,
|
|
222
|
+
in: header,
|
|
223
|
+
name: api-key,
|
|
224
|
+
description: "Server-issued API key. Also `x-api-key` header or `?apiKey=` query.",
|
|
225
|
+
}
|
|
226
|
+
JwtAuth:
|
|
227
|
+
{
|
|
228
|
+
type: apiKey,
|
|
229
|
+
in: header,
|
|
230
|
+
name: Authorization,
|
|
231
|
+
description: "Raw JWT — no `Bearer ` prefix. From `POST /authenticate`.",
|
|
232
|
+
}
|
|
233
|
+
schemas:
|
|
234
|
+
OdTrainSettings:
|
|
235
|
+
type: object
|
|
236
|
+
additionalProperties: true
|
|
237
|
+
description: "Free-form Ultralytics train args. The HUB endpoint reads `epochs` and `imgsz` from the first element."
|
|
238
|
+
properties:
|
|
239
|
+
epochs: { type: integer }
|
|
240
|
+
imgsz: { type: integer }
|
|
241
|
+
batch: { type: integer }
|
|
242
|
+
OdPredictSettings:
|
|
243
|
+
type: object
|
|
244
|
+
additionalProperties: true
|
|
245
|
+
description: "Free-form predict args. Inference reads `conf`, `iou` and `agnostic_nms` from the first element as defaults."
|
|
246
|
+
properties:
|
|
247
|
+
conf: { type: number }
|
|
248
|
+
iou: { type: number }
|
|
249
|
+
agnostic_nms: { type: boolean }
|
|
250
|
+
OdModelSchema:
|
|
251
|
+
type: object
|
|
252
|
+
properties:
|
|
253
|
+
_id: { type: string }
|
|
254
|
+
name:
|
|
255
|
+
{
|
|
256
|
+
type: string,
|
|
257
|
+
description: "Must match `^[a-zA-Z_][a-zA-Z0-9_\\s]*$`; unique per namespace.",
|
|
258
|
+
}
|
|
259
|
+
current_model_version:
|
|
260
|
+
{
|
|
261
|
+
type: string,
|
|
262
|
+
description: "Auto-advanced (forward-only) to the newest trained version's `_id`.",
|
|
263
|
+
}
|
|
264
|
+
current_model_version_populated:
|
|
265
|
+
type: object
|
|
266
|
+
nullable: true
|
|
267
|
+
additionalProperties: true
|
|
268
|
+
description: "Present when `populatedKeys[]` includes `current_model_version` — the `ai-object-detection-model-version` document with `weight_best`, `weight_last`, `train_data`, `confusion_matrix` and `confusion_matrix_normalized` populated as media documents."
|
|
269
|
+
train_settings:
|
|
270
|
+
{
|
|
271
|
+
type: array,
|
|
272
|
+
items: { $ref: "#/components/schemas/OdTrainSettings" },
|
|
273
|
+
}
|
|
274
|
+
predict_settings:
|
|
275
|
+
{
|
|
276
|
+
type: array,
|
|
277
|
+
items: { $ref: "#/components/schemas/OdPredictSettings" },
|
|
278
|
+
}
|
|
279
|
+
test_size:
|
|
280
|
+
{
|
|
281
|
+
type: number,
|
|
282
|
+
description: "Test split ratio, exclusive range (0, 0.2). Default 0.05.",
|
|
283
|
+
}
|
|
284
|
+
validation_size:
|
|
285
|
+
{
|
|
286
|
+
type: number,
|
|
287
|
+
description: "Validation split ratio, exclusive range (0.05, 0.4). Default 0.25.",
|
|
288
|
+
}
|
|
289
|
+
disabled: { type: boolean }
|
|
290
|
+
company_namespace: { type: array, items: { type: string } }
|
|
291
|
+
createdAt: { type: string, format: date-time }
|
|
292
|
+
updatedAt: { type: string, format: date-time }
|
|
293
|
+
OdModelCreateBody:
|
|
294
|
+
type: object
|
|
295
|
+
description: "Body for creating a model. The tenant key (`company_namespace`) is optional for SDK callers and is otherwise injected from the caller's session."
|
|
296
|
+
required: [name]
|
|
297
|
+
properties:
|
|
298
|
+
name:
|
|
299
|
+
{
|
|
300
|
+
type: string,
|
|
301
|
+
description: "Must match `^[a-zA-Z_][a-zA-Z0-9_\\s]*$`.",
|
|
302
|
+
}
|
|
303
|
+
train_settings:
|
|
304
|
+
{
|
|
305
|
+
type: array,
|
|
306
|
+
items: { $ref: "#/components/schemas/OdTrainSettings" },
|
|
307
|
+
}
|
|
308
|
+
predict_settings:
|
|
309
|
+
{
|
|
310
|
+
type: array,
|
|
311
|
+
items: { $ref: "#/components/schemas/OdPredictSettings" },
|
|
312
|
+
}
|
|
313
|
+
current_model_version:
|
|
314
|
+
{
|
|
315
|
+
type: string,
|
|
316
|
+
description: Normally left unset — advanced by the server when a version finishes training.,
|
|
317
|
+
}
|
|
318
|
+
test_size:
|
|
319
|
+
{
|
|
320
|
+
type: number,
|
|
321
|
+
minimum: 0,
|
|
322
|
+
maximum: 0.2,
|
|
323
|
+
description: Exclusive bounds.,
|
|
324
|
+
}
|
|
325
|
+
validation_size:
|
|
326
|
+
{
|
|
327
|
+
type: number,
|
|
328
|
+
minimum: 0.05,
|
|
329
|
+
maximum: 0.4,
|
|
330
|
+
description: Exclusive bounds.,
|
|
331
|
+
}
|
|
332
|
+
company_namespace:
|
|
333
|
+
type: array
|
|
334
|
+
items: { type: string }
|
|
335
|
+
description: Optional tenant namespace override for SDK callers.
|
|
336
|
+
OdModelUpdateBody:
|
|
337
|
+
type: object
|
|
338
|
+
description: "Body for updating a model. `company_namespace` is derived from the caller's session — do not send it. Set `disabled: true` to soft-delete."
|
|
339
|
+
properties:
|
|
340
|
+
name: { type: string }
|
|
341
|
+
train_settings:
|
|
342
|
+
{
|
|
343
|
+
type: array,
|
|
344
|
+
items: { $ref: "#/components/schemas/OdTrainSettings" },
|
|
345
|
+
}
|
|
346
|
+
predict_settings:
|
|
347
|
+
{
|
|
348
|
+
type: array,
|
|
349
|
+
items: { $ref: "#/components/schemas/OdPredictSettings" },
|
|
350
|
+
}
|
|
351
|
+
current_model_version: { type: string }
|
|
352
|
+
test_size: { type: number }
|
|
353
|
+
validation_size: { type: number }
|
|
354
|
+
disabled: { type: boolean }
|
|
355
|
+
OdModelFindResult:
|
|
356
|
+
type: object
|
|
357
|
+
properties:
|
|
358
|
+
data:
|
|
359
|
+
{ type: array, items: { $ref: "#/components/schemas/OdModelSchema" } }
|
|
360
|
+
total_result: { type: number }
|
|
361
|
+
current_count: { type: number }
|
|
362
|
+
total_pages: { type: number }
|
|
363
|
+
current_page: { type: number }
|
|
364
|
+
per_page: { type: number }
|
|
365
|
+
first_page_url: { type: string }
|
|
366
|
+
last_page_url: { type: string }
|
|
367
|
+
next_page_url: { type: string, nullable: true }
|
|
368
|
+
prev_page_url: { type: string, nullable: true }
|
|
369
|
+
path: { type: string }
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Repzo API - AI Object Detection Segment
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: |
|
|
6
|
+
**Segments** are reusable named label sets for the Object Detection
|
|
7
|
+
business layer — "our brand", "competitor X", "energy drinks". They are
|
|
8
|
+
the SUBJECTS of share-of-shelf metrics
|
|
9
|
+
(`/ai-object-detection-metric`, `type: share_of_shelf`): a metric adds
|
|
10
|
+
one or more segment rows and may override a segment's labels for that
|
|
11
|
+
metric only; rows without an override follow the segment's own labels —
|
|
12
|
+
editing the segment updates every such metric on its next evaluation.
|
|
13
|
+
|
|
14
|
+
`labels` is optional — an empty segment is a named placeholder whose
|
|
15
|
+
metrics must supply their own override.
|
|
16
|
+
|
|
17
|
+
**Referential guard.** Deleting a segment is BLOCKED while an active
|
|
18
|
+
metric still references it (the error names the metrics); remove it from
|
|
19
|
+
those metrics first.
|
|
20
|
+
|
|
21
|
+
**Multi-tenancy & lifecycle.** Scoped by `company_namespace` (injected
|
|
22
|
+
from the caller's token), soft-deleted via `disabled: true`; the name is
|
|
23
|
+
unique per namespace among live segments. The server stamps `creator`
|
|
24
|
+
(on create) and `editor` (on update / delete) from the caller's token.
|
|
25
|
+
`PUT` re-validates the whole body, so `name` must be present and non-blank
|
|
26
|
+
on every update. `PATCH` is not allowed (400). References
|
|
27
|
+
`ai-object-detection-label`. Admin-facing.
|
|
28
|
+
servers:
|
|
29
|
+
- url: https://sv.api.repzo.me
|
|
30
|
+
security:
|
|
31
|
+
- ApiKeyAuth: []
|
|
32
|
+
- JwtAuth: []
|
|
33
|
+
paths:
|
|
34
|
+
/ai-object-detection-segment:
|
|
35
|
+
get:
|
|
36
|
+
summary: List segments
|
|
37
|
+
operationId: findAiObjectDetectionSegment
|
|
38
|
+
parameters:
|
|
39
|
+
- in: query
|
|
40
|
+
name: _id
|
|
41
|
+
description: Filter by segment `_id`. Pass once or as `?_id[]=...` for multiple.
|
|
42
|
+
schema:
|
|
43
|
+
oneOf:
|
|
44
|
+
- type: string
|
|
45
|
+
- type: array
|
|
46
|
+
items: { type: string }
|
|
47
|
+
- in: query
|
|
48
|
+
name: name
|
|
49
|
+
description: Exact-match on `name` (single value or list).
|
|
50
|
+
schema:
|
|
51
|
+
oneOf:
|
|
52
|
+
- type: string
|
|
53
|
+
- type: array
|
|
54
|
+
items: { type: string }
|
|
55
|
+
- in: query
|
|
56
|
+
name: search
|
|
57
|
+
description: Case-insensitive substring / regex match on `name`.
|
|
58
|
+
schema: { type: string }
|
|
59
|
+
- in: query
|
|
60
|
+
name: labels
|
|
61
|
+
description: Segments containing any of these label ids.
|
|
62
|
+
schema:
|
|
63
|
+
oneOf:
|
|
64
|
+
- type: string
|
|
65
|
+
- type: array
|
|
66
|
+
items: { type: string }
|
|
67
|
+
- in: query
|
|
68
|
+
name: disabled
|
|
69
|
+
description: "`true` returns only soft-deleted segments, `false` only live ones. Omitted returns both."
|
|
70
|
+
schema: { type: boolean }
|
|
71
|
+
- in: query
|
|
72
|
+
name: populatedKeys
|
|
73
|
+
description: "Embed refs. Supported: `labels` (adds `labels_populated`)."
|
|
74
|
+
schema:
|
|
75
|
+
type: array
|
|
76
|
+
items:
|
|
77
|
+
type: string
|
|
78
|
+
enum: [labels]
|
|
79
|
+
- in: query
|
|
80
|
+
name: from_updatedAt
|
|
81
|
+
description: Return segments with `updatedAt` on/after this Unix timestamp (ms); snapped to start of day unless `exact_time=true`.
|
|
82
|
+
schema: { type: number }
|
|
83
|
+
- in: query
|
|
84
|
+
name: to_updatedAt
|
|
85
|
+
description: Return segments with `updatedAt` on/before this Unix timestamp (ms).
|
|
86
|
+
schema: { type: number }
|
|
87
|
+
- in: query
|
|
88
|
+
name: from_createdAt
|
|
89
|
+
description: Return segments with `createdAt` on/after this Unix timestamp (ms).
|
|
90
|
+
schema: { type: number }
|
|
91
|
+
- in: query
|
|
92
|
+
name: to_createdAt
|
|
93
|
+
description: Return segments with `createdAt` on/before this Unix timestamp (ms).
|
|
94
|
+
schema: { type: number }
|
|
95
|
+
- in: query
|
|
96
|
+
name: per_page
|
|
97
|
+
description: Page size (capped by the server's pagination max).
|
|
98
|
+
schema: { type: integer, minimum: 1 }
|
|
99
|
+
example: 20
|
|
100
|
+
- in: query
|
|
101
|
+
name: page
|
|
102
|
+
description: 1-based page number.
|
|
103
|
+
schema: { type: integer, minimum: 1 }
|
|
104
|
+
example: 1
|
|
105
|
+
- in: query
|
|
106
|
+
name: sort
|
|
107
|
+
description: Field to sort by. Defaults to `_id`.
|
|
108
|
+
schema: { type: string, default: _id }
|
|
109
|
+
- in: query
|
|
110
|
+
name: sortPageOrder
|
|
111
|
+
description: Sort direction. Defaults to descending.
|
|
112
|
+
schema: { type: string, enum: [asc, dsc], default: dsc }
|
|
113
|
+
responses:
|
|
114
|
+
"200":
|
|
115
|
+
description: Paginated segments.
|
|
116
|
+
content:
|
|
117
|
+
application/json:
|
|
118
|
+
schema:
|
|
119
|
+
$ref: "#/components/schemas/SegmentFindResult"
|
|
120
|
+
post:
|
|
121
|
+
summary: Create a segment
|
|
122
|
+
operationId: createAiObjectDetectionSegment
|
|
123
|
+
requestBody:
|
|
124
|
+
required: true
|
|
125
|
+
content:
|
|
126
|
+
application/json:
|
|
127
|
+
schema:
|
|
128
|
+
$ref: "#/components/schemas/SegmentCreateBody"
|
|
129
|
+
responses:
|
|
130
|
+
"201":
|
|
131
|
+
description: The created segment (with the server-stamped `creator`).
|
|
132
|
+
content:
|
|
133
|
+
application/json:
|
|
134
|
+
schema:
|
|
135
|
+
$ref: "#/components/schemas/Segment"
|
|
136
|
+
"400":
|
|
137
|
+
description: Missing / blank name, or the name already exists in the namespace.
|
|
138
|
+
/ai-object-detection-segment/{id}:
|
|
139
|
+
get:
|
|
140
|
+
summary: Get a segment
|
|
141
|
+
operationId: getAiObjectDetectionSegment
|
|
142
|
+
parameters:
|
|
143
|
+
- in: path
|
|
144
|
+
name: id
|
|
145
|
+
required: true
|
|
146
|
+
schema: { type: string }
|
|
147
|
+
responses:
|
|
148
|
+
"200":
|
|
149
|
+
description: The segment document.
|
|
150
|
+
content:
|
|
151
|
+
application/json:
|
|
152
|
+
schema:
|
|
153
|
+
$ref: "#/components/schemas/Segment"
|
|
154
|
+
"400":
|
|
155
|
+
description: No segment with that id in the caller's namespace.
|
|
156
|
+
put:
|
|
157
|
+
summary: Update a segment
|
|
158
|
+
description: "Label edits propagate to every metric row WITHOUT an override on its next evaluation. `name` is re-validated (required, non-blank). Stamps `editor`."
|
|
159
|
+
operationId: updateAiObjectDetectionSegment
|
|
160
|
+
parameters:
|
|
161
|
+
- in: path
|
|
162
|
+
name: id
|
|
163
|
+
required: true
|
|
164
|
+
schema: { type: string }
|
|
165
|
+
requestBody:
|
|
166
|
+
required: true
|
|
167
|
+
content:
|
|
168
|
+
application/json:
|
|
169
|
+
schema:
|
|
170
|
+
$ref: "#/components/schemas/SegmentUpdateBody"
|
|
171
|
+
responses:
|
|
172
|
+
"200":
|
|
173
|
+
description: The updated segment.
|
|
174
|
+
content:
|
|
175
|
+
application/json:
|
|
176
|
+
schema:
|
|
177
|
+
$ref: "#/components/schemas/Segment"
|
|
178
|
+
"400":
|
|
179
|
+
description: Missing / blank name.
|
|
180
|
+
"404":
|
|
181
|
+
description: No segment with that id in the caller's namespace.
|
|
182
|
+
delete:
|
|
183
|
+
summary: Soft-delete a segment (guarded)
|
|
184
|
+
description: "Sets `disabled: true` and stamps `editor` — REJECTED while any active metric references the segment (the 400 lists the metric names)."
|
|
185
|
+
operationId: removeAiObjectDetectionSegment
|
|
186
|
+
parameters:
|
|
187
|
+
- in: path
|
|
188
|
+
name: id
|
|
189
|
+
required: true
|
|
190
|
+
schema: { type: string }
|
|
191
|
+
responses:
|
|
192
|
+
"200":
|
|
193
|
+
description: The disabled segment.
|
|
194
|
+
content:
|
|
195
|
+
application/json:
|
|
196
|
+
schema:
|
|
197
|
+
$ref: "#/components/schemas/Segment"
|
|
198
|
+
"400":
|
|
199
|
+
description: The segment is still referenced by metrics.
|
|
200
|
+
"404":
|
|
201
|
+
description: No segment with that id in the caller's namespace.
|
|
202
|
+
components:
|
|
203
|
+
securitySchemes:
|
|
204
|
+
ApiKeyAuth:
|
|
205
|
+
type: apiKey
|
|
206
|
+
in: header
|
|
207
|
+
name: api-key
|
|
208
|
+
description: |
|
|
209
|
+
Server-issued API key. Also accepted via the `x-api-key` header or the
|
|
210
|
+
`?apiKey=` query parameter as fallbacks.
|
|
211
|
+
JwtAuth:
|
|
212
|
+
type: apiKey
|
|
213
|
+
in: header
|
|
214
|
+
name: Authorization
|
|
215
|
+
description: |
|
|
216
|
+
Raw JWT in the `Authorization` header — **no `Bearer ` prefix**.
|
|
217
|
+
Obtained from `POST /authenticate` (admin / rep / client login).
|
|
218
|
+
schemas:
|
|
219
|
+
UserStamp:
|
|
220
|
+
type: object
|
|
221
|
+
description: Creator / editor stamp derived from the caller's token.
|
|
222
|
+
properties:
|
|
223
|
+
_id: { type: string }
|
|
224
|
+
type:
|
|
225
|
+
type: string
|
|
226
|
+
enum: [admin, rep, tenant, client]
|
|
227
|
+
name: { type: string }
|
|
228
|
+
admin: { type: string }
|
|
229
|
+
rep: { type: string }
|
|
230
|
+
tenant: { type: string }
|
|
231
|
+
client: { type: string }
|
|
232
|
+
SegmentCreateBody:
|
|
233
|
+
type: object
|
|
234
|
+
description: "Body for creating a segment. `company_namespace` is optional for SDK callers and otherwise injected from the caller's session."
|
|
235
|
+
required: [name]
|
|
236
|
+
properties:
|
|
237
|
+
name:
|
|
238
|
+
type: string
|
|
239
|
+
description: Unique per namespace among live segments. Must be non-blank.
|
|
240
|
+
description: { type: string }
|
|
241
|
+
labels:
|
|
242
|
+
type: array
|
|
243
|
+
items: { type: string }
|
|
244
|
+
description: Member label ids (optional — empty = placeholder).
|
|
245
|
+
company_namespace:
|
|
246
|
+
type: array
|
|
247
|
+
items: { type: string }
|
|
248
|
+
description: Optional tenant namespace override for SDK callers.
|
|
249
|
+
SegmentUpdateBody:
|
|
250
|
+
type: object
|
|
251
|
+
description: "Body for updating a segment. `company_namespace` is derived from the caller's session — do not send it. `name` is required on every PUT."
|
|
252
|
+
required: [name]
|
|
253
|
+
properties:
|
|
254
|
+
name:
|
|
255
|
+
type: string
|
|
256
|
+
description: Unique per namespace among live segments. Must be non-blank.
|
|
257
|
+
description: { type: string }
|
|
258
|
+
labels:
|
|
259
|
+
type: array
|
|
260
|
+
items: { type: string }
|
|
261
|
+
disabled:
|
|
262
|
+
type: boolean
|
|
263
|
+
description: "Soft-delete flag — set `true` to disable via update (bypasses the metric guard on DELETE)."
|
|
264
|
+
Segment:
|
|
265
|
+
type: object
|
|
266
|
+
properties:
|
|
267
|
+
_id: { type: string }
|
|
268
|
+
disabled: { type: boolean }
|
|
269
|
+
name: { type: string }
|
|
270
|
+
description: { type: string }
|
|
271
|
+
labels:
|
|
272
|
+
type: array
|
|
273
|
+
items: { type: string }
|
|
274
|
+
creator:
|
|
275
|
+
$ref: "#/components/schemas/UserStamp"
|
|
276
|
+
editor:
|
|
277
|
+
$ref: "#/components/schemas/UserStamp"
|
|
278
|
+
company_namespace:
|
|
279
|
+
type: array
|
|
280
|
+
items: { type: string }
|
|
281
|
+
description: Tenant key (server-injected).
|
|
282
|
+
createdAt: { type: string, format: date-time }
|
|
283
|
+
updatedAt: { type: string, format: date-time }
|
|
284
|
+
SegmentFindResult:
|
|
285
|
+
type: object
|
|
286
|
+
description: Standard paginated result envelope.
|
|
287
|
+
properties:
|
|
288
|
+
data:
|
|
289
|
+
type: array
|
|
290
|
+
items:
|
|
291
|
+
$ref: "#/components/schemas/Segment"
|
|
292
|
+
total_result: { type: number }
|
|
293
|
+
current_count: { type: number }
|
|
294
|
+
total_pages: { type: number }
|
|
295
|
+
current_page: { type: number }
|
|
296
|
+
per_page: { type: number }
|
|
297
|
+
first_page_url: { type: string }
|
|
298
|
+
last_page_url: { type: string }
|
|
299
|
+
next_page_url: { type: string, nullable: true }
|
|
300
|
+
prev_page_url: { type: string, nullable: true }
|
|
301
|
+
path: { type: string }
|