@twin.org/entity-storage-service 0.0.1-next.10

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,636 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "TWIN - Test Endpoints",
5
+ "description": "REST API for TWIN - Test Endpoints.",
6
+ "version": "1.0.0",
7
+ "license": {
8
+ "name": "Apache 2.0 License",
9
+ "url": "https://opensource.org/licenses/Apache-2.0"
10
+ }
11
+ },
12
+ "servers": [
13
+ {
14
+ "url": "https://localhost"
15
+ }
16
+ ],
17
+ "tags": [
18
+ {
19
+ "name": "EntityStorage",
20
+ "description": "Endpoints which are modelled to access an entity storage contract."
21
+ }
22
+ ],
23
+ "paths": {
24
+ "/entity-storage": {
25
+ "post": {
26
+ "operationId": "entityStorageSet",
27
+ "summary": "Set an entry in entity storage.",
28
+ "tags": [
29
+ "EntityStorage"
30
+ ],
31
+ "security": [
32
+ {
33
+ "jwtBearerAuthScheme": []
34
+ }
35
+ ],
36
+ "requestBody": {
37
+ "description": "Set an entry in entity storage.",
38
+ "required": true,
39
+ "content": {
40
+ "application/json": {
41
+ "schema": {
42
+ "$ref": "#/components/schemas/EntityStorageSetRequest"
43
+ },
44
+ "examples": {
45
+ "entityStorageSetRequestExample": {
46
+ "value": {
47
+ "id": "12345",
48
+ "name": "My Item"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ "responses": {
56
+ "204": {
57
+ "description": "The rest request ended in success with no data."
58
+ },
59
+ "400": {
60
+ "description": "The server cannot process the request, see the content for more details.",
61
+ "content": {
62
+ "application/json": {
63
+ "schema": {
64
+ "$ref": "#/components/schemas/Error"
65
+ },
66
+ "examples": {
67
+ "exampleResponse": {
68
+ "value": {
69
+ "name": "GeneralError",
70
+ "message": "component.error",
71
+ "properties": {
72
+ "foo": "bar"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ },
80
+ "401": {
81
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
82
+ "content": {
83
+ "application/json": {
84
+ "schema": {
85
+ "$ref": "#/components/schemas/Error"
86
+ },
87
+ "examples": {
88
+ "exampleResponse": {
89
+ "value": {
90
+ "name": "UnauthorizedError",
91
+ "message": "component.error"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "500": {
99
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
100
+ "content": {
101
+ "application/json": {
102
+ "schema": {
103
+ "$ref": "#/components/schemas/Error"
104
+ },
105
+ "examples": {
106
+ "exampleResponse": {
107
+ "value": {
108
+ "name": "InternalServerError",
109
+ "message": "component.error"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "get": {
119
+ "operationId": "entityStorageList",
120
+ "summary": "Query entries from entity storage.",
121
+ "tags": [
122
+ "EntityStorage"
123
+ ],
124
+ "parameters": [
125
+ {
126
+ "name": "conditions",
127
+ "description": "The condition for the query as JSON version of EntityCondition type.",
128
+ "in": "query",
129
+ "required": false,
130
+ "schema": {
131
+ "type": "string"
132
+ }
133
+ },
134
+ {
135
+ "name": "orderBy",
136
+ "description": "The order property for the results.",
137
+ "in": "query",
138
+ "required": false,
139
+ "schema": {
140
+ "type": "string"
141
+ }
142
+ },
143
+ {
144
+ "name": "orderByDirection",
145
+ "description": "The direction for the order, defaults to desc.",
146
+ "in": "query",
147
+ "required": false,
148
+ "schema": {
149
+ "$ref": "#/components/schemas/SortDirection"
150
+ }
151
+ },
152
+ {
153
+ "name": "properties",
154
+ "description": "The properties to return in the response as a comma separated list, by default returns all properties.",
155
+ "in": "query",
156
+ "required": false,
157
+ "schema": {
158
+ "type": "string"
159
+ }
160
+ },
161
+ {
162
+ "name": "pageSize",
163
+ "description": "The number of entries to return per page.",
164
+ "in": "query",
165
+ "required": false,
166
+ "schema": {
167
+ "type": "number"
168
+ }
169
+ },
170
+ {
171
+ "name": "cursor",
172
+ "description": "The cursor to get next chunk of data, returned in previous response.",
173
+ "in": "query",
174
+ "required": false,
175
+ "schema": {
176
+ "type": "string"
177
+ }
178
+ }
179
+ ],
180
+ "security": [
181
+ {
182
+ "jwtBearerAuthScheme": []
183
+ }
184
+ ],
185
+ "responses": {
186
+ "200": {
187
+ "description": "Response to getting the list of entries from a query.",
188
+ "content": {
189
+ "application/json": {
190
+ "schema": {
191
+ "$ref": "#/components/schemas/EntityStorageListResponse"
192
+ },
193
+ "examples": {
194
+ "entityStorageListResponseExample": {
195
+ "value": {
196
+ "entities": [
197
+ {
198
+ "id": "12345",
199
+ "name": "My Item"
200
+ }
201
+ ]
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "400": {
209
+ "description": "The server cannot process the request, see the content for more details.",
210
+ "content": {
211
+ "application/json": {
212
+ "schema": {
213
+ "$ref": "#/components/schemas/Error"
214
+ },
215
+ "examples": {
216
+ "exampleResponse": {
217
+ "value": {
218
+ "name": "GeneralError",
219
+ "message": "component.error",
220
+ "properties": {
221
+ "foo": "bar"
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ },
229
+ "401": {
230
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
231
+ "content": {
232
+ "application/json": {
233
+ "schema": {
234
+ "$ref": "#/components/schemas/Error"
235
+ },
236
+ "examples": {
237
+ "exampleResponse": {
238
+ "value": {
239
+ "name": "UnauthorizedError",
240
+ "message": "component.error"
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ },
247
+ "500": {
248
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
249
+ "content": {
250
+ "application/json": {
251
+ "schema": {
252
+ "$ref": "#/components/schemas/Error"
253
+ },
254
+ "examples": {
255
+ "exampleResponse": {
256
+ "value": {
257
+ "name": "InternalServerError",
258
+ "message": "component.error"
259
+ }
260
+ }
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }
267
+ },
268
+ "/entity-storage/{id}": {
269
+ "get": {
270
+ "operationId": "entityStorageGet",
271
+ "summary": "Get an entry from entity storage.",
272
+ "tags": [
273
+ "EntityStorage"
274
+ ],
275
+ "parameters": [
276
+ {
277
+ "name": "id",
278
+ "description": "The id of the entity to get.",
279
+ "in": "path",
280
+ "required": true,
281
+ "schema": {
282
+ "type": "string"
283
+ },
284
+ "style": "simple",
285
+ "example": "12345"
286
+ },
287
+ {
288
+ "name": "secondaryIndex",
289
+ "description": "The secondary index to query with the id.",
290
+ "in": "query",
291
+ "required": false,
292
+ "schema": {
293
+ "type": "string"
294
+ }
295
+ }
296
+ ],
297
+ "security": [
298
+ {
299
+ "jwtBearerAuthScheme": []
300
+ }
301
+ ],
302
+ "responses": {
303
+ "200": {
304
+ "description": "Get an entry from entity storage.",
305
+ "content": {
306
+ "application/json": {
307
+ "schema": {
308
+ "$ref": "#/components/schemas/EntityStorageGetResponse"
309
+ },
310
+ "examples": {
311
+ "entityStorageGetResponseExample": {
312
+ "value": {
313
+ "id": "12345",
314
+ "name": "My Item"
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ },
321
+ "400": {
322
+ "description": "The server cannot process the request, see the content for more details.",
323
+ "content": {
324
+ "application/json": {
325
+ "schema": {
326
+ "$ref": "#/components/schemas/Error"
327
+ },
328
+ "examples": {
329
+ "exampleResponse": {
330
+ "value": {
331
+ "name": "GeneralError",
332
+ "message": "component.error",
333
+ "properties": {
334
+ "foo": "bar"
335
+ }
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+ },
342
+ "401": {
343
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
344
+ "content": {
345
+ "application/json": {
346
+ "schema": {
347
+ "$ref": "#/components/schemas/Error"
348
+ },
349
+ "examples": {
350
+ "exampleResponse": {
351
+ "value": {
352
+ "name": "UnauthorizedError",
353
+ "message": "component.error"
354
+ }
355
+ }
356
+ }
357
+ }
358
+ }
359
+ },
360
+ "404": {
361
+ "description": "The resource you tried to access does not exist, see the content for more details.",
362
+ "content": {
363
+ "application/json": {
364
+ "schema": {
365
+ "$ref": "#/components/schemas/NotFoundResponse"
366
+ },
367
+ "examples": {
368
+ "exampleResponse": {
369
+ "value": {
370
+ "name": "NotFoundError",
371
+ "message": "component.error",
372
+ "properties": {
373
+ "notFoundId": "1"
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }
379
+ }
380
+ },
381
+ "500": {
382
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
383
+ "content": {
384
+ "application/json": {
385
+ "schema": {
386
+ "$ref": "#/components/schemas/Error"
387
+ },
388
+ "examples": {
389
+ "exampleResponse": {
390
+ "value": {
391
+ "name": "InternalServerError",
392
+ "message": "component.error"
393
+ }
394
+ }
395
+ }
396
+ }
397
+ }
398
+ }
399
+ }
400
+ },
401
+ "delete": {
402
+ "operationId": "entityStorageRemove",
403
+ "summary": "Remove an entry from entity storage.",
404
+ "tags": [
405
+ "EntityStorage"
406
+ ],
407
+ "parameters": [
408
+ {
409
+ "name": "id",
410
+ "description": "The id of the entity to remove.",
411
+ "in": "path",
412
+ "required": true,
413
+ "schema": {
414
+ "type": "string"
415
+ },
416
+ "style": "simple",
417
+ "example": "12345"
418
+ }
419
+ ],
420
+ "security": [
421
+ {
422
+ "jwtBearerAuthScheme": []
423
+ }
424
+ ],
425
+ "responses": {
426
+ "204": {
427
+ "description": "The rest request ended in success with no data."
428
+ },
429
+ "400": {
430
+ "description": "The server cannot process the request, see the content for more details.",
431
+ "content": {
432
+ "application/json": {
433
+ "schema": {
434
+ "$ref": "#/components/schemas/Error"
435
+ },
436
+ "examples": {
437
+ "exampleResponse": {
438
+ "value": {
439
+ "name": "GeneralError",
440
+ "message": "component.error",
441
+ "properties": {
442
+ "foo": "bar"
443
+ }
444
+ }
445
+ }
446
+ }
447
+ }
448
+ }
449
+ },
450
+ "401": {
451
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
452
+ "content": {
453
+ "application/json": {
454
+ "schema": {
455
+ "$ref": "#/components/schemas/Error"
456
+ },
457
+ "examples": {
458
+ "exampleResponse": {
459
+ "value": {
460
+ "name": "UnauthorizedError",
461
+ "message": "component.error"
462
+ }
463
+ }
464
+ }
465
+ }
466
+ }
467
+ },
468
+ "404": {
469
+ "description": "The resource you tried to access does not exist, see the content for more details.",
470
+ "content": {
471
+ "application/json": {
472
+ "schema": {
473
+ "$ref": "#/components/schemas/NotFoundResponse"
474
+ },
475
+ "examples": {
476
+ "exampleResponse": {
477
+ "value": {
478
+ "name": "NotFoundError",
479
+ "message": "component.error",
480
+ "properties": {
481
+ "notFoundId": "1"
482
+ }
483
+ }
484
+ }
485
+ }
486
+ }
487
+ }
488
+ },
489
+ "500": {
490
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
491
+ "content": {
492
+ "application/json": {
493
+ "schema": {
494
+ "$ref": "#/components/schemas/Error"
495
+ },
496
+ "examples": {
497
+ "exampleResponse": {
498
+ "value": {
499
+ "name": "InternalServerError",
500
+ "message": "component.error"
501
+ }
502
+ }
503
+ }
504
+ }
505
+ }
506
+ }
507
+ }
508
+ }
509
+ }
510
+ },
511
+ "components": {
512
+ "schemas": {
513
+ "EntityStorageGetResponse": {
514
+ "description": "The data for the requested entity."
515
+ },
516
+ "EntityStorageListResponse": {
517
+ "type": "object",
518
+ "properties": {
519
+ "entities": {
520
+ "type": "array",
521
+ "items": {},
522
+ "description": "The entities from the query."
523
+ },
524
+ "cursor": {
525
+ "type": "string",
526
+ "description": "The cursor for the next page."
527
+ }
528
+ },
529
+ "required": [
530
+ "entities"
531
+ ],
532
+ "additionalProperties": false,
533
+ "description": "The list of entries from the query."
534
+ },
535
+ "EntityStorageSetRequest": {
536
+ "description": "The data to be used in the entity."
537
+ },
538
+ "Error": {
539
+ "type": "object",
540
+ "properties": {
541
+ "name": {
542
+ "type": "string",
543
+ "description": "The name for the error."
544
+ },
545
+ "message": {
546
+ "type": "string",
547
+ "description": "The message for the error."
548
+ },
549
+ "source": {
550
+ "type": "string",
551
+ "description": "The source of the error."
552
+ },
553
+ "properties": {
554
+ "type": "object",
555
+ "additionalProperties": {},
556
+ "description": "Any additional information for the error."
557
+ },
558
+ "stack": {
559
+ "type": "string",
560
+ "description": "The stack trace for the error."
561
+ },
562
+ "inner": {
563
+ "$ref": "#/components/schemas/Error"
564
+ }
565
+ },
566
+ "required": [
567
+ "name",
568
+ "message"
569
+ ],
570
+ "additionalProperties": false,
571
+ "description": "Model to describe serialized error."
572
+ },
573
+ "NotFoundResponse": {
574
+ "type": "object",
575
+ "additionalProperties": false,
576
+ "properties": {
577
+ "notFoundId": {
578
+ "type": "string",
579
+ "description": "The id if the item that was not found."
580
+ },
581
+ "name": {
582
+ "type": "string",
583
+ "description": "The name for the error."
584
+ },
585
+ "message": {
586
+ "type": "string",
587
+ "description": "The message for the error."
588
+ },
589
+ "source": {
590
+ "type": "string",
591
+ "description": "The source of the error."
592
+ },
593
+ "properties": {
594
+ "type": "object",
595
+ "additionalProperties": {},
596
+ "description": "Any additional information for the error."
597
+ },
598
+ "stack": {
599
+ "type": "string",
600
+ "description": "The stack trace for the error."
601
+ },
602
+ "inner": {
603
+ "$ref": "#/components/schemas/Error"
604
+ }
605
+ },
606
+ "required": [
607
+ "message",
608
+ "name"
609
+ ],
610
+ "description": "The body which contains the error."
611
+ },
612
+ "SortDirection": {
613
+ "anyOf": [
614
+ {
615
+ "type": "string",
616
+ "const": "asc",
617
+ "description": "Ascending."
618
+ },
619
+ {
620
+ "type": "string",
621
+ "const": "desc",
622
+ "description": "Descending."
623
+ }
624
+ ],
625
+ "description": "The sort directions."
626
+ }
627
+ },
628
+ "securitySchemes": {
629
+ "jwtBearerAuthScheme": {
630
+ "type": "http",
631
+ "scheme": "bearer",
632
+ "bearerFormat": "JWT"
633
+ }
634
+ }
635
+ }
636
+ }