namespace _zeitbild.api { /** */ export function register_davina_calendars( rest_subject : lib_plankton.rest_caldav.type_rest ) : void { register< null, ( null | Array< { id : int; name : string; access_level : string; } > ) > ( rest_subject, lib_plankton.http.enum_method.get, "/davina/calendars", { "input_schema": () => ({ "nullable": true, }), "output_schema": () => ({ "nullable": false, "type": "boolean", }), "restriction": restriction_web_auth, "execution": async (stuff) => { const user : {id : _zeitbild.type_user_id; object : _zeitbild.type_user_object;} = await _zeitbild.api.user_from_web_auth(stuff); return ( _zeitbild.service.calendar.overview(user.id) .then( (data_raw) => Promise.resolve( data_raw .map( (entry) => ({ "id": entry.id, "name": entry.name, "access_level": _zeitbild.value_object.access_level.to_string(entry.access_level), }) ) ) ) .then( (data) => Promise.resolve({ "status_code": 200, "data": data, }) ) ); }, } ); } }