mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-28 03:22:39 +00:00
server code
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/device/v1"
|
||||
)
|
||||
|
||||
type IDeviceV1 interface {
|
||||
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
|
||||
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
|
||||
GetRandomDevice(ctx context.Context, req *v1.GetRandomDeviceReq) (res *v1.GetRandomDeviceRes, err error)
|
||||
GetDeviceInfo(ctx context.Context, req *v1.GetDeviceInfoReq) (res *v1.GetDeviceInfoRes, err error)
|
||||
UpdateDeviceInfo(ctx context.Context, req *v1.UpdateDeviceInfoReq) (res *v1.UpdateDeviceInfoRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"stackChan/internal/model"
|
||||
"stackChan/internal/model/entity"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/device" method:"post" tags:"Device" summary:"Device create request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name,omitempty" description:"Device name"`
|
||||
}
|
||||
|
||||
type CreateRes struct {
|
||||
Id int64 `json:"id" dc:"Device id"`
|
||||
}
|
||||
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/device" method:"put" tags:"Device" summary:"Device update request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name" description:"Device name"`
|
||||
}
|
||||
|
||||
type UpdateRes struct{}
|
||||
|
||||
type GetRandomDeviceReq struct {
|
||||
g.Meta `path:"/device/randomList" method:"get" tags:"Device" summary:"Device get Random"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
}
|
||||
|
||||
type GetRandomDeviceRes []entity.Device
|
||||
|
||||
type GetDeviceInfoReq struct {
|
||||
g.Meta `path:"/device/info" method:"get" tags:"Device" summary:"Device Info Get request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
}
|
||||
|
||||
type GetDeviceInfoRes model.DeviceInfo
|
||||
|
||||
type UpdateDeviceInfoReq struct {
|
||||
g.Meta `path:"/device/info" method:"put" tags:"Device" summary:"Device Info Put request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name" description:"Device name"`
|
||||
}
|
||||
|
||||
type UpdateDeviceInfoRes string
|
||||
Reference in New Issue
Block a user