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 } ) type ( CreatePostReq { title string `json:"title"` content string `json:"content"` cover_image_key string `json:"cover_image_key"` } CreatePostResp { post_id string `json:"post_id"` } ) type ( EditPostReq { post_id string `json:"post_id"` title string `json:"title"` content string `json:"content"` cover_image_key string `json:"cover_image_key"` } EditPostResp {} ) type ( DeletePostReq { post_id string `json:"post_id"` } DeletePostResp {} ) @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) } @server ( middleware: SuperAdminAuthMiddleware prefix: /api/blog/post ) service Blog { @doc ( summary: "Create a new blog post" description: "Create a new blog post" ) @handler CreatePostHandler post /create (CreatePostReq) returns (CreatePostResp) @doc ( summary: "Edit an existing blog post" description: "Edit an existing blog post" ) @handler EditPostHandler post /edit (EditPostReq) returns (EditPostResp) @doc ( summary: "Delete a blog post" description: "Delete a blog post" ) @handler DeletePostHandler post /delete (DeletePostReq) returns (DeletePostResp) } @server ( middleware: SuperAdminAuthMiddleware prefix: /api/blog ) service Blog { @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) }