const accessToken = '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'; // Replace with your actual access token
const gistData = {
description: 'My Gist',
public: true,
files: {
'file1.txt': {
content: 'Hello, this is my gist!'
}
}
};
fetch('https://api.github.com/gists', {
method: 'POST',
headers: {
'Authorization': `token ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(gistData),
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error creating gist:', error));