rewrite the compat API to something more generic

This commit is contained in:
Tamo 2022-10-06 19:44:50 +02:00 committed by Clément Renault
parent 2456a632e8
commit 116c424fba
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
13 changed files with 1355 additions and 132 deletions

View file

@ -5,6 +5,7 @@ use time::{Duration, OffsetDateTime};
use uuid::Uuid;
use super::{
errors::ResponseError,
meta::IndexUid,
settings::{Settings, Unchecked},
};
@ -148,19 +149,6 @@ pub enum TaskResult {
Other,
}
#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
#[cfg_attr(test, derive(serde::Serialize))]
#[serde(rename_all = "camelCase")]
pub struct ResponseError {
pub message: String,
#[serde(rename = "code")]
pub error_code: String,
#[serde(rename = "type")]
pub error_type: String,
#[serde(rename = "link")]
pub error_link: String,
}
impl Task {
/// Return true when a task is finished.
/// A task is finished when its last state is either `Succeeded` or `Failed`.