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
|
@SerialName("uploaded_at") val uploadedAt: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class DocumentActionResponse(
|
|
||||||
val message: String,
|
|
||||||
val document: Document
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Document(
|
data class Document(
|
||||||
val id: Int? = null,
|
val id: Int? = null,
|
||||||
|
|||||||
@@ -260,9 +260,9 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (response.status.isSuccess()) {
|
if (response.status.isSuccess()) {
|
||||||
// Backend returns wrapped response: {message: string, document: DocumentResponse}
|
// Backend returns document directly
|
||||||
val wrapper: DocumentActionResponse = response.body()
|
val document: Document = response.body()
|
||||||
ApiResult.Success(wrapper.document)
|
ApiResult.Success(document)
|
||||||
} else {
|
} else {
|
||||||
ApiResult.Error("Failed to activate document", response.status.value)
|
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()) {
|
if (response.status.isSuccess()) {
|
||||||
// Backend returns wrapped response: {message: string, document: DocumentResponse}
|
// Backend returns document directly
|
||||||
val wrapper: DocumentActionResponse = response.body()
|
val document: Document = response.body()
|
||||||
ApiResult.Success(wrapper.document)
|
ApiResult.Success(document)
|
||||||
} else {
|
} else {
|
||||||
ApiResult.Error("Failed to deactivate document", response.status.value)
|
ApiResult.Error("Failed to deactivate document", response.status.value)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user