Appearance
仓库
获取仓库。
const TOKEN = '123456';
const url = `https://gitee.com/api/v5/user/repos`;
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}获取仓库信息。
const TOKEN = '123456';
const NAME = 'yourname';
const REPO = 'mygit';
const url = `https://gitee.com/api/v5/repos/${NAME}/${REPO}`;
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}