Skip to content

Commit

Permalink
add collections_v2 endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan0xC committed Jun 27, 2024
1 parent 9af6f86 commit a74c7bf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/api/core/ciphers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pub fn routes() -> Vec<Route> {
delete_all,
move_cipher_selected,
move_cipher_selected_put,
put_collections2_update,
post_collections2_update,
put_collections_update,
post_collections_update,
post_collections_admin,
Expand Down Expand Up @@ -695,6 +697,33 @@ struct CollectionsAdminData {
collection_ids: Vec<String>,
}

#[put("/ciphers/<uuid>/collections_v2", data = "<data>")]
async fn put_collections2_update(
uuid: &str,
data: Json<CollectionsAdminData>,
headers: Headers,
conn: DbConn,
nt: Notify<'_>,
) -> JsonResult {
post_collections2_update(uuid, data, headers, conn, nt).await
}

#[post("/ciphers/<uuid>/collections_v2", data = "<data>")]
async fn post_collections2_update(
uuid: &str,
data: Json<CollectionsAdminData>,
headers: Headers,
conn: DbConn,
nt: Notify<'_>,
) -> JsonResult {
let cipher_details = post_collections_update(uuid, data, headers, conn, nt).await?;
Ok(Json(json!({ // AttachmentUploadDataResponseModel
"object": "optionalCipherDetails",
"unavailable": false,
"cipher": *cipher_details
})))
}

#[put("/ciphers/<uuid>/collections", data = "<data>")]
async fn put_collections_update(
uuid: &str,
Expand Down

0 comments on commit a74c7bf

Please sign in to comment.