$.uaCalendar = function() { //========================================================================================================== CALENDARS this.create = function(pData,pCbkFunc) {//REF: https://developers.google.com/calendar/api/v3/reference/calendars/insert $.ajax({ url: 'https://www.googleapis.com/calendar/v3/calendars', method: 'POST', data: { summary: pData.name, description: 'UnfoldingArt Calendar, Artistic Events' }, headers : { Authorization : 'Bearer ' + pData.strAccess } }). done(function(pResp) { pCbkFunc({ bError: false, idCalendar: pResp.result.id }); }). fail(function(e) { pCbkFunc({ bError: true }); }); }; this.update_TimeZone = function(pData, pCbkFunc) { //REF: https://developers.google.com/calendar/api/v3/reference/calendars/update //pData:{idCalendar, strTimeZone, strAccess} //Update timezone only $.ajax({ url: 'https://www.googleapis.com/calendar/v3/calendars/'+ pData.idCalendar, method: 'PUT', data: { timeZone: pData.strTimeZone //Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich }, headers : { Authorization : 'Bearer ' + pData.strAccess } }). done(function(pResp) { let x = pResp; }). fail(function(e) { pCbkFunc({ bError: false }); }); }; this.delete = function(pData,pCbkFunc) {//REF: $.ajax({ url: 'https://www.googleapis.com/calendar/v3/calendars/'+ pData.idCalendar, method: 'DELETE', headers : { Authorization : 'Bearer ' + pData.strAccess } }). done(function(pResp) { let x = pResp; }). fail(function(e) { pCbkFunc({ bError: false }); }); }; //========================================================================================================== EVENTS this.createEvent = function(pData,pCbkFunc) {//REF: https://developers.google.com/calendar/api/v3/reference/events/insert /* pData = { strAccess, dateStart, dateEnd title // -> summary description -> JSON.stringify({ //used for posts or event participation type:event/post info:'xxx',//description idPicture / idVideo, hashtags:'' }) location } */ }; this.updateEvent = function(pData,pCbkFunc) { }; this.deleteEvent = function(pData,pCbkFunc) { }; this.getEvent = function(pData,pCbkFunc) { }; this.getList_Events = function(pData,pCbkFunc) { }; return this; };