Files
Blog/api/Blog.api
2025-10-24 21:44:15 +08:00

65 lines
1.5 KiB
Plaintext

syntax = "v1"
info (
title: "Blog API"
desc: "API for blog application"
author: "cialloo"
date: "2025-10-24"
version: "v1"
)
type (
PingReq {}
PingResp {
ok bool `json:"ok"`
}
)
type (
UploadPresignedURLReq {
file_name string `json:"file_name"` // Original file name
}
UploadPresignedURLResp {
url string `json:"url"` // Presigned URL for upload
file_key string `json:"file_key"` // Key to identify the uploaded file
expire_at int64 `json:"expire_at"` // Expiration timestamp
}
)
type (
DownloadPresignedURLReq {
file_key string `json:"file_key"` // Key to identify the file to download
}
DownloadPresignedURLResp {
url string `json:"url"` // Presigned URL for download
expire_at int64 `json:"expire_at"` // Expiration timestamp
}
)
@server (
prefix: /api/blog
)
service Blog {
@doc (
summary: "Ping the server to check if it's alive"
description: "Ping the server to check if it's alive"
)
@handler pingHandler
get /ping (PingReq) returns (PingResp)
@doc (
summary: "Get presigned URL for file upload"
description: "Get presigned URL for file upload"
)
@handler UploadPresignedURLHandler
post /file/upload (UploadPresignedURLReq) returns (UploadPresignedURLResp)
@doc (
summary: "Get presigned URL for file download"
description: "Get presigned URL for file download"
)
@handler DownloadPresignedURLHandler
post /file/download (DownloadPresignedURLReq) returns (DownloadPresignedURLResp)
}