@hestia-earth/caching-api 0.1.1 → 0.1.4

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/openapi.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
- "title": "FastAPI",
5
- "version": "0.1.0"
4
+ "title": "HESTIA Caching API",
5
+ "version": "0.1.4"
6
6
  },
7
7
  "paths": {
8
8
  "/sites/{key}": {
@@ -418,6 +418,360 @@
418
418
  }
419
419
  }
420
420
  },
421
+ "/tokens": {
422
+ "get": {
423
+ "tags": [
424
+ "tokens"
425
+ ],
426
+ "summary": "Read All",
427
+ "description": "Lists all API tokens. Secrets are never returned.",
428
+ "operationId": "read_all_tokens_get",
429
+ "responses": {
430
+ "200": {
431
+ "description": "Successful Response",
432
+ "content": {
433
+ "application/json": {
434
+ "schema": {
435
+ "items": {
436
+ "$ref": "#/components/schemas/TokenOut"
437
+ },
438
+ "type": "array",
439
+ "title": "Response Read All Tokens Get"
440
+ }
441
+ }
442
+ }
443
+ }
444
+ },
445
+ "security": [
446
+ {
447
+ "APIKeyHeader": []
448
+ }
449
+ ]
450
+ },
451
+ "post": {
452
+ "tags": [
453
+ "tokens"
454
+ ],
455
+ "summary": "Create",
456
+ "description": "Creates a new API token. The plaintext token is returned once and is not\nstored \u2014 save it now, it cannot be retrieved later.",
457
+ "operationId": "create_tokens_post",
458
+ "requestBody": {
459
+ "content": {
460
+ "application/json": {
461
+ "schema": {
462
+ "$ref": "#/components/schemas/TokenCreate"
463
+ }
464
+ }
465
+ },
466
+ "required": true
467
+ },
468
+ "responses": {
469
+ "201": {
470
+ "description": "Successful Response",
471
+ "content": {
472
+ "application/json": {
473
+ "schema": {
474
+ "$ref": "#/components/schemas/TokenWithSecret"
475
+ }
476
+ }
477
+ }
478
+ },
479
+ "422": {
480
+ "description": "Validation Error",
481
+ "content": {
482
+ "application/json": {
483
+ "schema": {
484
+ "$ref": "#/components/schemas/HTTPValidationError"
485
+ }
486
+ }
487
+ }
488
+ }
489
+ },
490
+ "security": [
491
+ {
492
+ "APIKeyHeader": []
493
+ }
494
+ ]
495
+ }
496
+ },
497
+ "/tokens/{token_id}": {
498
+ "get": {
499
+ "tags": [
500
+ "tokens"
501
+ ],
502
+ "summary": "Read One",
503
+ "description": "Retrieves a single API token by its id.",
504
+ "operationId": "read_one_tokens__token_id__get",
505
+ "security": [
506
+ {
507
+ "APIKeyHeader": []
508
+ }
509
+ ],
510
+ "parameters": [
511
+ {
512
+ "name": "token_id",
513
+ "in": "path",
514
+ "required": true,
515
+ "schema": {
516
+ "type": "string",
517
+ "title": "Token Id"
518
+ }
519
+ }
520
+ ],
521
+ "responses": {
522
+ "200": {
523
+ "description": "Successful Response",
524
+ "content": {
525
+ "application/json": {
526
+ "schema": {
527
+ "$ref": "#/components/schemas/TokenOut"
528
+ }
529
+ }
530
+ }
531
+ },
532
+ "422": {
533
+ "description": "Validation Error",
534
+ "content": {
535
+ "application/json": {
536
+ "schema": {
537
+ "$ref": "#/components/schemas/HTTPValidationError"
538
+ }
539
+ }
540
+ }
541
+ }
542
+ }
543
+ },
544
+ "patch": {
545
+ "tags": [
546
+ "tokens"
547
+ ],
548
+ "summary": "Update",
549
+ "description": "Updates a token: rename, re-scope, renew (change expiry) or (de)activate it.\nDoes not rotate the secret.",
550
+ "operationId": "update_tokens__token_id__patch",
551
+ "security": [
552
+ {
553
+ "APIKeyHeader": []
554
+ }
555
+ ],
556
+ "parameters": [
557
+ {
558
+ "name": "token_id",
559
+ "in": "path",
560
+ "required": true,
561
+ "schema": {
562
+ "type": "string",
563
+ "title": "Token Id"
564
+ }
565
+ }
566
+ ],
567
+ "requestBody": {
568
+ "required": true,
569
+ "content": {
570
+ "application/json": {
571
+ "schema": {
572
+ "$ref": "#/components/schemas/TokenUpdate"
573
+ }
574
+ }
575
+ }
576
+ },
577
+ "responses": {
578
+ "200": {
579
+ "description": "Successful Response",
580
+ "content": {
581
+ "application/json": {
582
+ "schema": {
583
+ "$ref": "#/components/schemas/TokenOut"
584
+ }
585
+ }
586
+ }
587
+ },
588
+ "422": {
589
+ "description": "Validation Error",
590
+ "content": {
591
+ "application/json": {
592
+ "schema": {
593
+ "$ref": "#/components/schemas/HTTPValidationError"
594
+ }
595
+ }
596
+ }
597
+ }
598
+ }
599
+ },
600
+ "delete": {
601
+ "tags": [
602
+ "tokens"
603
+ ],
604
+ "summary": "Remove",
605
+ "description": "Deletes an API token.",
606
+ "operationId": "remove_tokens__token_id__delete",
607
+ "security": [
608
+ {
609
+ "APIKeyHeader": []
610
+ }
611
+ ],
612
+ "parameters": [
613
+ {
614
+ "name": "token_id",
615
+ "in": "path",
616
+ "required": true,
617
+ "schema": {
618
+ "type": "string",
619
+ "title": "Token Id"
620
+ }
621
+ }
622
+ ],
623
+ "responses": {
624
+ "200": {
625
+ "description": "Successful Response",
626
+ "content": {
627
+ "application/json": {
628
+ "schema": {}
629
+ }
630
+ }
631
+ },
632
+ "422": {
633
+ "description": "Validation Error",
634
+ "content": {
635
+ "application/json": {
636
+ "schema": {
637
+ "$ref": "#/components/schemas/HTTPValidationError"
638
+ }
639
+ }
640
+ }
641
+ }
642
+ }
643
+ }
644
+ },
645
+ "/tokens/{token_id}/reactivate": {
646
+ "post": {
647
+ "tags": [
648
+ "tokens"
649
+ ],
650
+ "summary": "Reactivate",
651
+ "description": "Reactivates a token, rotating its secret and returning the new plaintext.\nThe previous secret is invalidated immediately.",
652
+ "operationId": "reactivate_tokens__token_id__reactivate_post",
653
+ "security": [
654
+ {
655
+ "APIKeyHeader": []
656
+ }
657
+ ],
658
+ "parameters": [
659
+ {
660
+ "name": "token_id",
661
+ "in": "path",
662
+ "required": true,
663
+ "schema": {
664
+ "type": "string",
665
+ "title": "Token Id"
666
+ }
667
+ }
668
+ ],
669
+ "requestBody": {
670
+ "content": {
671
+ "application/json": {
672
+ "schema": {
673
+ "$ref": "#/components/schemas/TokenReactivate",
674
+ "default": {}
675
+ }
676
+ }
677
+ }
678
+ },
679
+ "responses": {
680
+ "200": {
681
+ "description": "Successful Response",
682
+ "content": {
683
+ "application/json": {
684
+ "schema": {
685
+ "$ref": "#/components/schemas/TokenWithSecret"
686
+ }
687
+ }
688
+ }
689
+ },
690
+ "422": {
691
+ "description": "Validation Error",
692
+ "content": {
693
+ "application/json": {
694
+ "schema": {
695
+ "$ref": "#/components/schemas/HTTPValidationError"
696
+ }
697
+ }
698
+ }
699
+ }
700
+ }
701
+ }
702
+ },
703
+ "/geospatial/collections": {
704
+ "get": {
705
+ "tags": [
706
+ "geospatial"
707
+ ],
708
+ "summary": "List Collections",
709
+ "description": "The collections this API can answer for.\n\nCallers hold a mix: the ones HESTIA owns are served here, the public Earth\nEngine ones are not. Since `/run` rejects a query it cannot answer *in\nfull*, a caller batching collections together needs to know the split up\nfront rather than discovering it from a 422.",
710
+ "operationId": "list_collections_geospatial_collections_get",
711
+ "responses": {
712
+ "200": {
713
+ "description": "Successful Response",
714
+ "content": {
715
+ "application/json": {
716
+ "schema": {}
717
+ }
718
+ }
719
+ }
720
+ },
721
+ "security": [
722
+ {
723
+ "APIKeyHeader": []
724
+ }
725
+ ]
726
+ }
727
+ },
728
+ "/geospatial/run": {
729
+ "post": {
730
+ "tags": [
731
+ "geospatial"
732
+ ],
733
+ "summary": "Run Query",
734
+ "description": "Samples the exported geospatial assets at coordinates, or reduces them over\nboundaries or GADM regions.\n\nAccepts the same payload as ``hestia_earth.earth_engine.run`` so the models\ncan call this instead, and returns the values in the same order:\ngeometry-major, one value per collection.\n\nOnly collections HESTIA owns are served here. Public Earth Engine\ncollections (ERA5, TERRACLIMATE, GMTED2010) are rejected rather than\nsilently returning nothing -- the caller is expected to route those to\nEarth Engine.",
735
+ "operationId": "run_query_geospatial_run_post",
736
+ "requestBody": {
737
+ "content": {
738
+ "application/json": {
739
+ "schema": {
740
+ "$ref": "#/components/schemas/GeospatialQuery"
741
+ }
742
+ }
743
+ },
744
+ "required": true
745
+ },
746
+ "responses": {
747
+ "200": {
748
+ "description": "Successful Response",
749
+ "content": {
750
+ "application/json": {
751
+ "schema": {
752
+ "$ref": "#/components/schemas/GeospatialResults"
753
+ }
754
+ }
755
+ }
756
+ },
757
+ "422": {
758
+ "description": "Validation Error",
759
+ "content": {
760
+ "application/json": {
761
+ "schema": {
762
+ "$ref": "#/components/schemas/HTTPValidationError"
763
+ }
764
+ }
765
+ }
766
+ }
767
+ },
768
+ "security": [
769
+ {
770
+ "APIKeyHeader": []
771
+ }
772
+ ]
773
+ }
774
+ },
421
775
  "/version": {
422
776
  "get": {
423
777
  "tags": [
@@ -456,6 +810,154 @@
456
810
  },
457
811
  "components": {
458
812
  "schemas": {
813
+ "Collection": {
814
+ "properties": {
815
+ "collection": {
816
+ "type": "string",
817
+ "title": "Collection"
818
+ }
819
+ },
820
+ "additionalProperties": true,
821
+ "type": "object",
822
+ "required": [
823
+ "collection"
824
+ ],
825
+ "title": "Collection",
826
+ "description": "One collection to sample.\n\nMirrors the payload ``hestia_earth.earth_engine`` accepts so the models can\nswap one for the other without reshaping the query. Fields beyond\n``collection`` (``band_name``, ``reducer``, ``name``, depth bounds) are\ncarried for compatibility and ignored when sampling by coordinates -- a\npoint needs no reduction, and the soil depth is already encoded in the\ncollection name."
827
+ },
828
+ "Coordinate": {
829
+ "properties": {
830
+ "latitude": {
831
+ "type": "number",
832
+ "maximum": 90.0,
833
+ "minimum": -90.0,
834
+ "title": "Latitude"
835
+ },
836
+ "longitude": {
837
+ "type": "number",
838
+ "maximum": 180.0,
839
+ "minimum": -180.0,
840
+ "title": "Longitude"
841
+ }
842
+ },
843
+ "type": "object",
844
+ "required": [
845
+ "latitude",
846
+ "longitude"
847
+ ],
848
+ "title": "Coordinate"
849
+ },
850
+ "GeospatialQuery": {
851
+ "properties": {
852
+ "ee_type": {
853
+ "anyOf": [
854
+ {
855
+ "type": "string"
856
+ },
857
+ {
858
+ "type": "null"
859
+ }
860
+ ],
861
+ "title": "Ee Type"
862
+ },
863
+ "collections": {
864
+ "items": {
865
+ "$ref": "#/components/schemas/Collection"
866
+ },
867
+ "type": "array",
868
+ "minItems": 1,
869
+ "title": "Collections"
870
+ },
871
+ "coordinates": {
872
+ "anyOf": [
873
+ {
874
+ "items": {
875
+ "$ref": "#/components/schemas/Coordinate"
876
+ },
877
+ "type": "array"
878
+ },
879
+ {
880
+ "type": "null"
881
+ }
882
+ ],
883
+ "title": "Coordinates"
884
+ },
885
+ "boundaries": {
886
+ "anyOf": [
887
+ {
888
+ "items": {
889
+ "additionalProperties": true,
890
+ "type": "object"
891
+ },
892
+ "type": "array"
893
+ },
894
+ {
895
+ "type": "null"
896
+ }
897
+ ],
898
+ "title": "Boundaries"
899
+ },
900
+ "gadm-ids": {
901
+ "anyOf": [
902
+ {
903
+ "items": {
904
+ "type": "string"
905
+ },
906
+ "type": "array"
907
+ },
908
+ {
909
+ "type": "null"
910
+ }
911
+ ],
912
+ "title": "Gadm-Ids"
913
+ },
914
+ "scale": {
915
+ "anyOf": [
916
+ {
917
+ "type": "number",
918
+ "exclusiveMinimum": 0.0
919
+ },
920
+ {
921
+ "type": "null"
922
+ }
923
+ ],
924
+ "title": "Scale"
925
+ }
926
+ },
927
+ "type": "object",
928
+ "required": [
929
+ "collections"
930
+ ],
931
+ "title": "GeospatialQuery",
932
+ "description": "One of ``coordinates``, ``boundaries`` or ``gadm-ids``.\n\n``hestia_earth.earth_engine.run`` picks its mode from whichever key is\npresent, so the same payload works against either backend."
933
+ },
934
+ "GeospatialResults": {
935
+ "properties": {
936
+ "results": {
937
+ "items": {
938
+ "anyOf": [
939
+ {
940
+ "type": "number"
941
+ },
942
+ {
943
+ "type": "integer"
944
+ },
945
+ {
946
+ "type": "null"
947
+ }
948
+ ]
949
+ },
950
+ "type": "array",
951
+ "title": "Results"
952
+ }
953
+ },
954
+ "type": "object",
955
+ "required": [
956
+ "results"
957
+ ],
958
+ "title": "GeospatialResults",
959
+ "description": "Values ordered coordinate-major: per coordinate, one per collection."
960
+ },
459
961
  "HTTPValidationError": {
460
962
  "properties": {
461
963
  "detail": {
@@ -565,6 +1067,285 @@
565
1067
  ],
566
1068
  "title": "SitePaginated"
567
1069
  },
1070
+ "TokenCreate": {
1071
+ "properties": {
1072
+ "name": {
1073
+ "type": "string",
1074
+ "title": "Name"
1075
+ },
1076
+ "scopes": {
1077
+ "items": {
1078
+ "type": "string"
1079
+ },
1080
+ "type": "array",
1081
+ "title": "Scopes"
1082
+ },
1083
+ "expires_at": {
1084
+ "anyOf": [
1085
+ {
1086
+ "type": "string",
1087
+ "format": "date-time"
1088
+ },
1089
+ {
1090
+ "type": "null"
1091
+ }
1092
+ ],
1093
+ "title": "Expires At"
1094
+ }
1095
+ },
1096
+ "type": "object",
1097
+ "required": [
1098
+ "name",
1099
+ "scopes"
1100
+ ],
1101
+ "title": "TokenCreate"
1102
+ },
1103
+ "TokenOut": {
1104
+ "properties": {
1105
+ "id": {
1106
+ "type": "string",
1107
+ "title": "Id"
1108
+ },
1109
+ "name": {
1110
+ "type": "string",
1111
+ "title": "Name"
1112
+ },
1113
+ "prefix": {
1114
+ "type": "string",
1115
+ "title": "Prefix"
1116
+ },
1117
+ "scopes": {
1118
+ "items": {
1119
+ "type": "string"
1120
+ },
1121
+ "type": "array",
1122
+ "title": "Scopes"
1123
+ },
1124
+ "is_active": {
1125
+ "type": "boolean",
1126
+ "title": "Is Active"
1127
+ },
1128
+ "active": {
1129
+ "type": "boolean",
1130
+ "title": "Active"
1131
+ },
1132
+ "expires_at": {
1133
+ "anyOf": [
1134
+ {
1135
+ "type": "string",
1136
+ "format": "date-time"
1137
+ },
1138
+ {
1139
+ "type": "null"
1140
+ }
1141
+ ],
1142
+ "title": "Expires At"
1143
+ },
1144
+ "last_used_at": {
1145
+ "anyOf": [
1146
+ {
1147
+ "type": "string",
1148
+ "format": "date-time"
1149
+ },
1150
+ {
1151
+ "type": "null"
1152
+ }
1153
+ ],
1154
+ "title": "Last Used At"
1155
+ },
1156
+ "created_at": {
1157
+ "type": "string",
1158
+ "format": "date-time",
1159
+ "title": "Created At"
1160
+ },
1161
+ "updated_at": {
1162
+ "anyOf": [
1163
+ {
1164
+ "type": "string",
1165
+ "format": "date-time"
1166
+ },
1167
+ {
1168
+ "type": "null"
1169
+ }
1170
+ ],
1171
+ "title": "Updated At"
1172
+ }
1173
+ },
1174
+ "type": "object",
1175
+ "required": [
1176
+ "id",
1177
+ "name",
1178
+ "prefix",
1179
+ "scopes",
1180
+ "is_active",
1181
+ "active",
1182
+ "created_at"
1183
+ ],
1184
+ "title": "TokenOut"
1185
+ },
1186
+ "TokenReactivate": {
1187
+ "properties": {
1188
+ "expires_at": {
1189
+ "anyOf": [
1190
+ {
1191
+ "type": "string",
1192
+ "format": "date-time"
1193
+ },
1194
+ {
1195
+ "type": "null"
1196
+ }
1197
+ ],
1198
+ "title": "Expires At"
1199
+ }
1200
+ },
1201
+ "type": "object",
1202
+ "title": "TokenReactivate",
1203
+ "description": "Reactivation rotates the secret; an optional new expiry may be set\n(null clears the expiry so the token never expires)."
1204
+ },
1205
+ "TokenUpdate": {
1206
+ "properties": {
1207
+ "name": {
1208
+ "anyOf": [
1209
+ {
1210
+ "type": "string"
1211
+ },
1212
+ {
1213
+ "type": "null"
1214
+ }
1215
+ ],
1216
+ "title": "Name"
1217
+ },
1218
+ "scopes": {
1219
+ "anyOf": [
1220
+ {
1221
+ "items": {
1222
+ "type": "string"
1223
+ },
1224
+ "type": "array"
1225
+ },
1226
+ {
1227
+ "type": "null"
1228
+ }
1229
+ ],
1230
+ "title": "Scopes"
1231
+ },
1232
+ "expires_at": {
1233
+ "anyOf": [
1234
+ {
1235
+ "type": "string",
1236
+ "format": "date-time"
1237
+ },
1238
+ {
1239
+ "type": "null"
1240
+ }
1241
+ ],
1242
+ "title": "Expires At"
1243
+ },
1244
+ "is_active": {
1245
+ "anyOf": [
1246
+ {
1247
+ "type": "boolean"
1248
+ },
1249
+ {
1250
+ "type": "null"
1251
+ }
1252
+ ],
1253
+ "title": "Is Active"
1254
+ }
1255
+ },
1256
+ "type": "object",
1257
+ "title": "TokenUpdate",
1258
+ "description": "Partial update (rename, re-scope, renew expiry, (de)activate).\n\nDoes not rotate the secret; use the reactivate endpoint for that."
1259
+ },
1260
+ "TokenWithSecret": {
1261
+ "properties": {
1262
+ "id": {
1263
+ "type": "string",
1264
+ "title": "Id"
1265
+ },
1266
+ "name": {
1267
+ "type": "string",
1268
+ "title": "Name"
1269
+ },
1270
+ "prefix": {
1271
+ "type": "string",
1272
+ "title": "Prefix"
1273
+ },
1274
+ "scopes": {
1275
+ "items": {
1276
+ "type": "string"
1277
+ },
1278
+ "type": "array",
1279
+ "title": "Scopes"
1280
+ },
1281
+ "is_active": {
1282
+ "type": "boolean",
1283
+ "title": "Is Active"
1284
+ },
1285
+ "active": {
1286
+ "type": "boolean",
1287
+ "title": "Active"
1288
+ },
1289
+ "expires_at": {
1290
+ "anyOf": [
1291
+ {
1292
+ "type": "string",
1293
+ "format": "date-time"
1294
+ },
1295
+ {
1296
+ "type": "null"
1297
+ }
1298
+ ],
1299
+ "title": "Expires At"
1300
+ },
1301
+ "last_used_at": {
1302
+ "anyOf": [
1303
+ {
1304
+ "type": "string",
1305
+ "format": "date-time"
1306
+ },
1307
+ {
1308
+ "type": "null"
1309
+ }
1310
+ ],
1311
+ "title": "Last Used At"
1312
+ },
1313
+ "created_at": {
1314
+ "type": "string",
1315
+ "format": "date-time",
1316
+ "title": "Created At"
1317
+ },
1318
+ "updated_at": {
1319
+ "anyOf": [
1320
+ {
1321
+ "type": "string",
1322
+ "format": "date-time"
1323
+ },
1324
+ {
1325
+ "type": "null"
1326
+ }
1327
+ ],
1328
+ "title": "Updated At"
1329
+ },
1330
+ "token": {
1331
+ "type": "string",
1332
+ "title": "Token"
1333
+ }
1334
+ },
1335
+ "type": "object",
1336
+ "required": [
1337
+ "id",
1338
+ "name",
1339
+ "prefix",
1340
+ "scopes",
1341
+ "is_active",
1342
+ "active",
1343
+ "created_at",
1344
+ "token"
1345
+ ],
1346
+ "title": "TokenWithSecret",
1347
+ "description": "Returned only on creation and reactivation: carries the plaintext token,\nwhich is never stored and cannot be retrieved again."
1348
+ },
568
1349
  "ValidationError": {
569
1350
  "properties": {
570
1351
  "loc": {