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"` // Indicates if the server is healthy } ) type ( UploadPresignedURLReq { FileName string `json:"fileName"` // Name of the file to be uploaded } UploadPresignedURLResp { Url string `json:"url"` // Presigned URL for uploading the file FileKey string `json:"fileKey"` // Unique key to identify the uploaded file ExpireAt int64 `json:"expireAt"` // Timestamp when the presigned URL expires } ) type ( DownloadPresignedURLReq { FileKey string `json:"fileKey"` // Unique key of the file to be downloaded } DownloadPresignedURLResp { Url string `json:"url"` // Presigned URL for downloading the file ExpireAt int64 `json:"expireAt"` // Timestamp when the presigned URL expires } ) type ( CreatePostReq { Title string `json:"title"` // Title of the blog post Content string `json:"content"` // Content/body of the blog post CoverImageKey string `json:"coverImageKey"` // Key of the cover image file (optional) } CreatePostResp { PostId string `json:"postId"` // Unique identifier of the created post } ) type ( EditPostReq { PostId string `json:"postId"` // Unique identifier of the post to edit Title string `json:"title"` // New title of the blog post Content string `json:"content"` // New content/body of the blog post CoverImageKey string `json:"coverImageKey"` // New key of the cover image file (optional) } EditPostResp {} ) type ( DeletePostReq { PostId string `json:"postId"` // Unique identifier of the post to delete } DeletePostResp {} ) type ( GetPostReq { PostId string `json:"postId"` // Unique identifier of the post to retrieve } GetPostResp { PostId string `json:"postId"` // Unique identifier of the post Title string `json:"title"` // Title of the blog post Content string `json:"content"` // Content/body of the blog post CoverImageUrl string `json:"coverImageUrl"` // URL of the cover image (if exists) CreatedAt int64 `json:"createdAt"` // Timestamp when the post was created UpdatedAt int64 `json:"updatedAt"` // Timestamp when the post was last updated } ) type ( ListPostsReq { TagIds []string `json:"tagIds,optional"` // Array of tag IDs to filter posts (optional) Page int `json:"page"` // Page number for pagination (1-based) PageSize int `json:"pageSize"` // Number of posts per page } ListPostsResp { Posts []ListPostsRespPosts `json:"posts"` // Array of blog posts TotalCount int `json:"totalCount"` // Total number of posts available } ListPostsRespPosts { PostId string `json:"postId"` // Unique identifier of the post Title string `json:"title"` // Title of the blog post CoverImageUrl string `json:"coverImageUrl"` // URL of the cover image (if exists) CreatedAt int64 `json:"createdAt"` // Timestamp when the post was created UpdatedAt int64 `json:"updatedAt"` // Timestamp when the post was last updated } ) type ( ListTagsReq {} ListTagsResp { Tags []ListTagsRespTags `json:"tags"` // Array of blog tags } ListTagsRespTags { TagId string `json:"tagId"` // Unique identifier of the tag TagName string `json:"tagName"` // Name of the tag PostCount int `json:"postCount"` // Number of posts associated with the tag } ) @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 ( prefix: /api/blog/view ) service Blog { @doc ( summary: "Get a blog post by ID" description: "Get a blog post by ID" ) @handler GetPostHandler post /post (GetPostReq) returns (GetPostResp) @doc ( summary: "Get a list of blog posts" description: "Get a list of blog posts with pagination" ) @handler ListPostsHandler post /posts (ListPostsReq) returns (ListPostsResp) @doc ( summary: "Get a list of blog tags" description: "Get a list of blog tags" ) @handler ListTagsHandler post /tags (ListTagsReq) returns (ListTagsResp) } @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/file ) service Blog { @doc ( summary: "Get presigned URL for file upload" description: "Get presigned URL for file upload" ) @handler UploadPresignedURLHandler post /upload (UploadPresignedURLReq) returns (UploadPresignedURLResp) @doc ( summary: "Get presigned URL for file download" description: "Get presigned URL for file download" ) @handler DownloadPresignedURLHandler post /download (DownloadPresignedURLReq) returns (DownloadPresignedURLResp) }