Add support for Bday sharing

This commit is contained in:
Max Berger
2026-03-18 23:30:03 +01:00
parent 218cf00deb
commit e3242fcc2c
8 changed files with 346 additions and 22 deletions

View File

@@ -27,6 +27,8 @@ import { CollectionType } from "../models/collection.js";
* @property {boolean} [PermittedCreateCollectionByMap]
* @property {boolean} [FeatureEnabledCollectionByToken]
* @property {boolean} [PermittedCreateCollectionByToken]
* @property {boolean} [FeatureEnabledCollectionByBday]
* @property {boolean} [PermittedCreateCollectionByBday]
*/
/**
@@ -433,7 +435,7 @@ export function update_incoming_share(
call_sharing_api(
user,
password,
"map/update",
share.ShareType + "/update",
{
PathOrToken: share.PathOrToken,
Enabled: share.EnabledByUser,
@@ -453,3 +455,115 @@ export function update_incoming_share(
}
);
}
/**
* @param {string} user
* @param {string} password
* @param {Share} share
* @param {function(?string):void} callback
*/
export function add_share_by_bday(
user,
password,
share,
callback,
) {
call_sharing_api(
user,
password,
"bday/create",
{
PathMapped: share.PathMapped,
Permissions: share.Permissions,
Enabled: share.EnabledByOwner,
Hidden: share.HiddenByOwner,
Properties: share.Properties,
User: share.User,
PathOrToken: share.PathOrToken,
},
function (response) {
let json_response = JSON.parse(response);
if (json_response["Status"] !== "success") {
callback(json_response["Status"] || "Unknown error");
} else {
callback(null);
}
},
null,
function (error) {
callback(error);
}
);
}
/**
* @param {string} user
* @param {string} password
* @param {Share} share
* @param {function(?string):void} callback
*/
export function delete_share_by_bday(
user,
password,
share,
callback,
) {
call_sharing_api(
user,
password,
"bday/delete",
{ PathOrToken: share.PathOrToken },
function (response) {
let json_response = JSON.parse(response);
if (json_response["Status"] !== "success") {
callback(json_response["Status"] || "Unknown error");
} else {
callback(null);
}
},
null,
function (error) {
callback(error);
}
);
}
/**
* @param {string} user
* @param {string} password
* @param {Share} share
* @param {function(?string):void} callback
*/
export function update_share_by_bday(
user,
password,
share,
callback,
) {
call_sharing_api(
user,
password,
"bday/update",
{
PathOrToken: share.PathOrToken,
PathMapped: share.PathMapped,
User: share.User,
Permissions: share.Permissions,
Enabled: share.EnabledByOwner,
Hidden: share.HiddenByOwner,
Properties: share.Properties,
},
function (response) {
let json_response = JSON.parse(response);
if (json_response["Status"] !== "success") {
callback(json_response["Status"] || "Unknown error");
} else {
callback(null);
}
},
null,
function (error) {
callback(error);
}
);
}