Update DocumentApi for backend activate/deactivate response change
Backend now returns Document directly instead of wrapped DocumentActionResponse. Remove unused DocumentActionResponse class. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,12 +27,6 @@ data class DocumentImage(
|
||||
@SerialName("uploaded_at") val uploadedAt: String? = null
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class DocumentActionResponse(
|
||||
val message: String,
|
||||
val document: Document
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Document(
|
||||
val id: Int? = null,
|
||||
|
||||
@@ -260,9 +260,9 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
}
|
||||
|
||||
if (response.status.isSuccess()) {
|
||||
// Backend returns wrapped response: {message: string, document: DocumentResponse}
|
||||
val wrapper: DocumentActionResponse = response.body()
|
||||
ApiResult.Success(wrapper.document)
|
||||
// Backend returns document directly
|
||||
val document: Document = response.body()
|
||||
ApiResult.Success(document)
|
||||
} else {
|
||||
ApiResult.Error("Failed to activate document", response.status.value)
|
||||
}
|
||||
@@ -278,9 +278,9 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
}
|
||||
|
||||
if (response.status.isSuccess()) {
|
||||
// Backend returns wrapped response: {message: string, document: DocumentResponse}
|
||||
val wrapper: DocumentActionResponse = response.body()
|
||||
ApiResult.Success(wrapper.document)
|
||||
// Backend returns document directly
|
||||
val document: Document = response.body()
|
||||
ApiResult.Success(document)
|
||||
} else {
|
||||
ApiResult.Error("Failed to deactivate document", response.status.value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user