diff --git a/New_APIs/Quizlet API/Readme.md b/New_APIs/Quizlet API/Readme.md new file mode 100644 index 0000000..7816c2b --- /dev/null +++ b/New_APIs/Quizlet API/Readme.md @@ -0,0 +1,18 @@ +# Quizlet API Viewer App + +A simple web application to interact with the Quizlet API and view study sets. + +## Features +- Fetch and display Quizlet study sets +- Deploy new Quizlet apps +- Scale Quizlet app resources +- Retrieve logs from Quizlet apps + +## Installation +1. Clone the repository: + ```bash + git clone https://github.com/sreevidya-16/QuizletAPIApp.git + + +## Contributor +### Sree Vidya diff --git a/New_APIs/Quizlet API/index.html b/New_APIs/Quizlet API/index.html new file mode 100644 index 0000000..aef8260 --- /dev/null +++ b/New_APIs/Quizlet API/index.html @@ -0,0 +1,31 @@ + + + + + + + Quizlet API Viewer + + +

Quizlet API Viewer

+
+

Study Sets

+
+

Deploy

+ + + +

Scale

+ + + + +

Logs

+ + + +
+ + + + diff --git a/New_APIs/Quizlet API/index.js b/New_APIs/Quizlet API/index.js new file mode 100644 index 0000000..d77c2e0 --- /dev/null +++ b/New_APIs/Quizlet API/index.js @@ -0,0 +1,62 @@ +document.addEventListener('DOMContentLoaded', function () { + fetchQuizletStudySets(); + + document.getElementById('deployButton').addEventListener('click', async () => { + const appName = document.getElementById('deployAppName').value; + const sourceUrl = document.getElementById('deploySourceUrl').value; + const response = await fetch('/deploy', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, source_url: sourceUrl }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('scaleButton').addEventListener('click', async () => { + const appName = document.getElementById('scaleAppName').value; + const dynoType = document.getElementById('scaleDynoType').value; + const quantity = document.getElementById('scaleQuantity').value; + const response = await fetch('/scale', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, dyno_type: dynoType, quantity: parseInt(quantity) }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('logsButton').addEventListener('click', async () => { + const appName = document.getElementById('logsAppName').value; + const response = await fetch(`/logs?app_name=${appName}`); + const result = await response.json(); + const results = document.getElementById('results'); + results.innerHTML = JSON.stringify(result, null, 2); + }); +}); + +async function fetchQuizletStudySets() { + const accessToken = 'YOUR_QUIZLET_ACCESS_TOKEN'; + const endpoint = 'https://api.quizlet.com/2.0/sets'; + + fetch(endpoint, { + headers: { + 'Authorization': `Bearer ${accessToken}` + } + }) + .then(response => response.json()) + .then(data => { + const studySets = document.getElementById('studySets'); + data sets.forEach(set => { + const setItem = document.createElement('div'); + setItem.className = 'setItem'; + setItem.innerHTML = ` +

${set.title}

+

${set.term_count} terms

+

${set.description || 'No description available'}

+ `; + studySets.appendChild(setItem); + }); + }) + .catch(error => console.error('Error fetching study sets:', error)); +} diff --git a/New_APIs/Quizlet API/manifest.json b/New_APIs/Quizlet API/manifest.json new file mode 100644 index 0000000..7311221 --- /dev/null +++ b/New_APIs/Quizlet API/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "QuizletApp", + "name": "Quizlet API Viewer App", + "icons": [ + { + "src": "icon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/New_APIs/Quizlet API/package-lock.json b/New_APIs/Quizlet API/package-lock.json new file mode 100644 index 0000000..26de0d1 --- /dev/null +++ b/New_APIs/Quizlet API/package-lock.json @@ -0,0 +1,50 @@ +{ + "name": "quizlet-api-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-G7fYv8zS0D7ftu3gnLsOniwhgLU4k9v+1NEtFPP07/Oa8XJ51FtdUKLqIvsTcZo5ua23NO4s9Hr77BM19DOf1g==", + "requires": { + "accepts": "1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "2.0.6", + "qs": "6.7.0", + "range-parser": "1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "1.5.0", + "type-is": "1.6.18", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + }, + "quizlet-api": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/quizlet-api/-/quizlet-api-1.0.0.tgz", + "integrity": "sha512-3I5CVSy+mb/V9Fxh2RH1Hc+T4x+HbCu4Vj3H0nnJpItcLLt1s2M2n4c3lgY2yHsRHKvILwB3RZ/VZ1V6Dya0rA==" + } + } + } + \ No newline at end of file diff --git a/New_APIs/Quizlet API/package.json b/New_APIs/Quizlet API/package.json new file mode 100644 index 0000000..b5b06cb --- /dev/null +++ b/New_APIs/Quizlet API/package.json @@ -0,0 +1,16 @@ +{ + "name": "quizlet-api-app", + "version": "1.0.0", + "description": "A simple app to view Quizlet study sets", + "main": "index.js", + "scripts": { + "start": "node server.js" + }, + "author": "Your Name", + "license": "ISC", + "dependencies": { + "express": "^4.17.1", + "quizlet-api": "^1.0.0" + } + } + \ No newline at end of file diff --git a/New_APIs/Quizlet API/style.css b/New_APIs/Quizlet API/style.css new file mode 100644 index 0000000..c586d28 --- /dev/null +++ b/New_APIs/Quizlet API/style.css @@ -0,0 +1,52 @@ +body { + font-family: Arial, sans-serif; + background: linear-gradient(135deg, #89fffd, #ef32d9); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +h1 { + font-size: 2.5em; + margin-bottom: 20px; +} + +#app { + text-align: center; + padding: 20px; + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} + +h2 { + margin-top: 20px; + font-size: 1.5em; +} + +input, button { + margin: 10px 0; + padding: 10px; + border-radius: 5px; + border: none; +} + +button { + background: #ef32d9; + color: #fff; + cursor: pointer; +} + +button:hover { + background: #a726c1; +} + +#studySets .setItem { + margin-bottom: 15px; +} + +#results { + margin-top: 20px; +}