feat(03-01): Gateway SyncDeviceInfo 方法 + DTO 字段扩展
- gateway/models.go:新增 SyncDeviceInfoReq / SyncDeviceInfoResp 结构定义 - gateway/device.go:新增 SyncDeviceInfo() 方法,POST /device/sync-info - device_dto.go:DeviceResponse 新增 5 个 sync-info 同步字段;DeviceCardBindingResponse 新增 is_current - asset_dto.go:BoundCardInfo 新增 is_current 字段
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Package gateway 提供设备相关的 7 个 API 方法封装
|
||||
// Package gateway 提供设备相关的 8 个 API 方法封装
|
||||
package gateway
|
||||
|
||||
import (
|
||||
@@ -68,3 +68,13 @@ func (c *Client) RebootDevice(ctx context.Context, req *DeviceOperationReq) erro
|
||||
_, err := c.doRequest(ctx, "/device/restart", req)
|
||||
return err
|
||||
}
|
||||
|
||||
// SyncDeviceInfo 同步查询设备信息(直接返回,无需回调)
|
||||
// 与异步 /device/info 的区别:直接返回全量数据,无需 callbackUrl
|
||||
// POST /device/sync-info
|
||||
func (c *Client) SyncDeviceInfo(ctx context.Context, req *SyncDeviceInfoReq) (*SyncDeviceInfoResp, error) {
|
||||
if req.CardNo == "" {
|
||||
return nil, errors.New(errors.CodeInvalidParam, "cardNo 不能为空")
|
||||
}
|
||||
return doRequestWithResponse[SyncDeviceInfoResp](c, ctx, "/device/sync-info", req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user