Skip to content

Commit

Permalink
Update swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed Jan 22, 2025
1 parent 58f8b94 commit 0ffd330
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 5 deletions.
9 changes: 9 additions & 0 deletions disperser/dataapi/docs/v1/V1_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,15 @@ const docTemplateV1 = `{
},
"retrieval_status": {
"type": "string"
},
"v2_dispersal_online": {
"type": "boolean"
},
"v2_dispersal_socket": {
"type": "string"
},
"v2_dispersal_status": {
"type": "string"
}
}
},
Expand Down
9 changes: 9 additions & 0 deletions disperser/dataapi/docs/v1/V1_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,15 @@
},
"retrieval_status": {
"type": "string"
},
"v2_dispersal_online": {
"type": "boolean"
},
"v2_dispersal_socket": {
"type": "string"
},
"v2_dispersal_status": {
"type": "string"
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions disperser/dataapi/docs/v1/V1_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ definitions:
type: string
retrieval_status:
type: string
v2_dispersal_online:
type: boolean
v2_dispersal_socket:
type: string
v2_dispersal_status:
type: string
type: object
dataapi.OperatorStake:
properties:
Expand Down
78 changes: 78 additions & 0 deletions disperser/dataapi/docs/v2/V2_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,69 @@ const docTemplateV2 = `{
}
}
},
"/blobs/feed": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Blob"
],
"summary": "Fetch blob feed",
"parameters": [
{
"type": "string",
"description": "Fetch blobs up to the end time (ISO 8601 format: 2006-01-02T15:04:05Z) [default: now]",
"name": "end",
"in": "query"
},
{
"type": "integer",
"description": "Fetch blobs starting from an interval (in seconds) before the end time [default: 3600]",
"name": "interval",
"in": "query"
},
{
"type": "string",
"description": "Fetch blobs starting from the pagination token (exclusively). Overrides the interval param if specified [default: empty]",
"name": "pagination_token",
"in": "query"
},
{
"type": "integer",
"description": "The maximum number of blobs to fetch. System max (1000) if limit \u003c= 0 [default: 20; max: 1000]",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v2.BlobFeedResponse"
}
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
}
}
}
},
"/blobs/{blob_key}": {
"get": {
"produces": [
Expand Down Expand Up @@ -1100,6 +1163,9 @@ const docTemplateV2 = `{
"dispersal_socket": {
"type": "string"
},
"dispersal_status": {
"type": "string"
},
"operator_id": {
"type": "string"
},
Expand All @@ -1108,6 +1174,18 @@ const docTemplateV2 = `{
},
"retrieval_socket": {
"type": "string"
},
"retrieval_status": {
"type": "string"
},
"v2_dispersal_online": {
"type": "boolean"
},
"v2_dispersal_socket": {
"type": "string"
},
"v2_dispersal_status": {
"type": "string"
}
}
},
Expand Down
78 changes: 78 additions & 0 deletions disperser/dataapi/docs/v2/V2_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,69 @@
}
}
},
"/blobs/feed": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Blob"
],
"summary": "Fetch blob feed",
"parameters": [
{
"type": "string",
"description": "Fetch blobs up to the end time (ISO 8601 format: 2006-01-02T15:04:05Z) [default: now]",
"name": "end",
"in": "query"
},
{
"type": "integer",
"description": "Fetch blobs starting from an interval (in seconds) before the end time [default: 3600]",
"name": "interval",
"in": "query"
},
{
"type": "string",
"description": "Fetch blobs starting from the pagination token (exclusively). Overrides the interval param if specified [default: empty]",
"name": "pagination_token",
"in": "query"
},
{
"type": "integer",
"description": "The maximum number of blobs to fetch. System max (1000) if limit \u003c= 0 [default: 20; max: 1000]",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v2.BlobFeedResponse"
}
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
}
}
}
},
"/blobs/{blob_key}": {
"get": {
"produces": [
Expand Down Expand Up @@ -1097,6 +1160,9 @@
"dispersal_socket": {
"type": "string"
},
"dispersal_status": {
"type": "string"
},
"operator_id": {
"type": "string"
},
Expand All @@ -1105,6 +1171,18 @@
},
"retrieval_socket": {
"type": "string"
},
"retrieval_status": {
"type": "string"
},
"v2_dispersal_online": {
"type": "boolean"
},
"v2_dispersal_socket": {
"type": "string"
},
"v2_dispersal_status": {
"type": "string"
}
}
},
Expand Down
55 changes: 55 additions & 0 deletions disperser/dataapi/docs/v2/V2_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,22 @@ definitions:
type: boolean
dispersal_socket:
type: string
dispersal_status:
type: string
operator_id:
type: string
retrieval_online:
type: boolean
retrieval_socket:
type: string
retrieval_status:
type: string
v2_dispersal_online:
type: boolean
v2_dispersal_socket:
type: string
v2_dispersal_status:
type: string
type: object
v2.OperatorStake:
properties:
Expand Down Expand Up @@ -609,6 +619,51 @@ paths:
summary: Fetch blob verification info by blob key and batch header hash
tags:
- Blob
/blobs/feed:
get:
parameters:
- description: 'Fetch blobs up to the end time (ISO 8601 format: 2006-01-02T15:04:05Z)
[default: now]'
in: query
name: end
type: string
- description: 'Fetch blobs starting from an interval (in seconds) before the
end time [default: 3600]'
in: query
name: interval
type: integer
- description: 'Fetch blobs starting from the pagination token (exclusively).
Overrides the interval param if specified [default: empty]'
in: query
name: pagination_token
type: string
- description: 'The maximum number of blobs to fetch. System max (1000) if limit
<= 0 [default: 20; max: 1000]'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/v2.BlobFeedResponse'
"400":
description: 'error: Bad request'
schema:
$ref: '#/definitions/v2.ErrorResponse'
"404":
description: 'error: Not found'
schema:
$ref: '#/definitions/v2.ErrorResponse'
"500":
description: 'error: Server error'
schema:
$ref: '#/definitions/v2.ErrorResponse'
summary: Fetch blob feed
tags:
- Blob
/metrics/summary:
get:
parameters:
Expand Down
16 changes: 11 additions & 5 deletions disperser/dataapi/v2/server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ type (
}

OperatorPortCheckResponse struct {
OperatorId string `json:"operator_id"`
DispersalSocket string `json:"dispersal_socket"`
RetrievalSocket string `json:"retrieval_socket"`
DispersalOnline bool `json:"dispersal_online"`
RetrievalOnline bool `json:"retrieval_online"`
OperatorId string `json:"operator_id"`
DispersalSocket string `json:"dispersal_socket"`
DispersalOnline bool `json:"dispersal_online"`
DispersalStatus string `json:"dispersal_status"`
RetrievalSocket string `json:"retrieval_socket"`
RetrievalOnline bool `json:"retrieval_online"`
RetrievalStatus string `json:"retrieval_status"`
V2DispersalSocket string `json:"v2_dispersal_socket"`
V2DispersalOnline bool `json:"v2_dispersal_online"`
V2DispersalStatus string `json:"v2_dispersal_status"`
}

SemverReportResponse struct {
Expand Down Expand Up @@ -324,6 +329,7 @@ func (s *ServerV2) Shutdown() error {
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /blobs/feed [get]
func (s *ServerV2) FetchBlobFeedHandler(c *gin.Context) {
timer := prometheus.NewTimer(prometheus.ObserverFunc(func(f float64) {
s.metrics.ObserveLatency("FetchBlobFeedHandler", f*1000) // make milliseconds
Expand Down

0 comments on commit 0ffd330

Please sign in to comment.