Skip to content

Commit

Permalink
feat: add /snapshots api docs (#80)
Browse files Browse the repository at this point in the history
* feat: add /snapshots api docs

* fix: fix api and example
  • Loading branch information
pedrotambo authored Jan 14, 2023
1 parent f60beac commit a756503
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
26 changes: 26 additions & 0 deletions openapi/components/examples/content/200-snapshots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"value": [
{
"hash": "bafkreig6sfhegnp4okzecgx3v6gj6pohh5qzw6zjtrdqtggx64743rkmz4",
"timeRange": {
"initTimestamp": 1577836800000,
"endTimestamp": 1606867200000
},
"replacedSnapshotHashes": [
"bafkreig6sfhegnp4okzecgx3v6gj6pohh5qzw6zjtrdqtggx64743rkmz4"
],
"numberOfEntities": 0,
"generationTimestamp": 1671126919124
},
{
"hash": "bafkreig6sfhegnp4okzecgx3v6gj6pohh5qzw6zjtrdqtggx64743rkmz4",
"timeRange": {
"initTimestamp": 1606867200000,
"endTimestamp": 1635897600000
},
"replacedSnapshotHashes": [],
"numberOfEntities": 0,
"generationTimestamp": 1671126611185
}
]
}
30 changes: 30 additions & 0 deletions openapi/components/schemas/content/200-snapshots.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
type: array
items:
required:
- hash
- timeRange
- replacedSnapshotHashes
- numberOfEntities
- generationTimestamp
type: object
properties:
hash:
type: string
timeRange:
required:
- initTimestamp
- endTimestamp
type: object
properties:
initTimestamp:
type: number
endTimestamp:
type: number
replacedSnapshotHashes:
type: array
items:
type: string
numberOfEntities:
type: number
generationTimestamp:
type: number
2 changes: 2 additions & 0 deletions openapi/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ paths:
$ref: paths/content/content@pointer-changes.yaml
/snapshot:
$ref: 'paths/content/content@snapshot.yaml'
/snapshots:
$ref: 'paths/content/content@snapshots.yaml'
/status:
$ref: paths/content/content@status.yaml
25 changes: 25 additions & 0 deletions openapi/paths/content/content@snapshots.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
get:
operationId: getSnapshots
summary: Snapshots with a list of active entities
tags:
- Content Server
description: >-
Lists all active deployments stored in the database in multiple snapshots for different time ranges.
If the information needed is front in time of the most recent snapshot, you may use the
`/content/pointer-changes` endpoint with the necessary `from` filter.
responses:
'200':
description: >-
The result is a list of snapshots. Each "hash" field references the a snapshot with all the active entities that has an entity timestamp within the specified time range.
Each hash is a reference to a JSON file containing one line per entity in a JSON format.
Once you get the hashes you can download them using the
/content/contents/{hashId} endpoint.
content:
application/json; charset=utf-8:
schema:
$ref: ../../components/schemas/content/200-snapshots.yaml
examples:
default:
$ref: ../../components/examples/content/200-snapshots.json
'503':
description: New Snapshots not yet created

0 comments on commit a756503

Please sign in to comment.