-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94b013a
commit 21ba678
Showing
3 changed files
with
75 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,16 @@ | ||
# CoPilot Read Me | ||
|
||
## 2023-11-16 | ||
|
||
What is the URL that obtains the list of all GitHub repositories for a user? | ||
|
||
https://api.github.com/users/theo-armour/repos | ||
|
||
|
||
What is the URL that obtains the list of only the homepage URLs for all GitHub repositories for a user? | ||
|
||
|
||
|
||
Can you build a webpage that obtains the list of all GitHub repositories for a user and only displays the links to the "html_url"? | ||
|
||
Can you build a webpage that obtains the list of all GitHub organizations for a user and only displays the links to the "html_url"? |
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> | ||
|
||
<body> | ||
<input type="text" id="username" placeholder="Enter GitHub username"> | ||
<button onclick="getOrgs()">Get Organizations</button> | ||
<div id="orgs"></div> | ||
|
||
<script> | ||
function getOrgs () { | ||
const username = document.getElementById( 'username' ).value; | ||
fetch( `https://api.github.com/users/${ username }/orgs` ) | ||
.then( response => response.json() ) | ||
.then( data => { | ||
const orgsDiv = document.getElementById( 'orgs' ); | ||
orgsDiv.innerHTML = ''; // clear the div | ||
data.forEach( org => { | ||
console.log( "org", org, org.html_url ); | ||
const a = document.createElement( 'a' ); | ||
a.href = "https://github.com/" + org.login; | ||
a.textContent = org.login; | ||
orgsDiv.appendChild( a ); | ||
orgsDiv.appendChild( document.createElement( 'br' ) ); // line break | ||
} ); | ||
} ) | ||
.catch( error => console.error( 'Error:', error ) ); | ||
} | ||
</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,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<input type="text" id="username" placeholder="Enter GitHub username"> | ||
<button onclick="getRepos()">Get Repos</button> | ||
<div id="repos"></div> | ||
|
||
<script> | ||
function getRepos() { | ||
const username = document.getElementById('username').value; | ||
fetch(`https://api.github.com/users/${username}/repos`) | ||
.then(response => response.json()) | ||
.then(data => { | ||
const reposDiv = document.getElementById('repos'); | ||
reposDiv.innerHTML = ''; // clear the div | ||
data.forEach(repo => { | ||
const a = document.createElement('a'); | ||
a.href = repo.html_url; | ||
a.textContent = repo.name; | ||
reposDiv.appendChild(a); | ||
reposDiv.appendChild(document.createElement('br')); // line break | ||
}); | ||
}) | ||
.catch(error => console.error('Error:', error)); | ||
} | ||
</script> | ||
</body> | ||
</html> |