296 lines
8.8 KiB
Plaintext
296 lines
8.8 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "User API"
|
|
desc: "API for ppanel"
|
|
author: "Tension"
|
|
email: "tension@ppanel.com"
|
|
version: "0.0.1"
|
|
)
|
|
|
|
import (
|
|
"../types.api"
|
|
)
|
|
|
|
type (
|
|
// GetUserListRequest
|
|
GetUserListRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
Search string `form:"search,omitempty"`
|
|
UserId *int64 `form:"user_id,omitempty"`
|
|
SubscribeId *int64 `form:"subscribe_id,omitempty"`
|
|
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
|
|
}
|
|
// GetUserListResponse
|
|
GetUserListResponse {
|
|
Total int64 `json:"total"`
|
|
List []User `json:"list"`
|
|
}
|
|
// GetUserDetail
|
|
GetDetailRequest {
|
|
Id int64 `form:"id" validate:"required"`
|
|
}
|
|
UpdateUserBasiceInfoRequest {
|
|
UserId int64 `json:"user_id" validate:"required"`
|
|
Password string `json:"password"`
|
|
Avatar string `json:"avatar"`
|
|
Balance int64 `json:"balance"`
|
|
Commission int64 `json:"commission"`
|
|
ReferralPercentage uint8 `json:"referral_percentage"`
|
|
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
|
GiftAmount int64 `json:"gift_amount"`
|
|
Telegram int64 `json:"telegram"`
|
|
ReferCode string `json:"refer_code"`
|
|
RefererId int64 `json:"referer_id"`
|
|
Enable bool `json:"enable"`
|
|
IsAdmin bool `json:"is_admin"`
|
|
}
|
|
UpdateUserNotifySettingRequest {
|
|
UserId int64 `json:"user_id" validate:"required"`
|
|
EnableBalanceNotify bool `json:"enable_balance_notify"`
|
|
EnableLoginNotify bool `json:"enable_login_notify"`
|
|
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
|
|
EnableTradeNotify bool `json:"enable_trade_notify"`
|
|
}
|
|
CreateUserRequest {
|
|
Email string `json:"email"`
|
|
Telephone string `json:"telephone"`
|
|
TelephoneAreaCode string `json:"telephone_area_code"`
|
|
Password string `json:"password"`
|
|
ProductId int64 `json:"product_id"`
|
|
Duration int64 `json:"duration"`
|
|
ReferralPercentage uint8 `json:"referral_percentage"`
|
|
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
|
RefererUser string `json:"referer_user"`
|
|
ReferCode string `json:"refer_code"`
|
|
Balance int64 `json:"balance"`
|
|
Commission int64 `json:"commission"`
|
|
GiftAmount int64 `json:"gift_amount"`
|
|
IsAdmin bool `json:"is_admin"`
|
|
}
|
|
UserSubscribeDetail {
|
|
Id int64 `json:"id"`
|
|
UserId int64 `json:"user_id"`
|
|
User User `json:"user"`
|
|
OrderId int64 `json:"order_id"`
|
|
SubscribeId int64 `json:"subscribe_id"`
|
|
Subscribe Subscribe `json:"subscribe"`
|
|
StartTime int64 `json:"start_time"`
|
|
ExpireTime int64 `json:"expire_time"`
|
|
ResetTime int64 `json:"reset_time"`
|
|
Traffic int64 `json:"traffic"`
|
|
Download int64 `json:"download"`
|
|
Upload int64 `json:"upload"`
|
|
Token string `json:"token"`
|
|
Status uint8 `json:"status"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
BatchDeleteUserRequest {
|
|
Ids []int64 `json:"ids" validate:"required"`
|
|
}
|
|
DeleteUserDeivceRequest {
|
|
Id int64 `json:"id"`
|
|
}
|
|
KickOfflineRequest {
|
|
Id int64 `json:"id"`
|
|
}
|
|
CreateUserAuthMethodRequest {
|
|
UserId int64 `json:"user_id"`
|
|
AuthType string `json:"auth_type"`
|
|
AuthIdentifier string `json:"auth_identifier"`
|
|
}
|
|
DeleteUserAuthMethodRequest {
|
|
UserId int64 `json:"user_id"`
|
|
AuthType string `json:"auth_type"`
|
|
}
|
|
UpdateUserAuthMethodRequest {
|
|
UserId int64 `json:"user_id"`
|
|
AuthType string `json:"auth_type"`
|
|
AuthIdentifier string `json:"auth_identifier"`
|
|
}
|
|
GetUserAuthMethodRequest {
|
|
UserId int64 `json:"user_id"`
|
|
}
|
|
GetUserAuthMethodResponse {
|
|
AuthMethods []UserAuthMethod `json:"auth_methods"`
|
|
}
|
|
GetUserSubscribeListRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
UserId int64 `form:"user_id"`
|
|
}
|
|
GetUserSubscribeListResponse {
|
|
List []UserSubscribe `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
GetUserSubscribeLogsRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
UserId int64 `form:"user_id"`
|
|
SubscribeId int64 `form:"subscribe_id,omitempty"`
|
|
}
|
|
GetUserSubscribeLogsResponse {
|
|
List []UserSubscribeLog `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
GetUserSubscribeDevicesRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
UserId int64 `form:"user_id"`
|
|
SubscribeId int64 `form:"subscribe_id"`
|
|
}
|
|
GetUserSubscribeDevicesResponse {
|
|
List []UserDevice `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
CreateUserSubscribeRequest {
|
|
UserId int64 `json:"user_id"`
|
|
ExpiredAt int64 `json:"expired_at"`
|
|
Traffic int64 `json:"traffic"`
|
|
SubscribeId int64 `json:"subscribe_id"`
|
|
}
|
|
UpdateUserSubscribeRequest {
|
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
|
SubscribeId int64 `json:"subscribe_id"`
|
|
Traffic int64 `json:"traffic"`
|
|
ExpiredAt int64 `json:"expired_at"`
|
|
Upload int64 `json:"upload"`
|
|
Download int64 `json:"download"`
|
|
}
|
|
GetUserLoginLogsRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
UserId int64 `form:"user_id"`
|
|
}
|
|
GetUserLoginLogsResponse {
|
|
List []UserLoginLog `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
GetUserSubscribeResetTrafficLogsRequest {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
UserSubscribeId int64 `form:"user_subscribe_id"`
|
|
}
|
|
GetUserSubscribeResetTrafficLogsResponse {
|
|
List []ResetSubscribeTrafficLog `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
DeleteUserSubscribeRequest {
|
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
|
}
|
|
GetUserSubscribeByIdRequest {
|
|
Id int64 `form:"id" validate:"required"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: v1/admin/user
|
|
group: admin/user
|
|
jwt: JwtAuth
|
|
middleware: AuthMiddleware
|
|
)
|
|
service ppanel {
|
|
@doc "Get user list"
|
|
@handler GetUserList
|
|
get /list (GetUserListRequest) returns (GetUserListResponse)
|
|
|
|
@doc "Get user detail"
|
|
@handler GetUserDetail
|
|
get /detail (GetDetailRequest) returns (User)
|
|
|
|
@doc "Update user basic info"
|
|
@handler UpdateUserBasicInfo
|
|
put /basic (UpdateUserBasiceInfoRequest)
|
|
|
|
@doc "Update user notify setting"
|
|
@handler UpdateUserNotifySetting
|
|
put /notify (UpdateUserNotifySettingRequest)
|
|
|
|
@doc "Delete user"
|
|
@handler DeleteUser
|
|
delete / (GetDetailRequest)
|
|
|
|
@doc "Current user"
|
|
@handler CurrentUser
|
|
get /current returns (User)
|
|
|
|
@doc "Batch delete user"
|
|
@handler BatchDeleteUser
|
|
delete /batch (BatchDeleteUserRequest)
|
|
|
|
@doc "Create user"
|
|
@handler CreateUser
|
|
post / (CreateUserRequest)
|
|
|
|
@doc "User device"
|
|
@handler UpdateUserDevice
|
|
put /device (UserDevice)
|
|
|
|
@doc "Delete user device"
|
|
@handler DeleteUserDevice
|
|
delete /device (DeleteUserDeivceRequest)
|
|
|
|
@doc "kick offline user device"
|
|
@handler KickOfflineByUserDevice
|
|
put /device/kick_offline (KickOfflineRequest)
|
|
|
|
@doc "Create user auth method"
|
|
@handler CreateUserAuthMethod
|
|
post /auth_method (CreateUserAuthMethodRequest)
|
|
|
|
@doc "Delete user auth method"
|
|
@handler DeleteUserAuthMethod
|
|
delete /auth_method (DeleteUserAuthMethodRequest)
|
|
|
|
@doc "Update user auth method"
|
|
@handler UpdateUserAuthMethod
|
|
put /auth_method (UpdateUserAuthMethodRequest)
|
|
|
|
@doc "Get user auth method"
|
|
@handler GetUserAuthMethod
|
|
get /auth_method (GetUserAuthMethodRequest) returns (GetUserAuthMethodResponse)
|
|
|
|
@doc "Get user subcribe"
|
|
@handler GetUserSubscribe
|
|
get /subscribe (GetUserSubscribeListRequest) returns (GetUserSubscribeListResponse)
|
|
|
|
@doc "Get user subcribe by id"
|
|
@handler GetUserSubscribeById
|
|
get /subscribe/detail (GetUserSubscribeByIdRequest) returns (UserSubscribeDetail)
|
|
|
|
@doc "Get user subcribe logs"
|
|
@handler GetUserSubscribeLogs
|
|
get /subscribe/logs (GetUserSubscribeLogsRequest) returns (GetUserSubscribeLogsResponse)
|
|
|
|
@doc "Get user subcribe reset traffic logs"
|
|
@handler GetUserSubscribeResetTrafficLogs
|
|
get /subscribe/reset/logs (GetUserSubscribeResetTrafficLogsRequest) returns (GetUserSubscribeResetTrafficLogsResponse)
|
|
|
|
@doc "Get user subcribe traffic logs"
|
|
@handler GetUserSubscribeTrafficLogs
|
|
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
|
|
|
|
@doc "Get user subcribe devices"
|
|
@handler GetUserSubscribeDevices
|
|
get /subscribe/device (GetUserSubscribeDevicesRequest) returns (GetUserSubscribeDevicesResponse)
|
|
|
|
@doc "Create user subcribe"
|
|
@handler CreateUserSubscribe
|
|
post /subscribe (CreateUserSubscribeRequest)
|
|
|
|
@doc "Update user subcribe"
|
|
@handler UpdateUserSubscribe
|
|
put /subscribe (UpdateUserSubscribeRequest)
|
|
|
|
@doc "Delete user subcribe"
|
|
@handler DeleteUserSubscribe
|
|
delete /subscribe (DeleteUserSubscribeRequest)
|
|
|
|
@doc "Get user login logs"
|
|
@handler GetUserLoginLogs
|
|
get /login/logs (GetUserLoginLogsRequest) returns (GetUserLoginLogsResponse)
|
|
}
|
|
|