80 lines
1.7 KiB
Plaintext
80 lines
1.7 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "Ads API"
|
|
desc: "API for ppanel"
|
|
author: "Tension"
|
|
email: "tension@ppanel.com"
|
|
version: "0.0.1"
|
|
)
|
|
|
|
type (
|
|
CreateAdsRequest {
|
|
Title string `json:"title"`
|
|
Type string `json:"type"`
|
|
Content string `json:"content"`
|
|
Description string `json:"description"`
|
|
TargetURL string `json:"target_url"`
|
|
StartTime int64 `json:"start_time"`
|
|
EndTime int64 `json:"end_time"`
|
|
Status int `json:"status"`
|
|
}
|
|
UpdateAdsRequest {
|
|
Id int64 `json:"id"`
|
|
Title string `json:"title"`
|
|
Type string `json:"type"`
|
|
Content string `json:"content"`
|
|
Description string `json:"description"`
|
|
TargetURL string `json:"target_url"`
|
|
StartTime int64 `json:"start_time"`
|
|
EndTime int64 `json:"end_time"`
|
|
Status int `json:"status"`
|
|
}
|
|
DeleteAdsRequest {
|
|
Id int64 `json:"id"`
|
|
}
|
|
GetAdsListRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
Status *int `form:"status,omitempty"`
|
|
Search string `form:"search,omitempty"`
|
|
}
|
|
GetAdsListResponse {
|
|
Total int64 `json:"total"`
|
|
List []Ads `json:"list"`
|
|
}
|
|
GetAdsDetailRequest {
|
|
Id int64 `form:"id"`
|
|
}
|
|
)
|
|
|
|
import "../types.api"
|
|
|
|
@server (
|
|
prefix: v1/admin/ads
|
|
group: admin/ads
|
|
middleware: AuthMiddleware
|
|
)
|
|
service ppanel {
|
|
@doc "Create Ads"
|
|
@handler CreateAds
|
|
post / (CreateAdsRequest)
|
|
|
|
@doc "Update Ads"
|
|
@handler UpdateAds
|
|
put / (UpdateAdsRequest)
|
|
|
|
@doc "Delete Ads"
|
|
@handler DeleteAds
|
|
delete / (DeleteAdsRequest)
|
|
|
|
@doc "Get Ads List"
|
|
@handler GetAdsList
|
|
get /list (GetAdsListRequest) returns (GetAdsListResponse)
|
|
|
|
@doc "Get Ads Detail"
|
|
@handler GetAdsDetail
|
|
get /detail (GetAdsDetailRequest) returns (Ads)
|
|
}
|
|
|