Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions app/src/main/resources/explorer-backend-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5560,6 +5560,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -6072,6 +6080,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
Expand Down Expand Up @@ -6172,6 +6188,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
Expand Down Expand Up @@ -6272,6 +6296,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
Expand Down Expand Up @@ -6372,6 +6404,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
Expand Down Expand Up @@ -7000,6 +7040,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -7146,6 +7194,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -7290,6 +7346,14 @@
"responses": {
"200": {
"description": "Ok",
"headers": {
"Cache-Control": {
"required": true,
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ trait BaseEndpoint extends ErrorExamples with TapirCodecs with TapirSchemasLike
)
)

def cacheControl(maxAgeSeconds: Int): EndpointIO.FixedHeader[Unit] =
header("Cache-Control", s"public, max-age=$maxAgeSeconds")

def arrayBody[T](tpe: String, maxSize: Int)(implicit
examples: List[Example[ArraySeq[T]]],
rw: ReadWriter[ArraySeq[T]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ trait ChartsEndpoints extends BaseEndpoint with QueryParams {

val intervalTypes: String = IntervalType.all.dropRight(1).map(_.string).mkString(", ")

private val chartCacheMaxAgeSeconds = 60

private val chartsEndpoint =
baseEndpoint
.tag("Charts")
.in("charts")
.out(cacheControl(chartCacheMaxAgeSeconds))

val getHashrates: BaseEndpoint[(TimeInterval, IntervalType), ArraySeq[Hashrate]] =
chartsEndpoint.get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ trait InfosEndpoints extends BaseEndpoint with QueryParams {
.tag("Infos")
.in("infos")

private val infoCacheMaxAgeSeconds = 30

private val supplyEndpoint =
infosEndpoint
.in("supply")
.out(cacheControl(infoCacheMaxAgeSeconds))

val getInfos: BaseEndpoint[Unit, ExplorerInfo] =
infosEndpoint.get
Expand Down
Loading