Files
SecurityDefenseDevice/app/src/main/java/com/example/defenseapplication/utils/ApiService.kt
2026-05-21 17:54:49 +08:00

165 lines
5.0 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.example.defenseapplication.utils
import bean.ForgotRequest
import com.example.defenseapplication.bean.DeviceBean
import com.example.defenseapplication.bean.DeviceUserBean
import com.example.defenseapplication.bean.FamilyBean
import com.example.defenseapplication.bean.GetCodeBean
import bean.LoginBean
import bean.LoginRequest
import bean.RegisterRequest
import com.example.defenseapplication.bean.AddDeviceUserRequest
import com.example.defenseapplication.bean.DeleteBean
import com.example.defenseapplication.bean.DeleteDeviceUserRequest
import com.example.defenseapplication.bean.FamilyMembersBean
import com.example.defenseapplication.bean.MessageGroup
import com.example.defenseapplication.bean.SwitchFamilyRequest
import com.example.defenseapplication.bean.UpdatePassword
import com.example.defenseapplication.bean.UpdateUserInfo
import com.example.defenseapplication.bean.UserInfoBean
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Query
interface ApiService {
/**
* 获取登录验证码
*/
@GET("/resource/sms/code")
suspend fun getCode(@Query("userName") userName: String): GetCodeBean<String>
/**
* app登录方法
* @param loginRequest 登录参数 sms验证码登录password密码登录
*
*/
@POST("/app/login")
suspend fun login(@Body loginRequest: LoginRequest): GetCodeBean<LoginBean>
/**
* app注册
*/
@POST("/app/register")
suspend fun register(@Body registerRequest: RegisterRequest): GetCodeBean<Any>
/**
* 忘记密码——修改密码
*/
@PUT("/app/forgot")
suspend fun forgotPassword(@Body forgotRequest: ForgotRequest): GetCodeBean<Any>
/**
* 获取家庭列表
*/
@GET("/app/selectFamily")
suspend fun getFamilyList(): GetCodeBean<List<FamilyBean>>
/**
* 切换家庭
*/
@POST("/app/switchFamily")
suspend fun switchFamily(@Body request: SwitchFamilyRequest): GetCodeBean<Any>
/**
* 获取设备列表
*/
@GET("/app/getdeviceList")
suspend fun getDeviceList(): GetCodeBean<List<DeviceBean>>
/**
* 查看消息列表
*/
@GET("/app/appMessage/list")
suspend fun getMessage(): GetCodeBean<List<MessageGroup>>
/**
* 修改设备信息
*/
@PUT("/app/updateDeviceInfo")
suspend fun updateDeviceInfo(@Body deviceBean: DeviceBean): GetCodeBean<DeviceBean>
/**
* 获取设备信息
*/
@GET("/app/deviceInfo/{id}")
suspend fun getDeviceInfo(@retrofit2.http.Path("id") id: String): GetCodeBean<DeviceBean>
/**
* 解绑设备
*/
@POST("/app/deleteDevice")
suspend fun deleteDevice(@Body deleteBean: DeleteBean): GetCodeBean<DeleteBean>
/**
* 查看设备关联用户列表
*/
@GET("/app/deviceUser/list/{deviceId}")
suspend fun getDeviceUserList(
@retrofit2.http.Path("deviceId") deviceId: String,
@Query("deviceNo") deviceNo: String? = null,
@Query("deviceName") deviceName: String? = null,
@Query("userId") userId: String? = null,
@Query("nickName") nickName: String? = null,
@Query("idCard") idCard: String? = null,
@Query("phonenumber") phonenumber: String? = null
): GetCodeBean<List<DeviceUserBean>>
/**
* 删除关联用户
*/
@POST("/app/deleteDeviceUser")
suspend fun deleteDeviceUser(@Body request: DeleteDeviceUserRequest): GetCodeBean<Any>
/**
* 查看家庭成员表
*/
@GET("/app/familyMembers/list")
suspend fun getFamilyMembers(
@Query("createDept") createDept: Long? = null,
@Query("createBy") createBy: Long? = null,
@Query("createTime") createTime: String? = null,
@Query("updateBy") updateBy: Long? = null,
@Query("updateTime") updateTime: String? = null,
@Query("params.key.key") paramsKey: String? = null,
@Query("id") id: Long? = null,
@Query("parentId") parentId: Long? = null,
@Query("parentName") parentName: String? = null,
@Query("userId") userId: Long? = null,
@Query("status") status: String? = null
): GetCodeBean<List<FamilyMembersBean>>
/**
* 添加设备关联用户
*/
@POST("/app/addDeviceUser")
suspend fun addDeviceUser(@Body request: AddDeviceUserRequest): GetCodeBean<Any>
/**
* 获取登录用户个人信息
*/
@GET("/app/userInfo")
suspend fun getUserInfo(): GetCodeBean<UserInfoBean>
/**
* 修改个人信息
*/
@PUT("/app/updateUserInfo")
suspend fun updateUserInfo(@Body request: UpdateUserInfo): GetCodeBean<UpdateUserInfo>
/**
* 登录后旧密码修改密码
*/
@PUT("/app/forgotPassword")
suspend fun updatePassword(@Body request: UpdatePassword): GetCodeBean<UpdatePassword>
/**
* 登陆后手机号找回密码
* */
@POST("/app/retrievePassword")
suspend fun retrievePassword(@Body request: ForgotRequest): GetCodeBean<ForgotRequest>
}