aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:04:13 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:04:13 -0800
commitb86e007b7469ebb22a806d38aca0bccf9078e80d (patch)
tree69dc8bda4316cae4bbdbe3acea287d46baa42b96
parent86fd0a416efd4015dc47494e723afd7f13771006 (diff)
downloadfatcat-b86e007b7469ebb22a806d38aca0bccf9078e80d.tar.gz
fatcat-b86e007b7469ebb22a806d38aca0bccf9078e80d.zip
rust impl of API harmonization
-rw-r--r--rust/src/api_entity_crud.rs6
-rw-r--r--rust/src/api_server.rs52
-rw-r--r--rust/src/api_wrappers.rs64
-rw-r--r--rust/src/database_models.rs2
-rw-r--r--rust/tests/test_api_server_http.rs2
-rw-r--r--rust/tests/test_old_python_tests.rs6
6 files changed, 66 insertions, 66 deletions
diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs
index ee2d4ef3..b5e37412 100644
--- a/rust/src/api_entity_crud.rs
+++ b/rust/src/api_entity_crud.rs
@@ -829,7 +829,7 @@ impl EntityCrud for FileEntity {
size: None,
urls: None,
mimetype: None,
- releases: None,
+ release_ids: None,
state: Some(ident_row.state().unwrap().shortname()),
ident: Some(FatCatId::from_uuid(&ident_row.id).to_string()),
revision: ident_row.rev_id.map(|u| u.to_string()),
@@ -880,7 +880,7 @@ impl EntityCrud for FileEntity {
size: rev_row.size.map(|v| v as i64),
urls: Some(urls),
mimetype: rev_row.mimetype,
- releases: Some(releases.iter().map(|fcid| fcid.to_string()).collect()),
+ release_ids: Some(releases.iter().map(|fcid| fcid.to_string()).collect()),
state: state,
ident: ident_id,
revision: Some(rev_row.id.to_string()),
@@ -925,7 +925,7 @@ impl EntityCrud for FileEntity {
let mut file_url_rows: Vec<FileRevUrlNewRow> = vec![];
for (model, rev_id) in models.iter().zip(rev_ids.iter()) {
- match &model.releases {
+ match &model.release_ids {
None => (),
Some(release_list) => {
let these_release_rows: Result<Vec<FileReleaseRow>> = release_list
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index d06de9c1..99db91c0 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -55,14 +55,14 @@ pub struct Server {
}
pub fn get_release_files(
- id: FatCatId,
+ ident: FatCatId,
hide_flags: HideFlags,
conn: &DbConn,
) -> Result<Vec<FileEntity>> {
let rows: Vec<(FileRevRow, FileIdentRow, FileReleaseRow)> = file_rev::table
.inner_join(file_ident::table)
.inner_join(file_release::table)
- .filter(file_release::target_release_ident_id.eq(&id.to_uuid()))
+ .filter(file_release::target_release_ident_id.eq(&ident.to_uuid()))
.filter(file_ident::is_live.eq(true))
.filter(file_ident::redirect_id.is_null())
.load(conn)?;
@@ -149,7 +149,7 @@ impl Server {
pub fn get_creator_releases_handler(
&self,
- id: FatCatId,
+ ident: FatCatId,
hide_flags: HideFlags,
conn: &DbConn,
) -> Result<Vec<ReleaseEntity>> {
@@ -157,7 +157,7 @@ impl Server {
let rows: Vec<(ReleaseRevRow, ReleaseIdentRow, ReleaseContribRow)> = release_rev::table
.inner_join(release_ident::table)
.inner_join(release_contrib::table)
- .filter(release_contrib::creator_ident_id.eq(&id.to_uuid()))
+ .filter(release_contrib::creator_ident_id.eq(&ident.to_uuid()))
.filter(release_ident::is_live.eq(true))
.filter(release_ident::redirect_id.is_null())
.load(conn)?;
@@ -297,22 +297,22 @@ impl Server {
pub fn get_release_files_handler(
&self,
- id: FatCatId,
+ ident: FatCatId,
hide_flags: HideFlags,
conn: &DbConn,
) -> Result<Vec<FileEntity>> {
- get_release_files(id, hide_flags, conn)
+ get_release_files(ident, hide_flags, conn)
}
pub fn get_work_releases_handler(
&self,
- id: FatCatId,
+ ident: FatCatId,
hide_flags: HideFlags,
conn: &DbConn,
) -> Result<Vec<ReleaseEntity>> {
let rows: Vec<(ReleaseRevRow, ReleaseIdentRow)> = release_rev::table
.inner_join(release_ident::table)
- .filter(release_rev::work_ident_id.eq(&id.to_uuid()))
+ .filter(release_rev::work_ident_id.eq(&ident.to_uuid()))
.filter(release_ident::is_live.eq(true))
.filter(release_ident::redirect_id.is_null())
.load(conn)?;
@@ -322,8 +322,8 @@ impl Server {
.collect()
}
- pub fn accept_editgroup_handler(&self, id: FatCatId, conn: &DbConn) -> Result<()> {
- accept_editgroup(id, conn)?;
+ pub fn accept_editgroup_handler(&self, editgroup_id: FatCatId, conn: &DbConn) -> Result<()> {
+ accept_editgroup(editgroup_id, conn)?;
Ok(())
}
@@ -341,7 +341,7 @@ impl Server {
.get_result(conn)?;
Ok(Editgroup {
- id: Some(uuid2fcid(&row.id)),
+ editgroup_id: Some(uuid2fcid(&row.id)),
editor_id: uuid2fcid(&row.editor_id),
description: row.description,
edits: None,
@@ -349,13 +349,13 @@ impl Server {
})
}
- pub fn get_editgroup_handler(&self, id: FatCatId, conn: &DbConn) -> Result<Editgroup> {
- let row: EditgroupRow = editgroup::table.find(id.to_uuid()).first(conn)?;
+ pub fn get_editgroup_handler(&self, editgroup_id: FatCatId, conn: &DbConn) -> Result<Editgroup> {
+ let row: EditgroupRow = editgroup::table.find(editgroup_id.to_uuid()).first(conn)?;
let edits = EditgroupEdits {
containers: Some(
container_edit::table
- .filter(container_edit::editgroup_id.eq(id.to_uuid()))
+ .filter(container_edit::editgroup_id.eq(editgroup_id.to_uuid()))
.get_results(conn)?
.into_iter()
.map(|e: ContainerEditRow| e.into_model().unwrap())
@@ -363,7 +363,7 @@ impl Server {
),
creators: Some(
creator_edit::table
- .filter(creator_edit::editgroup_id.eq(id.to_uuid()))
+ .filter(creator_edit::editgroup_id.eq(editgroup_id.to_uuid()))
.get_results(conn)?
.into_iter()
.map(|e: CreatorEditRow| e.into_model().unwrap())
@@ -371,7 +371,7 @@ impl Server {
),
files: Some(
file_edit::table
- .filter(file_edit::editgroup_id.eq(id.to_uuid()))
+ .filter(file_edit::editgroup_id.eq(editgroup_id.to_uuid()))
.get_results(conn)?
.into_iter()
.map(|e: FileEditRow| e.into_model().unwrap())
@@ -379,7 +379,7 @@ impl Server {
),
releases: Some(
release_edit::table
- .filter(release_edit::editgroup_id.eq(id.to_uuid()))
+ .filter(release_edit::editgroup_id.eq(editgroup_id.to_uuid()))
.get_results(conn)?
.into_iter()
.map(|e: ReleaseEditRow| e.into_model().unwrap())
@@ -387,7 +387,7 @@ impl Server {
),
works: Some(
work_edit::table
- .filter(work_edit::editgroup_id.eq(id.to_uuid()))
+ .filter(work_edit::editgroup_id.eq(editgroup_id.to_uuid()))
.get_results(conn)?
.into_iter()
.map(|e: WorkEditRow| e.into_model().unwrap())
@@ -396,7 +396,7 @@ impl Server {
};
let eg = Editgroup {
- id: Some(uuid2fcid(&row.id)),
+ editgroup_id: Some(uuid2fcid(&row.id)),
editor_id: uuid2fcid(&row.editor_id),
description: row.description,
edits: Some(edits),
@@ -405,11 +405,11 @@ impl Server {
Ok(eg)
}
- pub fn get_editor_handler(&self, id: FatCatId, conn: &DbConn) -> Result<Editor> {
- let row: EditorRow = editor::table.find(id.to_uuid()).first(conn)?;
+ pub fn get_editor_handler(&self, editor_id: FatCatId, conn: &DbConn) -> Result<Editor> {
+ let row: EditorRow = editor::table.find(editor_id.to_uuid()).first(conn)?;
let ed = Editor {
- id: Some(uuid2fcid(&row.id)),
+ editor_id: Some(uuid2fcid(&row.id)),
username: row.username,
};
Ok(ed)
@@ -417,11 +417,11 @@ impl Server {
pub fn get_editor_changelog_handler(
&self,
- id: FatCatId,
+ editor_id: FatCatId,
conn: &DbConn,
) -> Result<Vec<ChangelogEntry>> {
// TODO: single query
- let editor: EditorRow = editor::table.find(id.to_uuid()).first(conn)?;
+ let editor: EditorRow = editor::table.find(editor_id.to_uuid()).first(conn)?;
let changes: Vec<(ChangelogRow, EditgroupRow)> = changelog::table
.inner_join(editgroup::table)
.filter(editgroup::editor_id.eq(editor.id))
@@ -464,8 +464,8 @@ impl Server {
Ok(entries)
}
- pub fn get_changelog_entry_handler(&self, id: i64, conn: &DbConn) -> Result<ChangelogEntry> {
- let cl_row: ChangelogRow = changelog::table.find(id).first(conn)?;
+ pub fn get_changelog_entry_handler(&self, index: i64, conn: &DbConn) -> Result<ChangelogEntry> {
+ let cl_row: ChangelogRow = changelog::table.find(index).first(conn)?;
let editgroup =
self.get_editgroup_handler(FatCatId::from_uuid(&cl_row.editgroup_id), conn)?;
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index c3df7d72..ed4053b9 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -30,7 +30,7 @@ macro_rules! wrap_entity_handlers {
fn $get_fn(
&self,
- id: String,
+ ident: String,
expand: Option<String>,
hide: Option<String>,
_context: &Context,
@@ -38,7 +38,7 @@ macro_rules! wrap_entity_handlers {
let conn = self.db_pool.get().expect("db_pool error");
// No transaction for GET
let ret = match (|| {
- let entity_id = FatCatId::from_str(&id)?;
+ let entity_id = FatCatId::from_str(&ident)?;
let hide_flags = match hide {
None => HideFlags::none(),
Some(param) => HideFlags::from_str(&param)?,
@@ -56,7 +56,7 @@ macro_rules! wrap_entity_handlers {
Ok(entity) =>
$get_resp::FoundEntity(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $get_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $get_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), ident) }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
@@ -79,12 +79,12 @@ macro_rules! wrap_entity_handlers {
fn $post_fn(
&self,
entity: models::$model,
- editgroup: Option<String>,
+ editgroup_id: Option<String>,
_context: &Context,
) -> Box<Future<Item = $post_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let editgroup_id = if let Some(s) = editgroup {
+ let editgroup_id = if let Some(s) = editgroup_id {
Some(FatCatId::from_str(&s)?)
} else { None };
let edit_context = make_edit_context(&conn, editgroup_id, false)?;
@@ -122,12 +122,12 @@ macro_rules! wrap_entity_handlers {
&self,
entity_list: &Vec<models::$model>,
autoaccept: Option<bool>,
- editgroup: Option<String>,
+ editgroup_id: Option<String>,
_context: &Context,
) -> Box<Future<Item = $post_batch_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let editgroup_id = if let Some(s) = editgroup {
+ let editgroup_id = if let Some(s) = editgroup_id {
Some(FatCatId::from_str(&s)?)
} else { None };
self.$post_batch_handler(entity_list, autoaccept.unwrap_or(false), editgroup_id, &conn)
@@ -161,15 +161,15 @@ macro_rules! wrap_entity_handlers {
fn $update_fn(
&self,
- id: String,
+ ident: String,
entity: models::$model,
- editgroup: Option<String>,
+ editgroup_id: Option<String>,
_context: &Context,
) -> Box<Future<Item = $update_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let entity_id = FatCatId::from_str(&id)?;
- let editgroup_id = if let Some(s) = editgroup {
+ let entity_id = FatCatId::from_str(&ident)?;
+ let editgroup_id = if let Some(s) = editgroup_id {
Some(FatCatId::from_str(&s)?)
} else { None };
let edit_context = make_edit_context(&conn, editgroup_id, false)?;
@@ -179,7 +179,7 @@ macro_rules! wrap_entity_handlers {
Ok(edit) =>
$update_resp::UpdatedEntity(edit),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $update_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $update_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), ident) }),
Err(Error(ErrorKind::Diesel(e), _)) =>
$update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::Uuid(e), _)) =>
@@ -209,13 +209,13 @@ macro_rules! wrap_entity_handlers {
fn $delete_fn(
&self,
- id: String,
+ ident: String,
editgroup_id: Option<String>,
_context: &Context,
) -> Box<Future<Item = $delete_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let entity_id = FatCatId::from_str(&id)?;
+ let entity_id = FatCatId::from_str(&ident)?;
let editgroup_id: Option<FatCatId> = match editgroup_id {
Some(s) => Some(FatCatId::from_str(&s)?),
None => None,
@@ -227,7 +227,7 @@ macro_rules! wrap_entity_handlers {
Ok(edit) =>
$delete_resp::DeletedEntity(edit),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $delete_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $delete_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), ident) }),
Err(Error(ErrorKind::Diesel(e), _)) =>
$delete_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::Uuid(e), _)) =>
@@ -253,20 +253,20 @@ macro_rules! wrap_entity_handlers {
fn $get_history_fn(
&self,
- id: String,
+ ident: String,
limit: Option<i64>,
_context: &Context,
) -> Box<Future<Item = $get_history_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
// No transaction for GET?
let ret = match (|| {
- let entity_id = FatCatId::from_str(&id)?;
+ let entity_id = FatCatId::from_str(&ident)?;
$model::db_get_history(&conn, entity_id, limit)
})() {
Ok(history) =>
$get_history_resp::FoundEntityHistory(history),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $get_history_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $get_history_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), ident) }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$get_history_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
@@ -284,7 +284,7 @@ macro_rules! wrap_entity_handlers {
fn $get_rev_fn(
&self,
- id: String,
+ rev_id: String,
expand: Option<String>,
hide: Option<String>,
_context: &Context,
@@ -292,7 +292,7 @@ macro_rules! wrap_entity_handlers {
let conn = self.db_pool.get().expect("db_pool error");
// No transaction for GET?
let ret = match (|| {
- let rev_id = Uuid::from_str(&id)?;
+ let rev_id = Uuid::from_str(&rev_id)?;
let hide_flags = match hide {
None => HideFlags::none(),
Some(param) => HideFlags::from_str(&param)?,
@@ -310,7 +310,7 @@ macro_rules! wrap_entity_handlers {
Ok(entity) =>
$get_rev_resp::FoundEntityRevision(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $get_rev_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $get_rev_resp::NotFound(ErrorResponse { message: format!("No such entity revision {}: {}", stringify!($model), rev_id) }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$get_rev_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
@@ -378,20 +378,20 @@ macro_rules! wrap_entity_handlers {
fn $get_redirects_fn(
&self,
- id: String,
+ ident: String,
_context: &Context,
) -> Box<Future<Item = $get_redirects_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
// No transaction for GET?
let ret = match (|| {
- let entity_id = FatCatId::from_str(&id)?;
+ let entity_id = FatCatId::from_str(&ident)?;
let redirects: Vec<FatCatId> = $model::db_get_redirects(&conn, entity_id)?;
Ok(redirects.into_iter().map(|fcid| fcid.to_string()).collect())
})() {
Ok(redirects) =>
$get_redirects_resp::FoundEntityRedirects(redirects),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- $get_redirects_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), id) }),
+ $get_redirects_resp::NotFound(ErrorResponse { message: format!("No such entity {}: {}", stringify!($model), ident) }),
Err(Error(ErrorKind::Uuid(e), _)) =>
$get_redirects_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::InvalidFatcatId(e), _)) =>
@@ -798,20 +798,20 @@ impl Api for Server {
fn accept_editgroup(
&self,
- id: String,
+ editgroup_id: String,
_context: &Context,
) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let id = FatCatId::from_str(&id)?;
- self.accept_editgroup_handler(id, &conn)
+ let editgroup_id = FatCatId::from_str(&editgroup_id)?;
+ self.accept_editgroup_handler(editgroup_id, &conn)
}) {
Ok(()) => AcceptEditgroupResponse::MergedSuccessfully(Success {
message: "horray!".to_string(),
}),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => {
AcceptEditgroupResponse::NotFound(ErrorResponse {
- message: format!("No such editgroup: {}", id),
+ message: format!("No such editgroup: {}", editgroup_id),
})
}
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) => {
@@ -828,18 +828,18 @@ impl Api for Server {
fn get_editgroup(
&self,
- id: String,
+ editgroup_id: String,
_context: &Context,
) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
- let id = FatCatId::from_str(&id)?;
- self.get_editgroup_handler(id, &conn)
+ let editgroup_id = FatCatId::from_str(&editgroup_id)?;
+ self.get_editgroup_handler(editgroup_id, &conn)
}) {
Ok(entity) => GetEditgroupResponse::Found(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => {
GetEditgroupResponse::NotFound(ErrorResponse {
- message: format!("No such editgroup: {}", id),
+ message: format!("No such editgroup: {}", editgroup_id),
})
}
Err(e) =>
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 617b150b..2431e0fe 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -416,7 +416,7 @@ impl EditgroupRow {
/// eg, entity history queries (where we already have the entity edit we want)
pub fn into_model_partial(self) -> Editgroup {
Editgroup {
- id: Some(uuid2fcid(&self.id)),
+ editgroup_id: Some(uuid2fcid(&self.id)),
editor_id: uuid2fcid(&self.editor_id),
description: self.description,
extra: self.extra_json,
diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs
index d6cdb6d3..86559545 100644
--- a/rust/tests/test_api_server_http.rs
+++ b/rust/tests/test_api_server_http.rs
@@ -1202,7 +1202,7 @@ fn test_post_batch_autoaccept() {
// editgroup
check_http_response(
request::post(
- "http://localhost:9411/v0/container/batch?autoaccept=yes&editgroup=asdf",
+ "http://localhost:9411/v0/container/batch?autoaccept=yes&editgroup_id=asdf",
headers.clone(),
r#"[{"name": "test journal"}, {"name": "another test journal"}]"#,
&router,
diff --git a/rust/tests/test_old_python_tests.rs b/rust/tests/test_old_python_tests.rs
index d7e5c03b..b3d4a316 100644
--- a/rust/tests/test_old_python_tests.rs
+++ b/rust/tests/test_old_python_tests.rs
@@ -26,7 +26,7 @@ fn test_api_rich_create() {
new_eg.description = Some("a unit test edit".to_string());
let resp = client.create_editgroup(new_eg).wait().unwrap();
let editgroup_id = match resp {
- CreateEditgroupResponse::SuccessfullyCreated(eg) => eg.id.unwrap(),
+ CreateEditgroupResponse::SuccessfullyCreated(eg) => eg.editgroup_id.unwrap(),
_ => unreachable!(),
};
@@ -116,7 +116,7 @@ fn test_api_rich_create() {
let mut new_file = FileEntity::new();
new_file.sha1 = Some("7d97e98f8af710c7e7fe703abc8f639e0ee507c4".to_string());
new_file.size = Some(1234);
- new_file.releases = Some(vec![release_id.clone()]);
+ new_file.release_ids = Some(vec![release_id.clone()]);
// extra=dict(f=4, b="zing"))),
let resp = client
.create_file(new_file, Some(editgroup_id.clone()))
@@ -178,7 +178,7 @@ fn test_api_rich_create() {
GetFileResponse::FoundEntity(e) => e,
_ => unreachable!(),
};
- assert_eq!(fe.releases.unwrap()[0], release_id.clone());
+ assert_eq!(fe.release_ids.unwrap()[0], release_id.clone());
// had a test for active_editgroup here, but that's soon-to-be-deprecated