更新代码
This commit is contained in:
@@ -9,6 +9,7 @@ import com.aiosman.ravenow.data.api.GoogleRegisterRequestBody
|
||||
import com.aiosman.ravenow.data.api.LoginUserRequestBody
|
||||
import com.aiosman.ravenow.data.api.RegisterMessageChannelRequestBody
|
||||
import com.aiosman.ravenow.data.api.RegisterRequestBody
|
||||
import com.aiosman.ravenow.data.api.RemoveAccountRequestBody
|
||||
import com.aiosman.ravenow.data.api.ResetPasswordRequestBody
|
||||
import com.aiosman.ravenow.data.api.TrtcSignResponseBody
|
||||
import com.aiosman.ravenow.data.api.UnRegisterMessageChannelRequestBody
|
||||
@@ -386,6 +387,8 @@ interface AccountService {
|
||||
suspend fun getMyTrtcSign(): TrtcSignResponseBody
|
||||
|
||||
suspend fun getAppConfig(): AppConfig
|
||||
|
||||
suspend fun removeAccount(password: String)
|
||||
}
|
||||
|
||||
class AccountServiceImpl : AccountService {
|
||||
@@ -554,4 +557,16 @@ class AccountServiceImpl : AccountService {
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get app config")
|
||||
return body.data
|
||||
}
|
||||
|
||||
override suspend fun removeAccount(password: String) {
|
||||
val resp = ApiClient.api.deleteAccount(
|
||||
RemoveAccountRequestBody(password)
|
||||
)
|
||||
if (!resp.isSuccessful) {
|
||||
parseErrorResponse(resp.errorBody())?.let {
|
||||
throw it.toServiceException()
|
||||
}
|
||||
throw ServiceException("Failed to remove account")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,6 +200,10 @@ data class CreateReportRequestBody(
|
||||
val base64Images: List<String>,
|
||||
)
|
||||
|
||||
data class RemoveAccountRequestBody(
|
||||
@SerializedName("password")
|
||||
val password: String,
|
||||
)
|
||||
|
||||
interface RaveNowAPI {
|
||||
@POST("register")
|
||||
@@ -449,5 +453,11 @@ interface RaveNowAPI {
|
||||
suspend fun createReport(
|
||||
@Body body: CreateReportRequestBody
|
||||
): Response<Unit>
|
||||
|
||||
@POST("account/my/delete")
|
||||
suspend fun deleteAccount(
|
||||
@Body body: RemoveAccountRequestBody
|
||||
): Response<Unit>
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user