Skip to content

Commit

Permalink
new download endpoint (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateeullahmalik authored Jul 12, 2024
1 parent a91fabc commit 0834110
Show file tree
Hide file tree
Showing 21 changed files with 27,893 additions and 38,100 deletions.
38 changes: 38 additions & 0 deletions walletnode/api/design/cascade.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,44 @@ var _ = Service("cascade", func() {
})
})

Method("downloadV2", func() {
Description("Starts downloading cascade Artifact.")
Meta("swagger:summary", "Downloads cascade artifact")

Security(APIKeyAuth)

Payload(DownloadPayload)
Result(FileDownloadV2Result)

HTTP(func() {
GET("/v2/download")
Param("txid")
Param("pid")

Response("UnAuthorized", StatusUnauthorized)
Response("NotFound", StatusNotFound)
Response("InternalServerError", StatusInternalServerError)
Response(StatusOK)
})
})

Method("getDownloadTaskState", func() {
Description("Gets the state of download task")
Meta("swagger:summary", "Get history of states as a json string with a list of state objects.")

Payload(func() {
Extend(DownloadTaskStatePayload)
})
Result(ArrayOf(TaskHistory))

HTTP(func() {
GET("/downloads/{file_id}/status")
Response("NotFound", StatusNotFound)
Response("InternalServerError", StatusInternalServerError)
Response(StatusOK)
})
})

Method("registrationDetails", func() {
Description("Get the file registration details")
Meta("swagger:summary", "Get the file registration details")
Expand Down
20 changes: 20 additions & 0 deletions walletnode/api/design/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ var RegisterTaskPayload = Type("RegisterTaskPayload", func() {
Required("taskId")
})

// DownloadTaskStatePayload represents a payload for returning task.
var DownloadTaskStatePayload = Type("DownloadTaskStatePayload", func() {
Attribute("file_id", String, "File ID returned by Download V2 API", func() {
TypeName("file_id")
MinLength(8)
MaxLength(8)
Example("n6Qn6TFM")
})
Required("file_id")
})

// RegisterTaskState is task streaming of the NFT registration.
var RegisterTaskState = Type("TaskState", func() {
Attribute("date", String, func() {
Expand Down Expand Up @@ -224,6 +235,15 @@ var FileDownloadResult = Type("FileDownloadResult", func() {
Required("file_id")
})

// FileDownloadV2Result is Asset download result.
var FileDownloadV2Result = Type("FileDownloadV2Result", func() {
Description("Asset download response V2 - returns task_id for the download task")
Attribute("file_id", String, func() {
Description("Task ID for the download task - caller can check the status of the download task using this task_id")
})
Required("file_id")
})

// DownloadResult is Asset download result.
var DownloadResult = Type("DownloadResult", func() {
Description("Asset download response")
Expand Down
71 changes: 54 additions & 17 deletions walletnode/api/gen/cascade/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 50 additions & 16 deletions walletnode/api/gen/cascade/endpoints.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion walletnode/api/gen/cascade/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions walletnode/api/gen/http/cascade/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0834110

Please sign in to comment.