-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #370 from sreevidya-16/sree
Added Quizlet API
- Loading branch information
Showing
7 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>Quizlet API Viewer</title> | ||
</head> | ||
<body> | ||
<h1>Quizlet API Viewer</h1> | ||
<div id="app"> | ||
<h2>Study Sets</h2> | ||
<div id="studySets"></div> | ||
<h2>Deploy</h2> | ||
<input type="text" id="deployAppName" placeholder="App Name"> | ||
<input type="text" id="deploySourceUrl" placeholder="Source URL"> | ||
<button id="deployButton">Deploy</button> | ||
<h2>Scale</h2> | ||
<input type="text" id="scaleAppName" placeholder="App Name"> | ||
<input type="text" id="scaleDynoType" placeholder="Dyno Type"> | ||
<input type="number" id="scaleQuantity" placeholder="Quantity"> | ||
<button id="scaleButton">Scale</button> | ||
<h2>Logs</h2> | ||
<input type="text" id="logsAppName" placeholder="App Name"> | ||
<button id="logsButton">Get Logs</button> | ||
<ul id="results"></ul> | ||
</div> | ||
|
||
<script src="index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = ` | ||
<h3>${set.title}</h3> | ||
<p>${set.term_count} terms</p> | ||
<p>${set.description || 'No description available'}</p> | ||
`; | ||
studySets.appendChild(setItem); | ||
}); | ||
}) | ||
.catch(error => console.error('Error fetching study sets:', error)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |