🚡 move response struct
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
package alidrive
|
package alidrive
|
||||||
|
|
||||||
// list request bean
|
// ListReq list request bean
|
||||||
type ListReq struct {
|
type ListReq struct {
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
Fields string `json:"fields"`
|
Fields string `json:"fields"`
|
||||||
@@ -14,7 +14,7 @@ type ListReq struct {
|
|||||||
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// get request bean
|
// GetReq get request bean
|
||||||
type GetReq struct {
|
type GetReq struct {
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
FileId string `json:"file_id"`
|
FileId string `json:"file_id"`
|
||||||
@@ -22,7 +22,7 @@ type GetReq struct {
|
|||||||
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// download request bean
|
// DownloadReq download request bean
|
||||||
type DownloadReq struct {
|
type DownloadReq struct {
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
FileId string `json:"file_id"`
|
FileId string `json:"file_id"`
|
||||||
@@ -30,7 +30,7 @@ type DownloadReq struct {
|
|||||||
FileName string `json:"file_name"`
|
FileName string `json:"file_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// search request bean
|
// SearchReq search request bean
|
||||||
type SearchReq struct {
|
type SearchReq struct {
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
ImageThumbnailProcess string `json:"image_thumbnail_process"`
|
ImageThumbnailProcess string `json:"image_thumbnail_process"`
|
||||||
@@ -44,37 +44,32 @@ type SearchReq struct {
|
|||||||
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
VideoThumbnailProcess string `json:"video_thumbnail_process"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// token_login request bean
|
// TokenLoginReq token_login request bean
|
||||||
type TokenLoginReq struct {
|
type TokenLoginReq struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_token request bean
|
// GetTokenReq get_token request bean
|
||||||
type GetTokenReq struct {
|
type GetTokenReq struct {
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh_token request bean
|
// RefreshTokenReq refresh_token request bean
|
||||||
type RefreshTokenReq struct {
|
type RefreshTokenReq struct {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
GrantType string `json:"grant_type"`
|
GrantType string `json:"grant_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// office_preview_url request bean
|
// OfficePreviewUrlReq office_preview_url request bean
|
||||||
type OfficePreviewUrlReq struct {
|
type OfficePreviewUrlReq struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
FileId string `json:"file_id"`
|
FileId string `json:"file_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// video preview url request bean
|
// VideoPreviewUrlReq video preview url request bean
|
||||||
type VideoPreviewUrlReq struct {
|
type VideoPreviewUrlReq struct {
|
||||||
DriveId string `json:"drive_id"`
|
DriveId string `json:"drive_id"`
|
||||||
FileId string `json:"file_id"`
|
FileId string `json:"file_id"`
|
||||||
ExpireSec int `json:"expire_sec"`
|
ExpireSec int `json:"expire_sec"`
|
||||||
}
|
|
||||||
type ReqData struct {
|
|
||||||
Code int `json:"code"`
|
|
||||||
Data interface{} `json:"data"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
}
|
@@ -1,21 +1,23 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
type Response struct {
|
||||||
"github.com/Xhofe/alist/alidrive"
|
Code int `json:"code"`
|
||||||
)
|
Data interface{} `json:"data"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
// common meta response
|
// MetaResponse common meta response
|
||||||
func MetaResponse(code int, msg string) alidrive.ReqData {
|
func MetaResponse(code int, msg string) Response {
|
||||||
return alidrive.ReqData{
|
return Response{
|
||||||
Code: code,
|
Code: code,
|
||||||
Data: nil,
|
Data: nil,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// common data response
|
// DataResponse common data response
|
||||||
func DataResponse(data interface{}) alidrive.ReqData {
|
func DataResponse(data interface{}) Response {
|
||||||
return alidrive.ReqData{
|
return Response{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Data: data,
|
Data: data,
|
||||||
Message: "ok",
|
Message: "ok",
|
||||||
|
Reference in New Issue
Block a user