App script Chat GPT 100% working code. with some minimul errors
/* BAITHKEE BACKEND API Google Apps Script for handling News, Views, and Reports */ function doGet(e) { var action = e.parameter.action; if (action == "getNews") return getNews(e); if (action == "addView") return addView(e); if (action == "report") return reportNews(e); return ContentService.createTextOutput("Baithkee API is Live"); } function doPost(e) { var data = JSON.parse(e.postData.contents); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("NEWS"); // Naya News Post karna sheet.appendRow([ new Date().getTime(), // ID data.headline, data.text, data.username, data.photo, data.email, data.latitude, data.longitude, new Date().getTime(), // Timestamp 0, // Views "" // Reports (storing as string to check unique users) ...