Repository: zenghongtu/GitHub-Pro
Branch: main
Commit: b64fd9d639a9
Files: 182
Total size: 2.6 MB
Directory structure:
gitextract_wre2chye/
├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc
├── README.md
├── babel.config.js
├── config/
│ ├── dev.js
│ ├── index.js
│ └── prod.js
├── openapi-codegen.config.ts
├── package.json
├── project.config.json
├── project.private.config.json
├── project.tt.json
├── src/
│ ├── app.config.ts
│ ├── app.scss
│ ├── app.tsx
│ ├── assets/
│ │ └── iconfont/
│ │ └── icon.css
│ ├── components/
│ │ ├── activity-item/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── author/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── avatar/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── empty/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── fab-button/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── font-icon/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── list-item/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── load-more/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── markdown/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── no-authority/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── repo-item/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── skeleton-card/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── user-info/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ └── user-item/
│ │ ├── index.module.scss
│ │ └── index.tsx
│ ├── constants.ts
│ ├── github/
│ │ ├── githubComponents.ts
│ │ ├── githubContext.ts
│ │ ├── githubFetcher.ts
│ │ ├── githubParameters.ts
│ │ ├── githubResponses.ts
│ │ └── githubSchemas.ts
│ ├── hooks/
│ │ ├── useInfiniteGithubRequest.ts
│ │ ├── usePageScrollBackToTop.tsx
│ │ ├── usePullDownRefreshEvent.ts
│ │ ├── useReachBottomEvent.ts
│ │ ├── useRequest.ts
│ │ ├── useRequestWIthMore.ts
│ │ └── useTrending.ts
│ ├── index.html
│ ├── pages/
│ │ ├── activity/
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ └── repo.tsx
│ │ ├── bookmarks/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── commits/
│ │ │ ├── commit-item/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── developer/
│ │ │ ├── followers/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── following/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ ├── repos/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ └── starred/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── issues/
│ │ │ ├── comment-item/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── create-comment/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── create-issue/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ ├── issue-detail/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── issue-item/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ └── shared_data.ts
│ │ ├── login/
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── my-languages/
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ └── languages.ts
│ │ ├── news/
│ │ │ ├── content/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── index.config.ts
│ │ │ └── index.tsx
│ │ ├── notifications/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── profile/
│ │ │ ├── content.tsx
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ └── issues.tsx
│ │ ├── repos/
│ │ │ ├── content/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── contributors/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── files/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── forks/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ ├── list-render/
│ │ │ │ └── index.tsx
│ │ │ ├── readme/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ ├── stars/
│ │ │ │ ├── index.module.scss
│ │ │ │ └── index.tsx
│ │ │ └── watchs/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── search/
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ ├── index.tsx
│ │ │ ├── issues.tsx
│ │ │ ├── repos.tsx
│ │ │ └── users.tsx
│ │ ├── starred/
│ │ │ ├── content.tsx
│ │ │ ├── index.config.ts
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ └── trending/
│ │ ├── index.config.ts
│ │ ├── index.module.scss
│ │ ├── index.tsx
│ │ ├── language/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ ├── repo-item/
│ │ │ ├── index.module.scss
│ │ │ └── index.tsx
│ │ └── user-item/
│ │ ├── index.module.scss
│ │ └── index.tsx
│ ├── services/
│ │ ├── commits.ts
│ │ ├── github.ts
│ │ ├── issues.ts
│ │ ├── repos.ts
│ │ ├── search.ts
│ │ ├── trending.ts
│ │ ├── user.ts
│ │ └── users.ts
│ ├── store/
│ │ ├── constatnts.ts
│ │ ├── index.ts
│ │ ├── reducers/
│ │ │ ├── issue.ts
│ │ │ ├── lang.ts
│ │ │ └── user.ts
│ │ └── reducers.ts
│ ├── style/
│ │ └── variables.scss
│ ├── utils/
│ │ ├── base64.js
│ │ ├── common.ts
│ │ ├── date.ts
│ │ ├── event_bus.ts
│ │ ├── repo.ts
│ │ ├── request.ts
│ │ └── size.ts
│ └── wemark/
│ ├── parser.js
│ ├── prism.js
│ ├── prism.wxss
│ ├── remarkable.js
│ ├── richtext.js
│ ├── wemark.js
│ ├── wemark.json
│ ├── wemark.wxml
│ └── wemark.wxss
├── tsconfig.json
└── types/
├── global.d.ts
└── trending.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# 🎨 http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
================================================
FILE: .gitignore
================================================
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store
.swc
================================================
FILE: .prettierignore
================================================
node_modules
dist
tests
*.d.ts
*.js
*.md
*.yaml
.vscode
================================================
FILE: .prettierrc
================================================
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": [
"./node_modules/prettier-plugin-packagejson",
"./node_modules/prettier-plugin-organize-imports"
]
}
================================================
FILE: README.md
================================================
# GitHub Pro

> 一个简洁、强大的 GitHub 小程序客户端
基于 Taro3 / Taro-ui / React-query / React18 / **TypeScript**。
## 想法
探究 Taro 使用 TypeScript 的坑,以及 Taro Hooks 的能力(所有页面、组件均用 Hooks) -- 结论: 真香~😋
## 扫码体验

(或者微信搜索小程序:GitHub Pro)
## Preview

## Screenshots
| | | |
| :---: | :---: | :---: |
||||
||||
## 协议
Copyright © 2023 zenghongtu
================================================
FILE: babel.config.js
================================================
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
],
plugins: [
[
'import',
{
libraryName: 'taro-ui',
customName: name => {
if(name === 'at-list-item'){
name = 'at-list/item'
} else if(name === 'at-action-sheet-item'){
name = 'at-action-sheet/body/item'
}
return `taro-ui/lib/components/${name.slice(3)}`
},
customStyleName: name => {
/**
* 修复style
*/
if(name === 'at-tabs-pane'){
name = 'at-tabs'
}
else if(name === 'at-list-item'){
name = 'at-list'
}
else if(name === 'at-action-sheet-item'){
name = 'at-action-sheet'
}
return `taro-ui/dist/style/components/${name.slice(3)}.scss`
}
},
'taro-ui'
]
]
}
================================================
FILE: config/dev.js
================================================
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
mini: {},
h5: {}
}
================================================
FILE: config/index.js
================================================
const path = require('path');
const config = {
projectName: 'GitHub-Pro',
date: '2023-2-7',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
alias: {
'@': path.resolve(__dirname, '..', 'src'),
},
copy: {
patterns: [
{
from: 'src/wemark',
to: 'dist/wemark'
}
],
options: {
}
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
sass: {
resource: [path.resolve(__dirname, "..", "src/style/variables.scss")],
// data: `@import "taro-ui/dist/style/variables/default.scss";`,
},
weapp: {
compile: {
exclude: [
'src/wemark/remarkable.js',
]
}
},
mini: {
miniCssExtractPluginOption: {
ignoreOrder: true,
},
postcss: {
pxtransform: {
enable: true,
config: {
},
},
url: {
enable: true,
config: {
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[hash:base64:6]',
},
},
},
},
h5: {
publicPath: '/',
staticDirectory: 'static',
// esnextModules: ['nutui-react'],
postcss: {
pxtransform: {
enable: true,
config: {
},
},
autoprefixer: {
enable: true,
config: {},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
};
module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'));
}
return merge({}, config, require('./prod'));
};
================================================
FILE: config/prod.js
================================================
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {
},
mini: {},
h5: {
/**
* WebpackChain 插件配置
* @docs https://github.com/neutrinojs/webpack-chain
*/
// webpackChain (chain) {
// /**
// * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
// * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
// */
// chain.plugin('analyzer')
// .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
// /**
// * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
// * @docs https://github.com/chrisvfritz/prerender-spa-plugin
// */
// const path = require('path')
// const Prerender = require('prerender-spa-plugin')
// const staticDir = path.join(__dirname, '..', 'dist')
// chain
// .plugin('prerender')
// .use(new Prerender({
// staticDir,
// routes: [ '/pages/index/index' ],
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
// }))
// }
}
}
================================================
FILE: openapi-codegen.config.ts
================================================
import { defineConfig } from '@openapi-codegen/cli';
import {
generateReactQueryComponents,
generateSchemaTypes,
} from '@openapi-codegen/typescript';
export default defineConfig({
github: {
from: {
source: 'url',
url: 'https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml',
},
outputDir: './src/github',
to: async (context) => {
const filenamePrefix = 'github';
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix,
});
await generateReactQueryComponents(context, {
filenamePrefix,
schemasFiles,
});
},
},
});
================================================
FILE: package.json
================================================
{
"name": "GitHub-Pro",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"author": "jasonzeng ",
"scripts": {
"build:alipay": "taro build --type alipay",
"build:h5": "taro build --type h5",
"build:jd": "taro build --type jd",
"build:qq": "taro build --type qq",
"build:quickapp": "taro build --type quickapp",
"build:rn": "taro build --type rn",
"build:swan": "taro build --type swan",
"build:tt": "taro build --type tt",
"build:weapp": "taro build --type weapp",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:qq": "npm run build:qq -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:weapp": "npm run build:weapp -- --watch",
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
"gen:github": "openapi-codegen gen github"
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"dependencies": {
"@babel/runtime": "^7.7.7",
"@tanstack/react-query": "^4.24.4",
"@tarojs/components": "3.6.0",
"@tarojs/helper": "3.6.0",
"@tarojs/plugin-framework-react": "3.6.0",
"@tarojs/plugin-html": "3.6.0",
"@tarojs/plugin-platform-alipay": "3.6.0",
"@tarojs/plugin-platform-jd": "3.6.0",
"@tarojs/plugin-platform-qq": "3.6.0",
"@tarojs/plugin-platform-swan": "3.6.0",
"@tarojs/plugin-platform-tt": "3.6.0",
"@tarojs/plugin-platform-weapp": "3.6.0",
"@tarojs/react": "3.6.0",
"@tarojs/router": "3.6.0",
"@tarojs/runtime": "3.6.0",
"@tarojs/shared": "3.6.0",
"@tarojs/taro": "3.6.0",
"@tarojs/taro-h5": "3.6.0",
"classnames": "^2.3.2",
"lodash": "4.17.15",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-redux": "^8.0.5",
"react-refresh": "^0.11.0",
"redux": "^4.2.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.4.2",
"taro-ui": "3.1.0-beta.4",
"zustand": "^4.3.3"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@openapi-codegen/cli": "^2.0.0",
"@openapi-codegen/typescript": "^6.1.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "3.6.0",
"@tarojs/webpack5-runner": "3.6.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-router-dom": "^5.1.7",
"@types/react-syntax-highlighter": "^13.5.2",
"@types/react-test-renderer": "^18.0.0",
"@types/react-transition-group": "^4.4.4",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-plugin-import": "^1.13.3",
"babel-preset-taro": "3.6.0",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.2",
"prettier-plugin-organize-imports": "^3.2.0",
"prettier-plugin-packagejson": "^2.3.0",
"style-loader": "1.3.0",
"stylelint": "^14.4.0",
"typescript": "^4.1.0",
"webpack": "5.69.0"
}
}
================================================
FILE: project.config.json
================================================
{
"miniprogramRoot": "dist/",
"projectname": "GitHub-Pro",
"description": "",
"appid": "wx96c15ae0f6f25368",
"setting": {
"urlCheck": true,
"es6": false,
"enhance": false,
"compileHotReLoad": false,
"postcss": false,
"minified": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "2.30.0",
"srcMiniprogramRoot": "dist/",
"packOptions": {
"ignore": [],
"include": []
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}
================================================
FILE: project.private.config.json
================================================
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "GitHub-Pro",
"setting": {
"compileHotReLoad": true
}
}
================================================
FILE: project.tt.json
================================================
{
"miniprogramRoot": "./",
"projectname": "GitHub-Pro",
"description": "",
"appid": "touristappid",
"setting": {
"urlCheck": true,
"es6": false,
"postcss": false,
"minified": false
},
"compileType": "miniprogram"
}
================================================
FILE: src/app.config.ts
================================================
export default defineAppConfig({
pages: [
'pages/trending/index',
'pages/news/index',
'pages/activity/repo',
'pages/activity/index',
'pages/developer/index',
'pages/profile/index',
'pages/profile/issues',
'pages/search/index',
'pages/login/index',
'pages/repos/index',
'pages/my-languages/index',
'pages/repos/contributors/index',
'pages/repos/forks/index',
'pages/repos/stars/index',
'pages/repos/watchs/index',
'pages/commits/index',
'pages/repos/content/index',
'pages/issues/index',
'pages/issues/create-comment/index',
'pages/issues/create-issue/index',
'pages/issues/issue-detail/index',
'pages/developer/followers/index',
'pages/developer/following/index',
'pages/developer/repos/index',
'pages/developer/starred/index',
'pages/repos/files/index',
'pages/starred/index',
],
window: {
navigationStyle: 'default',
backgroundColor: '#f3f3f3',
backgroundTextStyle: 'dark',
navigationBarTitleText: 'GitHub Pro',
navigationBarBackgroundColor: '#fafafa',
navigationBarTextStyle: 'black',
backgroundColorTop: '#fafafa',
backgroundColorBottom: '#fafafa',
enablePullDownRefresh: true,
},
tabBar: {
backgroundColor: '#fafafa',
position: 'bottom',
borderStyle: 'white',
color: '#8499a5',
selectedColor: '#007afb',
list: [
{
pagePath: 'pages/trending/index',
iconPath: './assets/icons/trending.png',
selectedIconPath: './assets/icons/trending_active.png',
text: 'Trending',
},
{
pagePath: 'pages/news/index',
iconPath: './assets/icons/news.png',
selectedIconPath: './assets/icons/news_active.png',
text: 'News',
},
{
pagePath: 'pages/search/index',
iconPath: './assets/icons/search.png',
selectedIconPath: './assets/icons/search_active.png',
text: 'Search',
},
{
pagePath: 'pages/starred/index',
iconPath: './assets/icons/star.png',
selectedIconPath: './assets/icons/star_active.png',
text: 'Starred',
},
{
pagePath: 'pages/profile/index',
iconPath: './assets/icons/github.png',
selectedIconPath: './assets/icons/github_active.png',
text: 'Profile',
},
],
},
usingComponents: {
wemark: './wemark/wemark',
},
});
================================================
FILE: src/app.scss
================================================
page {
background: $bg;
}
================================================
FILE: src/app.tsx
================================================
import '@/assets/iconfont/icon.css';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Taro from '@tarojs/taro';
import { Component } from 'react';
import { Provider } from 'react-redux';
import './app.scss';
import configStore from './store';
const store = configStore();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 1,
retryDelay: (attempt) => attempt * 2000,
// staleTime: 10,
},
},
});
class App extends Component {
componentWillMount() {
// TODO by path
// const { path, query, scene } = this.$router.params
}
componentDidMount() {
this.updateApp();
// Taro.getClipboardData({
// success(res) {
// const data = res.data as string;
// if (data && data.startsWith(githubHttpsUrl)) {
// const [owner, repo, filePath] = parseGitHub(data);
// const url = getNavPath({ owner, filePath, repo });
// if (url) {
// Taro.navigateTo({ url });
// }
// }
// },
// });
// no use
// if (process.env.TARO_ENV === 'weapp') {
// const env = process.env.ClOUD_ENV
// Taro.cloud.init({ env, traceUser: true })
// }
}
componentDidShow() {}
componentDidHide() {}
componentDidCatchError() {}
updateApp() {
if (Taro.canIUse('getUpdateManager')) {
const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log('hasUpdate: ', res.hasUpdate);
});
updateManager.onUpdateReady(function () {
Taro.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
Taro.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
});
});
}
}
// 在 App 类中的 render() 函数没有实际作用
// 请勿修改此函数
render() {
return (
{this.props.children}
);
}
}
export default App;
================================================
FILE: src/assets/iconfont/icon.css
================================================
@font-face {
font-family: 'iconfont';
src: url('iconfont.eot?t=1568428655639'); /* IE9 */
src: url('iconfont.eot?t=1568428655639#iefix') format('embedded-opentype'),
/* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAABVIAAsAAAAAJowAABT3AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCIaAq2XKsZATYCJAOBGAtOAAQgBYRtB4MbG7IfM6PmdBVAFGVJU2T/lwNOZAh1gdX7CUOpEjUxxouv3XevvVhW22qVJzGwxeOEAWaYfk6OlOETx8qpCkQQSr7hv+3wtR3K+XkoJTz8z/neB03T9BOgGyEqwm4OgY5nkC8ZuX01SAIEyAy1mc1EdpsZWAVirUdqJgNU1POBL3wJll1P/M4rKsjw/Db/z6UFxesVMQqwMQrszSuC4PQ9i3uNTRvQWXF97v8Hq3atS145uSxbVi9dqYsoloEvU+1Tr9VhYVica9ut98tedxk/sBIs8UGk9ACAwP8+nzPPDgU7WYKAolroMxjYxO7vEXRqLNZov5MEIDib/znTJjdGiRmhcPf6/Dn5f/mHCpjmiItpjwYEaixPbhPq//bo3yjNiNIRC31TZkbMqFk3IfVAWlstCyGdIDw/w8BmiUZDiOqyYRPUNwGoerLHfNhv/u/gsjEKFZHLMJq9v737QwAOOaqITl16DcJGc+UFusyaPnU8diCATpkhsGWLcUuN2FQAW67eMNhIf734wQ0BSUBxHbLflM6TaGdivKHK8AijmskuTwHWtwIFVAENch+zQexIOaiKCg7rT5wWM4BOtCOANjEm0YQaqUkznU0fM9rMNvv+wnwyLeJumDvJneyus9EOex1wzCnnXHDXJ8/xkj1XT+AV+j4klPfb4l0H93pxgk638rpY0uu/44EkW64cWYpZCAJoHPIVyRMiTBTRxBBLnHgJEiWxKZAsRao06TIoCmUKgrBA5ygA8dhKFMPEPGZAgkkE2TCVIBemGeTAtAdZMJ2Pk30QFhyNEHA2IgD3ITR8gXDgJ0Q+/I0ogi0AeXDTQQjcKhAGdxSIAncyiAZ3HYgBd2PEwh2IOLgLEQ93IxLgHkQi3ItIggcQNjyGKICnEMnwHCIFXkCkwruINPgJIB2eAzLgJQMFXioohJcHMuEN/RAEoOT10wtYBfZScP643qKOhry9bQQKbXC2Jks+lmVtPZkeQZBnyOkMx6UEJuAEnAhltqIilrZtXbiEECfWuJrNkUhHEPloajo9K2IoQQ3tcKGFmpraQp0JaiQM6fbIjTAlgiOJSCQWmZ8h4xTV1IxQYkaMpIU6qM7mthD5kNs2KiqO9ZcSjQeHtJv1T+jlzIHRDk5stJ99ZFgscMrdn87ZCyMXR4sMf9VDJ9blikaFOIh6/DFGkdGc8Xoj54l/biFWcFC7yXyLXe6kmoujDbNsc5RyIGEPJP0WusGsvrHmA6T9LllYvTjhb/96HMz+xJ4EsJ6mcaAtfKGtqT2MRARwNw7gIIaIxyBApiIeQSxCFMCQOE9+hrozPDTUfWpW6/0zI4I9p2dTZ9x/Dh1oCdMiVTwUC8n6eK2VoWTQPpKhvG8mhLmEYCfExKuVIeWMkLmnzEypiykh9WXGeDNGYl3SsDhmxUm8Nk4mpwtLaT59V52TLaxk+Wzj+YQkXkiKyV6ZACk209+tLxaL7mOAllqfKqZmEV6/K5nhHoEDmYyqXE/M8FidUITkzKRCMunhs3XBumwlWwxSCySU0umsh5OmuvfH/8rgYcWRXNWXPVBVfsm/1Z9STqijjx/TtHVYxhHcRzXTjfMmQrdamntH59B3zw272toskxylDYJFsFKXG7hdrUnVw8grwxUFpO/COt5d6U++W6lDKJvVGiBSzbXcOTQ00H14FlZXyTpCZRIGMzGtRuMBczCFFB4RdEWzWD6vRkV8f6gzRviiVpVqakOui/bmOQR7RmZTd84WyJxD4KnQ90dz0EYOy4aaZ4GmKTokuq+S3QbDaMerKIkhGqMoSOcfkjSG0ldCiEV8ECeWNldOHTxcfhALSf3soVL2iFGAYbv2cPDQsYPBI2cIv0MQd4nCVp7caCkO9g3WlMecDNvkTipIn4huAzBEBxDAO8QnZcAw1Plc8MKLjjiqOAgsg+kMjw7TQKoN1SdqERcTWiBI6i+plYJsl5WieeMNXhSg17WpdwQGsecCKT+Tn6tPpSfHmbMQwBVpSFm2E0q6paDfndW30CEjeP/imAFvdcQfuPMutOp9/XoSfgv8myCeFahTnu1TcnfNsn887XtyQo4o8p53wJt95PmLNUNof0GUv3YYZPCCAAkP725nFInsU4305IzVrdt1NzPgU2Cu60B9q+/7yu/bfDHTGc+Ee68S9/0j6yb5+V5ToXxcu6JyOqd7BHnwNOYfN151hrkZmcMxQC9zz7zZoPR13FM32zk0WDBHjYJd5jxxuXeC+wTeCOPtvDymVdfH79lux7TYWjd4jVorLrR5CxCG7EbKLez1xhf83FyFMD/BswW7x7MQran/OLs0hXslTjuU+E0fetqnLr/Lv/iieMqyP8Mh1RcNT9DLRZPp+ofxH09euRrLO1uLK6LsuT+i5E5yt/lnOu+L/7pMnPaOJ2gO/0jLgH/GkCkUdIZA265+OQyRZ5GMG0PUPIdtBillEGiDaYz1b4ZBJBzddoKHKNfGCLSrfTS+tyXcerE26mwSITYDEuXH1a2gRadGA1C16i8Z+tXPfWii5XKTC5VRdTs1q1SKiny+Uilwu8V6JNU5QbCVGCFatdnIRypJkbfSPNFMlp/i+RgiGjYniErdngPuPZu9WGxd3jKL3PpPqFIakIYV0c9VhLe458zVDimczkVQa0C6+sFUI0DkZ/5VtVYr24XohqgvXUqIG/qqd7gL4QL1TlFw8OIaesJXaYgyPTw9r1hNgRZI45hAKcZBwKl+AXkzoji/nqjoenSPYcxndmo5OHp59Iy0/d5om8OwoT56fG/4mKnKPBE6ofr+Bb/W2JjATeX7AYt21S8aYPHZ7IDa6oRA8oALba9Xh7WeJdczHkWRVaC88/fn+GIUZ6HmXLD/4vQyQx45C584k4xWjsRu+hrOcGuoVBYfbw746Vu5HHsqLTz65PiHaA2ZO05dOt9YQLAywFGU1KpsPh+VUnXP0IAm0N5yqi4fksTP604er12h27Ty9+bwUr2NsM9Z+c5qUlXG1+UJYsMfx66435A5boRc8iN5P1MgGpy/x5lf71aiSbW7UfGxOq4mjSVVZz638k61m82zP1sg/m79m7EdIvcmKv7IX978R95q9IaEB463CfvdRbv0p+x57o8Z9EiXM3Hn7r+8OjI4mvzYn4Pvnp/38Kd7vhmVjyT279SK3xA4cKhYLDx++zS+b49RieKSSfqWUIj5ILVi6BEuuOXS5qAVdn19REv3nO0NJROl68le6lxsvGZFEpqhmioYTY0Y2eK4zkmeJ5bQokGysUbc8+vmer8N8lagoOjmz6+jCACUSUCONjU3CjduFv+8h61ubU4LCJpthPh3LLPd99x7P2tu9JIRcipEQPA+xtwuxtsBdyPX9ZZDUJqgucM+b0YmJa+pIQ8iIIJWTm8oYBsysGONBgtqGEoFALWWoSGD10sggN42Qy22VANqsLCiehtKNBRgUF+qfk0E5BiIcqQCqmMUSVmzORjo2R+NVe5sf/dEB1GyGLf6uA3c/lvWW/3cT459tzqjM64JgT1eK+Hf8Sq3dVeF8hEzOU4uOnzZVdWukWna3VSXN89hxpPkqFB+da3KLR6X4VzMlYFGS+doP4yTCw//47aZ8M/h2Htr82rGOpWr2UpfyJmf9GRDz99fvz+/Dl33unF67b7H63fIgqt+3fJ434LTVvthy/NnV37akObiHxxY0fU9lyf+Za/djRsL9z52kVUG5eHhHu1be+Ym2/jt2eV5i2UuAYZ+lUbTe699f119UFTMrAYxI+3798e4Zxhj2aDxEKDEDPdiMGtW+X0LEBjDb8IoABJAGFAmbrAYcGaqjYh2Oms56+QQTM0EXCcvJ+5L3Txk8NmQ42A1nHXyBMCpDmeY6vYhlIhollHoaHRX4t3M7QA3OgihG0jeUPqibOop1VanY5M8kq2DCeQpkkyfcegpRMDnWNWTS+tKcWQY1nbV4U7aNs1/mWkwNyz+rNxH7i0XiEhwy2F8psk2UUD0jtyGTLood1auiD6LvoGeFBpAp6Aw7X80+GQI+7rLKTuYfcrlOqfkgY5n5XVpB6OPPYgTPFsSUV4ub6UyKK3q7evsbZeat9ko6X8VCP2r9qdnGCQu/egpbZsinDSYDhxGd+tNTGYOsXvUAdDHfg6ZYQqp0is2818rqGx785q+u3uuEVvN3QzoxQAmIFA2B42mfCfNL8YC2xhwjCQx3BBbB8bEeGPcDFBpdOdAuc1GDkenMeDwx0CIJceaGpvVJnAemQ2fJ8GYaTWmx/U2UhzK2ZnET9rpuiOZn7wDDPEE2Yk3ruPXb2ykdWaU4qXxmFFjbNwNQx8VZCVaX+OvrUQ6MkOJK8XYNHe61WwNFQh4tFJ2EX0s8GTsZYHah5Iw4cb8jTLpbu9f7axJWRTfgoLbr9LrS/lCVm5o4qvbRp+n05aFLVGksiu+JWdTfQrU48d7yuMkinypPzqEWCO6neci+/28UbFN+jnqJ0tynMOjMeJZei5bEicX8pu4KT1jKIraHE4RqVfvgtW13BjBwDJPnlScBJDLC9NHTc7+Fh+vXZz8NIJpTcyiOKoLbt9OryPlq7UyI57+i8Vr43V2aoODErJuJPDLs7zk8oyW8xNGQxba6qlFXZx8cd3G6uXEhpw2xsbphAVS0f3yD511NDzmQYD9U3V+KBdBpYubHFEWbdrC2hz2iiB60J1hkzQ7yYIJJ82dUYKgTKCD8kU+mjk6IvKojtWiBMWBf/t1x8+0kxGvNvQMOACHgXmLXxHT9Jnx3X5/B4LiFqWOdTSS0M159rejATdwZ/7AmV9H07Mc0abFUCkQUEN30V6+1LsEGj5d3r/ZOqtn9SU05wTUzGvd/DOnSDs/L+CL3+xHJ7e5GU/GrqBPojOKElaeVNDyJaueG/nbQtNXsjT2pSnt7GVdbLx6HiOeqgiY6Z0ToJnPKQRPxHOv/EHfGu5zRJFLYNhL8fTtVt+OcCy+aEP8UeE+ir8rESIbp+oCtfStF//gxZ8O0WU8UoQoQvMUC5YTLdM6AyRYHbuGCtXXd2QhycvKE/6Rijc45R6W1oDMHyVFYEyPYzj+wAKb/iA0twueuBXfSvCcoQLyZwwqoYoKiG7lCeHyYJ6dAKjEcIRAHvox/mcG8yCTUVz86hWPCkBiN0Ii3c5gDQ2RUHcKacbNIdh5mIDMEODE8yJm5ks2GTCDmgQY0DtAunEDIPWJdf4jBw4eOnAgzH9yIrV3yNJLXYrFQn1jLUO9ufVQby+lgVJ/oHoAzIfqoQYs8PPI5qbMKe/d+7Bf+vb2ls9JyeYe6VulK4SPPgnsfHYy5mSBB3cULtStEgrTlxbv5JBL03/xmNe0ikiRHFhfN+AxQMAvnEKsmtcEhkOR19/irzpHsGztRiwEqCBxN7GPOClOaAbBNlyBhMCtgVN6/GTdpGMkxqr+EMSz63iEbDbPgZ58/vV9IQF0FQK24DwJ4hPEXmJ3IipgPYbNjnC+gnwdgT8Et4CQxDZwnGKGUBR+DxcVCmPMcZjDCIuyqfdUW52ZCgMRNJCgeN49uQp0M1/Ka/LyqnV27uUKYpRqeih9lqdkxEeyfaOndNRbAcbnP2FkS5woEPFrm0GX+x//H/4wX/sw/x/KNqk0NCU0rdJ5kup58LeJeV5AT0oLEoIqkKoJE6qcK4PjC2iQsrxiHV6pVNIZa3xF7ni+y1PcCkUIyGG8plnaxaGlpW4WmhSVS6GJUDfSwiUFm06jsvSNYCLNFERSgSpuRq1uplSJrg42RZWAjems2bR+8WqeaAP8CI7p0Y9Kq4JqVqHxc/Sc2+a30qD780R2MSUaoZScOHJkLgfenzF5enjmDtrz57QdICN8OrDFxGqamg4iZmetsxk52NRUpMFiYjQ7jldWDouGX/gEMKXZejD9AXKwi+5nx7TDA0SFFdMcl4ryYw76E6Bkhazh2pQZQKABz1PsVuzvQe7Rgs3F8TkGTD5tb+5mQmb7E1TCn7ijcvluJFelotNRLn37gFyapfqOfX+BvTh69Hku9CX9GjxXNNxt7KV1Hj+aRFlWO2sZ5bdM5SZhLXRAPdA3sGv/N1PFVecos2zJSR+G+6FD8vQV/ujRn0AfsGl+5ud7e6d0jsbH3RVYM25Yycsc9Me1Z3SCVn5rec+sHUOHlHE1Bdqw6qTPfjfFLz75JV1YbQFXk9Zb4pdz7C7L3MfuIdhq+1xhViQ/ON/DglgqGsyPnFT7XFAlttvRXt/q1Aln/eDwb3NzfwKumfx+/5WZMdPhTsdxltYKesEK3yf/Ja88yhv8iPpbRY6qRrEa1NldoNqHGODfSkPdEX+knUrjHW1U1UmrOjVHvrHif1UDPThjyzrYN0IoHTUEfccovhRhSSuJnbD/D2WJ9P/acBUOICulpJPdkiM6OiDNlaGeFxJUV8jdRBklvxOvS1Ia74ZM8M+ry2pQr8euwWWG/A8qkxfU/1UeS7r0s6kvNv66srGxKS02/p/UVR+OpLTBj2jQHKqNTELiZPuRZOc8RJ+cV1Ry/uvwsGm5uMRJHEWCY93s8hOpJsHXqkjJ3PZfcVKyx0mCZHMKmyJWj6niAoRp4ixs2nIOleajvD2WqM2SaARgvJkLToizlZNiPOSUOKdYPeY6F5DiOWeJi8o5hvSsM6ykuquvAjIMrj859iohwnZld/2F2BIVv5Mu+IdSudm9RUSFUz8hKDIodR/fzYILRSf3Y/FgSEldLrqFt81olj9fIrWsJ9h4nWZXOiqAGBg4VU6vTet4SoTzm6vIyP8CUZOQkrLH46b/QFHxjTvRIkRxsD8F4dqjLpu324vedRAlcI/tCzVxMogC6RZXTgu70BZ4ZqNWoC37FEmOpOUVNuqlaSxJoCfu5fpZM1EkWVE13TAt23F9fk4Qznhc8Lly486DJy/efHzXn0pIxI+/AIGCgnEjObVHTzyQtOSnOOiAsfHSqD8LmgaU648XFU1AtkxyXmHGEleBE86iSqx83nreCSDc9KS+ibWciXjZq+46zZCVlwafsXy6yqHteKKIM3c4Q7mKbF1fSPz4sMifW0pdwf+GavchYkHWLmjZYThb3sPY+nVM2mM5qq1Yggpb/5zAdptYdh2OMnUIpZXgUM8qqPhxVW3zK210nAWSXeM1JuJ0lqF5ac+wh1itbFZc4oRVEYYuknoyVrkgb7xnO81mAAAA')
format('woff2'),
url('iconfont.woff?t=1568428655639') format('woff'),
url('iconfont.ttf?t=1568428655639') format('truetype'),
/* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1568428655639#iconfont') format('svg'); /* iOS 4.1- */
}
.icon {
font-family: 'iconfont' !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-guanyu:before {
content: '\e65d';
}
.icon-author:before {
content: '\e60e';
}
.icon-tab:before {
content: '\e815';
}
.icon-folder:before {
content: '\e69c';
}
.icon-3801wenjian:before {
content: '\e66d';
}
.icon-setting:before {
content: '\e64e';
}
.icon-file:before {
content: '\e857';
}
.icon-gongsi:before {
content: '\e79e';
}
.icon-comment:before {
content: '\e719';
}
.icon-baocuntupian:before {
content: '\e6d1';
}
.icon-book-open:before {
content: '\e72c';
}
.icon-code:before {
content: '\e75c';
}
.icon-copy:before {
content: '\e765';
}
.icon-file-image:before {
content: '\e78c';
}
.icon-filter:before {
content: '\e78f';
}
.icon-git-branch:before {
content: '\e796';
}
.icon-git-pull-request:before {
content: '\e798';
}
.icon-git-repo-forked:before {
content: '\e799';
}
.icon-github:before {
content: '\e79a';
}
.icon-globe:before {
content: '\e79b';
}
.icon-hot:before {
content: '\e7a8';
}
.icon-info:before {
content: '\e7ac';
}
.icon-git-commit:before {
content: '\e7ae';
}
.icon-link-external:before {
content: '\e7bb';
}
.icon-news:before {
content: '\e7db';
}
.icon-search:before {
content: '\e80a';
}
.icon-star:before {
content: '\e820';
}
.icon-book:before {
content: '\e641';
}
.icon-fankui:before {
content: '\e613';
}
.icon-email:before {
content: '\e635';
}
.icon-people:before {
content: '\e62b';
}
.icon-events:before {
content: '\e6f5';
}
.icon-tag:before {
content: '\e6db';
}
.icon-eye:before {
content: '\e7a4';
}
.icon-link:before {
content: '\e817';
}
.icon-location:before {
content: '\e6f4';
}
.icon-activity:before {
content: '\e645';
}
================================================
FILE: src/components/activity-item/index.module.scss
================================================
.item-wrap {
padding: 20px;
margin-top: 20px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.05);
border-radius: 10px;
box-sizing: border-box;
background: $itemBg;
}
.repo-name {
font-weight: 800;
color: $color-brand-light;
}
.event-wrap {
margin-left: 5px;
overflow: hidden;
}
.commit-sha {
color: $color-brand-dark;
}
.event-desc {
margin-top: 10px;
font-size: 25px;
font-weight: 400;
}
.event-action {
text-transform: capitalize;
}
.issue-number {
color: $color-brand-light;
}
================================================
FILE: src/components/activity-item/index.tsx
================================================
import Author from '@/components/author';
import type * as Schemas from '@/src/githubSchemas';
import { Text, View } from '@tarojs/components';
import { ITouchEvent } from '@tarojs/components/types/common';
import Taro from '@tarojs/taro';
import { memo } from 'react';
import styles from './index.module.scss';
const spacesRegExp = new RegExp('[\r\n\t]+', 'g');
const refsHeadsRegExp = new RegExp('refs/heads/');
const maxTextLength = 100;
const truncateText = (text = '') => {
let truncated = text.slice(0, maxTextLength);
if (text.length >= maxTextLength) {
truncated += '...';
}
return truncated;
};
export type ActivityItemDataType = Schemas.Event;
interface ActivityItemProps {
item: ActivityItemDataType;
}
const ActivityItem = ({ item }: ActivityItemProps) => {
if (!item) {
return null;
}
const {
actor: { avatar_url, display_login, login },
repo: { name },
created_at,
} = item;
const handleIssueNumberClick = (full_name, number) => (e: ITouchEvent) => {
e.stopPropagation();
const url = `/pages/issues/issue-detail/index?full_name=${full_name}&number=${number}`;
Taro.navigateTo({ url });
};
const renderEvent = () => {
const {
type,
repo: { name },
payload,
} = item;
switch (type) {
case 'PushEvent': {
const { ref, commits } = payload;
const _ref = ref!.replace(refsHeadsRegExp, '');
const len = commits!.length;
return (
Pushed to {_ref} at{' '}
{name}
{commits!.slice(0, 3).map((item) => {
const { message, sha } = item;
const commit = truncateText(message.replace(spacesRegExp, ''));
const _sha = sha.substr(0, 8);
return (
{_sha}
{commit}
);
})}
{len > 3 && (
...
)}
);
}
case 'IssuesEvent': {
return (
{payload.action}{' '}
issue {name}
{payload.issue!.title}
);
}
case 'PullRequestEvent': {
const { pull_request, action } = payload;
const { title } = pull_request!;
return (
{action} pull request{' '}
{name}
{title}
);
}
case 'IssueCommentEvent': {
const { comment, issue } = payload;
const { body } = comment!;
const detail = body.replace(spacesRegExp, ' ');
const text = truncateText(detail);
const number = issue!.number;
return (
Created comment on{' '}
#{number}
{' '}
in
{name}
{text}
);
}
case 'WatchEvent': {
return (
Starred {name}
);
}
case 'PublicEvent': {
return (
Open sourced {name}
);
}
case 'ForkEvent': {
const { forkee } = payload;
return (
Forked {forkee?.full_name} from{' '}
{name}
);
}
case 'CreateEvent': {
return (
Created {payload.ref_type} {payload.ref || ''} at
{name}
{payload.description || ''}
);
}
case 'DeleteEvent': {
return (
Deleted {payload.ref_type} {payload.ref} at
{name}
{payload.description}
);
}
case 'MemberEvent': {
return (
{payload.action} permissions of {payload.member!.login} to
{payload.repository?.full_name}
);
}
case 'PullRequestReviewCommentEvent': {
const comment = payload.comment;
const body = comment!.body;
const detail = body.replace(spacesRegExp, ' ');
const text = truncateText(detail);
return (
Reviewed pull request in{' '}
{name}
{text}
);
}
case 'GollumEvent': {
const page = payload.pages![0];
const { action, page_name } = page;
return (
{action} {page_name}{' '}
{name}
);
}
case 'ReleaseEvent': {
return (
Released {payload.release!.name || payload.release!.tag_name} at{' '}
{name}
);
}
case 'CommitCommentEvent': {
const comment = payload.comment;
return (
Commented on commit{' '}
{name} @{' '}
{comment!.commit_id.substring(0, 8)}
);
}
}
// const text = JSON.stringify(item);
// return (
//
// {text}
//
// );
return (
{payload?.action} at
{name}
);
};
const handleCardClick = () => {
Taro.navigateTo({ url: `/pages/repos/index?full_name=${name}` });
};
return (
{renderEvent()}
);
};
const areEqual = ({ item: prevItem }: any, { item }: any) => {
return prevItem && prevItem.repo.name === item.repo.name;
};
export default memo(ActivityItem, areEqual);
================================================
FILE: src/components/author/index.module.scss
================================================
.author {
display: flex;
justify-items: center;
width: 100%;
}
.login {
font-size: 32px;
font-weight: 400;
color: #40a0fa;
}
.create-at {
margin-left: auto;
align-self: flex-start;
font-size: 25px;
color: rgb(151, 151, 151);
}
================================================
FILE: src/components/author/index.tsx
================================================
import { getTimeAgo } from '@/utils/date';
import { Text, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { memo } from 'react';
import Avatar from '../avatar';
import styles from './index.module.scss';
interface AuthorProps {
login: string;
url: string;
size?: number | string;
created_at?: string;
}
const Author = ({ login, url, size, created_at = '' }: AuthorProps) => {
const handleLoginClick = () => {
const url = `/pages/developer/index?name=${login}`;
Taro.navigateTo({ url });
};
url = url.endsWith('?') ? `${url}s=96&v=4` : `${url}&s=96`;
return (
{login}
{!!created_at && (
{getTimeAgo(created_at)}
)}
);
};
const areEqual = ({ login: prevLogin }: any, { login }: any) => {
return prevLogin === login;
};
export default memo(Author, areEqual);
================================================
FILE: src/components/avatar/index.module.scss
================================================
.avatar {
width: 80px;
height: 80px;
margin-right: 20px;
border-radius: 50%;
}
================================================
FILE: src/components/avatar/index.tsx
================================================
import { Block, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import classnames from 'classnames';
import { memo } from 'react';
import styles from './index.module.scss';
interface AvatarProps {
url: string;
className?: string;
username?: string;
circle?: boolean;
size?: string | number;
}
const Avatar = ({
url,
className = '',
username = '',
circle = true,
size = 40,
}: AvatarProps) => {
const width = size + 'px';
const styleProps: any = {
width,
height: width,
};
if (!circle) {
styleProps.borderRadius = +size / 4 + 'px';
}
const handleImgClick = () => {
if (!username) {
return;
}
const url = `/pages/developer/index?name=${username}`;
Taro.navigateTo({ url });
};
return (
);
};
const areEqual = (prevProps: any, props: any) => {
return prevProps.url === props.url;
};
export default memo(Avatar, areEqual);
================================================
FILE: src/components/empty/index.module.scss
================================================
.wrap {
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
background: $bg;
}
.inner {
margin: 40px auto;
}
.img {
width: 400px;
height: 400px;
}
.desc {
text-align: center;
font-size: 35px;
color: rgb(88, 88, 88);
}
.tips {
color: $primary;
}
================================================
FILE: src/components/empty/index.tsx
================================================
import img from '@/assets/spidertocat.png';
import { Image, Text, View } from '@tarojs/components';
import { FC } from 'react';
import styles from './index.module.scss';
const Empty: FC = () => {
return (
没有数据~
试试下拉刷新
{/*
{
Taro.startPullDownRefresh();
}}
>
重试
*/}
);
};
export default Empty;
================================================
FILE: src/components/fab-button/index.module.scss
================================================
.fab-btn {
position: fixed;
bottom: 36px;
right: 26px;
z-index: 3;
}
================================================
FILE: src/components/fab-button/index.tsx
================================================
import { View } from '@tarojs/components';
import { ITouchEvent } from '@tarojs/components/types/common';
import { ReactNode } from 'react';
import { AtFab, AtIcon } from 'taro-ui';
import styles from './index.module.scss';
interface FabButtonProps {
icon?: string;
prefixClass?: string;
children?: ReactNode;
size?: 'small' | 'normal';
onClick: (e: ITouchEvent) => void;
}
const FabButton = ({
icon = 'filter',
prefixClass = '',
onClick,
children,
size = 'small',
}: FabButtonProps) => {
const props: any = { value: icon };
if (prefixClass) {
props.prefixClass = prefixClass;
}
return (
{children || }
);
};
export default FabButton;
================================================
FILE: src/components/font-icon/index.module.scss
================================================
================================================
FILE: src/components/font-icon/index.tsx
================================================
import { AtIcon } from 'taro-ui';
interface FontIconProps {
value: string;
size?: string | number;
styleProps?: React.CSSProperties;
}
const FontIcon = ({ value, size = 16, styleProps = {} }: FontIconProps) => {
const fontSize = size + 'px';
const style: React.CSSProperties = {
lineHeight: '1em',
fontSize,
...styleProps,
};
return (
);
};
export default FontIcon;
================================================
FILE: src/components/list-item/index.module.scss
================================================
.item {
display: flex;
align-items: center;
padding: 15px 24px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: $primary-text-color;
font-size: 29px;
font-weight: 500;
line-height: 1.5;
transition: background-color 0.3s;
position: relative;
border-bottom: 0px solid $bg;
&:active {
background-color: #f0f0f0;
}
}
.left {
display: flex;
align-items: center;
}
.right {
margin-left: auto;
@extend .left;
}
.extra-text {
font-size: 28px;
text-align: right;
font-weight: 400;
color: $text-color;
}
================================================
FILE: src/components/list-item/index.tsx
================================================
import FontIcon from '@/components/font-icon';
import { Text, View } from '@tarojs/components';
import { ITouchEvent } from '@tarojs/components/types/common';
import classnames from 'classnames';
import { AtIcon } from 'taro-ui';
import styles from './index.module.scss';
interface ListItemProps {
onClick?: (ev: ITouchEvent) => void;
className?: string;
hasBorder?: boolean;
title?: string;
renderTitle?: () => JSX.Element;
onRightClick?: (ev: ITouchEvent) => void;
extraText?: string;
language?: string;
icon?: string;
rightIcon?: string;
color?: string;
renderExtraText?: () => JSX.Element;
arrow?: 'right' | 'left' | 'up' | 'down' | null;
size?: string | number;
style?: React.CSSProperties;
}
const ListItem = ({
className,
title,
language,
extraText,
icon,
rightIcon,
renderTitle,
renderExtraText,
onClick = function () {},
onRightClick = function () {},
arrow = 'right',
hasBorder = true,
color = 'none',
size = 25,
style = {},
}: ListItemProps) => {
const styleProps: any = {};
if (hasBorder) {
styleProps.borderBottomWidth = '1px';
}
const iconStyleProps: React.CSSProperties = {
fontSize: size + 'px',
padding: '1px',
marginRight: '10px',
borderRadius: '50%',
color: '#fff',
background: color,
...style,
};
return (
{icon && }
{title || (renderTitle && renderTitle())}
{extraText && {extraText}}
{rightIcon && (
)}
{arrow && (
)}
);
};
export default ListItem;
================================================
FILE: src/components/load-more/index.module.scss
================================================
.wrap {
position: relative;
}
================================================
FILE: src/components/load-more/index.tsx
================================================
import { View } from '@tarojs/components';
import { AtLoadMore } from 'taro-ui';
import 'taro-ui/dist/style/components/activity-indicator.scss';
import 'taro-ui/dist/style/components/loading.scss';
import styles from './index.module.scss';
const LoadMore = ({ hasMore }: { hasMore: boolean }) => {
const status = hasMore ? 'loading' : 'noMore';
return (
);
};
export default LoadMore;
================================================
FILE: src/components/markdown/index.module.scss
================================================
================================================
FILE: src/components/markdown/index.tsx
================================================
import { copyText } from '@/utils/common';
import {
getNavPath,
githubHttpsUrl,
isGitHubPage,
mdLink,
parseGitHub,
} from '@/utils/repo';
import { View } from '@tarojs/components';
import { ITouchEvent } from '@tarojs/components/types/common';
import Taro from '@tarojs/taro';
interface MarkDownProps {
md: string | undefined | null;
full_name?: string;
}
const Markdown = ({ md: rawMD, full_name }: MarkDownProps) => {
if (!rawMD) {
return null;
}
const faceLink = (f: string) => {
return (
''
);
};
const getFixedMD = (rawMD = '') => {
let md = rawMD;
const d = {
'’': "'",
'
': '\n\n',
'
': '\n\n',
'
': '\n\n',
'': '',
'': '',
'': '',
'': '',
'': '* ',
'': '\n',
'': '\n',
'': '`',
'': '`',
' ': ' ',
'"': '"',
'“': '"',
'”': '"',
'>': '>',
'<': '<',
};
for (const k in d) {
const reg = new RegExp(k, 'g');
md = md.replace(reg, d[k]);
}
const faceRegExp = [/:([a-z_]{1,30}?):/g, /[+*-] (\[[x ]\])/g];
faceRegExp.map((f) => {
const tmpreg = md;
while ((match = f.exec(tmpreg))) {
if (match[1].startsWith('[')) {
match[0] = match[1];
if (match[1].indexOf('x') > 0) {
match[1] = 'white_check_mark';
} else {
match[1] = 'white_medium_square';
}
}
md = md.replace(match[0], faceLink(match[1]));
}
});
const linkRegExp =
/((^|[ \n:\uff1a\uff0c]+)(https?:\/\/[/0-9a-zA-Z.&=#_?-]+)([ \t\r\n]+|$))/g;
const matchCnt = 3;
let match: any;
const newHtml = md;
while ((match = linkRegExp.exec(newHtml))) {
if (match[1] && match[matchCnt]) {
const t = match[1];
const url = match[matchCnt];
const r = t.replace(url, mdLink(url, url));
md = md.replace(match[1], r);
}
}
return md;
};
const md = getFixedMD(rawMD);
const handleClick = (e: ITouchEvent) => {
let clickurl = e.detail.currentTarget.dataset.text;
console.log('clickurl: ', clickurl);
const isRelativeFile =
clickurl && (clickurl.startsWith('./') || !clickurl.startsWith('http'));
if (isRelativeFile) {
clickurl = `${githubHttpsUrl}/${full_name}/${clickurl}`;
}
const isGitHubUrl = isRelativeFile || isGitHubPage(clickurl);
// TODO 跳转其他小程序
if (isGitHubUrl) {
const [owner, repo, filePath] = parseGitHub(clickurl);
const path = getNavPath({ owner, repo, filePath });
console.log('path: ', path);
if (path) {
Taro.navigateTo({ url: path });
}
return;
} else {
copyText(clickurl);
}
};
const baseUrl = full_name
? 'https://raw.githubusercontent.com/' + full_name + '/master/'
: '';
// TODO 修复 md 中含有 html 情况下的渲染
// TODO 修复表格显示问题
// TODO 添加 currentDir,获取正确的图片引入地址
return (
);
};
export default Markdown;
================================================
FILE: src/components/no-authority/index.module.scss
================================================
.wrap {
display: flex;
height: 100vh;
width: 100vw;
justify-content: center;
text-align: center;
align-items: center;
// background: $itemBg;
}
.inner {
margin: auto;
}
.img {
width: 400px;
height: 400px;
}
.desc {
font-size: 35px;
color: rgb(88, 88, 88);
}
.login {
margin-top: 20px;
}
================================================
FILE: src/components/no-authority/index.tsx
================================================
import img from '@/assets/stormtroopocat.png';
import { Image, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { AtButton } from 'taro-ui';
import styles from './index.module.scss';
const NoAuthority = () => {
return (
需要登录才能查看
{
Taro.navigateTo({ url: `/pages/login/index` });
}}
>
前往登录
);
};
export default NoAuthority;
================================================
FILE: src/components/repo-item/index.module.scss
================================================
.repo-wrap {
display: flex;
margin: 25px 20px;
padding: 20px;
box-sizing: border-box;
font-size: 25px;
border-radius: 10px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.05);
background: $itemBg;
}
.avatar {
width: 80px;
height: 80px;
margin-right: 20px;
border-radius: 50%;
}
.info {
flex: 1;
}
.lang-color {
width: 25px;
height: 25px;
border-radius: 50%;
margin-left: 8px;
}
.top {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.name {
color: #40a0fa;
font-weight: 700;
font-size: 28px;
}
.language {
margin-left: auto;
align-self: flex-start;
}
.desc {
font-size: 23px;
font-weight: 400;
margin: 10px 0 10px 5px;
}
.bottom {
display: flex;
justify-content: flex-start;
font-size: 23px;
font-weight: 300;
}
.meta-item {
flex: 1;
white-space: nowrap;
color: rgb(107, 107, 107);
}
================================================
FILE: src/components/repo-item/index.tsx
================================================
import { SearchReposResponse } from '@/github/githubComponents';
import { Text, View } from '@tarojs/components';
import { ITouchEvent } from '@tarojs/components/types/common';
import Taro from '@tarojs/taro';
import { memo } from 'react';
import { LANGUAGE_COLOR_MAP } from '../../pages/my-languages/languages';
import FontIcon from '../font-icon';
import styles from './index.module.scss';
interface RepoItemProps {
repo: SearchReposResponse['items'][number];
}
const RepoItem = ({ repo }: RepoItemProps) => {
if (!repo) {
return null;
}
const {
id,
node_id,
name,
full_name,
owner,
html_url,
description,
fork,
url,
forks_url,
keys_url,
collaborators_url,
teams_url,
hooks_url,
issue_events_url,
events_url,
assignees_url,
branches_url,
tags_url,
blobs_url,
git_tags_url,
git_refs_url,
trees_url,
statuses_url,
languages_url,
stargazers_url,
contributors_url,
subscribers_url,
subscription_url,
commits_url,
git_commits_url,
comments_url,
issue_comment_url,
contents_url,
compare_url,
merges_url,
archive_url,
downloads_url,
issues_url,
pulls_url,
milestones_url,
notifications_url,
labels_url,
releases_url,
deployments_url,
created_at,
updated_at,
pushed_at,
git_url,
ssh_url,
clone_url,
svn_url,
homepage,
size,
stargazers_count,
watchers_count,
language,
has_issues,
has_projects,
has_downloads,
has_wiki,
has_pages,
forks_count,
mirror_url,
archived,
disabled,
open_issues_count,
license,
forks,
open_issues,
watchers,
default_branch,
permissions,
} = repo;
const { avatar_url, login } = owner || {};
const handleNameClick = (e: ITouchEvent) => {
e.stopPropagation();
const url = `/pages/developer/index?name=${login}`;
Taro.navigateTo({ url });
};
const handleCardClick = () => {
const url = `/pages/repos/index?owner=${login}&repo=${name}`;
Taro.navigateTo({ url });
};
return (
{/* */}
{full_name}
{language || ''}
{description || ''}
{stargazers_count}
{forks_count}
Updated on{' '}
{updated_at.slice(0, 10)}
);
};
const areEqual = ({ repo: prevRepo }: any, { repo }: any) => {
return prevRepo && prevRepo.full_name === repo.full_name;
};
export default memo(RepoItem, areEqual);
================================================
FILE: src/components/skeleton-card/index.module.scss
================================================
.loading {
text-align: center;
margin-top: 250px;
color: $loading-text-color;
font-size: 30px;
}
================================================
FILE: src/components/skeleton-card/index.tsx
================================================
import monaLoadingGif from '@/assets/mona-loading.gif';
import { Block, Image, Text, View } from '@tarojs/components';
import { FC, ReactNode } from 'react';
import Empty from '../empty';
import styles from './index.module.scss';
const SkeletonCard: FC<{
children: ReactNode;
isLoading?: boolean;
isError?: boolean;
}> = ({ children, isLoading, isError }) => {
// TODO skeleton replace loading
return (
{isLoading ? (
努力加载..
) : isError ? (
) : (
children
)}
);
};
export default SkeletonCard;
================================================
FILE: src/components/user-info/index.module.scss
================================================
.wrap {
}
.header {
padding: 20px;
display: flex;
align-items: space-between;
background: $itemBg;
}
.divide {
height: 1px;
width: 100vw;
}
.basic {
display: flex;
flex-wrap: wrap;
margin-right: auto;
font-size: 25px;
}
.name {
width: 100%;
font-size: 32px;
font-weight: 600;
color: $primary;
}
.bio {
width: 100%;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break: break-all;
word-wrap: break-word;
overflow: hidden;
text-overflow: ellipsis;
color: $text-color;
}
.Joined {
width: 100%;
font-size: 25px;
font-weight: 400;
}
.info {
margin-top: 30px;
padding: 20px;
border-radius: 10px;
box-sizing: border-box;
background: $itemBg;
}
.meta {
margin: 0;
}
.nav {
display: flex;
justify-content: space-around;
align-items: center;
}
.nav-item {
flex: 1;
text-align: center;
}
.item-count {
color: rgb(43, 43, 43);
font-weight: 600;
font-size: 35px;
}
.item-label {
font-weight: 400;
font-size: 28px;
text-transform: capitalize;
}
.logout {
padding: 30px;
}
.action-btns {
display: flex;
justify-content: space-around;
padding: 0 30px 20px;
background-color: $itemBg;
}
.btn {
}
================================================
FILE: src/components/user-info/index.tsx
================================================
import {
useActivityCheckRepoIsStarredByAuthenticatedUser,
useActivityStarRepoForAuthenticatedUser,
} from '@/github/githubComponents';
import { copyText } from '@/utils/common';
import { getTimeAgo } from '@/utils/date';
import { Block, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import classnames from 'classnames';
import { AtButton, AtList } from 'taro-ui';
import Avatar from '../avatar';
import Empty from '../empty';
import ListItem from '../list-item';
import styles from './index.module.scss';
const supportStarParams = { owner: 'zenghongtu', repo: 'GitHub-Pro' };
const UserInfo = ({
userInfo,
isFollowing,
onFollowClick,
onLogout,
isCurrent = true,
}: any) => {
if (!userInfo) {
return ;
}
const { data } = useActivityCheckRepoIsStarredByAuthenticatedUser({
pathParams: supportStarParams,
});
const isStarred = !data && data !== null;
const { mutateAsync } = useActivityStarRepoForAuthenticatedUser({});
const handleNavTo = (url: string) => () => {
Taro.navigateTo({ url });
};
const handleCopy = (text: string) => () => {
copyText(text);
};
const handleSupport = () => {
mutateAsync({ pathParams: supportStarParams }).then((res) => {
if (!res && res !== null) {
Taro.showToast({ title: '感谢支持! 🎈', icon: 'none' });
}
});
};
const {
login,
id,
node_id,
avatar_url,
gravatar_id,
url,
html_url,
followers_url,
following_url,
gists_url,
starred_url,
subscriptions_url,
organizations_url,
repos_url,
events_url,
received_events_url,
type,
site_admin,
name,
company = '',
blog = '',
location = '',
email = '',
hireable,
bio = '',
public_repos,
public_gists,
followers = 0,
following = 0,
created_at,
updated_at,
} = userInfo!;
const style: React.CSSProperties = { padding: '6px', fontSize: '16px' };
return (
{name || login} ({login})
{bio}
Joined at {getTimeAgo(created_at)}
{Number(public_repos).toLocaleString()}
repositories
{Number(followers).toLocaleString()}
followers
{Number(following).toLocaleString()}
following
{/*
{public_gists}
Gists
*/}
{!isCurrent && (
{isFollowing ? 'unfollow' : 'follow'}
share
)}
{!isCurrent && (
)}
{isCurrent && (
{!isStarred && (
)}
Logout
)}
);
};
export default UserInfo;
================================================
FILE: src/components/user-item/index.module.scss
================================================
.user {
display: flex;
align-items: center;
margin: 20px;
padding: 8px 0;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.05);
border-radius: 10px;
box-sizing: border-box;
background: $itemBg;
}
================================================
FILE: src/components/user-item/index.tsx
================================================
import { Block, View } from '@tarojs/components';
import Author from '../author';
import Empty from '../empty';
import LoadMore from '../load-more';
import styles from './index.module.scss';
const UserItem = ({ data, hasMore }: any) => {
return (
{data ? (
{data.map((user) => {
const node_id = user.node_id;
const login = user.login;
const avatar_url = user.avatar_url;
return (
);
})}
{data && }
) : (
)}
);
};
export default UserItem;
================================================
FILE: src/constants.ts
================================================
export interface IDefaultParams {
per_page?: number;
page?: number;
}
export const defaultParams: IDefaultParams = {
per_page: 20,
page: 1,
};
export const issueDefaultParams: IDefaultParams = {
// 多了会 GG
per_page: 10,
page: 1,
};
export const defaultSearchParams = {
q: '',
sort: '',
order: '',
per_page: 30,
page: 1,
};
export const REACH_BOTTOM_EVENT = 'reach_bottom_event';
export const PULL_DOWN_REFRESH_EVENT = 'pull_down_refresh_event';
export const THROTTLE_DELAY = 1500;
export const TRENDING_URL = 'https://trending.stayin.cn';
export const CURRENT_LANGUAGE_STORAGE_KEY = 'current-language';
================================================
FILE: src/github/githubComponents.ts
================================================
/**
* Generated by @openapi-codegen
*
* @version 1.1.4
*/
import * as reactQuery from '@tanstack/react-query';
import { GithubContext, useGithubContext } from './githubContext';
import type * as Fetcher from './githubFetcher';
import { githubFetch } from './githubFetcher';
import type * as Responses from './githubResponses';
import type * as Schemas from './githubSchemas';
export type MetaRootError = Fetcher.ErrorWrapper;
export type MetaRootResponse = {
/**
* @format uri
*/
authorizations_url: string;
/**
* @format uri
*/
code_search_url: string;
/**
* @format uri
*/
commit_search_url: string;
/**
* @format uri
*/
current_user_authorizations_html_url: string;
/**
* @format uri
*/
current_user_repositories_url: string;
/**
* @format uri
*/
current_user_url: string;
/**
* @format uri
*/
emails_url: string;
/**
* @format uri
*/
emojis_url: string;
/**
* @format uri
*/
events_url: string;
/**
* @format uri
*/
feeds_url: string;
/**
* @format uri
*/
followers_url: string;
/**
* @format uri
*/
following_url: string;
/**
* @format uri
*/
gists_url: string;
/**
* @format uri
*/
hub_url: string;
/**
* @format uri
*/
issue_search_url: string;
/**
* @format uri
*/
issues_url: string;
/**
* @format uri
*/
keys_url: string;
/**
* @format uri
*/
label_search_url: string;
/**
* @format uri
*/
notifications_url: string;
/**
* @format uri
*/
organization_repositories_url: string;
/**
* @format uri
*/
organization_teams_url: string;
/**
* @format uri
*/
organization_url: string;
/**
* @format uri
*/
public_gists_url: string;
/**
* @format uri
*/
rate_limit_url: string;
/**
* @format uri
*/
repository_search_url: string;
/**
* @format uri
*/
repository_url: string;
/**
* @format uri
*/
starred_gists_url: string;
/**
* @format uri
*/
starred_url: string;
/**
* @format uri
*/
topic_search_url?: string;
/**
* @format uri
*/
user_organizations_url: string;
/**
* @format uri
*/
user_repositories_url: string;
/**
* @format uri
*/
user_search_url: string;
/**
* @format uri
*/
user_url: string;
};
export type MetaRootVariables = GithubContext['fetcherOptions'];
/**
* Get Hypermedia links to resources accessible in GitHub's REST API
*/
export const fetchMetaRoot = (
variables: MetaRootVariables,
signal?: AbortSignal,
) =>
githubFetch({
url: '/',
method: 'get',
...variables,
signal,
});
/**
* Get Hypermedia links to resources accessible in GitHub's REST API
*/
export const useMetaRoot = (
variables: MetaRootVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/', operationId: 'metaRoot', variables }),
({ signal }) => fetchMetaRoot({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsGetAuthenticatedError = Fetcher.ErrorWrapper;
export type AppsGetAuthenticatedVariables = GithubContext['fetcherOptions'];
/**
* Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the `installations_count` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsGetAuthenticated = (
variables: AppsGetAuthenticatedVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Integration,
AppsGetAuthenticatedError,
undefined,
{},
{},
{}
>({ url: '/app', method: 'get', ...variables, signal });
/**
* Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the `installations_count` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsGetAuthenticated = (
variables: AppsGetAuthenticatedVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Integration,
AppsGetAuthenticatedError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Integration,
AppsGetAuthenticatedError,
TData
>(
queryKeyFn({
path: '/app',
operationId: 'appsGetAuthenticated',
variables,
}),
({ signal }) =>
fetchAppsGetAuthenticated({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsCreateFromManifestPathParams = {
code: string;
};
export type AppsCreateFromManifestError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type AppsCreateFromManifestResponse = {
/**
* @example "Iv1.25b5d1e65ffc4022"
*/
client_id: string;
/**
* @example "1d4b2097ac622ba702d19de498f005747a8b21d3"
*/
client_secret: string;
/**
* @example "2017-07-08T20:18:44.000Z"
* @format date-time
*/
created_at: string;
/**
* @example The description of the app.
*/
description: string | null;
/**
* The list of events for the GitHub app
*
* @example label
* @example deployment
*/
events: string[];
/**
* @example https://example.com
* @format uri
*/
external_url: string;
/**
* @example https://github.com/apps/super-ci
* @format uri
*/
html_url: string;
/**
* Unique identifier of the GitHub app
*
* @example 37
*/
id?: number;
/**
* The number of installations associated with the GitHub app
*
* @example 5
*/
installations_count?: number;
/**
* The name of the GitHub app
*
* @example Probot Owners
*/
name?: string;
/**
* @example MDExOkludGVncmF0aW9uMQ==
*/
node_id?: string;
/**
* Simple User
*/
owner?: Schemas.SimpleUser;
/**
* @example "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEArYxrNYD/iT5CZVpRJu4rBKmmze3PVmT/gCo2ATUvDvZTPTey\nxcGJ3vvrJXazKk06pN05TN29o98jrYz4cengG3YGsXPNEpKsIrEl8NhbnxapEnM9\nJCMRe0P5JcPsfZlX6hmiT7136GRWiGOUba2X9+HKh8QJVLG5rM007TBER9/z9mWm\nrJuNh+m5l320oBQY/Qq3A7wzdEfZw8qm/mIN0FCeoXH1L6B8xXWaAYBwhTEh6SSn\nZHlO1Xu1JWDmAvBCi0RO5aRSKM8q9QEkvvHP4yweAtK3N8+aAbZ7ovaDhyGz8r6r\nzhU1b8Uo0Z2ysf503WqzQgIajr7Fry7/kUwpgQIDAQABAoIBADwJp80Ko1xHPZDy\nfcCKBDfIuPvkmSW6KumbsLMaQv1aGdHDwwTGv3t0ixSay8CGlxMRtRDyZPib6SvQ\n6OH/lpfpbMdW2ErkksgtoIKBVrDilfrcAvrNZu7NxRNbhCSvN8q0s4ICecjbbVQh\nnueSdlA6vGXbW58BHMq68uRbHkP+k+mM9U0mDJ1HMch67wlg5GbayVRt63H7R2+r\nVxcna7B80J/lCEjIYZznawgiTvp3MSanTglqAYi+m1EcSsP14bJIB9vgaxS79kTu\noiSo93leJbBvuGo8QEiUqTwMw4tDksmkLsoqNKQ1q9P7LZ9DGcujtPy4EZsamSJT\ny8OJt0ECgYEA2lxOxJsQk2kI325JgKFjo92mQeUObIvPfSNWUIZQDTjniOI6Gv63\nGLWVFrZcvQBWjMEQraJA9xjPbblV8PtfO87MiJGLWCHFxmPz2dzoedN+2Coxom8m\nV95CLz8QUShuao6u/RYcvUaZEoYs5bHcTmy5sBK80JyEmafJPtCQVxMCgYEAy3ar\nZr3yv4xRPEPMat4rseswmuMooSaK3SKub19WFI5IAtB/e7qR1Rj9JhOGcZz+OQrl\nT78O2OFYlgOIkJPvRMrPpK5V9lslc7tz1FSh3BZMRGq5jSyD7ETSOQ0c8T2O/s7v\nbeEPbVbDe4mwvM24XByH0GnWveVxaDl51ABD65sCgYB3ZAspUkOA5egVCh8kNpnd\nSd6SnuQBE3ySRlT2WEnCwP9Ph6oPgn+oAfiPX4xbRqkL8q/k0BdHQ4h+zNwhk7+h\nWtPYRAP1Xxnc/F+jGjb+DVaIaKGU18MWPg7f+FI6nampl3Q0KvfxwX0GdNhtio8T\nTj1E+SnFwh56SRQuxSh2gwKBgHKjlIO5NtNSflsUYFM+hyQiPiqnHzddfhSG+/3o\nm5nNaSmczJesUYreH5San7/YEy2UxAugvP7aSY2MxB+iGsiJ9WD2kZzTUlDZJ7RV\nUzWsoqBR+eZfVJ2FUWWvy8TpSG6trh4dFxImNtKejCR1TREpSiTV3Zb1dmahK9GV\nrK9NAoGAbBxRLoC01xfxCTgt5BDiBcFVh4fp5yYKwavJPLzHSpuDOrrI9jDn1oKN\nonq5sDU1i391zfQvdrbX4Ova48BN+B7p63FocP/MK5tyyBoT8zQEk2+vWDOw7H/Z\nu5dTCPxTIsoIwUw1I+7yIxqJzLPFgR2gVBwY1ra/8iAqCj+zeBw=\n-----END RSA PRIVATE KEY-----\n"
*/
pem: string;
/**
* The set of permissions for the GitHub app
*
* @example {"deployments":"write","issues":"read"}
*/
permissions: {
checks?: string;
contents?: string;
deployments?: string;
issues?: string;
metadata?: string;
} & {
[key: string]: string;
};
/**
* The slug name of the GitHub app
*
* @example probot-owners
*/
slug?: string;
/**
* @example "2017-07-08T20:18:44.000Z"
* @format date-time
*/
updated_at: string;
/**
* @example "6fba8f2fc8a7e8f2cca5577eddd82ca7586b3b6b"
*/
webhook_secret: string;
} & {
[key: string]: any;
};
export type AppsCreateFromManifestVariables = {
pathParams: AppsCreateFromManifestPathParams;
} & GithubContext['fetcherOptions'];
/**
* Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary `code` used to retrieve the GitHub App's `id`, `pem` (private key), and `webhook_secret`.
*/
export const fetchAppsCreateFromManifest = (
variables: AppsCreateFromManifestVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsCreateFromManifestResponse,
AppsCreateFromManifestError,
undefined,
{},
{},
AppsCreateFromManifestPathParams
>({
url: '/app-manifests/{code}/conversions',
method: 'post',
...variables,
signal,
});
/**
* Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary `code` used to retrieve the GitHub App's `id`, `pem` (private key), and `webhook_secret`.
*/
export const useAppsCreateFromManifest = (
options?: Omit<
reactQuery.UseMutationOptions<
AppsCreateFromManifestResponse,
AppsCreateFromManifestError,
AppsCreateFromManifestVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
AppsCreateFromManifestResponse,
AppsCreateFromManifestError,
AppsCreateFromManifestVariables
>(
(variables: AppsCreateFromManifestVariables) =>
fetchAppsCreateFromManifest({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsGetWebhookConfigForAppError = Fetcher.ErrorWrapper;
export type AppsGetWebhookConfigForAppVariables =
GithubContext['fetcherOptions'];
/**
* Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)."
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsGetWebhookConfigForApp = (
variables: AppsGetWebhookConfigForAppVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.WebhookConfig,
AppsGetWebhookConfigForAppError,
undefined,
{},
{},
{}
>({ url: '/app/hook/config', method: 'get', ...variables, signal });
/**
* Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)."
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsGetWebhookConfigForApp = (
variables: AppsGetWebhookConfigForAppVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.WebhookConfig,
AppsGetWebhookConfigForAppError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.WebhookConfig,
AppsGetWebhookConfigForAppError,
TData
>(
queryKeyFn({
path: '/app/hook/config',
operationId: 'appsGetWebhookConfigForApp',
variables,
}),
({ signal }) =>
fetchAppsGetWebhookConfigForApp(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsUpdateWebhookConfigForAppError =
Fetcher.ErrorWrapper;
export type AppsUpdateWebhookConfigForAppRequestBody = {
content_type?: Schemas.WebhookConfigContentType;
insecure_ssl?: Schemas.WebhookConfigInsecureSsl;
secret?: Schemas.WebhookConfigSecret;
url?: Schemas.WebhookConfigUrl;
};
export type AppsUpdateWebhookConfigForAppVariables = {
body?: AppsUpdateWebhookConfigForAppRequestBody;
} & GithubContext['fetcherOptions'];
/**
* Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)."
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsUpdateWebhookConfigForApp = (
variables: AppsUpdateWebhookConfigForAppVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.WebhookConfig,
AppsUpdateWebhookConfigForAppError,
AppsUpdateWebhookConfigForAppRequestBody,
{},
{},
{}
>({ url: '/app/hook/config', method: 'patch', ...variables, signal });
/**
* Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)."
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsUpdateWebhookConfigForApp = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.WebhookConfig,
AppsUpdateWebhookConfigForAppError,
AppsUpdateWebhookConfigForAppVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.WebhookConfig,
AppsUpdateWebhookConfigForAppError,
AppsUpdateWebhookConfigForAppVariables
>(
(variables: AppsUpdateWebhookConfigForAppVariables) =>
fetchAppsUpdateWebhookConfigForApp({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsListInstallationsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
outdated?: string;
};
export type AppsListInstallationsError = Fetcher.ErrorWrapper;
export type AppsListInstallationsResponse = Schemas.Installation[];
export type AppsListInstallationsVariables = {
queryParams?: AppsListInstallationsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*
* The permissions the installation has are included under the `permissions` key.
*/
export const fetchAppsListInstallations = (
variables: AppsListInstallationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListInstallationsResponse,
AppsListInstallationsError,
undefined,
{},
AppsListInstallationsQueryParams,
{}
>({ url: '/app/installations', method: 'get', ...variables, signal });
/**
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*
* The permissions the installation has are included under the `permissions` key.
*/
export const useAppsListInstallations = (
variables: AppsListInstallationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListInstallationsResponse,
AppsListInstallationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsListInstallationsResponse,
AppsListInstallationsError,
TData
>(
queryKeyFn({
path: '/app/installations',
operationId: 'appsListInstallations',
variables,
}),
({ signal }) =>
fetchAppsListInstallations({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsDeleteInstallationPathParams = {
/**
* installation_id parameter
*/
installationId: number;
};
export type AppsDeleteInstallationError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type AppsDeleteInstallationVariables = {
pathParams: AppsDeleteInstallationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/rest/reference/apps/#suspend-an-app-installation)" endpoint.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsDeleteInstallation = (
variables: AppsDeleteInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsDeleteInstallationError,
undefined,
{},
{},
AppsDeleteInstallationPathParams
>({
url: '/app/installations/{installationId}',
method: 'delete',
...variables,
signal,
});
/**
* Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/rest/reference/apps/#suspend-an-app-installation)" endpoint.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsDeleteInstallation = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsDeleteInstallationError,
AppsDeleteInstallationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsDeleteInstallationError,
AppsDeleteInstallationVariables
>(
(variables: AppsDeleteInstallationVariables) =>
fetchAppsDeleteInstallation({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsGetInstallationPathParams = {
/**
* installation_id parameter
*/
installationId: number;
};
export type AppsGetInstallationError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
>;
export type AppsGetInstallationVariables = {
pathParams: AppsGetInstallationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (`target_type`) will be either an organization or a user account, depending which account the repository belongs to.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsGetInstallation = (
variables: AppsGetInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Installation,
AppsGetInstallationError,
undefined,
{},
{},
AppsGetInstallationPathParams
>({
url: '/app/installations/{installationId}',
method: 'get',
...variables,
signal,
});
/**
* Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (`target_type`) will be either an organization or a user account, depending which account the repository belongs to.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsGetInstallation = (
variables: AppsGetInstallationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Installation,
AppsGetInstallationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Installation,
AppsGetInstallationError,
TData
>(
queryKeyFn({
path: '/app/installations/{installation_id}',
operationId: 'appsGetInstallation',
variables,
}),
({ signal }) =>
fetchAppsGetInstallation({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsCreateInstallationAccessTokenPathParams = {
/**
* installation_id parameter
*/
installationId: number;
};
export type AppsCreateInstallationAccessTokenError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type AppsCreateInstallationAccessTokenRequestBody = {
permissions?: Schemas.AppPermissions;
/**
* List of repository names that the token should have access to
*/
repositories?: string[];
/**
* List of repository IDs that the token should have access to
*
* @example 1
*/
repository_ids?: number[];
};
export type AppsCreateInstallationAccessTokenVariables = {
body?: AppsCreateInstallationAccessTokenRequestBody;
pathParams: AppsCreateInstallationAccessTokenPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the `repository_ids` when creating the token. When you omit `repository_ids`, the response does not contain the `repositories` key.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsCreateInstallationAccessToken = (
variables: AppsCreateInstallationAccessTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.InstallationToken,
AppsCreateInstallationAccessTokenError,
AppsCreateInstallationAccessTokenRequestBody,
{},
{},
AppsCreateInstallationAccessTokenPathParams
>({
url: '/app/installations/{installationId}/access_tokens',
method: 'post',
...variables,
signal,
});
/**
* Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the `repository_ids` when creating the token. When you omit `repository_ids`, the response does not contain the `repositories` key.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsCreateInstallationAccessToken = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.InstallationToken,
AppsCreateInstallationAccessTokenError,
AppsCreateInstallationAccessTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.InstallationToken,
AppsCreateInstallationAccessTokenError,
AppsCreateInstallationAccessTokenVariables
>(
(variables: AppsCreateInstallationAccessTokenVariables) =>
fetchAppsCreateInstallationAccessToken({
...fetcherOptions,
...variables,
}),
options,
);
};
export type AppsUnsuspendInstallationPathParams = {
/**
* installation_id parameter
*/
installationId: number;
};
export type AppsUnsuspendInstallationError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type AppsUnsuspendInstallationVariables = {
pathParams: AppsUnsuspendInstallationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes a GitHub App installation suspension.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsUnsuspendInstallation = (
variables: AppsUnsuspendInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsUnsuspendInstallationError,
undefined,
{},
{},
AppsUnsuspendInstallationPathParams
>({
url: '/app/installations/{installationId}/suspended',
method: 'delete',
...variables,
signal,
});
/**
* Removes a GitHub App installation suspension.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsUnsuspendInstallation = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsUnsuspendInstallationError,
AppsUnsuspendInstallationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsUnsuspendInstallationError,
AppsUnsuspendInstallationVariables
>(
(variables: AppsUnsuspendInstallationVariables) =>
fetchAppsUnsuspendInstallation({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsSuspendInstallationPathParams = {
/**
* installation_id parameter
*/
installationId: number;
};
export type AppsSuspendInstallationError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type AppsSuspendInstallationVariables = {
pathParams: AppsSuspendInstallationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsSuspendInstallation = (
variables: AppsSuspendInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsSuspendInstallationError,
undefined,
{},
{},
AppsSuspendInstallationPathParams
>({
url: '/app/installations/{installationId}/suspended',
method: 'put',
...variables,
signal,
});
/**
* Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsSuspendInstallation = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsSuspendInstallationError,
AppsSuspendInstallationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsSuspendInstallationError,
AppsSuspendInstallationVariables
>(
(variables: AppsSuspendInstallationVariables) =>
fetchAppsSuspendInstallation({ ...fetcherOptions, ...variables }),
options,
);
};
export type OauthAuthorizationsListGrantsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* The client ID of your GitHub app.
*/
client_id?: string;
};
export type OauthAuthorizationsListGrantsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type OauthAuthorizationsListGrantsResponse = Schemas.ApplicationGrant[];
export type OauthAuthorizationsListGrantsVariables = {
queryParams?: OauthAuthorizationsListGrantsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `["repo", "user"]`.
*/
export const fetchOauthAuthorizationsListGrants = (
variables: OauthAuthorizationsListGrantsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OauthAuthorizationsListGrantsResponse,
OauthAuthorizationsListGrantsError,
undefined,
{},
OauthAuthorizationsListGrantsQueryParams,
{}
>({ url: '/applications/grants', method: 'get', ...variables, signal });
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `["repo", "user"]`.
*/
export const useOauthAuthorizationsListGrants = <
TData = OauthAuthorizationsListGrantsResponse,
>(
variables: OauthAuthorizationsListGrantsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OauthAuthorizationsListGrantsResponse,
OauthAuthorizationsListGrantsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OauthAuthorizationsListGrantsResponse,
OauthAuthorizationsListGrantsError,
TData
>(
queryKeyFn({
path: '/applications/grants',
operationId: 'oauthAuthorizationsListGrants',
variables,
}),
({ signal }) =>
fetchOauthAuthorizationsListGrants(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OauthAuthorizationsDeleteGrantPathParams = {
/**
* grant_id parameter
*/
grantId: number;
};
export type OauthAuthorizationsDeleteGrantError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type OauthAuthorizationsDeleteGrantVariables = {
pathParams: OauthAuthorizationsDeleteGrantPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized).
*/
export const fetchOauthAuthorizationsDeleteGrant = (
variables: OauthAuthorizationsDeleteGrantVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OauthAuthorizationsDeleteGrantError,
undefined,
{},
{},
OauthAuthorizationsDeleteGrantPathParams
>({
url: '/applications/grants/{grantId}',
method: 'delete',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized).
*/
export const useOauthAuthorizationsDeleteGrant = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OauthAuthorizationsDeleteGrantError,
OauthAuthorizationsDeleteGrantVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OauthAuthorizationsDeleteGrantError,
OauthAuthorizationsDeleteGrantVariables
>(
(variables: OauthAuthorizationsDeleteGrantVariables) =>
fetchOauthAuthorizationsDeleteGrant({ ...fetcherOptions, ...variables }),
options,
);
};
export type OauthAuthorizationsGetGrantPathParams = {
/**
* grant_id parameter
*/
grantId: number;
};
export type OauthAuthorizationsGetGrantError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type OauthAuthorizationsGetGrantVariables = {
pathParams: OauthAuthorizationsGetGrantPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const fetchOauthAuthorizationsGetGrant = (
variables: OauthAuthorizationsGetGrantVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ApplicationGrant,
OauthAuthorizationsGetGrantError,
undefined,
{},
{},
OauthAuthorizationsGetGrantPathParams
>({
url: '/applications/grants/{grantId}',
method: 'get',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const useOauthAuthorizationsGetGrant = <
TData = Schemas.ApplicationGrant,
>(
variables: OauthAuthorizationsGetGrantVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ApplicationGrant,
OauthAuthorizationsGetGrantError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ApplicationGrant,
OauthAuthorizationsGetGrantError,
TData
>(
queryKeyFn({
path: '/applications/grants/{grant_id}',
operationId: 'oauthAuthorizationsGetGrant',
variables,
}),
({ signal }) =>
fetchOauthAuthorizationsGetGrant(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsDeleteAuthorizationPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type AppsDeleteAuthorizationError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type AppsDeleteAuthorizationRequestBody = {
/**
* The OAuth access token used to authenticate to the GitHub API.
*/
access_token?: string;
};
export type AppsDeleteAuthorizationVariables = {
body?: AppsDeleteAuthorizationRequestBody;
pathParams: AppsDeleteAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid OAuth `access_token` as an input parameter and the grant for the token's owner will be deleted.
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized).
*/
export const fetchAppsDeleteAuthorization = (
variables: AppsDeleteAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsDeleteAuthorizationError,
AppsDeleteAuthorizationRequestBody,
{},
{},
AppsDeleteAuthorizationPathParams
>({
url: '/applications/{clientId}/grant',
method: 'delete',
...variables,
signal,
});
/**
* OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid OAuth `access_token` as an input parameter and the grant for the token's owner will be deleted.
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized).
*/
export const useAppsDeleteAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsDeleteAuthorizationError,
AppsDeleteAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsDeleteAuthorizationError,
AppsDeleteAuthorizationVariables
>(
(variables: AppsDeleteAuthorizationVariables) =>
fetchAppsDeleteAuthorization({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsRevokeGrantForApplicationPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
accessToken: string;
};
export type AppsRevokeGrantForApplicationError =
Fetcher.ErrorWrapper;
export type AppsRevokeGrantForApplicationVariables = {
pathParams: AppsRevokeGrantForApplicationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid token as `:access_token` and the grant for the token's owner will be deleted.
*
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized).
*/
export const fetchAppsRevokeGrantForApplication = (
variables: AppsRevokeGrantForApplicationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsRevokeGrantForApplicationError,
undefined,
{},
{},
AppsRevokeGrantForApplicationPathParams
>({
url: '/applications/{clientId}/grants/{accessToken}',
method: 'delete',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid token as `:access_token` and the grant for the token's owner will be deleted.
*
* Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized).
*/
export const useAppsRevokeGrantForApplication = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsRevokeGrantForApplicationError,
AppsRevokeGrantForApplicationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsRevokeGrantForApplicationError,
AppsRevokeGrantForApplicationVariables
>(
(variables: AppsRevokeGrantForApplicationVariables) =>
fetchAppsRevokeGrantForApplication({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsDeleteTokenPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type AppsDeleteTokenError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type AppsDeleteTokenRequestBody = {
/**
* The OAuth access token used to authenticate to the GitHub API.
*/
access_token: string;
};
export type AppsDeleteTokenVariables = {
body: AppsDeleteTokenRequestBody;
pathParams: AppsDeleteTokenPathParams;
} & GithubContext['fetcherOptions'];
/**
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export const fetchAppsDeleteToken = (
variables: AppsDeleteTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsDeleteTokenError,
AppsDeleteTokenRequestBody,
{},
{},
AppsDeleteTokenPathParams
>({
url: '/applications/{clientId}/token',
method: 'delete',
...variables,
signal,
});
/**
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export const useAppsDeleteToken = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsDeleteTokenError,
AppsDeleteTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsDeleteTokenError,
AppsDeleteTokenVariables
>(
(variables: AppsDeleteTokenVariables) =>
fetchAppsDeleteToken({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsResetTokenPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type AppsResetTokenError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type AppsResetTokenRequestBody = {
/**
* The access_token of the OAuth application.
*/
access_token: string;
};
export type AppsResetTokenVariables = {
body: AppsResetTokenRequestBody;
pathParams: AppsResetTokenPathParams;
} & GithubContext['fetcherOptions'];
/**
* OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const fetchAppsResetToken = (
variables: AppsResetTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
AppsResetTokenError,
AppsResetTokenRequestBody,
{},
{},
AppsResetTokenPathParams
>({
url: '/applications/{clientId}/token',
method: 'patch',
...variables,
signal,
});
/**
* OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const useAppsResetToken = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
AppsResetTokenError,
AppsResetTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
AppsResetTokenError,
AppsResetTokenVariables
>(
(variables: AppsResetTokenVariables) =>
fetchAppsResetToken({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsCheckTokenPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type AppsCheckTokenError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type AppsCheckTokenRequestBody = {
/**
* The access_token of the OAuth application.
*/
access_token: string;
};
export type AppsCheckTokenVariables = {
body: AppsCheckTokenRequestBody;
pathParams: AppsCheckTokenPathParams;
} & GithubContext['fetcherOptions'];
/**
* OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application `client_id` and the password is its `client_secret`. Invalid tokens will return `404 NOT FOUND`.
*/
export const fetchAppsCheckToken = (
variables: AppsCheckTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
AppsCheckTokenError,
AppsCheckTokenRequestBody,
{},
{},
AppsCheckTokenPathParams
>({
url: '/applications/{clientId}/token',
method: 'post',
...variables,
signal,
});
/**
* OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application `client_id` and the password is its `client_secret`. Invalid tokens will return `404 NOT FOUND`.
*/
export const useAppsCheckToken = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
AppsCheckTokenError,
AppsCheckTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
AppsCheckTokenError,
AppsCheckTokenVariables
>(
(variables: AppsCheckTokenVariables) =>
fetchAppsCheckToken({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsScopeTokenPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type AppsScopeTokenError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type AppsScopeTokenRequestBody = {
/**
* **Required.** The OAuth access token used to authenticate to the GitHub API.
*
* @example e72e16c7e42f292c6912e7710c838347ae178b4a
*/
access_token: string;
permissions?: Schemas.AppPermissions;
/**
* The list of repository names to scope the user-to-server access token to. `repositories` may not be specified if `repository_ids` is specified.
*/
repositories?: string[];
/**
* The list of repository IDs to scope the user-to-server access token to. `repository_ids` may not be specified if `repositories` is specified.
*
* @example 1
*/
repository_ids?: number[];
/**
* The name of the user or organization to scope the user-to-server access token to. **Required** unless `target_id` is specified.
*
* @example octocat
*/
target?: string;
/**
* The ID of the user or organization to scope the user-to-server access token to. **Required** unless `target` is specified.
*
* @example 1
*/
target_id?: number;
};
export type AppsScopeTokenVariables = {
body: AppsScopeTokenRequestBody;
pathParams: AppsScopeTokenPathParams;
} & GithubContext['fetcherOptions'];
/**
* Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const fetchAppsScopeToken = (
variables: AppsScopeTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
AppsScopeTokenError,
AppsScopeTokenRequestBody,
{},
{},
AppsScopeTokenPathParams
>({
url: '/applications/{clientId}/token/scoped',
method: 'post',
...variables,
signal,
});
/**
* Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const useAppsScopeToken = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
AppsScopeTokenError,
AppsScopeTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
AppsScopeTokenError,
AppsScopeTokenVariables
>(
(variables: AppsScopeTokenVariables) =>
fetchAppsScopeToken({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsRevokeAuthorizationForApplicationPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
accessToken: string;
};
export type AppsRevokeAuthorizationForApplicationError =
Fetcher.ErrorWrapper;
export type AppsRevokeAuthorizationForApplicationVariables = {
pathParams: AppsRevokeAuthorizationForApplicationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export const fetchAppsRevokeAuthorizationForApplication = (
variables: AppsRevokeAuthorizationForApplicationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsRevokeAuthorizationForApplicationError,
undefined,
{},
{},
AppsRevokeAuthorizationForApplicationPathParams
>({
url: '/applications/{clientId}/tokens/{accessToken}',
method: 'delete',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export const useAppsRevokeAuthorizationForApplication = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsRevokeAuthorizationForApplicationError,
AppsRevokeAuthorizationForApplicationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsRevokeAuthorizationForApplicationError,
AppsRevokeAuthorizationForApplicationVariables
>(
(variables: AppsRevokeAuthorizationForApplicationVariables) =>
fetchAppsRevokeAuthorizationForApplication({
...fetcherOptions,
...variables,
}),
options,
);
};
export type AppsCheckAuthorizationPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
accessToken: string;
};
export type AppsCheckAuthorizationError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type AppsCheckAuthorizationResponse = Schemas.Authorization;
export type AppsCheckAuthorizationVariables = {
pathParams: AppsCheckAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const fetchAppsCheckAuthorization = (
variables: AppsCheckAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsCheckAuthorizationResponse,
AppsCheckAuthorizationError,
undefined,
{},
{},
AppsCheckAuthorizationPathParams
>({
url: '/applications/{clientId}/tokens/{accessToken}',
method: 'get',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const useAppsCheckAuthorization = <
TData = AppsCheckAuthorizationResponse,
>(
variables: AppsCheckAuthorizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsCheckAuthorizationResponse,
AppsCheckAuthorizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsCheckAuthorizationResponse,
AppsCheckAuthorizationError,
TData
>(
queryKeyFn({
path: '/applications/{client_id}/tokens/{access_token}',
operationId: 'appsCheckAuthorization',
variables,
}),
({ signal }) =>
fetchAppsCheckAuthorization({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsResetAuthorizationPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
accessToken: string;
};
export type AppsResetAuthorizationError = Fetcher.ErrorWrapper;
export type AppsResetAuthorizationVariables = {
pathParams: AppsResetAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const fetchAppsResetAuthorization = (
variables: AppsResetAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
AppsResetAuthorizationError,
undefined,
{},
{},
AppsResetAuthorizationPathParams
>({
url: '/applications/{clientId}/tokens/{accessToken}',
method: 'post',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/).
*
* OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
*/
export const useAppsResetAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
AppsResetAuthorizationError,
AppsResetAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
AppsResetAuthorizationError,
AppsResetAuthorizationVariables
>(
(variables: AppsResetAuthorizationVariables) =>
fetchAppsResetAuthorization({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsGetBySlugPathParams = {
appSlug: string;
};
export type AppsGetBySlugError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
>;
export type AppsGetBySlugVariables = {
pathParams: AppsGetBySlugPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note**: The `:app_slug` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., `https://github.com/settings/apps/:app_slug`).
*
* If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const fetchAppsGetBySlug = (
variables: AppsGetBySlugVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Integration,
AppsGetBySlugError,
undefined,
{},
{},
AppsGetBySlugPathParams
>({ url: '/apps/{appSlug}', method: 'get', ...variables, signal });
/**
* **Note**: The `:app_slug` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., `https://github.com/settings/apps/:app_slug`).
*
* If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const useAppsGetBySlug = (
variables: AppsGetBySlugVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/apps/{app_slug}',
operationId: 'appsGetBySlug',
variables,
}),
({ signal }) =>
fetchAppsGetBySlug({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OauthAuthorizationsListAuthorizationsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* The client ID of your GitHub app.
*/
client_id?: string;
};
export type OauthAuthorizationsListAuthorizationsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type OauthAuthorizationsListAuthorizationsResponse =
Schemas.Authorization[];
export type OauthAuthorizationsListAuthorizationsVariables = {
queryParams?: OauthAuthorizationsListAuthorizationsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const fetchOauthAuthorizationsListAuthorizations = (
variables: OauthAuthorizationsListAuthorizationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OauthAuthorizationsListAuthorizationsResponse,
OauthAuthorizationsListAuthorizationsError,
undefined,
{},
OauthAuthorizationsListAuthorizationsQueryParams,
{}
>({ url: '/authorizations', method: 'get', ...variables, signal });
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const useOauthAuthorizationsListAuthorizations = <
TData = OauthAuthorizationsListAuthorizationsResponse,
>(
variables: OauthAuthorizationsListAuthorizationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OauthAuthorizationsListAuthorizationsResponse,
OauthAuthorizationsListAuthorizationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OauthAuthorizationsListAuthorizationsResponse,
OauthAuthorizationsListAuthorizationsError,
TData
>(
queryKeyFn({
path: '/authorizations',
operationId: 'oauthAuthorizationsListAuthorizations',
variables,
}),
({ signal }) =>
fetchOauthAuthorizationsListAuthorizations(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OauthAuthorizationsCreateAuthorizationError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 410;
payload: Responses.Gone;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OauthAuthorizationsCreateAuthorizationRequestBody = {
/**
* The OAuth app client key for which to create the token.
*
* @maxLength 20
*/
client_id?: string;
/**
* The OAuth app client secret for which to create the token.
*
* @maxLength 40
*/
client_secret?: string;
/**
* A unique string to distinguish an authorization from others created for the same client ID and user.
*/
fingerprint?: string;
/**
* A note to remind you what the OAuth token is for.
*
* @example Update all gems
*/
note?: string;
/**
* A URL to remind you what app the OAuth token is for.
*/
note_url?: string;
/**
* A list of scopes that this authorization is in.
*
* @example public_repo
* @example user
*/
scopes?: string[] | null;
};
export type OauthAuthorizationsCreateAuthorizationVariables = {
body?: OauthAuthorizationsCreateAuthorizationRequestBody;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use `fingerprint` to differentiate between them.
*
* You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use).
*
* Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on).
*/
export const fetchOauthAuthorizationsCreateAuthorization = (
variables: OauthAuthorizationsCreateAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
OauthAuthorizationsCreateAuthorizationError,
OauthAuthorizationsCreateAuthorizationRequestBody,
{},
{},
{}
>({ url: '/authorizations', method: 'post', ...variables, signal });
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use `fingerprint` to differentiate between them.
*
* You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use).
*
* Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on).
*/
export const useOauthAuthorizationsCreateAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
OauthAuthorizationsCreateAuthorizationError,
OauthAuthorizationsCreateAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
OauthAuthorizationsCreateAuthorizationError,
OauthAuthorizationsCreateAuthorizationVariables
>(
(variables: OauthAuthorizationsCreateAuthorizationVariables) =>
fetchOauthAuthorizationsCreateAuthorization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppPathParams = {
/**
* The client ID of your GitHub app.
*/
clientId: string;
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppError =
Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OauthAuthorizationsGetOrCreateAuthorizationForAppRequestBody = {
/**
* The OAuth app client secret for which to create the token.
*
* @maxLength 40
*/
client_secret: string;
/**
* A unique string to distinguish an authorization from others created for the same client ID and user.
*/
fingerprint?: string;
/**
* A note to remind you what the OAuth token is for.
*
* @example Update all gems
*/
note?: string;
/**
* A URL to remind you what app the OAuth token is for.
*/
note_url?: string;
/**
* A list of scopes that this authorization is in.
*
* @example public_repo
* @example user
*/
scopes?: string[] | null;
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppVariables = {
body: OauthAuthorizationsGetOrCreateAuthorizationForAppRequestBody;
pathParams: OauthAuthorizationsGetOrCreateAuthorizationForAppPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const fetchOauthAuthorizationsGetOrCreateAuthorizationForApp = (
variables: OauthAuthorizationsGetOrCreateAuthorizationForAppVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppError,
OauthAuthorizationsGetOrCreateAuthorizationForAppRequestBody,
{},
{},
OauthAuthorizationsGetOrCreateAuthorizationForAppPathParams
>({
url: '/authorizations/clients/{clientId}',
method: 'put',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const useOauthAuthorizationsGetOrCreateAuthorizationForApp = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppError,
OauthAuthorizationsGetOrCreateAuthorizationForAppVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppError,
OauthAuthorizationsGetOrCreateAuthorizationForAppVariables
>(
(variables: OauthAuthorizationsGetOrCreateAuthorizationForAppVariables) =>
fetchOauthAuthorizationsGetOrCreateAuthorizationForApp({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPathParams =
{
/**
* The client ID of your GitHub app.
*/
clientId: string;
fingerprint: string;
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintError =
Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintRequestBody =
{
/**
* The OAuth app client secret for which to create the token.
*
* @maxLength 40
*/
client_secret: string;
/**
* A note to remind you what the OAuth token is for.
*
* @example Update all gems
*/
note?: string;
/**
* A URL to remind you what app the OAuth token is for.
*/
note_url?: string;
/**
* A list of scopes that this authorization is in.
*
* @example public_repo
* @example user
*/
scopes?: string[] | null;
};
export type OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintVariables =
{
body: OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintRequestBody;
pathParams: OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. `fingerprint` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*/
export const fetchOauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint =
(
variables: OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintError,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintRequestBody,
{},
{},
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPathParams
>({
url: '/authorizations/clients/{clientId}/{fingerprint}',
method: 'put',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api).
*
* This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. `fingerprint` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*/
export const useOauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint =
(
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintError,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintError,
OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintVariables
>(
(
variables: OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintVariables,
) =>
fetchOauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OauthAuthorizationsDeleteAuthorizationPathParams = {
/**
* authorization_id parameter
*/
authorizationId: number;
};
export type OauthAuthorizationsDeleteAuthorizationError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type OauthAuthorizationsDeleteAuthorizationVariables = {
pathParams: OauthAuthorizationsDeleteAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const fetchOauthAuthorizationsDeleteAuthorization = (
variables: OauthAuthorizationsDeleteAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OauthAuthorizationsDeleteAuthorizationError,
undefined,
{},
{},
OauthAuthorizationsDeleteAuthorizationPathParams
>({
url: '/authorizations/{authorizationId}',
method: 'delete',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const useOauthAuthorizationsDeleteAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OauthAuthorizationsDeleteAuthorizationError,
OauthAuthorizationsDeleteAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OauthAuthorizationsDeleteAuthorizationError,
OauthAuthorizationsDeleteAuthorizationVariables
>(
(variables: OauthAuthorizationsDeleteAuthorizationVariables) =>
fetchOauthAuthorizationsDeleteAuthorization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OauthAuthorizationsGetAuthorizationPathParams = {
/**
* authorization_id parameter
*/
authorizationId: number;
};
export type OauthAuthorizationsGetAuthorizationError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type OauthAuthorizationsGetAuthorizationVariables = {
pathParams: OauthAuthorizationsGetAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const fetchOauthAuthorizationsGetAuthorization = (
variables: OauthAuthorizationsGetAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
OauthAuthorizationsGetAuthorizationError,
undefined,
{},
{},
OauthAuthorizationsGetAuthorizationPathParams
>({
url: '/authorizations/{authorizationId}',
method: 'get',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*/
export const useOauthAuthorizationsGetAuthorization = <
TData = Schemas.Authorization,
>(
variables: OauthAuthorizationsGetAuthorizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Authorization,
OauthAuthorizationsGetAuthorizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Authorization,
OauthAuthorizationsGetAuthorizationError,
TData
>(
queryKeyFn({
path: '/authorizations/{authorization_id}',
operationId: 'oauthAuthorizationsGetAuthorization',
variables,
}),
({ signal }) =>
fetchOauthAuthorizationsGetAuthorization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OauthAuthorizationsUpdateAuthorizationPathParams = {
/**
* authorization_id parameter
*/
authorizationId: number;
};
export type OauthAuthorizationsUpdateAuthorizationError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type OauthAuthorizationsUpdateAuthorizationRequestBody = {
/**
* A list of scopes to add to this authorization.
*/
add_scopes?: string[];
/**
* A unique string to distinguish an authorization from others created for the same client ID and user.
*/
fingerprint?: string;
/**
* A note to remind you what the OAuth token is for.
*
* @example Update all gems
*/
note?: string;
/**
* A URL to remind you what app the OAuth token is for.
*/
note_url?: string;
/**
* A list of scopes to remove from this authorization.
*/
remove_scopes?: string[];
/**
* A list of scopes that this authorization is in.
*
* @example public_repo
* @example user
*/
scopes?: string[] | null;
};
export type OauthAuthorizationsUpdateAuthorizationVariables = {
body?: OauthAuthorizationsUpdateAuthorizationRequestBody;
pathParams: OauthAuthorizationsUpdateAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* You can only send one of these scope keys at a time.
*/
export const fetchOauthAuthorizationsUpdateAuthorization = (
variables: OauthAuthorizationsUpdateAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Authorization,
OauthAuthorizationsUpdateAuthorizationError,
OauthAuthorizationsUpdateAuthorizationRequestBody,
{},
{},
OauthAuthorizationsUpdateAuthorizationPathParams
>({
url: '/authorizations/{authorizationId}',
method: 'patch',
...variables,
signal,
});
/**
* **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/).
*
* If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)."
*
* You can only send one of these scope keys at a time.
*/
export const useOauthAuthorizationsUpdateAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Authorization,
OauthAuthorizationsUpdateAuthorizationError,
OauthAuthorizationsUpdateAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Authorization,
OauthAuthorizationsUpdateAuthorizationError,
OauthAuthorizationsUpdateAuthorizationVariables
>(
(variables: OauthAuthorizationsUpdateAuthorizationVariables) =>
fetchOauthAuthorizationsUpdateAuthorization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type CodesOfConductGetAllCodesOfConductError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
>;
export type CodesOfConductGetAllCodesOfConductResponse =
Schemas.CodeOfConduct[];
export type CodesOfConductGetAllCodesOfConductVariables =
GithubContext['fetcherOptions'];
export const fetchCodesOfConductGetAllCodesOfConduct = (
variables: CodesOfConductGetAllCodesOfConductVariables,
signal?: AbortSignal,
) =>
githubFetch<
CodesOfConductGetAllCodesOfConductResponse,
CodesOfConductGetAllCodesOfConductError,
undefined,
{},
{},
{}
>({ url: '/codes_of_conduct', method: 'get', ...variables, signal });
export const useCodesOfConductGetAllCodesOfConduct = <
TData = CodesOfConductGetAllCodesOfConductResponse,
>(
variables: CodesOfConductGetAllCodesOfConductVariables,
options?: Omit<
reactQuery.UseQueryOptions<
CodesOfConductGetAllCodesOfConductResponse,
CodesOfConductGetAllCodesOfConductError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
CodesOfConductGetAllCodesOfConductResponse,
CodesOfConductGetAllCodesOfConductError,
TData
>(
queryKeyFn({
path: '/codes_of_conduct',
operationId: 'codesOfConductGetAllCodesOfConduct',
variables,
}),
({ signal }) =>
fetchCodesOfConductGetAllCodesOfConduct(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type CodesOfConductGetConductCodePathParams = {
key: string;
};
export type CodesOfConductGetConductCodeError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
>;
export type CodesOfConductGetConductCodeVariables = {
pathParams: CodesOfConductGetConductCodePathParams;
} & GithubContext['fetcherOptions'];
export const fetchCodesOfConductGetConductCode = (
variables: CodesOfConductGetConductCodeVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.CodeOfConduct,
CodesOfConductGetConductCodeError,
undefined,
{},
{},
CodesOfConductGetConductCodePathParams
>({ url: '/codes_of_conduct/{key}', method: 'get', ...variables, signal });
export const useCodesOfConductGetConductCode = (
variables: CodesOfConductGetConductCodeVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.CodeOfConduct,
CodesOfConductGetConductCodeError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.CodeOfConduct,
CodesOfConductGetConductCodeError,
TData
>(
queryKeyFn({
path: '/codes_of_conduct/{key}',
operationId: 'codesOfConductGetConductCode',
variables,
}),
({ signal }) =>
fetchCodesOfConductGetConductCode(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsCreateContentAttachmentPathParams = {
contentReferenceId: number;
};
export type AppsCreateContentAttachmentError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 410;
payload: Responses.Gone;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type AppsCreateContentAttachmentRequestBody = {
/**
* The body of the attachment
*
* @example Body of the attachment
* @maxLength 262144
*/
body: string;
/**
* The title of the attachment
*
* @example Title of the attachment
* @maxLength 1024
*/
title: string;
};
export type AppsCreateContentAttachmentVariables = {
body: AppsCreateContentAttachmentRequestBody;
pathParams: AppsCreateContentAttachmentPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the `id` of the content reference from the [`content_reference` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment.
*
* The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const fetchAppsCreateContentAttachment = (
variables: AppsCreateContentAttachmentVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ContentReferenceAttachment,
AppsCreateContentAttachmentError,
AppsCreateContentAttachmentRequestBody,
{},
{},
AppsCreateContentAttachmentPathParams
>({
url: '/content_references/{contentReferenceId}/attachments',
method: 'post',
...variables,
signal,
});
/**
* Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the `id` of the content reference from the [`content_reference` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment.
*
* The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const useAppsCreateContentAttachment = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ContentReferenceAttachment,
AppsCreateContentAttachmentError,
AppsCreateContentAttachmentVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ContentReferenceAttachment,
AppsCreateContentAttachmentError,
AppsCreateContentAttachmentVariables
>(
(variables: AppsCreateContentAttachmentVariables) =>
fetchAppsCreateContentAttachment({ ...fetcherOptions, ...variables }),
options,
);
};
export type EmojisGetError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type EmojisGetResponse = {
[key: string]: string;
};
export type EmojisGetVariables = GithubContext['fetcherOptions'];
/**
* Lists all the emojis available to use on GitHub.
*/
export const fetchEmojisGet = (
variables: EmojisGetVariables,
signal?: AbortSignal,
) =>
githubFetch({
url: '/emojis',
method: 'get',
...variables,
signal,
});
/**
* Lists all the emojis available to use on GitHub.
*/
export const useEmojisGet = (
variables: EmojisGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/emojis', operationId: 'emojisGet', variables }),
({ signal }) => fetchEmojisGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminGetGithubActionsPermissionsEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminGetGithubActionsPermissionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminGetGithubActionsPermissionsEnterpriseVariables = {
pathParams: EnterpriseAdminGetGithubActionsPermissionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminGetGithubActionsPermissionsEnterprise = (
variables: EnterpriseAdminGetGithubActionsPermissionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ActionsEnterprisePermissions,
EnterpriseAdminGetGithubActionsPermissionsEnterpriseError,
undefined,
{},
{},
EnterpriseAdminGetGithubActionsPermissionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions',
method: 'get',
...variables,
signal,
});
/**
* Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminGetGithubActionsPermissionsEnterprise = <
TData = Schemas.ActionsEnterprisePermissions,
>(
variables: EnterpriseAdminGetGithubActionsPermissionsEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ActionsEnterprisePermissions,
EnterpriseAdminGetGithubActionsPermissionsEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ActionsEnterprisePermissions,
EnterpriseAdminGetGithubActionsPermissionsEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/permissions',
operationId: 'enterpriseAdminGetGithubActionsPermissionsEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminGetGithubActionsPermissionsEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminSetGithubActionsPermissionsEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminSetGithubActionsPermissionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminSetGithubActionsPermissionsEnterpriseRequestBody = {
allowed_actions?: Schemas.AllowedActions;
enabled_organizations: Schemas.EnabledOrganizations;
};
export type EnterpriseAdminSetGithubActionsPermissionsEnterpriseVariables = {
body: EnterpriseAdminSetGithubActionsPermissionsEnterpriseRequestBody;
pathParams: EnterpriseAdminSetGithubActionsPermissionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminSetGithubActionsPermissionsEnterprise = (
variables: EnterpriseAdminSetGithubActionsPermissionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseError,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseRequestBody,
{},
{},
EnterpriseAdminSetGithubActionsPermissionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions',
method: 'put',
...variables,
signal,
});
/**
* Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminSetGithubActionsPermissionsEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseError,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseError,
EnterpriseAdminSetGithubActionsPermissionsEnterpriseVariables
>(
(
variables: EnterpriseAdminSetGithubActionsPermissionsEnterpriseVariables,
) =>
fetchEnterpriseAdminSetGithubActionsPermissionsEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseQueryParams =
{
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseResponse =
{
organizations: Schemas.OrganizationSimple[];
total_count: number;
};
export type EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseVariables =
{
pathParams: EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprisePathParams;
queryParams?: EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise =
(
variables: EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseResponse,
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseError,
undefined,
{},
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseQueryParams,
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/organizations',
method: 'get',
...variables,
signal,
});
/**
* Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise =
<
TData = EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseResponse,
>(
variables: EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseResponse,
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseResponse,
EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/permissions/organizations',
operationId:
'enterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseRequestBody =
{
/**
* List of organization IDs to enable for GitHub Actions.
*/
selected_organization_ids: number[];
};
export type EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseVariables =
{
body: EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseRequestBody;
pathParams: EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise =
(
variables: EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseError,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseRequestBody,
{},
{},
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/organizations',
method: 'put',
...variables,
signal,
});
/**
* Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseError,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseError,
EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseVariables
>(
(
variables: EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseVariables,
) =>
fetchEnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise(
{ ...fetcherOptions, ...variables },
),
options,
);
};
export type EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of an organization.
*/
orgId: number;
};
export type EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseVariables =
{
pathParams: EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise =
(
variables: EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseError,
undefined,
{},
{},
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/organizations/{orgId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseError,
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseError,
EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseVariables
>(
(
variables: EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseVariables,
) =>
fetchEnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of an organization.
*/
orgId: number;
};
export type EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseVariables =
{
pathParams: EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise =
(
variables: EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseError,
undefined,
{},
{},
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/organizations/{orgId}',
method: 'put',
...variables,
signal,
});
/**
* Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseError,
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseError,
EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseVariables
>(
(
variables: EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseVariables,
) =>
fetchEnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminGetAllowedActionsEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminGetAllowedActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminGetAllowedActionsEnterpriseVariables = {
pathParams: EnterpriseAdminGetAllowedActionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminGetAllowedActionsEnterprise = (
variables: EnterpriseAdminGetAllowedActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.SelectedActions,
EnterpriseAdminGetAllowedActionsEnterpriseError,
undefined,
{},
{},
EnterpriseAdminGetAllowedActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/selected-actions',
method: 'get',
...variables,
signal,
});
/**
* Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminGetAllowedActionsEnterprise = <
TData = Schemas.SelectedActions,
>(
variables: EnterpriseAdminGetAllowedActionsEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.SelectedActions,
EnterpriseAdminGetAllowedActionsEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.SelectedActions,
EnterpriseAdminGetAllowedActionsEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/permissions/selected-actions',
operationId: 'enterpriseAdminGetAllowedActionsEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminGetAllowedActionsEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminSetAllowedActionsEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminSetAllowedActionsEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminSetAllowedActionsEnterpriseVariables = {
body: Schemas.SelectedActions;
pathParams: EnterpriseAdminSetAllowedActionsEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminSetAllowedActionsEnterprise = (
variables: EnterpriseAdminSetAllowedActionsEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminSetAllowedActionsEnterpriseError,
Schemas.SelectedActions,
{},
{},
EnterpriseAdminSetAllowedActionsEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/permissions/selected-actions',
method: 'put',
...variables,
signal,
});
/**
* Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminSetAllowedActionsEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminSetAllowedActionsEnterpriseError,
EnterpriseAdminSetAllowedActionsEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminSetAllowedActionsEnterpriseError,
EnterpriseAdminSetAllowedActionsEnterpriseVariables
>(
(variables: EnterpriseAdminSetAllowedActionsEnterpriseVariables) =>
fetchEnterpriseAdminSetAllowedActionsEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminListSelfHostedRunnerGroupsForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseQueryParams =
{
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseResponse = {
runner_groups: Schemas.RunnerGroupsEnterprise[];
total_count: number;
};
export type EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseVariables = {
pathParams: EnterpriseAdminListSelfHostedRunnerGroupsForEnterprisePathParams;
queryParams?: EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all self-hosted runner groups for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListSelfHostedRunnerGroupsForEnterprise = (
variables: EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseError,
undefined,
{},
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseQueryParams,
EnterpriseAdminListSelfHostedRunnerGroupsForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups',
method: 'get',
...variables,
signal,
});
/**
* Lists all self-hosted runner groups for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListSelfHostedRunnerGroupsForEnterprise = <
TData = EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseResponse,
>(
variables: EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runner-groups',
operationId: 'enterpriseAdminListSelfHostedRunnerGroupsForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListSelfHostedRunnerGroupsForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseRequestBody =
{
/**
* Name of the runner group.
*/
name: string;
/**
* List of runner IDs to add to the runner group.
*/
runners?: number[];
/**
* List of organization IDs that can access the runner group.
*/
selected_organization_ids?: number[];
/**
* Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: `all` or `selected`
*/
visibility?: 'selected' | 'all';
};
export type EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVariables = {
body: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseRequestBody;
pathParams: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates a new self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise = (
variables: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseRequestBody,
{},
{},
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups',
method: 'post',
...variables,
signal,
});
/**
* Creates a new self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVariables
>(
(
variables: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVariables,
) =>
fetchEnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseVariables =
{
pathParams: EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise = (
variables: EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseError,
undefined,
{},
{},
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}',
method: 'delete',
...variables,
signal,
});
/**
* Deletes a self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseError,
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseError,
EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseVariables
>(
(
variables: EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseVariables,
) =>
fetchEnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminGetSelfHostedRunnerGroupForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseVariables = {
pathParams: EnterpriseAdminGetSelfHostedRunnerGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a specific self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminGetSelfHostedRunnerGroupForEnterprise = (
variables: EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminGetSelfHostedRunnerGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}',
method: 'get',
...variables,
signal,
});
/**
* Gets a specific self-hosted runner group for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminGetSelfHostedRunnerGroupForEnterprise = <
TData = Schemas.RunnerGroupsEnterprise,
>(
variables: EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}',
operationId: 'enterpriseAdminGetSelfHostedRunnerGroupForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminGetSelfHostedRunnerGroupForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseRequestBody =
{
/**
* Name of the runner group.
*/
name?: string;
/**
* Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: `all` or `selected`
*
* @default all
*/
visibility?: 'selected' | 'all';
};
export type EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVariables = {
body?: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseRequestBody;
pathParams: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Updates the `name` and `visibility` of a self-hosted runner group in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise = (
variables: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseRequestBody,
{},
{},
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}',
method: 'patch',
...variables,
signal,
});
/**
* Updates the `name` and `visibility` of a self-hosted runner group in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.RunnerGroupsEnterprise,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseError,
EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVariables
>(
(
variables: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVariables,
) =>
fetchEnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseQueryParams =
{
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseResponse =
{
organizations: Schemas.OrganizationSimple[];
total_count: number;
};
export type EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables =
{
pathParams: EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams;
queryParams?: EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the organizations with access to a self-hosted runner group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
variables: EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseResponse,
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
undefined,
{},
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseQueryParams,
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/organizations',
method: 'get',
...variables,
signal,
});
/**
* Lists the organizations with access to a self-hosted runner group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise =
<
TData = EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseResponse,
>(
variables: EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseResponse,
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseResponse,
EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations',
operationId:
'enterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseRequestBody =
{
/**
* List of organization IDs that can access the runner group.
*/
selected_organization_ids: number[];
};
export type EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables =
{
body: EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseRequestBody;
pathParams: EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Replaces the list of organizations that have access to a self-hosted runner configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
variables: EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseRequestBody,
{},
{},
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/organizations',
method: 'put',
...variables,
signal,
});
/**
* Replaces the list of organizations that have access to a self-hosted runner configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>(
(
variables: EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
) =>
fetchEnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of an organization.
*/
orgId: number;
};
export type EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables =
{
pathParams: EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
variables: EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
undefined,
{},
{},
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/organizations/{orgId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>(
(
variables: EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
) =>
fetchEnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of an organization.
*/
orgId: number;
};
export type EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables =
{
pathParams: EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
variables: EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
undefined,
{},
{},
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/organizations/{orgId}',
method: 'put',
...variables,
signal,
});
/**
* Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)."
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseError,
EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables
>(
(
variables: EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseVariables,
) =>
fetchEnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminListSelfHostedRunnersInGroupForEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseQueryParams =
{
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseResponse = {
runners: Schemas.Runner[];
total_count: number;
};
export type EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseVariables =
{
pathParams: EnterpriseAdminListSelfHostedRunnersInGroupForEnterprisePathParams;
queryParams?: EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the self-hosted runners that are in a specific enterprise group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListSelfHostedRunnersInGroupForEnterprise = (
variables: EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseError,
undefined,
{},
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseQueryParams,
EnterpriseAdminListSelfHostedRunnersInGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/runners',
method: 'get',
...variables,
signal,
});
/**
* Lists the self-hosted runners that are in a specific enterprise group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListSelfHostedRunnersInGroupForEnterprise = <
TData = EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseResponse,
>(
variables: EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners',
operationId: 'enterpriseAdminListSelfHostedRunnersInGroupForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListSelfHostedRunnersInGroupForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseRequestBody =
{
/**
* List of runner IDs to add to the runner group.
*/
runners: number[];
};
export type EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseVariables = {
body: EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseRequestBody;
pathParams: EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Replaces the list of self-hosted runners that are part of an enterprise runner group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise = (
variables: EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseError,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseRequestBody,
{},
{},
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/runners',
method: 'put',
...variables,
signal,
});
/**
* Replaces the list of self-hosted runners that are part of an enterprise runner group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseError,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseError,
EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseVariables
>(
(
variables: EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseVariables,
) =>
fetchEnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprisePathParams =
{
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseVariables =
{
pathParams: EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise =
(
variables: EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/runners/{runnerId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseError,
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseError,
EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseVariables
>(
(
variables: EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseVariables,
) =>
fetchEnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseVariables = {
pathParams: EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds a self-hosted runner to a runner group configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise`
* scope to use this endpoint.
*/
export const fetchEnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise = (
variables: EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runner-groups/{runnerGroupId}/runners/{runnerId}',
method: 'put',
...variables,
signal,
});
/**
* Adds a self-hosted runner to a runner group configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise`
* scope to use this endpoint.
*/
export const useEnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseError,
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseError,
EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseVariables
>(
(
variables: EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseVariables,
) =>
fetchEnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminListSelfHostedRunnersForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminListSelfHostedRunnersForEnterpriseQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type EnterpriseAdminListSelfHostedRunnersForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListSelfHostedRunnersForEnterpriseResponse = {
runners?: Schemas.Runner[];
total_count?: number;
};
export type EnterpriseAdminListSelfHostedRunnersForEnterpriseVariables = {
pathParams: EnterpriseAdminListSelfHostedRunnersForEnterprisePathParams;
queryParams?: EnterpriseAdminListSelfHostedRunnersForEnterpriseQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all self-hosted runners configured for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListSelfHostedRunnersForEnterprise = (
variables: EnterpriseAdminListSelfHostedRunnersForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListSelfHostedRunnersForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersForEnterpriseError,
undefined,
{},
EnterpriseAdminListSelfHostedRunnersForEnterpriseQueryParams,
EnterpriseAdminListSelfHostedRunnersForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners',
method: 'get',
...variables,
signal,
});
/**
* Lists all self-hosted runners configured for an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListSelfHostedRunnersForEnterprise = <
TData = EnterpriseAdminListSelfHostedRunnersForEnterpriseResponse,
>(
variables: EnterpriseAdminListSelfHostedRunnersForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListSelfHostedRunnersForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListSelfHostedRunnersForEnterpriseResponse,
EnterpriseAdminListSelfHostedRunnersForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runners',
operationId: 'enterpriseAdminListSelfHostedRunnersForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListSelfHostedRunnersForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminListRunnerApplicationsForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminListRunnerApplicationsForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminListRunnerApplicationsForEnterpriseResponse =
Schemas.RunnerApplication[];
export type EnterpriseAdminListRunnerApplicationsForEnterpriseVariables = {
pathParams: EnterpriseAdminListRunnerApplicationsForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Lists binaries for the runner application that you can download and run.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminListRunnerApplicationsForEnterprise = (
variables: EnterpriseAdminListRunnerApplicationsForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
EnterpriseAdminListRunnerApplicationsForEnterpriseResponse,
EnterpriseAdminListRunnerApplicationsForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminListRunnerApplicationsForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners/downloads',
method: 'get',
...variables,
signal,
});
/**
* Lists binaries for the runner application that you can download and run.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminListRunnerApplicationsForEnterprise = <
TData = EnterpriseAdminListRunnerApplicationsForEnterpriseResponse,
>(
variables: EnterpriseAdminListRunnerApplicationsForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
EnterpriseAdminListRunnerApplicationsForEnterpriseResponse,
EnterpriseAdminListRunnerApplicationsForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
EnterpriseAdminListRunnerApplicationsForEnterpriseResponse,
EnterpriseAdminListRunnerApplicationsForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runners/downloads',
operationId: 'enterpriseAdminListRunnerApplicationsForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminListRunnerApplicationsForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type EnterpriseAdminCreateRegistrationTokenForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminCreateRegistrationTokenForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminCreateRegistrationTokenForEnterpriseVariables = {
pathParams: EnterpriseAdminCreateRegistrationTokenForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns a token that you can pass to the `config` script. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*
* #### Example using registration token
*
* Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
*
* ```
* ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN
* ```
*/
export const fetchEnterpriseAdminCreateRegistrationTokenForEnterprise = (
variables: EnterpriseAdminCreateRegistrationTokenForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRegistrationTokenForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminCreateRegistrationTokenForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners/registration-token',
method: 'post',
...variables,
signal,
});
/**
* Returns a token that you can pass to the `config` script. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*
* #### Example using registration token
*
* Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
*
* ```
* ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN
* ```
*/
export const useEnterpriseAdminCreateRegistrationTokenForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRegistrationTokenForEnterpriseError,
EnterpriseAdminCreateRegistrationTokenForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRegistrationTokenForEnterpriseError,
EnterpriseAdminCreateRegistrationTokenForEnterpriseVariables
>(
(variables: EnterpriseAdminCreateRegistrationTokenForEnterpriseVariables) =>
fetchEnterpriseAdminCreateRegistrationTokenForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminCreateRemoveTokenForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type EnterpriseAdminCreateRemoveTokenForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminCreateRemoveTokenForEnterpriseVariables = {
pathParams: EnterpriseAdminCreateRemoveTokenForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns a token that you can pass to the `config` script to remove a self-hosted runner from an enterprise. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*
* #### Example using remove token
*
* To remove your self-hosted runner from an enterprise, replace `TOKEN` with the remove token provided by this
* endpoint.
*
* ```
* ./config.sh remove --token TOKEN
* ```
*/
export const fetchEnterpriseAdminCreateRemoveTokenForEnterprise = (
variables: EnterpriseAdminCreateRemoveTokenForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRemoveTokenForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminCreateRemoveTokenForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners/remove-token',
method: 'post',
...variables,
signal,
});
/**
* Returns a token that you can pass to the `config` script to remove a self-hosted runner from an enterprise. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*
* #### Example using remove token
*
* To remove your self-hosted runner from an enterprise, replace `TOKEN` with the remove token provided by this
* endpoint.
*
* ```
* ./config.sh remove --token TOKEN
* ```
*/
export const useEnterpriseAdminCreateRemoveTokenForEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRemoveTokenForEnterpriseError,
EnterpriseAdminCreateRemoveTokenForEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.AuthenticationToken,
EnterpriseAdminCreateRemoveTokenForEnterpriseError,
EnterpriseAdminCreateRemoveTokenForEnterpriseVariables
>(
(variables: EnterpriseAdminCreateRemoveTokenForEnterpriseVariables) =>
fetchEnterpriseAdminCreateRemoveTokenForEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminDeleteSelfHostedRunnerFromEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseVariables = {
pathParams: EnterpriseAdminDeleteSelfHostedRunnerFromEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminDeleteSelfHostedRunnerFromEnterprise = (
variables: EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseError,
undefined,
{},
{},
EnterpriseAdminDeleteSelfHostedRunnerFromEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners/{runnerId}',
method: 'delete',
...variables,
signal,
});
/**
* Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminDeleteSelfHostedRunnerFromEnterprise = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseError,
EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseError,
EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseVariables
>(
(variables: EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseVariables) =>
fetchEnterpriseAdminDeleteSelfHostedRunnerFromEnterprise({
...fetcherOptions,
...variables,
}),
options,
);
};
export type EnterpriseAdminGetSelfHostedRunnerForEnterprisePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type EnterpriseAdminGetSelfHostedRunnerForEnterpriseError =
Fetcher.ErrorWrapper;
export type EnterpriseAdminGetSelfHostedRunnerForEnterpriseVariables = {
pathParams: EnterpriseAdminGetSelfHostedRunnerForEnterprisePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a specific self-hosted runner configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const fetchEnterpriseAdminGetSelfHostedRunnerForEnterprise = (
variables: EnterpriseAdminGetSelfHostedRunnerForEnterpriseVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Runner,
EnterpriseAdminGetSelfHostedRunnerForEnterpriseError,
undefined,
{},
{},
EnterpriseAdminGetSelfHostedRunnerForEnterprisePathParams
>({
url: '/enterprises/{enterprise}/actions/runners/{runnerId}',
method: 'get',
...variables,
signal,
});
/**
* Gets a specific self-hosted runner configured in an enterprise.
*
* You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint.
*/
export const useEnterpriseAdminGetSelfHostedRunnerForEnterprise = <
TData = Schemas.Runner,
>(
variables: EnterpriseAdminGetSelfHostedRunnerForEnterpriseVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Runner,
EnterpriseAdminGetSelfHostedRunnerForEnterpriseError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Runner,
EnterpriseAdminGetSelfHostedRunnerForEnterpriseError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/actions/runners/{runner_id}',
operationId: 'enterpriseAdminGetSelfHostedRunnerForEnterprise',
variables,
}),
({ signal }) =>
fetchEnterpriseAdminGetSelfHostedRunnerForEnterprise(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AuditLogGetAuditLogPathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type AuditLogGetAuditLogQueryParams = {
/**
* A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log).
*/
phrase?: string;
/**
* The event types to include:
*
* - `web` - returns web (non-Git) events
* - `git` - returns Git events
* - `all` - returns both web and Git events
*
* The default is `web`.
*/
include?: 'web' | 'git' | 'all';
/**
* A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor.
*/
after?: string;
/**
* A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor.
*/
before?: string;
/**
* The order of audit log events. To list newest events first, specify `desc`. To list oldest events first, specify `asc`.
*
* The default is `desc`.
*/
order?: 'desc' | 'asc';
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
};
export type AuditLogGetAuditLogError = Fetcher.ErrorWrapper;
export type AuditLogGetAuditLogResponse = Schemas.AuditLogEvent[];
export type AuditLogGetAuditLogVariables = {
pathParams: AuditLogGetAuditLogPathParams;
queryParams?: AuditLogGetAuditLogQueryParams;
} & GithubContext['fetcherOptions'];
/**
* **Note:** The audit log REST API is currently in beta and is subject to change.
*
* Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the `admin:enterprise` scope.
*/
export const fetchAuditLogGetAuditLog = (
variables: AuditLogGetAuditLogVariables,
signal?: AbortSignal,
) =>
githubFetch<
AuditLogGetAuditLogResponse,
AuditLogGetAuditLogError,
undefined,
{},
AuditLogGetAuditLogQueryParams,
AuditLogGetAuditLogPathParams
>({
url: '/enterprises/{enterprise}/audit-log',
method: 'get',
...variables,
signal,
});
/**
* **Note:** The audit log REST API is currently in beta and is subject to change.
*
* Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the `admin:enterprise` scope.
*/
export const useAuditLogGetAuditLog = (
variables: AuditLogGetAuditLogVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AuditLogGetAuditLogResponse,
AuditLogGetAuditLogError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AuditLogGetAuditLogResponse,
AuditLogGetAuditLogError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/audit-log',
operationId: 'auditLogGetAuditLog',
variables,
}),
({ signal }) =>
fetchAuditLogGetAuditLog({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type BillingGetGithubActionsBillingGhePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type BillingGetGithubActionsBillingGheError =
Fetcher.ErrorWrapper;
export type BillingGetGithubActionsBillingGheVariables = {
pathParams: BillingGetGithubActionsBillingGhePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the summary of the free and paid GitHub Actions minutes used.
*
* Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
*
* The authenticated user must be an enterprise admin.
*/
export const fetchBillingGetGithubActionsBillingGhe = (
variables: BillingGetGithubActionsBillingGheVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingGheError,
undefined,
{},
{},
BillingGetGithubActionsBillingGhePathParams
>({
url: '/enterprises/{enterprise}/settings/billing/actions',
method: 'get',
...variables,
signal,
});
/**
* Gets the summary of the free and paid GitHub Actions minutes used.
*
* Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
*
* The authenticated user must be an enterprise admin.
*/
export const useBillingGetGithubActionsBillingGhe = <
TData = Schemas.ActionsBillingUsage,
>(
variables: BillingGetGithubActionsBillingGheVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingGheError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingGheError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/settings/billing/actions',
operationId: 'billingGetGithubActionsBillingGhe',
variables,
}),
({ signal }) =>
fetchBillingGetGithubActionsBillingGhe(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type BillingGetGithubPackagesBillingGhePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type BillingGetGithubPackagesBillingGheError =
Fetcher.ErrorWrapper;
export type BillingGetGithubPackagesBillingGheVariables = {
pathParams: BillingGetGithubPackagesBillingGhePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the free and paid storage used for GitHub Packages in gigabytes.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* The authenticated user must be an enterprise admin.
*/
export const fetchBillingGetGithubPackagesBillingGhe = (
variables: BillingGetGithubPackagesBillingGheVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingGheError,
undefined,
{},
{},
BillingGetGithubPackagesBillingGhePathParams
>({
url: '/enterprises/{enterprise}/settings/billing/packages',
method: 'get',
...variables,
signal,
});
/**
* Gets the free and paid storage used for GitHub Packages in gigabytes.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* The authenticated user must be an enterprise admin.
*/
export const useBillingGetGithubPackagesBillingGhe = <
TData = Schemas.PackagesBillingUsage,
>(
variables: BillingGetGithubPackagesBillingGheVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingGheError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingGheError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/settings/billing/packages',
operationId: 'billingGetGithubPackagesBillingGhe',
variables,
}),
({ signal }) =>
fetchBillingGetGithubPackagesBillingGhe(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type BillingGetSharedStorageBillingGhePathParams = {
/**
* The slug version of the enterprise name. You can also substitute this value with the enterprise id.
*/
enterprise: string;
};
export type BillingGetSharedStorageBillingGheError =
Fetcher.ErrorWrapper;
export type BillingGetSharedStorageBillingGheVariables = {
pathParams: BillingGetSharedStorageBillingGhePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* The authenticated user must be an enterprise admin.
*/
export const fetchBillingGetSharedStorageBillingGhe = (
variables: BillingGetSharedStorageBillingGheVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingGheError,
undefined,
{},
{},
BillingGetSharedStorageBillingGhePathParams
>({
url: '/enterprises/{enterprise}/settings/billing/shared-storage',
method: 'get',
...variables,
signal,
});
/**
* Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* The authenticated user must be an enterprise admin.
*/
export const useBillingGetSharedStorageBillingGhe = <
TData = Schemas.CombinedBillingUsage,
>(
variables: BillingGetSharedStorageBillingGheVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingGheError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingGheError,
TData
>(
queryKeyFn({
path: '/enterprises/{enterprise}/settings/billing/shared-storage',
operationId: 'billingGetSharedStorageBillingGhe',
variables,
}),
({ signal }) =>
fetchBillingGetSharedStorageBillingGhe(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActivityListPublicEventsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActivityListPublicEventsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 503;
payload: Responses.ServiceUnavailable;
}
>;
export type ActivityListPublicEventsResponse = Schemas.Event[];
export type ActivityListPublicEventsVariables = {
queryParams?: ActivityListPublicEventsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.
*/
export const fetchActivityListPublicEvents = (
variables: ActivityListPublicEventsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActivityListPublicEventsResponse,
ActivityListPublicEventsError,
undefined,
{},
ActivityListPublicEventsQueryParams,
{}
>({ url: '/events', method: 'get', ...variables, signal });
/**
* We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.
*/
export const useActivityListPublicEvents = <
TData = ActivityListPublicEventsResponse,
>(
variables: ActivityListPublicEventsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActivityListPublicEventsResponse,
ActivityListPublicEventsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActivityListPublicEventsResponse,
ActivityListPublicEventsError,
TData
>(
queryKeyFn({
path: '/events',
operationId: 'activityListPublicEvents',
variables,
}),
({ signal }) =>
fetchActivityListPublicEvents(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActivityGetFeedsError = Fetcher.ErrorWrapper;
export type ActivityGetFeedsVariables = GithubContext['fetcherOptions'];
/**
* GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user:
*
* * **Timeline**: The GitHub global public timeline
* * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia)
* * **Current user public**: The public timeline for the authenticated user
* * **Current user**: The private timeline for the authenticated user
* * **Current user actor**: The private timeline for activity created by the authenticated user
* * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of.
* * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
*
* **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens.
*/
export const fetchActivityGetFeeds = (
variables: ActivityGetFeedsVariables,
signal?: AbortSignal,
) =>
githubFetch({
url: '/feeds',
method: 'get',
...variables,
signal,
});
/**
* GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user:
*
* * **Timeline**: The GitHub global public timeline
* * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia)
* * **Current user public**: The public timeline for the authenticated user
* * **Current user**: The private timeline for the authenticated user
* * **Current user actor**: The private timeline for activity created by the authenticated user
* * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of.
* * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
*
* **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens.
*/
export const useActivityGetFeeds = (
variables: ActivityGetFeedsVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/feeds', operationId: 'activityGetFeeds', variables }),
({ signal }) =>
fetchActivityGetFeeds({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsListQueryParams = {
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type GistsListResponse = Schemas.BaseGist[];
export type GistsListVariables = {
queryParams?: GistsListQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists:
*/
export const fetchGistsList = (
variables: GistsListVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListResponse,
GistsListError,
undefined,
{},
GistsListQueryParams,
{}
>({ url: '/gists', method: 'get', ...variables, signal });
/**
* Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists:
*/
export const useGistsList = (
variables: GistsListVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/gists', operationId: 'gistsList', variables }),
({ signal }) => fetchGistsList({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsCreateError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type GistsCreateRequestBody = {
/**
* Description of the gist
*
* @example Example Ruby script
*/
description?: string;
/**
* Names and content for the files that make up the gist
*
* @example {"hello.rb":{"content":"puts \"Hello, World!\""}}
*/
files: {
[key: string]: {
/**
* Content of the file
*/
content: string;
};
};
public?: boolean | ('true' | 'false');
};
export type GistsCreateVariables = {
body: GistsCreateRequestBody;
} & GithubContext['fetcherOptions'];
/**
* Allows you to add a new gist with one or more files.
*
* **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
*/
export const fetchGistsCreate = (
variables: GistsCreateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistSimple,
GistsCreateError,
GistsCreateRequestBody,
{},
{},
{}
>({ url: '/gists', method: 'post', ...variables, signal });
/**
* Allows you to add a new gist with one or more files.
*
* **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
*/
export const useGistsCreate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.GistSimple,
GistsCreateError,
GistsCreateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.GistSimple,
GistsCreateError,
GistsCreateVariables
>(
(variables: GistsCreateVariables) =>
fetchGistsCreate({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsListPublicQueryParams = {
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListPublicError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type GistsListPublicResponse = Schemas.BaseGist[];
export type GistsListPublicVariables = {
queryParams?: GistsListPublicQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List public gists sorted by most recently updated to least recently updated.
*
* Note: With [pagination](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.
*/
export const fetchGistsListPublic = (
variables: GistsListPublicVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListPublicResponse,
GistsListPublicError,
undefined,
{},
GistsListPublicQueryParams,
{}
>({ url: '/gists/public', method: 'get', ...variables, signal });
/**
* List public gists sorted by most recently updated to least recently updated.
*
* Note: With [pagination](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.
*/
export const useGistsListPublic = (
variables: GistsListPublicVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GistsListPublicResponse,
GistsListPublicError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GistsListPublicResponse,
GistsListPublicError,
TData
>(
queryKeyFn({
path: '/gists/public',
operationId: 'gistsListPublic',
variables,
}),
({ signal }) =>
fetchGistsListPublic({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsListStarredQueryParams = {
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListStarredError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type GistsListStarredResponse = Schemas.BaseGist[];
export type GistsListStarredVariables = {
queryParams?: GistsListStarredQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List the authenticated user's starred gists:
*/
export const fetchGistsListStarred = (
variables: GistsListStarredVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListStarredResponse,
GistsListStarredError,
undefined,
{},
GistsListStarredQueryParams,
{}
>({ url: '/gists/starred', method: 'get', ...variables, signal });
/**
* List the authenticated user's starred gists:
*/
export const useGistsListStarred = (
variables: GistsListStarredVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GistsListStarredResponse,
GistsListStarredError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GistsListStarredResponse,
GistsListStarredError,
TData
>(
queryKeyFn({
path: '/gists/starred',
operationId: 'gistsListStarred',
variables,
}),
({ signal }) =>
fetchGistsListStarred({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsDeletePathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsDeleteError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsDeleteVariables = {
pathParams: GistsDeletePathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsDelete = (
variables: GistsDeleteVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
GistsDeleteError,
undefined,
{},
{},
GistsDeletePathParams
>({ url: '/gists/{gistId}', method: 'delete', ...variables, signal });
export const useGistsDelete = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
GistsDeleteError,
GistsDeleteVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
GistsDeleteError,
GistsDeleteVariables
>(
(variables: GistsDeleteVariables) =>
fetchGistsDelete({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsGetPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsGetError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.ForbiddenGist;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsGetVariables = {
pathParams: GistsGetPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsGet = (
variables: GistsGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistSimple,
GistsGetError,
undefined,
{},
{},
GistsGetPathParams
>({ url: '/gists/{gistId}', method: 'get', ...variables, signal });
export const useGistsGet = (
variables: GistsGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/gists/{gist_id}',
operationId: 'gistsGet',
variables,
}),
({ signal }) => fetchGistsGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsUpdatePathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsUpdateError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type GistsUpdateVariables = {
body?:
| {
/**
* Description of the gist
*
* @example Example Ruby script
*/
description: string;
/**
* Names of files to be updated
*
* @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}}
*/
files?: {
[key: string]:
| {
/**
* The new content of the file
*/
content: string;
/**
* The new filename for the file
*/
filename?: string | null;
}
| {
/**
* The new content of the file
*/
content?: string;
/**
* The new filename for the file
*/
filename: string | null;
}
| {}
| null;
};
}
| {
/**
* Description of the gist
*
* @example Example Ruby script
*/
description?: string;
/**
* Names of files to be updated
*
* @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}}
*/
files: {
[key: string]:
| {
/**
* The new content of the file
*/
content: string;
/**
* The new filename for the file
*/
filename?: string | null;
}
| {
/**
* The new content of the file
*/
content?: string;
/**
* The new filename for the file
*/
filename: string | null;
}
| {}
| null;
};
}
| null;
pathParams: GistsUpdatePathParams;
} & GithubContext['fetcherOptions'];
/**
* Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
*/
export const fetchGistsUpdate = (
variables: GistsUpdateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistSimple,
GistsUpdateError,
| {
/**
* Description of the gist
*
* @example Example Ruby script
*/
description: string;
/**
* Names of files to be updated
*
* @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}}
*/
files?: {
[key: string]:
| {
/**
* The new content of the file
*/
content: string;
/**
* The new filename for the file
*/
filename?: string | null;
}
| {
/**
* The new content of the file
*/
content?: string;
/**
* The new filename for the file
*/
filename: string | null;
}
| {}
| null;
};
}
| {
/**
* Description of the gist
*
* @example Example Ruby script
*/
description?: string;
/**
* Names of files to be updated
*
* @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}}
*/
files: {
[key: string]:
| {
/**
* The new content of the file
*/
content: string;
/**
* The new filename for the file
*/
filename?: string | null;
}
| {
/**
* The new content of the file
*/
content?: string;
/**
* The new filename for the file
*/
filename: string | null;
}
| {}
| null;
};
}
| null,
{},
{},
GistsUpdatePathParams
>({ url: '/gists/{gistId}', method: 'patch', ...variables, signal });
/**
* Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
*/
export const useGistsUpdate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.GistSimple,
GistsUpdateError,
GistsUpdateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.GistSimple,
GistsUpdateError,
GistsUpdateVariables
>(
(variables: GistsUpdateVariables) =>
fetchGistsUpdate({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsListCommentsPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsListCommentsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListCommentsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsListCommentsResponse = Schemas.GistComment[];
export type GistsListCommentsVariables = {
pathParams: GistsListCommentsPathParams;
queryParams?: GistsListCommentsQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsListComments = (
variables: GistsListCommentsVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListCommentsResponse,
GistsListCommentsError,
undefined,
{},
GistsListCommentsQueryParams,
GistsListCommentsPathParams
>({ url: '/gists/{gistId}/comments', method: 'get', ...variables, signal });
export const useGistsListComments = (
variables: GistsListCommentsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GistsListCommentsResponse,
GistsListCommentsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GistsListCommentsResponse,
GistsListCommentsError,
TData
>(
queryKeyFn({
path: '/gists/{gist_id}/comments',
operationId: 'gistsListComments',
variables,
}),
({ signal }) =>
fetchGistsListComments({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsCreateCommentPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsCreateCommentError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsCreateCommentRequestBody = {
/**
* The comment text.
*
* @example Body of the attachment
* @maxLength 65535
*/
body: string;
};
export type GistsCreateCommentVariables = {
body: GistsCreateCommentRequestBody;
pathParams: GistsCreateCommentPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsCreateComment = (
variables: GistsCreateCommentVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistComment,
GistsCreateCommentError,
GistsCreateCommentRequestBody,
{},
{},
GistsCreateCommentPathParams
>({ url: '/gists/{gistId}/comments', method: 'post', ...variables, signal });
export const useGistsCreateComment = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.GistComment,
GistsCreateCommentError,
GistsCreateCommentVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.GistComment,
GistsCreateCommentError,
GistsCreateCommentVariables
>(
(variables: GistsCreateCommentVariables) =>
fetchGistsCreateComment({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsDeleteCommentPathParams = {
/**
* gist_id parameter
*/
gistId: string;
/**
* comment_id parameter
*/
commentId: number;
};
export type GistsDeleteCommentError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsDeleteCommentVariables = {
pathParams: GistsDeleteCommentPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsDeleteComment = (
variables: GistsDeleteCommentVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
GistsDeleteCommentError,
undefined,
{},
{},
GistsDeleteCommentPathParams
>({
url: '/gists/{gistId}/comments/{commentId}',
method: 'delete',
...variables,
signal,
});
export const useGistsDeleteComment = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
GistsDeleteCommentError,
GistsDeleteCommentVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
GistsDeleteCommentError,
GistsDeleteCommentVariables
>(
(variables: GistsDeleteCommentVariables) =>
fetchGistsDeleteComment({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsGetCommentPathParams = {
/**
* gist_id parameter
*/
gistId: string;
/**
* comment_id parameter
*/
commentId: number;
};
export type GistsGetCommentError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.ForbiddenGist;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsGetCommentVariables = {
pathParams: GistsGetCommentPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsGetComment = (
variables: GistsGetCommentVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistComment,
GistsGetCommentError,
undefined,
{},
{},
GistsGetCommentPathParams
>({
url: '/gists/{gistId}/comments/{commentId}',
method: 'get',
...variables,
signal,
});
export const useGistsGetComment = (
variables: GistsGetCommentVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.GistComment,
GistsGetCommentError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/gists/{gist_id}/comments/{comment_id}',
operationId: 'gistsGetComment',
variables,
}),
({ signal }) =>
fetchGistsGetComment({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsUpdateCommentPathParams = {
/**
* gist_id parameter
*/
gistId: string;
/**
* comment_id parameter
*/
commentId: number;
};
export type GistsUpdateCommentError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type GistsUpdateCommentRequestBody = {
/**
* The comment text.
*
* @example Body of the attachment
* @maxLength 65535
*/
body: string;
};
export type GistsUpdateCommentVariables = {
body: GistsUpdateCommentRequestBody;
pathParams: GistsUpdateCommentPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsUpdateComment = (
variables: GistsUpdateCommentVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistComment,
GistsUpdateCommentError,
GistsUpdateCommentRequestBody,
{},
{},
GistsUpdateCommentPathParams
>({
url: '/gists/{gistId}/comments/{commentId}',
method: 'patch',
...variables,
signal,
});
export const useGistsUpdateComment = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.GistComment,
GistsUpdateCommentError,
GistsUpdateCommentVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.GistComment,
GistsUpdateCommentError,
GistsUpdateCommentVariables
>(
(variables: GistsUpdateCommentVariables) =>
fetchGistsUpdateComment({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsListCommitsPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsListCommitsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListCommitsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsListCommitsResponse = Schemas.GistCommit[];
export type GistsListCommitsVariables = {
pathParams: GistsListCommitsPathParams;
queryParams?: GistsListCommitsQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsListCommits = (
variables: GistsListCommitsVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListCommitsResponse,
GistsListCommitsError,
undefined,
{},
GistsListCommitsQueryParams,
GistsListCommitsPathParams
>({ url: '/gists/{gistId}/commits', method: 'get', ...variables, signal });
export const useGistsListCommits = (
variables: GistsListCommitsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GistsListCommitsResponse,
GistsListCommitsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GistsListCommitsResponse,
GistsListCommitsError,
TData
>(
queryKeyFn({
path: '/gists/{gist_id}/commits',
operationId: 'gistsListCommits',
variables,
}),
({ signal }) =>
fetchGistsListCommits({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsListForksPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsListForksQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type GistsListForksError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsListForksResponse = Schemas.GistSimple[];
export type GistsListForksVariables = {
pathParams: GistsListForksPathParams;
queryParams?: GistsListForksQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsListForks = (
variables: GistsListForksVariables,
signal?: AbortSignal,
) =>
githubFetch<
GistsListForksResponse,
GistsListForksError,
undefined,
{},
GistsListForksQueryParams,
GistsListForksPathParams
>({ url: '/gists/{gistId}/forks', method: 'get', ...variables, signal });
export const useGistsListForks = (
variables: GistsListForksVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GistsListForksResponse,
GistsListForksError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GistsListForksResponse,
GistsListForksError,
TData
>(
queryKeyFn({
path: '/gists/{gist_id}/forks',
operationId: 'gistsListForks',
variables,
}),
({ signal }) =>
fetchGistsListForks({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsForkPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsForkError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type GistsForkVariables = {
pathParams: GistsForkPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note**: This was previously `/gists/:gist_id/fork`.
*/
export const fetchGistsFork = (
variables: GistsForkVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.BaseGist,
GistsForkError,
undefined,
{},
{},
GistsForkPathParams
>({ url: '/gists/{gistId}/forks', method: 'post', ...variables, signal });
/**
* **Note**: This was previously `/gists/:gist_id/fork`.
*/
export const useGistsFork = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.BaseGist,
GistsForkError,
GistsForkVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.BaseGist,
GistsForkError,
GistsForkVariables
>(
(variables: GistsForkVariables) =>
fetchGistsFork({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsUnstarPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsUnstarError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsUnstarVariables = {
pathParams: GistsUnstarPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsUnstar = (
variables: GistsUnstarVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
GistsUnstarError,
undefined,
{},
{},
GistsUnstarPathParams
>({ url: '/gists/{gistId}/star', method: 'delete', ...variables, signal });
export const useGistsUnstar = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
GistsUnstarError,
GistsUnstarVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
GistsUnstarError,
GistsUnstarVariables
>(
(variables: GistsUnstarVariables) =>
fetchGistsUnstar({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsCheckIsStarredPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsCheckIsStarredError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: {};
}
>;
export type GistsCheckIsStarredVariables = {
pathParams: GistsCheckIsStarredPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsCheckIsStarred = (
variables: GistsCheckIsStarredVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
GistsCheckIsStarredError,
undefined,
{},
{},
GistsCheckIsStarredPathParams
>({ url: '/gists/{gistId}/star', method: 'get', ...variables, signal });
export const useGistsCheckIsStarred = (
variables: GistsCheckIsStarredVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/gists/{gist_id}/star',
operationId: 'gistsCheckIsStarred',
variables,
}),
({ signal }) =>
fetchGistsCheckIsStarred({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GistsStarPathParams = {
/**
* gist_id parameter
*/
gistId: string;
};
export type GistsStarError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type GistsStarVariables = {
pathParams: GistsStarPathParams;
} & GithubContext['fetcherOptions'];
/**
* Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
export const fetchGistsStar = (
variables: GistsStarVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
GistsStarError,
undefined,
{},
{},
GistsStarPathParams
>({ url: '/gists/{gistId}/star', method: 'put', ...variables, signal });
/**
* Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
export const useGistsStar = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
GistsStarError,
GistsStarVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation(
(variables: GistsStarVariables) =>
fetchGistsStar({ ...fetcherOptions, ...variables }),
options,
);
};
export type GistsGetRevisionPathParams = {
/**
* gist_id parameter
*/
gistId: string;
sha: string;
};
export type GistsGetRevisionError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type GistsGetRevisionVariables = {
pathParams: GistsGetRevisionPathParams;
} & GithubContext['fetcherOptions'];
export const fetchGistsGetRevision = (
variables: GistsGetRevisionVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GistSimple,
GistsGetRevisionError,
undefined,
{},
{},
GistsGetRevisionPathParams
>({ url: '/gists/{gistId}/{sha}', method: 'get', ...variables, signal });
export const useGistsGetRevision = (
variables: GistsGetRevisionVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.GistSimple,
GistsGetRevisionError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/gists/{gist_id}/{sha}',
operationId: 'gistsGetRevision',
variables,
}),
({ signal }) =>
fetchGistsGetRevision({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type GitignoreGetAllTemplatesError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type GitignoreGetAllTemplatesResponse = string[];
export type GitignoreGetAllTemplatesVariables = GithubContext['fetcherOptions'];
/**
* List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user).
*/
export const fetchGitignoreGetAllTemplates = (
variables: GitignoreGetAllTemplatesVariables,
signal?: AbortSignal,
) =>
githubFetch<
GitignoreGetAllTemplatesResponse,
GitignoreGetAllTemplatesError,
undefined,
{},
{},
{}
>({ url: '/gitignore/templates', method: 'get', ...variables, signal });
/**
* List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user).
*/
export const useGitignoreGetAllTemplates = <
TData = GitignoreGetAllTemplatesResponse,
>(
variables: GitignoreGetAllTemplatesVariables,
options?: Omit<
reactQuery.UseQueryOptions<
GitignoreGetAllTemplatesResponse,
GitignoreGetAllTemplatesError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
GitignoreGetAllTemplatesResponse,
GitignoreGetAllTemplatesError,
TData
>(
queryKeyFn({
path: '/gitignore/templates',
operationId: 'gitignoreGetAllTemplates',
variables,
}),
({ signal }) =>
fetchGitignoreGetAllTemplates(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type GitignoreGetTemplatePathParams = {
name: string;
};
export type GitignoreGetTemplateError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type GitignoreGetTemplateVariables = {
pathParams: GitignoreGetTemplatePathParams;
} & GithubContext['fetcherOptions'];
/**
* The API also allows fetching the source of a single template.
* Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents.
*/
export const fetchGitignoreGetTemplate = (
variables: GitignoreGetTemplateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GitignoreTemplate,
GitignoreGetTemplateError,
undefined,
{},
{},
GitignoreGetTemplatePathParams
>({
url: '/gitignore/templates/{name}',
method: 'get',
...variables,
signal,
});
/**
* The API also allows fetching the source of a single template.
* Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents.
*/
export const useGitignoreGetTemplate = (
variables: GitignoreGetTemplateVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.GitignoreTemplate,
GitignoreGetTemplateError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.GitignoreTemplate,
GitignoreGetTemplateError,
TData
>(
queryKeyFn({
path: '/gitignore/templates/{name}',
operationId: 'gitignoreGetTemplate',
variables,
}),
({ signal }) =>
fetchGitignoreGetTemplate({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsListReposAccessibleToInstallationQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type AppsListReposAccessibleToInstallationError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type AppsListReposAccessibleToInstallationResponse = {
repositories: Schemas.Repository[];
/**
* @example selected
*/
repository_selection?: string;
total_count: number;
};
export type AppsListReposAccessibleToInstallationVariables = {
queryParams?: AppsListReposAccessibleToInstallationQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List repositories that an app installation can access.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const fetchAppsListReposAccessibleToInstallation = (
variables: AppsListReposAccessibleToInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListReposAccessibleToInstallationResponse,
AppsListReposAccessibleToInstallationError,
undefined,
{},
AppsListReposAccessibleToInstallationQueryParams,
{}
>({ url: '/installation/repositories', method: 'get', ...variables, signal });
/**
* List repositories that an app installation can access.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const useAppsListReposAccessibleToInstallation = <
TData = AppsListReposAccessibleToInstallationResponse,
>(
variables: AppsListReposAccessibleToInstallationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListReposAccessibleToInstallationResponse,
AppsListReposAccessibleToInstallationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsListReposAccessibleToInstallationResponse,
AppsListReposAccessibleToInstallationError,
TData
>(
queryKeyFn({
path: '/installation/repositories',
operationId: 'appsListReposAccessibleToInstallation',
variables,
}),
({ signal }) =>
fetchAppsListReposAccessibleToInstallation(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsRevokeInstallationAccessTokenError =
Fetcher.ErrorWrapper;
export type AppsRevokeInstallationAccessTokenVariables =
GithubContext['fetcherOptions'];
/**
* Revokes the installation token you're using to authenticate as an installation and access this endpoint.
*
* Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const fetchAppsRevokeInstallationAccessToken = (
variables: AppsRevokeInstallationAccessTokenVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
AppsRevokeInstallationAccessTokenError,
undefined,
{},
{},
{}
>({ url: '/installation/token', method: 'delete', ...variables, signal });
/**
* Revokes the installation token you're using to authenticate as an installation and access this endpoint.
*
* Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint.
*
* You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint.
*/
export const useAppsRevokeInstallationAccessToken = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
AppsRevokeInstallationAccessTokenError,
AppsRevokeInstallationAccessTokenVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
AppsRevokeInstallationAccessTokenError,
AppsRevokeInstallationAccessTokenVariables
>(
(variables: AppsRevokeInstallationAccessTokenVariables) =>
fetchAppsRevokeInstallationAccessToken({
...fetcherOptions,
...variables,
}),
options,
);
};
export type IssuesListQueryParams = {
/**
* Indicates which sorts of issues to return. Can be one of:
* \* `assigned`: Issues assigned to you
* \* `created`: Issues created by you
* \* `mentioned`: Issues mentioning you
* \* `subscribed`: Issues you're subscribed to updates for
* \* `all`: All issues the authenticated user can see, regardless of participation or creation
*
* @default assigned
*/
filter?:
| 'assigned'
| 'created'
| 'mentioned'
| 'subscribed'
| 'repos'
| 'all';
/**
* Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`.
*
* @default open
*/
state?: 'open' | 'closed' | 'all';
/**
* A list of comma separated label names. Example: `bug,ui,@high`
*/
labels?: string;
/**
* What to sort results by. Can be either `created`, `updated`, `comments`.
*
* @default created
*/
sort?: 'created' | 'updated' | 'comments';
/**
* One of `asc` (ascending) or `desc` (descending).
*
* @default desc
*/
direction?: 'asc' | 'desc';
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
collab?: boolean;
orgs?: boolean;
owned?: boolean;
pulls?: boolean;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type IssuesListError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type IssuesListResponse = Schemas.Issue[];
export type IssuesListVariables = {
queryParams?: IssuesListQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List issues assigned to the authenticated user across all visible repositories including owned repositories, member
* repositories, and organization repositories. You can use the `filter` query parameter to fetch issues that are not
* necessarily assigned to you.
*
*
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this
* reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
* the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
* request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const fetchIssuesList = (
variables: IssuesListVariables,
signal?: AbortSignal,
) =>
githubFetch<
IssuesListResponse,
IssuesListError,
undefined,
{},
IssuesListQueryParams,
{}
>({ url: '/issues', method: 'get', ...variables, signal });
/**
* List issues assigned to the authenticated user across all visible repositories including owned repositories, member
* repositories, and organization repositories. You can use the `filter` query parameter to fetch issues that are not
* necessarily assigned to you.
*
*
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this
* reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
* the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
* request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const useIssuesList = (
variables: IssuesListVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/issues', operationId: 'issuesList', variables }),
({ signal }) =>
fetchIssuesList({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type LicensesGetAllCommonlyUsedQueryParams = {
featured?: boolean;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type LicensesGetAllCommonlyUsedError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type LicensesGetAllCommonlyUsedResponse = Schemas.LicenseSimple[];
export type LicensesGetAllCommonlyUsedVariables = {
queryParams?: LicensesGetAllCommonlyUsedQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchLicensesGetAllCommonlyUsed = (
variables: LicensesGetAllCommonlyUsedVariables,
signal?: AbortSignal,
) =>
githubFetch<
LicensesGetAllCommonlyUsedResponse,
LicensesGetAllCommonlyUsedError,
undefined,
{},
LicensesGetAllCommonlyUsedQueryParams,
{}
>({ url: '/licenses', method: 'get', ...variables, signal });
export const useLicensesGetAllCommonlyUsed = <
TData = LicensesGetAllCommonlyUsedResponse,
>(
variables: LicensesGetAllCommonlyUsedVariables,
options?: Omit<
reactQuery.UseQueryOptions<
LicensesGetAllCommonlyUsedResponse,
LicensesGetAllCommonlyUsedError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
LicensesGetAllCommonlyUsedResponse,
LicensesGetAllCommonlyUsedError,
TData
>(
queryKeyFn({
path: '/licenses',
operationId: 'licensesGetAllCommonlyUsed',
variables,
}),
({ signal }) =>
fetchLicensesGetAllCommonlyUsed(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type LicensesGetPathParams = {
license: string;
};
export type LicensesGetError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type LicensesGetVariables = {
pathParams: LicensesGetPathParams;
} & GithubContext['fetcherOptions'];
export const fetchLicensesGet = (
variables: LicensesGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.License,
LicensesGetError,
undefined,
{},
{},
LicensesGetPathParams
>({ url: '/licenses/{license}', method: 'get', ...variables, signal });
export const useLicensesGet = (
variables: LicensesGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/licenses/{license}',
operationId: 'licensesGet',
variables,
}),
({ signal }) =>
fetchLicensesGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type MarkdownRenderError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type MarkdownRenderRequestBody = {
/**
* The repository context to use when creating references in `gfm` mode.
*/
context?: string;
/**
* The rendering mode.
*
* @default markdown
* @example markdown
*/
mode?: 'markdown' | 'gfm';
/**
* The Markdown text to render in HTML.
*/
text: string;
};
export type MarkdownRenderVariables = {
body: MarkdownRenderRequestBody;
} & GithubContext['fetcherOptions'];
export const fetchMarkdownRender = (
variables: MarkdownRenderVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
MarkdownRenderError,
MarkdownRenderRequestBody,
{},
{},
{}
>({ url: '/markdown', method: 'post', ...variables, signal });
export const useMarkdownRender = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
MarkdownRenderError,
MarkdownRenderVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
MarkdownRenderError,
MarkdownRenderVariables
>(
(variables: MarkdownRenderVariables) =>
fetchMarkdownRender({ ...fetcherOptions, ...variables }),
options,
);
};
export type MarkdownRenderRawError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type MarkdownRenderRawVariables = GithubContext['fetcherOptions'];
/**
* You must send Markdown as plain text (using a `Content-Type` header of `text/plain` or `text/x-markdown`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.
*/
export const fetchMarkdownRenderRaw = (
variables: MarkdownRenderRawVariables,
signal?: AbortSignal,
) =>
githubFetch({
url: '/markdown/raw',
method: 'post',
...variables,
signal,
});
/**
* You must send Markdown as plain text (using a `Content-Type` header of `text/plain` or `text/x-markdown`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.
*/
export const useMarkdownRenderRaw = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
MarkdownRenderRawError,
MarkdownRenderRawVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
MarkdownRenderRawError,
MarkdownRenderRawVariables
>(
(variables: MarkdownRenderRawVariables) =>
fetchMarkdownRenderRaw({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsGetSubscriptionPlanForAccountPathParams = {
/**
* account_id parameter
*/
accountId: number;
};
export type AppsGetSubscriptionPlanForAccountError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 404;
payload: Schemas.BasicError;
}
>;
export type AppsGetSubscriptionPlanForAccountVariables = {
pathParams: AppsGetSubscriptionPlanForAccountPathParams;
} & GithubContext['fetcherOptions'];
/**
* Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsGetSubscriptionPlanForAccount = (
variables: AppsGetSubscriptionPlanForAccountVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountError,
undefined,
{},
{},
AppsGetSubscriptionPlanForAccountPathParams
>({
url: '/marketplace_listing/accounts/{accountId}',
method: 'get',
...variables,
signal,
});
/**
* Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsGetSubscriptionPlanForAccount = <
TData = Schemas.MarketplacePurchase,
>(
variables: AppsGetSubscriptionPlanForAccountVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountError,
TData
>(
queryKeyFn({
path: '/marketplace_listing/accounts/{account_id}',
operationId: 'appsGetSubscriptionPlanForAccount',
variables,
}),
({ signal }) =>
fetchAppsGetSubscriptionPlanForAccount(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsListPlansQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type AppsListPlansError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type AppsListPlansResponse = Schemas.MarketplaceListingPlan[];
export type AppsListPlansVariables = {
queryParams?: AppsListPlansQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all plans that are part of your GitHub Marketplace listing.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsListPlans = (
variables: AppsListPlansVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListPlansResponse,
AppsListPlansError,
undefined,
{},
AppsListPlansQueryParams,
{}
>({ url: '/marketplace_listing/plans', method: 'get', ...variables, signal });
/**
* Lists all plans that are part of your GitHub Marketplace listing.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsListPlans = (
variables: AppsListPlansVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListPlansResponse,
AppsListPlansError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/marketplace_listing/plans',
operationId: 'appsListPlans',
variables,
}),
({ signal }) =>
fetchAppsListPlans({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsListAccountsForPlanPathParams = {
/**
* plan_id parameter
*/
planId: number;
};
export type AppsListAccountsForPlanQueryParams = {
/**
* One of `created` (when the repository was starred) or `updated` (when it was last pushed to).
*
* @default created
*/
sort?: 'created' | 'updated';
/**
* To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter.
*/
direction?: 'asc' | 'desc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type AppsListAccountsForPlanError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type AppsListAccountsForPlanResponse = Schemas.MarketplacePurchase[];
export type AppsListAccountsForPlanVariables = {
pathParams: AppsListAccountsForPlanPathParams;
queryParams?: AppsListAccountsForPlanQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsListAccountsForPlan = (
variables: AppsListAccountsForPlanVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListAccountsForPlanResponse,
AppsListAccountsForPlanError,
undefined,
{},
AppsListAccountsForPlanQueryParams,
AppsListAccountsForPlanPathParams
>({
url: '/marketplace_listing/plans/{planId}/accounts',
method: 'get',
...variables,
signal,
});
/**
* Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsListAccountsForPlan = <
TData = AppsListAccountsForPlanResponse,
>(
variables: AppsListAccountsForPlanVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListAccountsForPlanResponse,
AppsListAccountsForPlanError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsListAccountsForPlanResponse,
AppsListAccountsForPlanError,
TData
>(
queryKeyFn({
path: '/marketplace_listing/plans/{plan_id}/accounts',
operationId: 'appsListAccountsForPlan',
variables,
}),
({ signal }) =>
fetchAppsListAccountsForPlan({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsGetSubscriptionPlanForAccountStubbedPathParams = {
/**
* account_id parameter
*/
accountId: number;
};
export type AppsGetSubscriptionPlanForAccountStubbedError =
Fetcher.ErrorWrapper<{
status: 401;
payload: Responses.RequiresAuthentication;
}>;
export type AppsGetSubscriptionPlanForAccountStubbedVariables = {
pathParams: AppsGetSubscriptionPlanForAccountStubbedPathParams;
} & GithubContext['fetcherOptions'];
/**
* Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsGetSubscriptionPlanForAccountStubbed = (
variables: AppsGetSubscriptionPlanForAccountStubbedVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountStubbedError,
undefined,
{},
{},
AppsGetSubscriptionPlanForAccountStubbedPathParams
>({
url: '/marketplace_listing/stubbed/accounts/{accountId}',
method: 'get',
...variables,
signal,
});
/**
* Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsGetSubscriptionPlanForAccountStubbed = <
TData = Schemas.MarketplacePurchase,
>(
variables: AppsGetSubscriptionPlanForAccountStubbedVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountStubbedError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.MarketplacePurchase,
AppsGetSubscriptionPlanForAccountStubbedError,
TData
>(
queryKeyFn({
path: '/marketplace_listing/stubbed/accounts/{account_id}',
operationId: 'appsGetSubscriptionPlanForAccountStubbed',
variables,
}),
({ signal }) =>
fetchAppsGetSubscriptionPlanForAccountStubbed(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type AppsListPlansStubbedQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type AppsListPlansStubbedError = Fetcher.ErrorWrapper<{
status: 401;
payload: Responses.RequiresAuthentication;
}>;
export type AppsListPlansStubbedResponse = Schemas.MarketplaceListingPlan[];
export type AppsListPlansStubbedVariables = {
queryParams?: AppsListPlansStubbedQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all plans that are part of your GitHub Marketplace listing.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsListPlansStubbed = (
variables: AppsListPlansStubbedVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListPlansStubbedResponse,
AppsListPlansStubbedError,
undefined,
{},
AppsListPlansStubbedQueryParams,
{}
>({
url: '/marketplace_listing/stubbed/plans',
method: 'get',
...variables,
signal,
});
/**
* Lists all plans that are part of your GitHub Marketplace listing.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsListPlansStubbed = (
variables: AppsListPlansStubbedVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListPlansStubbedResponse,
AppsListPlansStubbedError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsListPlansStubbedResponse,
AppsListPlansStubbedError,
TData
>(
queryKeyFn({
path: '/marketplace_listing/stubbed/plans',
operationId: 'appsListPlansStubbed',
variables,
}),
({ signal }) =>
fetchAppsListPlansStubbed({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type AppsListAccountsForPlanStubbedPathParams = {
/**
* plan_id parameter
*/
planId: number;
};
export type AppsListAccountsForPlanStubbedQueryParams = {
/**
* One of `created` (when the repository was starred) or `updated` (when it was last pushed to).
*
* @default created
*/
sort?: 'created' | 'updated';
/**
* To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter.
*/
direction?: 'asc' | 'desc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type AppsListAccountsForPlanStubbedError = Fetcher.ErrorWrapper<{
status: 401;
payload: Responses.RequiresAuthentication;
}>;
export type AppsListAccountsForPlanStubbedResponse =
Schemas.MarketplacePurchase[];
export type AppsListAccountsForPlanStubbedVariables = {
pathParams: AppsListAccountsForPlanStubbedPathParams;
queryParams?: AppsListAccountsForPlanStubbedQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const fetchAppsListAccountsForPlanStubbed = (
variables: AppsListAccountsForPlanStubbedVariables,
signal?: AbortSignal,
) =>
githubFetch<
AppsListAccountsForPlanStubbedResponse,
AppsListAccountsForPlanStubbedError,
undefined,
{},
AppsListAccountsForPlanStubbedQueryParams,
AppsListAccountsForPlanStubbedPathParams
>({
url: '/marketplace_listing/stubbed/plans/{planId}/accounts',
method: 'get',
...variables,
signal,
});
/**
* Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
*
* GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
*/
export const useAppsListAccountsForPlanStubbed = <
TData = AppsListAccountsForPlanStubbedResponse,
>(
variables: AppsListAccountsForPlanStubbedVariables,
options?: Omit<
reactQuery.UseQueryOptions<
AppsListAccountsForPlanStubbedResponse,
AppsListAccountsForPlanStubbedError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
AppsListAccountsForPlanStubbedResponse,
AppsListAccountsForPlanStubbedError,
TData
>(
queryKeyFn({
path: '/marketplace_listing/stubbed/plans/{plan_id}/accounts',
operationId: 'appsListAccountsForPlanStubbed',
variables,
}),
({ signal }) =>
fetchAppsListAccountsForPlanStubbed(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type MetaGetError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type MetaGetVariables = GithubContext['fetcherOptions'];
/**
* Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)."
*
* **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses.
*/
export const fetchMetaGet = (
variables: MetaGetVariables,
signal?: AbortSignal,
) =>
githubFetch({
url: '/meta',
method: 'get',
...variables,
signal,
});
/**
* Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)."
*
* **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses.
*/
export const useMetaGet = (
variables: MetaGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/meta', operationId: 'metaGet', variables }),
({ signal }) => fetchMetaGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ActivityListPublicEventsForRepoNetworkPathParams = {
owner: string;
repo: string;
};
export type ActivityListPublicEventsForRepoNetworkQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActivityListPublicEventsForRepoNetworkError = Fetcher.ErrorWrapper<
| {
status: 301;
payload: Responses.MovedPermanently;
}
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ActivityListPublicEventsForRepoNetworkResponse = Schemas.Event[];
export type ActivityListPublicEventsForRepoNetworkVariables = {
pathParams: ActivityListPublicEventsForRepoNetworkPathParams;
queryParams?: ActivityListPublicEventsForRepoNetworkQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchActivityListPublicEventsForRepoNetwork = (
variables: ActivityListPublicEventsForRepoNetworkVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActivityListPublicEventsForRepoNetworkResponse,
ActivityListPublicEventsForRepoNetworkError,
undefined,
{},
ActivityListPublicEventsForRepoNetworkQueryParams,
ActivityListPublicEventsForRepoNetworkPathParams
>({
url: '/networks/{owner}/{repo}/events',
method: 'get',
...variables,
signal,
});
export const useActivityListPublicEventsForRepoNetwork = <
TData = ActivityListPublicEventsForRepoNetworkResponse,
>(
variables: ActivityListPublicEventsForRepoNetworkVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActivityListPublicEventsForRepoNetworkResponse,
ActivityListPublicEventsForRepoNetworkError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActivityListPublicEventsForRepoNetworkResponse,
ActivityListPublicEventsForRepoNetworkError,
TData
>(
queryKeyFn({
path: '/networks/{owner}/{repo}/events',
operationId: 'activityListPublicEventsForRepoNetwork',
variables,
}),
({ signal }) =>
fetchActivityListPublicEventsForRepoNetwork(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActivityListNotificationsForAuthenticatedUserQueryParams = {
/**
* If `true`, show notifications marked as read.
*
* @default false
*/
all?: boolean;
/**
* If `true`, only shows notifications in which the user is directly participating or mentioned.
*
* @default false
*/
participating?: boolean;
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
/**
* Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
before?: string;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActivityListNotificationsForAuthenticatedUserError =
Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ActivityListNotificationsForAuthenticatedUserResponse =
Schemas.Thread[];
export type ActivityListNotificationsForAuthenticatedUserVariables = {
queryParams?: ActivityListNotificationsForAuthenticatedUserQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all notifications for the current user, sorted by most recently updated.
*/
export const fetchActivityListNotificationsForAuthenticatedUser = (
variables: ActivityListNotificationsForAuthenticatedUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActivityListNotificationsForAuthenticatedUserResponse,
ActivityListNotificationsForAuthenticatedUserError,
undefined,
{},
ActivityListNotificationsForAuthenticatedUserQueryParams,
{}
>({ url: '/notifications', method: 'get', ...variables, signal });
/**
* List all notifications for the current user, sorted by most recently updated.
*/
export const useActivityListNotificationsForAuthenticatedUser = <
TData = ActivityListNotificationsForAuthenticatedUserResponse,
>(
variables: ActivityListNotificationsForAuthenticatedUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActivityListNotificationsForAuthenticatedUserResponse,
ActivityListNotificationsForAuthenticatedUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActivityListNotificationsForAuthenticatedUserResponse,
ActivityListNotificationsForAuthenticatedUserError,
TData
>(
queryKeyFn({
path: '/notifications',
operationId: 'activityListNotificationsForAuthenticatedUser',
variables,
}),
({ signal }) =>
fetchActivityListNotificationsForAuthenticatedUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActivityMarkNotificationsAsReadError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivityMarkNotificationsAsReadResponse = {
message?: string;
};
export type ActivityMarkNotificationsAsReadRequestBody = {
/**
* Describes the last point that notifications were checked.
*
* @format date-time
*/
last_read_at?: string;
/**
* Whether the notification has been read.
*/
read?: boolean;
};
export type ActivityMarkNotificationsAsReadVariables = {
body?: ActivityMarkNotificationsAsReadRequestBody;
} & GithubContext['fetcherOptions'];
/**
* Marks all notifications as "read" removes it from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a `202 Accepted` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-notifications-for-the-authenticated-user) endpoint and pass the query parameter `all=false`.
*/
export const fetchActivityMarkNotificationsAsRead = (
variables: ActivityMarkNotificationsAsReadVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActivityMarkNotificationsAsReadResponse,
ActivityMarkNotificationsAsReadError,
ActivityMarkNotificationsAsReadRequestBody,
{},
{},
{}
>({ url: '/notifications', method: 'put', ...variables, signal });
/**
* Marks all notifications as "read" removes it from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a `202 Accepted` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-notifications-for-the-authenticated-user) endpoint and pass the query parameter `all=false`.
*/
export const useActivityMarkNotificationsAsRead = (
options?: Omit<
reactQuery.UseMutationOptions<
ActivityMarkNotificationsAsReadResponse,
ActivityMarkNotificationsAsReadError,
ActivityMarkNotificationsAsReadVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
ActivityMarkNotificationsAsReadResponse,
ActivityMarkNotificationsAsReadError,
ActivityMarkNotificationsAsReadVariables
>(
(variables: ActivityMarkNotificationsAsReadVariables) =>
fetchActivityMarkNotificationsAsRead({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActivityGetThreadPathParams = {
/**
* thread_id parameter
*/
threadId: number;
};
export type ActivityGetThreadError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivityGetThreadVariables = {
pathParams: ActivityGetThreadPathParams;
} & GithubContext['fetcherOptions'];
export const fetchActivityGetThread = (
variables: ActivityGetThreadVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Thread,
ActivityGetThreadError,
undefined,
{},
{},
ActivityGetThreadPathParams
>({
url: '/notifications/threads/{threadId}',
method: 'get',
...variables,
signal,
});
export const useActivityGetThread = (
variables: ActivityGetThreadVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/notifications/threads/{thread_id}',
operationId: 'activityGetThread',
variables,
}),
({ signal }) =>
fetchActivityGetThread({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ActivityMarkThreadAsReadPathParams = {
/**
* thread_id parameter
*/
threadId: number;
};
export type ActivityMarkThreadAsReadError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivityMarkThreadAsReadVariables = {
pathParams: ActivityMarkThreadAsReadPathParams;
} & GithubContext['fetcherOptions'];
export const fetchActivityMarkThreadAsRead = (
variables: ActivityMarkThreadAsReadVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActivityMarkThreadAsReadError,
undefined,
{},
{},
ActivityMarkThreadAsReadPathParams
>({
url: '/notifications/threads/{threadId}',
method: 'patch',
...variables,
signal,
});
export const useActivityMarkThreadAsRead = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActivityMarkThreadAsReadError,
ActivityMarkThreadAsReadVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActivityMarkThreadAsReadError,
ActivityMarkThreadAsReadVariables
>(
(variables: ActivityMarkThreadAsReadVariables) =>
fetchActivityMarkThreadAsRead({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActivityDeleteThreadSubscriptionPathParams = {
/**
* thread_id parameter
*/
threadId: number;
};
export type ActivityDeleteThreadSubscriptionError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivityDeleteThreadSubscriptionVariables = {
pathParams: ActivityDeleteThreadSubscriptionPathParams;
} & GithubContext['fetcherOptions'];
/**
* Mutes all future notifications for a conversation until you comment on the thread or get an **@mention**. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the [Set a thread subscription](https://docs.github.com/rest/reference/activity#set-a-thread-subscription) endpoint and set `ignore` to `true`.
*/
export const fetchActivityDeleteThreadSubscription = (
variables: ActivityDeleteThreadSubscriptionVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActivityDeleteThreadSubscriptionError,
undefined,
{},
{},
ActivityDeleteThreadSubscriptionPathParams
>({
url: '/notifications/threads/{threadId}/subscription',
method: 'delete',
...variables,
signal,
});
/**
* Mutes all future notifications for a conversation until you comment on the thread or get an **@mention**. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the [Set a thread subscription](https://docs.github.com/rest/reference/activity#set-a-thread-subscription) endpoint and set `ignore` to `true`.
*/
export const useActivityDeleteThreadSubscription = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActivityDeleteThreadSubscriptionError,
ActivityDeleteThreadSubscriptionVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActivityDeleteThreadSubscriptionError,
ActivityDeleteThreadSubscriptionVariables
>(
(variables: ActivityDeleteThreadSubscriptionVariables) =>
fetchActivityDeleteThreadSubscription({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActivityGetThreadSubscriptionForAuthenticatedUserPathParams = {
/**
* thread_id parameter
*/
threadId: number;
};
export type ActivityGetThreadSubscriptionForAuthenticatedUserError =
Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivityGetThreadSubscriptionForAuthenticatedUserVariables = {
pathParams: ActivityGetThreadSubscriptionForAuthenticatedUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription).
*
* Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread.
*/
export const fetchActivityGetThreadSubscriptionForAuthenticatedUser = (
variables: ActivityGetThreadSubscriptionForAuthenticatedUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ThreadSubscription,
ActivityGetThreadSubscriptionForAuthenticatedUserError,
undefined,
{},
{},
ActivityGetThreadSubscriptionForAuthenticatedUserPathParams
>({
url: '/notifications/threads/{threadId}/subscription',
method: 'get',
...variables,
signal,
});
/**
* This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription).
*
* Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread.
*/
export const useActivityGetThreadSubscriptionForAuthenticatedUser = <
TData = Schemas.ThreadSubscription,
>(
variables: ActivityGetThreadSubscriptionForAuthenticatedUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ThreadSubscription,
ActivityGetThreadSubscriptionForAuthenticatedUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ThreadSubscription,
ActivityGetThreadSubscriptionForAuthenticatedUserError,
TData
>(
queryKeyFn({
path: '/notifications/threads/{thread_id}/subscription',
operationId: 'activityGetThreadSubscriptionForAuthenticatedUser',
variables,
}),
({ signal }) =>
fetchActivityGetThreadSubscriptionForAuthenticatedUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActivitySetThreadSubscriptionPathParams = {
/**
* thread_id parameter
*/
threadId: number;
};
export type ActivitySetThreadSubscriptionError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ActivitySetThreadSubscriptionRequestBody = {
/**
* Whether to block all notifications from a thread.
*
* @default false
*/
ignored?: boolean;
};
export type ActivitySetThreadSubscriptionVariables = {
body?: ActivitySetThreadSubscriptionRequestBody;
pathParams: ActivitySetThreadSubscriptionPathParams;
} & GithubContext['fetcherOptions'];
/**
* If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**.
*
* You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.
*
* Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint.
*/
export const fetchActivitySetThreadSubscription = (
variables: ActivitySetThreadSubscriptionVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ThreadSubscription,
ActivitySetThreadSubscriptionError,
ActivitySetThreadSubscriptionRequestBody,
{},
{},
ActivitySetThreadSubscriptionPathParams
>({
url: '/notifications/threads/{threadId}/subscription',
method: 'put',
...variables,
signal,
});
/**
* If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**.
*
* You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.
*
* Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint.
*/
export const useActivitySetThreadSubscription = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ThreadSubscription,
ActivitySetThreadSubscriptionError,
ActivitySetThreadSubscriptionVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ThreadSubscription,
ActivitySetThreadSubscriptionError,
ActivitySetThreadSubscriptionVariables
>(
(variables: ActivitySetThreadSubscriptionVariables) =>
fetchActivitySetThreadSubscription({ ...fetcherOptions, ...variables }),
options,
);
};
export type MetaGetOctocatQueryParams = {
/**
* The words to show in Octocat's speech bubble
*/
s?: string;
};
export type MetaGetOctocatError = Fetcher.ErrorWrapper;
export type MetaGetOctocatVariables = {
queryParams?: MetaGetOctocatQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Get the octocat as ASCII art
*/
export const fetchMetaGetOctocat = (
variables: MetaGetOctocatVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
MetaGetOctocatError,
undefined,
{},
MetaGetOctocatQueryParams,
{}
>({ url: '/octocat', method: 'get', ...variables, signal });
/**
* Get the octocat as ASCII art
*/
export const useMetaGetOctocat = (
variables: MetaGetOctocatVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/octocat', operationId: 'metaGetOctocat', variables }),
({ signal }) =>
fetchMetaGetOctocat({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsListQueryParams = {
/**
* An organization ID. Only return organizations with an ID greater than this ID.
*/
since?: number;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
};
export type OrgsListError = Fetcher.ErrorWrapper<{
status: 304;
payload: Responses.NotModified;
}>;
export type OrgsListResponse = Schemas.OrganizationSimple[];
export type OrgsListVariables = {
queryParams?: OrgsListQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all organizations, in the order that they were created on GitHub.
*
* **Note:** Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations.
*/
export const fetchOrgsList = (
variables: OrgsListVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListResponse,
OrgsListError,
undefined,
{},
OrgsListQueryParams,
{}
>({ url: '/organizations', method: 'get', ...variables, signal });
/**
* Lists all organizations, in the order that they were created on GitHub.
*
* **Note:** Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations.
*/
export const useOrgsList = (
variables: OrgsListVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/organizations', operationId: 'orgsList', variables }),
({ signal }) => fetchOrgsList({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsGetPathParams = {
org: string;
};
export type OrgsGetError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsGetVariables = {
pathParams: OrgsGetPathParams;
} & GithubContext['fetcherOptions'];
/**
* To see many of the organization response values, you need to be an authenticated organization owner with the `admin:org` scope. When the value of `two_factor_requirement_enabled` is `true`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/).
*
* GitHub Apps with the `Organization plan` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below."
*/
export const fetchOrgsGet = (
variables: OrgsGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrganizationFull,
OrgsGetError,
undefined,
{},
{},
OrgsGetPathParams
>({ url: '/orgs/{org}', method: 'get', ...variables, signal });
/**
* To see many of the organization response values, you need to be an authenticated organization owner with the `admin:org` scope. When the value of `two_factor_requirement_enabled` is `true`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/).
*
* GitHub Apps with the `Organization plan` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below."
*/
export const useOrgsGet = (
variables: OrgsGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({ path: '/orgs/{org}', operationId: 'orgsGet', variables }),
({ signal }) => fetchOrgsGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsUpdatePathParams = {
org: string;
};
export type OrgsUpdateError = Fetcher.ErrorWrapper<
| {
status: 409;
payload: Responses.Conflict;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Schemas.ValidationError | Schemas.ValidationErrorSimple;
}
>;
export type OrgsUpdateRequestBody = {
/**
* Billing email address. This address is not publicized.
*/
billing_email?: string;
/**
* @example "http://github.blog"
*/
blog?: string;
/**
* The company name.
*/
company?: string;
/**
* Default permission level members have for organization repositories:
* \* `read` - can pull, but not push to or administer this repository.
* \* `write` - can pull and push, but not administer this repository.
* \* `admin` - can pull, push, and administer this repository.
* \* `none` - no permissions granted by default.
*
* @default read
*/
default_repository_permission?: 'read' | 'write' | 'admin' | 'none';
/**
* The description of the company.
*/
description?: string;
/**
* The publicly visible email address.
*/
email?: string;
/**
* Toggles whether an organization can use organization projects.
*/
has_organization_projects?: boolean;
/**
* Toggles whether repositories that belong to the organization can use repository projects.
*/
has_repository_projects?: boolean;
/**
* The location.
*/
location?: string;
/**
* Specifies which types of repositories non-admin organization members can create. Can be one of:
* \* `all` - all organization members can create public and private repositories.
* \* `private` - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud.
* \* `none` - only admin members can create repositories.
* **Note:** This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in `members_can_create_repositories`. See the parameter deprecation notice in the operation description for details.
*/
members_allowed_repository_creation_type?: 'all' | 'private' | 'none';
/**
* Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. Can be one of:
* \* `true` - all organization members can create internal repositories.
* \* `false` - only organization owners can create internal repositories.
* Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation.
*/
members_can_create_internal_repositories?: boolean;
/**
* Toggles whether organization members can create GitHub Pages sites. Can be one of:
* \* `true` - all organization members can create GitHub Pages sites.
* \* `false` - no organization members can create GitHub Pages sites. Existing published sites will not be impacted.
*
* @default true
*/
members_can_create_pages?: boolean;
/**
* Toggles whether organization members can create private GitHub Pages sites. Can be one of:
* \* `true` - all organization members can create private GitHub Pages sites.
* \* `false` - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted.
*
* @default true
*/
members_can_create_private_pages?: boolean;
/**
* Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of:
* \* `true` - all organization members can create private repositories.
* \* `false` - only organization owners can create private repositories.
* Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation.
*/
members_can_create_private_repositories?: boolean;
/**
* Toggles whether organization members can create public GitHub Pages sites. Can be one of:
* \* `true` - all organization members can create public GitHub Pages sites.
* \* `false` - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted.
*
* @default true
*/
members_can_create_public_pages?: boolean;
/**
* Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of:
* \* `true` - all organization members can create public repositories.
* \* `false` - only organization owners can create public repositories.
* Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation.
*/
members_can_create_public_repositories?: boolean;
/**
* Toggles the ability of non-admin organization members to create repositories. Can be one of:
* \* `true` - all organization members can create repositories.
* \* `false` - only organization owners can create repositories.
* Default: `true`
* **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details. **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details.
*
* @default true
*/
members_can_create_repositories?: boolean;
/**
* The shorthand name of the company.
*/
name?: string;
/**
* The Twitter username of the company.
*/
twitter_username?: string;
};
export type OrgsUpdateVariables = {
body?: OrgsUpdateRequestBody;
pathParams: OrgsUpdatePathParams;
} & GithubContext['fetcherOptions'];
/**
* **Parameter Deprecation Notice:** GitHub will replace and discontinue `members_allowed_repository_creation_type` in favor of more granular permissions. The new input parameters are `members_can_create_public_repositories`, `members_can_create_private_repositories` for all organizations and `members_can_create_internal_repositories` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes).
*
* Enables an authenticated organization owner with the `admin:org` scope to update the organization's profile and member privileges.
*/
export const fetchOrgsUpdate = (
variables: OrgsUpdateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrganizationFull,
OrgsUpdateError,
OrgsUpdateRequestBody,
{},
{},
OrgsUpdatePathParams
>({ url: '/orgs/{org}', method: 'patch', ...variables, signal });
/**
* **Parameter Deprecation Notice:** GitHub will replace and discontinue `members_allowed_repository_creation_type` in favor of more granular permissions. The new input parameters are `members_can_create_public_repositories`, `members_can_create_private_repositories` for all organizations and `members_can_create_internal_repositories` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes).
*
* Enables an authenticated organization owner with the `admin:org` scope to update the organization's profile and member privileges.
*/
export const useOrgsUpdate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.OrganizationFull,
OrgsUpdateError,
OrgsUpdateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.OrganizationFull,
OrgsUpdateError,
OrgsUpdateVariables
>(
(variables: OrgsUpdateVariables) =>
fetchOrgsUpdate({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActionsGetGithubActionsPermissionsOrganizationPathParams = {
org: string;
};
export type ActionsGetGithubActionsPermissionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsGetGithubActionsPermissionsOrganizationVariables = {
pathParams: ActionsGetGithubActionsPermissionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsGetGithubActionsPermissionsOrganization = (
variables: ActionsGetGithubActionsPermissionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ActionsOrganizationPermissions,
ActionsGetGithubActionsPermissionsOrganizationError,
undefined,
{},
{},
ActionsGetGithubActionsPermissionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions',
method: 'get',
...variables,
signal,
});
/**
* Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsGetGithubActionsPermissionsOrganization = <
TData = Schemas.ActionsOrganizationPermissions,
>(
variables: ActionsGetGithubActionsPermissionsOrganizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ActionsOrganizationPermissions,
ActionsGetGithubActionsPermissionsOrganizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ActionsOrganizationPermissions,
ActionsGetGithubActionsPermissionsOrganizationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/permissions',
operationId: 'actionsGetGithubActionsPermissionsOrganization',
variables,
}),
({ signal }) =>
fetchActionsGetGithubActionsPermissionsOrganization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetGithubActionsPermissionsOrganizationPathParams = {
org: string;
};
export type ActionsSetGithubActionsPermissionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsSetGithubActionsPermissionsOrganizationRequestBody = {
allowed_actions?: Schemas.AllowedActions;
enabled_repositories: Schemas.EnabledRepositories;
};
export type ActionsSetGithubActionsPermissionsOrganizationVariables = {
body: ActionsSetGithubActionsPermissionsOrganizationRequestBody;
pathParams: ActionsSetGithubActionsPermissionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization.
*
* If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as `allowed_actions` to `selected` actions, then you cannot override them for the organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsSetGithubActionsPermissionsOrganization = (
variables: ActionsSetGithubActionsPermissionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetGithubActionsPermissionsOrganizationError,
ActionsSetGithubActionsPermissionsOrganizationRequestBody,
{},
{},
ActionsSetGithubActionsPermissionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions',
method: 'put',
...variables,
signal,
});
/**
* Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization.
*
* If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as `allowed_actions` to `selected` actions, then you cannot override them for the organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsSetGithubActionsPermissionsOrganization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetGithubActionsPermissionsOrganizationError,
ActionsSetGithubActionsPermissionsOrganizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetGithubActionsPermissionsOrganizationError,
ActionsSetGithubActionsPermissionsOrganizationVariables
>(
(variables: ActionsSetGithubActionsPermissionsOrganizationVariables) =>
fetchActionsSetGithubActionsPermissionsOrganization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationPathParams =
{
org: string;
};
export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQueryParams =
{
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse =
{
repositories: Schemas.Repository[];
total_count: number;
};
export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationVariables =
{
pathParams: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationPathParams;
queryParams?: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsListSelectedRepositoriesEnabledGithubActionsOrganization =
(
variables: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse,
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError,
undefined,
{},
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQueryParams,
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/repositories',
method: 'get',
...variables,
signal,
});
/**
* Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsListSelectedRepositoriesEnabledGithubActionsOrganization =
<
TData = ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse,
>(
variables: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse,
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse,
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/permissions/repositories',
operationId:
'actionsListSelectedRepositoriesEnabledGithubActionsOrganization',
variables,
}),
({ signal }) =>
fetchActionsListSelectedRepositoriesEnabledGithubActionsOrganization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPathParams =
{
org: string;
};
export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBody =
{
/**
* List of repository IDs to enable for GitHub Actions.
*/
selected_repository_ids: number[];
};
export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationVariables =
{
body: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBody;
pathParams: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsSetSelectedRepositoriesEnabledGithubActionsOrganization =
(
variables: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBody,
{},
{},
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/repositories',
method: 'put',
...variables,
signal,
});
/**
* Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsSetSelectedRepositoriesEnabledGithubActionsOrganization =
(
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError,
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationVariables
>(
(
variables: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationVariables,
) =>
fetchActionsSetSelectedRepositoriesEnabledGithubActionsOrganization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsDisableSelectedRepositoryGithubActionsOrganizationPathParams =
{
org: string;
repositoryId: number;
};
export type ActionsDisableSelectedRepositoryGithubActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsDisableSelectedRepositoryGithubActionsOrganizationVariables =
{
pathParams: ActionsDisableSelectedRepositoryGithubActionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsDisableSelectedRepositoryGithubActionsOrganization = (
variables: ActionsDisableSelectedRepositoryGithubActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsDisableSelectedRepositoryGithubActionsOrganizationError,
undefined,
{},
{},
ActionsDisableSelectedRepositoryGithubActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/repositories/{repositoryId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsDisableSelectedRepositoryGithubActionsOrganization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsDisableSelectedRepositoryGithubActionsOrganizationError,
ActionsDisableSelectedRepositoryGithubActionsOrganizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsDisableSelectedRepositoryGithubActionsOrganizationError,
ActionsDisableSelectedRepositoryGithubActionsOrganizationVariables
>(
(
variables: ActionsDisableSelectedRepositoryGithubActionsOrganizationVariables,
) =>
fetchActionsDisableSelectedRepositoryGithubActionsOrganization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsEnableSelectedRepositoryGithubActionsOrganizationPathParams =
{
org: string;
repositoryId: number;
};
export type ActionsEnableSelectedRepositoryGithubActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsEnableSelectedRepositoryGithubActionsOrganizationVariables =
{
pathParams: ActionsEnableSelectedRepositoryGithubActionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsEnableSelectedRepositoryGithubActionsOrganization = (
variables: ActionsEnableSelectedRepositoryGithubActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsEnableSelectedRepositoryGithubActionsOrganizationError,
undefined,
{},
{},
ActionsEnableSelectedRepositoryGithubActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/repositories/{repositoryId}',
method: 'put',
...variables,
signal,
});
/**
* Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsEnableSelectedRepositoryGithubActionsOrganization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsEnableSelectedRepositoryGithubActionsOrganizationError,
ActionsEnableSelectedRepositoryGithubActionsOrganizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsEnableSelectedRepositoryGithubActionsOrganizationError,
ActionsEnableSelectedRepositoryGithubActionsOrganizationVariables
>(
(
variables: ActionsEnableSelectedRepositoryGithubActionsOrganizationVariables,
) =>
fetchActionsEnableSelectedRepositoryGithubActionsOrganization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsGetAllowedActionsOrganizationPathParams = {
org: string;
};
export type ActionsGetAllowedActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsGetAllowedActionsOrganizationVariables = {
pathParams: ActionsGetAllowedActionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization).""
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsGetAllowedActionsOrganization = (
variables: ActionsGetAllowedActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.SelectedActions,
ActionsGetAllowedActionsOrganizationError,
undefined,
{},
{},
ActionsGetAllowedActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/selected-actions',
method: 'get',
...variables,
signal,
});
/**
* Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization).""
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsGetAllowedActionsOrganization = <
TData = Schemas.SelectedActions,
>(
variables: ActionsGetAllowedActionsOrganizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.SelectedActions,
ActionsGetAllowedActionsOrganizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.SelectedActions,
ActionsGetAllowedActionsOrganizationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/permissions/selected-actions',
operationId: 'actionsGetAllowedActionsOrganization',
variables,
}),
({ signal }) =>
fetchActionsGetAllowedActionsOrganization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetAllowedActionsOrganizationPathParams = {
org: string;
};
export type ActionsSetAllowedActionsOrganizationError =
Fetcher.ErrorWrapper;
export type ActionsSetAllowedActionsOrganizationVariables = {
body: Schemas.SelectedActions;
pathParams: ActionsSetAllowedActionsOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* If the organization belongs to an enterprise that has `selected` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings.
*
* To use the `patterns_allowed` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the `patterns_allowed` setting only applies to public repositories in the organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const fetchActionsSetAllowedActionsOrganization = (
variables: ActionsSetAllowedActionsOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetAllowedActionsOrganizationError,
Schemas.SelectedActions,
{},
{},
ActionsSetAllowedActionsOrganizationPathParams
>({
url: '/orgs/{org}/actions/permissions/selected-actions',
method: 'put',
...variables,
signal,
});
/**
* Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
*
* If the organization belongs to an enterprise that has `selected` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings.
*
* To use the `patterns_allowed` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the `patterns_allowed` setting only applies to public repositories in the organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API.
*/
export const useActionsSetAllowedActionsOrganization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetAllowedActionsOrganizationError,
ActionsSetAllowedActionsOrganizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetAllowedActionsOrganizationError,
ActionsSetAllowedActionsOrganizationVariables
>(
(variables: ActionsSetAllowedActionsOrganizationVariables) =>
fetchActionsSetAllowedActionsOrganization({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsListSelfHostedRunnerGroupsForOrgPathParams = {
org: string;
};
export type ActionsListSelfHostedRunnerGroupsForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListSelfHostedRunnerGroupsForOrgError =
Fetcher.ErrorWrapper;
export type ActionsListSelfHostedRunnerGroupsForOrgResponse = {
runner_groups: Schemas.RunnerGroupsOrg[];
total_count: number;
};
export type ActionsListSelfHostedRunnerGroupsForOrgVariables = {
pathParams: ActionsListSelfHostedRunnerGroupsForOrgPathParams;
queryParams?: ActionsListSelfHostedRunnerGroupsForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists all self-hosted runner groups configured in an organization and inherited from an enterprise.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsListSelfHostedRunnerGroupsForOrg = (
variables: ActionsListSelfHostedRunnerGroupsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListSelfHostedRunnerGroupsForOrgResponse,
ActionsListSelfHostedRunnerGroupsForOrgError,
undefined,
{},
ActionsListSelfHostedRunnerGroupsForOrgQueryParams,
ActionsListSelfHostedRunnerGroupsForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups',
method: 'get',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists all self-hosted runner groups configured in an organization and inherited from an enterprise.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsListSelfHostedRunnerGroupsForOrg = <
TData = ActionsListSelfHostedRunnerGroupsForOrgResponse,
>(
variables: ActionsListSelfHostedRunnerGroupsForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListSelfHostedRunnerGroupsForOrgResponse,
ActionsListSelfHostedRunnerGroupsForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListSelfHostedRunnerGroupsForOrgResponse,
ActionsListSelfHostedRunnerGroupsForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runner-groups',
operationId: 'actionsListSelfHostedRunnerGroupsForOrg',
variables,
}),
({ signal }) =>
fetchActionsListSelfHostedRunnerGroupsForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsCreateSelfHostedRunnerGroupForOrgPathParams = {
org: string;
};
export type ActionsCreateSelfHostedRunnerGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsCreateSelfHostedRunnerGroupForOrgRequestBody = {
/**
* Name of the runner group.
*/
name: string;
/**
* List of runner IDs to add to the runner group.
*/
runners?: number[];
/**
* List of repository IDs that can access the runner group.
*/
selected_repository_ids?: number[];
/**
* Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories. Can be one of: `all`, `selected`, or `private`.
*
* @default all
*/
visibility?: 'selected' | 'all' | 'private';
};
export type ActionsCreateSelfHostedRunnerGroupForOrgVariables = {
body: ActionsCreateSelfHostedRunnerGroupForOrgRequestBody;
pathParams: ActionsCreateSelfHostedRunnerGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Creates a new self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsCreateSelfHostedRunnerGroupForOrg = (
variables: ActionsCreateSelfHostedRunnerGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsOrg,
ActionsCreateSelfHostedRunnerGroupForOrgError,
ActionsCreateSelfHostedRunnerGroupForOrgRequestBody,
{},
{},
ActionsCreateSelfHostedRunnerGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups',
method: 'post',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Creates a new self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsCreateSelfHostedRunnerGroupForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.RunnerGroupsOrg,
ActionsCreateSelfHostedRunnerGroupForOrgError,
ActionsCreateSelfHostedRunnerGroupForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.RunnerGroupsOrg,
ActionsCreateSelfHostedRunnerGroupForOrgError,
ActionsCreateSelfHostedRunnerGroupForOrgVariables
>(
(variables: ActionsCreateSelfHostedRunnerGroupForOrgVariables) =>
fetchActionsCreateSelfHostedRunnerGroupForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsDeleteSelfHostedRunnerGroupFromOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsDeleteSelfHostedRunnerGroupFromOrgError =
Fetcher.ErrorWrapper;
export type ActionsDeleteSelfHostedRunnerGroupFromOrgVariables = {
pathParams: ActionsDeleteSelfHostedRunnerGroupFromOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Deletes a self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsDeleteSelfHostedRunnerGroupFromOrg = (
variables: ActionsDeleteSelfHostedRunnerGroupFromOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsDeleteSelfHostedRunnerGroupFromOrgError,
undefined,
{},
{},
ActionsDeleteSelfHostedRunnerGroupFromOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}',
method: 'delete',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Deletes a self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsDeleteSelfHostedRunnerGroupFromOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsDeleteSelfHostedRunnerGroupFromOrgError,
ActionsDeleteSelfHostedRunnerGroupFromOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsDeleteSelfHostedRunnerGroupFromOrgError,
ActionsDeleteSelfHostedRunnerGroupFromOrgVariables
>(
(variables: ActionsDeleteSelfHostedRunnerGroupFromOrgVariables) =>
fetchActionsDeleteSelfHostedRunnerGroupFromOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsGetSelfHostedRunnerGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsGetSelfHostedRunnerGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsGetSelfHostedRunnerGroupForOrgVariables = {
pathParams: ActionsGetSelfHostedRunnerGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Gets a specific self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsGetSelfHostedRunnerGroupForOrg = (
variables: ActionsGetSelfHostedRunnerGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsOrg,
ActionsGetSelfHostedRunnerGroupForOrgError,
undefined,
{},
{},
ActionsGetSelfHostedRunnerGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}',
method: 'get',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Gets a specific self-hosted runner group for an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsGetSelfHostedRunnerGroupForOrg = <
TData = Schemas.RunnerGroupsOrg,
>(
variables: ActionsGetSelfHostedRunnerGroupForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.RunnerGroupsOrg,
ActionsGetSelfHostedRunnerGroupForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.RunnerGroupsOrg,
ActionsGetSelfHostedRunnerGroupForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runner-groups/{runner_group_id}',
operationId: 'actionsGetSelfHostedRunnerGroupForOrg',
variables,
}),
({ signal }) =>
fetchActionsGetSelfHostedRunnerGroupForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsUpdateSelfHostedRunnerGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsUpdateSelfHostedRunnerGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsUpdateSelfHostedRunnerGroupForOrgRequestBody = {
/**
* Name of the runner group.
*/
name?: string;
/**
* Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories. Can be one of: `all`, `selected`, or `private`.
*/
visibility?: 'selected' | 'all' | 'private';
};
export type ActionsUpdateSelfHostedRunnerGroupForOrgVariables = {
body?: ActionsUpdateSelfHostedRunnerGroupForOrgRequestBody;
pathParams: ActionsUpdateSelfHostedRunnerGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Updates the `name` and `visibility` of a self-hosted runner group in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsUpdateSelfHostedRunnerGroupForOrg = (
variables: ActionsUpdateSelfHostedRunnerGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RunnerGroupsOrg,
ActionsUpdateSelfHostedRunnerGroupForOrgError,
ActionsUpdateSelfHostedRunnerGroupForOrgRequestBody,
{},
{},
ActionsUpdateSelfHostedRunnerGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}',
method: 'patch',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Updates the `name` and `visibility` of a self-hosted runner group in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsUpdateSelfHostedRunnerGroupForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.RunnerGroupsOrg,
ActionsUpdateSelfHostedRunnerGroupForOrgError,
ActionsUpdateSelfHostedRunnerGroupForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.RunnerGroupsOrg,
ActionsUpdateSelfHostedRunnerGroupForOrgError,
ActionsUpdateSelfHostedRunnerGroupForOrgVariables
>(
(variables: ActionsUpdateSelfHostedRunnerGroupForOrgVariables) =>
fetchActionsUpdateSelfHostedRunnerGroupForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQueryParams = {
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
};
export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError =
Fetcher.ErrorWrapper;
export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse = {
repositories: Schemas.Repository[];
total_count: number;
};
export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgVariables = {
pathParams: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgPathParams;
queryParams?: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists the repositories with access to a self-hosted runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsListRepoAccessToSelfHostedRunnerGroupInOrg = (
variables: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse,
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError,
undefined,
{},
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQueryParams,
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/repositories',
method: 'get',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists the repositories with access to a self-hosted runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsListRepoAccessToSelfHostedRunnerGroupInOrg = <
TData = ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse,
>(
variables: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse,
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse,
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories',
operationId: 'actionsListRepoAccessToSelfHostedRunnerGroupInOrg',
variables,
}),
({ signal }) =>
fetchActionsListRepoAccessToSelfHostedRunnerGroupInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError =
Fetcher.ErrorWrapper;
export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBody = {
/**
* List of repository IDs that can access the runner group.
*/
selected_repository_ids: number[];
};
export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgVariables = {
body: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBody;
pathParams: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Replaces the list of repositories that have access to a self-hosted runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsSetRepoAccessToSelfHostedRunnerGroupInOrg = (
variables: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBody,
{},
{},
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/repositories',
method: 'put',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Replaces the list of repositories that have access to a self-hosted runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsSetRepoAccessToSelfHostedRunnerGroupInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgVariables
>(
(variables: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgVariables) =>
fetchActionsSetRepoAccessToSelfHostedRunnerGroupInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
repositoryId: number;
};
export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError =
Fetcher.ErrorWrapper;
export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgVariables = {
pathParams: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg = (
variables: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError,
undefined,
{},
{},
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/repositories/{repositoryId}',
method: 'delete',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgVariables
>(
(variables: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgVariables) =>
fetchActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
repositoryId: number;
};
export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError =
Fetcher.ErrorWrapper;
export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgVariables = {
pathParams: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org`
* scope to use this endpoint.
*/
export const fetchActionsAddRepoAccessToSelfHostedRunnerGroupInOrg = (
variables: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError,
undefined,
{},
{},
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/repositories/{repositoryId}',
method: 'put',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
*
* You must authenticate using an access token with the `admin:org`
* scope to use this endpoint.
*/
export const useActionsAddRepoAccessToSelfHostedRunnerGroupInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError,
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgVariables
>(
(variables: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgVariables) =>
fetchActionsAddRepoAccessToSelfHostedRunnerGroupInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsListSelfHostedRunnersInGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsListSelfHostedRunnersInGroupForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListSelfHostedRunnersInGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsListSelfHostedRunnersInGroupForOrgResponse = {
runners: Schemas.Runner[];
total_count: number;
};
export type ActionsListSelfHostedRunnersInGroupForOrgVariables = {
pathParams: ActionsListSelfHostedRunnersInGroupForOrgPathParams;
queryParams?: ActionsListSelfHostedRunnersInGroupForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists self-hosted runners that are in a specific organization group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsListSelfHostedRunnersInGroupForOrg = (
variables: ActionsListSelfHostedRunnersInGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListSelfHostedRunnersInGroupForOrgResponse,
ActionsListSelfHostedRunnersInGroupForOrgError,
undefined,
{},
ActionsListSelfHostedRunnersInGroupForOrgQueryParams,
ActionsListSelfHostedRunnersInGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/runners',
method: 'get',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Lists self-hosted runners that are in a specific organization group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsListSelfHostedRunnersInGroupForOrg = <
TData = ActionsListSelfHostedRunnersInGroupForOrgResponse,
>(
variables: ActionsListSelfHostedRunnersInGroupForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListSelfHostedRunnersInGroupForOrgResponse,
ActionsListSelfHostedRunnersInGroupForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListSelfHostedRunnersInGroupForOrgResponse,
ActionsListSelfHostedRunnersInGroupForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runner-groups/{runner_group_id}/runners',
operationId: 'actionsListSelfHostedRunnersInGroupForOrg',
variables,
}),
({ signal }) =>
fetchActionsListSelfHostedRunnersInGroupForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetSelfHostedRunnersInGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
};
export type ActionsSetSelfHostedRunnersInGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsSetSelfHostedRunnersInGroupForOrgRequestBody = {
/**
* List of runner IDs to add to the runner group.
*/
runners: number[];
};
export type ActionsSetSelfHostedRunnersInGroupForOrgVariables = {
body: ActionsSetSelfHostedRunnersInGroupForOrgRequestBody;
pathParams: ActionsSetSelfHostedRunnersInGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Replaces the list of self-hosted runners that are part of an organization runner group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsSetSelfHostedRunnersInGroupForOrg = (
variables: ActionsSetSelfHostedRunnersInGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetSelfHostedRunnersInGroupForOrgError,
ActionsSetSelfHostedRunnersInGroupForOrgRequestBody,
{},
{},
ActionsSetSelfHostedRunnersInGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/runners',
method: 'put',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
* Replaces the list of self-hosted runners that are part of an organization runner group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsSetSelfHostedRunnersInGroupForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetSelfHostedRunnersInGroupForOrgError,
ActionsSetSelfHostedRunnersInGroupForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetSelfHostedRunnersInGroupForOrgError,
ActionsSetSelfHostedRunnersInGroupForOrgVariables
>(
(variables: ActionsSetSelfHostedRunnersInGroupForOrgVariables) =>
fetchActionsSetSelfHostedRunnersInGroupForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsRemoveSelfHostedRunnerFromGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type ActionsRemoveSelfHostedRunnerFromGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsRemoveSelfHostedRunnerFromGroupForOrgVariables = {
pathParams: ActionsRemoveSelfHostedRunnerFromGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsRemoveSelfHostedRunnerFromGroupForOrg = (
variables: ActionsRemoveSelfHostedRunnerFromGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsRemoveSelfHostedRunnerFromGroupForOrgError,
undefined,
{},
{},
ActionsRemoveSelfHostedRunnerFromGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/runners/{runnerId}',
method: 'delete',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsRemoveSelfHostedRunnerFromGroupForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsRemoveSelfHostedRunnerFromGroupForOrgError,
ActionsRemoveSelfHostedRunnerFromGroupForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsRemoveSelfHostedRunnerFromGroupForOrgError,
ActionsRemoveSelfHostedRunnerFromGroupForOrgVariables
>(
(variables: ActionsRemoveSelfHostedRunnerFromGroupForOrgVariables) =>
fetchActionsRemoveSelfHostedRunnerFromGroupForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsAddSelfHostedRunnerToGroupForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner group.
*/
runnerGroupId: number;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type ActionsAddSelfHostedRunnerToGroupForOrgError =
Fetcher.ErrorWrapper;
export type ActionsAddSelfHostedRunnerToGroupForOrgVariables = {
pathParams: ActionsAddSelfHostedRunnerToGroupForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Adds a self-hosted runner to a runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org`
* scope to use this endpoint.
*/
export const fetchActionsAddSelfHostedRunnerToGroupForOrg = (
variables: ActionsAddSelfHostedRunnerToGroupForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsAddSelfHostedRunnerToGroupForOrgError,
undefined,
{},
{},
ActionsAddSelfHostedRunnerToGroupForOrgPathParams
>({
url: '/orgs/{org}/actions/runner-groups/{runnerGroupId}/runners/{runnerId}',
method: 'put',
...variables,
signal,
});
/**
* The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)."
*
*
* Adds a self-hosted runner to a runner group configured in an organization.
*
* You must authenticate using an access token with the `admin:org`
* scope to use this endpoint.
*/
export const useActionsAddSelfHostedRunnerToGroupForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsAddSelfHostedRunnerToGroupForOrgError,
ActionsAddSelfHostedRunnerToGroupForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsAddSelfHostedRunnerToGroupForOrgError,
ActionsAddSelfHostedRunnerToGroupForOrgVariables
>(
(variables: ActionsAddSelfHostedRunnerToGroupForOrgVariables) =>
fetchActionsAddSelfHostedRunnerToGroupForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsListSelfHostedRunnersForOrgPathParams = {
org: string;
};
export type ActionsListSelfHostedRunnersForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListSelfHostedRunnersForOrgError =
Fetcher.ErrorWrapper;
export type ActionsListSelfHostedRunnersForOrgResponse = {
runners: Schemas.Runner[];
total_count: number;
};
export type ActionsListSelfHostedRunnersForOrgVariables = {
pathParams: ActionsListSelfHostedRunnersForOrgPathParams;
queryParams?: ActionsListSelfHostedRunnersForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all self-hosted runners configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsListSelfHostedRunnersForOrg = (
variables: ActionsListSelfHostedRunnersForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListSelfHostedRunnersForOrgResponse,
ActionsListSelfHostedRunnersForOrgError,
undefined,
{},
ActionsListSelfHostedRunnersForOrgQueryParams,
ActionsListSelfHostedRunnersForOrgPathParams
>({
url: '/orgs/{org}/actions/runners',
method: 'get',
...variables,
signal,
});
/**
* Lists all self-hosted runners configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsListSelfHostedRunnersForOrg = <
TData = ActionsListSelfHostedRunnersForOrgResponse,
>(
variables: ActionsListSelfHostedRunnersForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListSelfHostedRunnersForOrgResponse,
ActionsListSelfHostedRunnersForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListSelfHostedRunnersForOrgResponse,
ActionsListSelfHostedRunnersForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runners',
operationId: 'actionsListSelfHostedRunnersForOrg',
variables,
}),
({ signal }) =>
fetchActionsListSelfHostedRunnersForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsListRunnerApplicationsForOrgPathParams = {
org: string;
};
export type ActionsListRunnerApplicationsForOrgError =
Fetcher.ErrorWrapper;
export type ActionsListRunnerApplicationsForOrgResponse =
Schemas.RunnerApplication[];
export type ActionsListRunnerApplicationsForOrgVariables = {
pathParams: ActionsListRunnerApplicationsForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Lists binaries for the runner application that you can download and run.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsListRunnerApplicationsForOrg = (
variables: ActionsListRunnerApplicationsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListRunnerApplicationsForOrgResponse,
ActionsListRunnerApplicationsForOrgError,
undefined,
{},
{},
ActionsListRunnerApplicationsForOrgPathParams
>({
url: '/orgs/{org}/actions/runners/downloads',
method: 'get',
...variables,
signal,
});
/**
* Lists binaries for the runner application that you can download and run.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsListRunnerApplicationsForOrg = <
TData = ActionsListRunnerApplicationsForOrgResponse,
>(
variables: ActionsListRunnerApplicationsForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListRunnerApplicationsForOrgResponse,
ActionsListRunnerApplicationsForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListRunnerApplicationsForOrgResponse,
ActionsListRunnerApplicationsForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runners/downloads',
operationId: 'actionsListRunnerApplicationsForOrg',
variables,
}),
({ signal }) =>
fetchActionsListRunnerApplicationsForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsCreateRegistrationTokenForOrgPathParams = {
org: string;
};
export type ActionsCreateRegistrationTokenForOrgError =
Fetcher.ErrorWrapper;
export type ActionsCreateRegistrationTokenForOrgVariables = {
pathParams: ActionsCreateRegistrationTokenForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns a token that you can pass to the `config` script. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*
* #### Example using registration token
*
* Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
*
* ```
* ./config.sh --url https://github.com/octo-org --token TOKEN
* ```
*/
export const fetchActionsCreateRegistrationTokenForOrg = (
variables: ActionsCreateRegistrationTokenForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.AuthenticationToken,
ActionsCreateRegistrationTokenForOrgError,
undefined,
{},
{},
ActionsCreateRegistrationTokenForOrgPathParams
>({
url: '/orgs/{org}/actions/runners/registration-token',
method: 'post',
...variables,
signal,
});
/**
* Returns a token that you can pass to the `config` script. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*
* #### Example using registration token
*
* Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint.
*
* ```
* ./config.sh --url https://github.com/octo-org --token TOKEN
* ```
*/
export const useActionsCreateRegistrationTokenForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.AuthenticationToken,
ActionsCreateRegistrationTokenForOrgError,
ActionsCreateRegistrationTokenForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.AuthenticationToken,
ActionsCreateRegistrationTokenForOrgError,
ActionsCreateRegistrationTokenForOrgVariables
>(
(variables: ActionsCreateRegistrationTokenForOrgVariables) =>
fetchActionsCreateRegistrationTokenForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsCreateRemoveTokenForOrgPathParams = {
org: string;
};
export type ActionsCreateRemoveTokenForOrgError =
Fetcher.ErrorWrapper;
export type ActionsCreateRemoveTokenForOrgVariables = {
pathParams: ActionsCreateRemoveTokenForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*
* #### Example using remove token
*
* To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
* endpoint.
*
* ```
* ./config.sh remove --token TOKEN
* ```
*/
export const fetchActionsCreateRemoveTokenForOrg = (
variables: ActionsCreateRemoveTokenForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.AuthenticationToken,
ActionsCreateRemoveTokenForOrgError,
undefined,
{},
{},
ActionsCreateRemoveTokenForOrgPathParams
>({
url: '/orgs/{org}/actions/runners/remove-token',
method: 'post',
...variables,
signal,
});
/**
* Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*
* #### Example using remove token
*
* To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this
* endpoint.
*
* ```
* ./config.sh remove --token TOKEN
* ```
*/
export const useActionsCreateRemoveTokenForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.AuthenticationToken,
ActionsCreateRemoveTokenForOrgError,
ActionsCreateRemoveTokenForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.AuthenticationToken,
ActionsCreateRemoveTokenForOrgError,
ActionsCreateRemoveTokenForOrgVariables
>(
(variables: ActionsCreateRemoveTokenForOrgVariables) =>
fetchActionsCreateRemoveTokenForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActionsDeleteSelfHostedRunnerFromOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type ActionsDeleteSelfHostedRunnerFromOrgError =
Fetcher.ErrorWrapper;
export type ActionsDeleteSelfHostedRunnerFromOrgVariables = {
pathParams: ActionsDeleteSelfHostedRunnerFromOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsDeleteSelfHostedRunnerFromOrg = (
variables: ActionsDeleteSelfHostedRunnerFromOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsDeleteSelfHostedRunnerFromOrgError,
undefined,
{},
{},
ActionsDeleteSelfHostedRunnerFromOrgPathParams
>({
url: '/orgs/{org}/actions/runners/{runnerId}',
method: 'delete',
...variables,
signal,
});
/**
* Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsDeleteSelfHostedRunnerFromOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsDeleteSelfHostedRunnerFromOrgError,
ActionsDeleteSelfHostedRunnerFromOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsDeleteSelfHostedRunnerFromOrgError,
ActionsDeleteSelfHostedRunnerFromOrgVariables
>(
(variables: ActionsDeleteSelfHostedRunnerFromOrgVariables) =>
fetchActionsDeleteSelfHostedRunnerFromOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsGetSelfHostedRunnerForOrgPathParams = {
org: string;
/**
* Unique identifier of the self-hosted runner.
*/
runnerId: number;
};
export type ActionsGetSelfHostedRunnerForOrgError =
Fetcher.ErrorWrapper;
export type ActionsGetSelfHostedRunnerForOrgVariables = {
pathParams: ActionsGetSelfHostedRunnerForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a specific self-hosted runner configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const fetchActionsGetSelfHostedRunnerForOrg = (
variables: ActionsGetSelfHostedRunnerForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Runner,
ActionsGetSelfHostedRunnerForOrgError,
undefined,
{},
{},
ActionsGetSelfHostedRunnerForOrgPathParams
>({
url: '/orgs/{org}/actions/runners/{runnerId}',
method: 'get',
...variables,
signal,
});
/**
* Gets a specific self-hosted runner configured in an organization.
*
* You must authenticate using an access token with the `admin:org` scope to use this endpoint.
*/
export const useActionsGetSelfHostedRunnerForOrg = (
variables: ActionsGetSelfHostedRunnerForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Runner,
ActionsGetSelfHostedRunnerForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Runner,
ActionsGetSelfHostedRunnerForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/runners/{runner_id}',
operationId: 'actionsGetSelfHostedRunnerForOrg',
variables,
}),
({ signal }) =>
fetchActionsGetSelfHostedRunnerForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsListOrgSecretsPathParams = {
org: string;
};
export type ActionsListOrgSecretsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListOrgSecretsError = Fetcher.ErrorWrapper;
export type ActionsListOrgSecretsResponse = {
secrets: Schemas.OrganizationActionsSecret[];
total_count: number;
};
export type ActionsListOrgSecretsVariables = {
pathParams: ActionsListOrgSecretsPathParams;
queryParams?: ActionsListOrgSecretsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsListOrgSecrets = (
variables: ActionsListOrgSecretsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListOrgSecretsResponse,
ActionsListOrgSecretsError,
undefined,
{},
ActionsListOrgSecretsQueryParams,
ActionsListOrgSecretsPathParams
>({
url: '/orgs/{org}/actions/secrets',
method: 'get',
...variables,
signal,
});
/**
* Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsListOrgSecrets = (
variables: ActionsListOrgSecretsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListOrgSecretsResponse,
ActionsListOrgSecretsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListOrgSecretsResponse,
ActionsListOrgSecretsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/secrets',
operationId: 'actionsListOrgSecrets',
variables,
}),
({ signal }) =>
fetchActionsListOrgSecrets({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ActionsGetOrgPublicKeyPathParams = {
org: string;
};
export type ActionsGetOrgPublicKeyError = Fetcher.ErrorWrapper;
export type ActionsGetOrgPublicKeyVariables = {
pathParams: ActionsGetOrgPublicKeyPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsGetOrgPublicKey = (
variables: ActionsGetOrgPublicKeyVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ActionsPublicKey,
ActionsGetOrgPublicKeyError,
undefined,
{},
{},
ActionsGetOrgPublicKeyPathParams
>({
url: '/orgs/{org}/actions/secrets/public-key',
method: 'get',
...variables,
signal,
});
/**
* Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsGetOrgPublicKey = (
variables: ActionsGetOrgPublicKeyVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ActionsPublicKey,
ActionsGetOrgPublicKeyError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ActionsPublicKey,
ActionsGetOrgPublicKeyError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/secrets/public-key',
operationId: 'actionsGetOrgPublicKey',
variables,
}),
({ signal }) =>
fetchActionsGetOrgPublicKey({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ActionsDeleteOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
};
export type ActionsDeleteOrgSecretError = Fetcher.ErrorWrapper;
export type ActionsDeleteOrgSecretVariables = {
pathParams: ActionsDeleteOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a secret in an organization using the secret name. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsDeleteOrgSecret = (
variables: ActionsDeleteOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsDeleteOrgSecretError,
undefined,
{},
{},
ActionsDeleteOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}',
method: 'delete',
...variables,
signal,
});
/**
* Deletes a secret in an organization using the secret name. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsDeleteOrgSecret = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsDeleteOrgSecretError,
ActionsDeleteOrgSecretVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsDeleteOrgSecretError,
ActionsDeleteOrgSecretVariables
>(
(variables: ActionsDeleteOrgSecretVariables) =>
fetchActionsDeleteOrgSecret({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActionsGetOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
};
export type ActionsGetOrgSecretError = Fetcher.ErrorWrapper;
export type ActionsGetOrgSecretVariables = {
pathParams: ActionsGetOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsGetOrgSecret = (
variables: ActionsGetOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrganizationActionsSecret,
ActionsGetOrgSecretError,
undefined,
{},
{},
ActionsGetOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}',
method: 'get',
...variables,
signal,
});
/**
* Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsGetOrgSecret = <
TData = Schemas.OrganizationActionsSecret,
>(
variables: ActionsGetOrgSecretVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.OrganizationActionsSecret,
ActionsGetOrgSecretError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.OrganizationActionsSecret,
ActionsGetOrgSecretError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/secrets/{secret_name}',
operationId: 'actionsGetOrgSecret',
variables,
}),
({ signal }) =>
fetchActionsGetOrgSecret({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ActionsCreateOrUpdateOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
};
export type ActionsCreateOrUpdateOrgSecretError =
Fetcher.ErrorWrapper;
export type ActionsCreateOrUpdateOrgSecretRequestBody = {
/**
* Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/rest/reference/actions#get-an-organization-public-key) endpoint.
*
* @pattern ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$
*/
encrypted_value?: string;
/**
* ID of the key you used to encrypt the secret.
*/
key_id?: string;
/**
* An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints.
*/
selected_repository_ids?: string[];
/**
* Configures the access that repositories have to the organization secret. Can be one of:
* \- `all` - All repositories in an organization can access the secret.
* \- `private` - Private repositories in an organization can access the secret.
* \- `selected` - Only specific repositories can access the secret.
*/
visibility?: 'all' | 'private' | 'selected';
};
export type ActionsCreateOrUpdateOrgSecretVariables = {
body?: ActionsCreateOrUpdateOrgSecretRequestBody;
pathParams: ActionsCreateOrUpdateOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates or updates an organization secret with an encrypted value. Encrypt your secret using
* [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access
* token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to
* use this endpoint.
*
* #### Example encrypting a secret using Node.js
*
* Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.
*
* ```
* const sodium = require('tweetsodium');
*
* const key = "base64-encoded-public-key";
* const value = "plain-text-secret";
*
* // Convert the message and key to Uint8Array's (Buffer implements that interface)
* const messageBytes = Buffer.from(value);
* const keyBytes = Buffer.from(key, 'base64');
*
* // Encrypt using LibSodium.
* const encryptedBytes = sodium.seal(messageBytes, keyBytes);
*
* // Base64 the encrypted secret
* const encrypted = Buffer.from(encryptedBytes).toString('base64');
*
* console.log(encrypted);
* ```
*
*
* #### Example encrypting a secret using Python
*
* Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3.
*
* ```
* from base64 import b64encode
* from nacl import encoding, public
*
* def encrypt(public_key: str, secret_value: str) -> str:
* """Encrypt a Unicode string using the public key."""
* public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
* sealed_box = public.SealedBox(public_key)
* encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
* return b64encode(encrypted).decode("utf-8")
* ```
*
* #### Example encrypting a secret using C#
*
* Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
*
* ```
* var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret");
* var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=");
*
* var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);
*
* Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));
* ```
*
* #### Example encrypting a secret using Ruby
*
* Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.
*
* ```ruby
* require "rbnacl"
* require "base64"
*
* key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=")
* public_key = RbNaCl::PublicKey.new(key)
*
* box = RbNaCl::Boxes::Sealed.from_public_key(public_key)
* encrypted_secret = box.encrypt("my_secret")
*
* # Print the base64 encoded secret
* puts Base64.strict_encode64(encrypted_secret)
* ```
*/
export const fetchActionsCreateOrUpdateOrgSecret = (
variables: ActionsCreateOrUpdateOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsCreateOrUpdateOrgSecretError,
ActionsCreateOrUpdateOrgSecretRequestBody,
{},
{},
ActionsCreateOrUpdateOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}',
method: 'put',
...variables,
signal,
});
/**
* Creates or updates an organization secret with an encrypted value. Encrypt your secret using
* [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access
* token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to
* use this endpoint.
*
* #### Example encrypting a secret using Node.js
*
* Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.
*
* ```
* const sodium = require('tweetsodium');
*
* const key = "base64-encoded-public-key";
* const value = "plain-text-secret";
*
* // Convert the message and key to Uint8Array's (Buffer implements that interface)
* const messageBytes = Buffer.from(value);
* const keyBytes = Buffer.from(key, 'base64');
*
* // Encrypt using LibSodium.
* const encryptedBytes = sodium.seal(messageBytes, keyBytes);
*
* // Base64 the encrypted secret
* const encrypted = Buffer.from(encryptedBytes).toString('base64');
*
* console.log(encrypted);
* ```
*
*
* #### Example encrypting a secret using Python
*
* Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3.
*
* ```
* from base64 import b64encode
* from nacl import encoding, public
*
* def encrypt(public_key: str, secret_value: str) -> str:
* """Encrypt a Unicode string using the public key."""
* public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
* sealed_box = public.SealedBox(public_key)
* encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
* return b64encode(encrypted).decode("utf-8")
* ```
*
* #### Example encrypting a secret using C#
*
* Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.
*
* ```
* var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret");
* var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=");
*
* var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);
*
* Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));
* ```
*
* #### Example encrypting a secret using Ruby
*
* Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.
*
* ```ruby
* require "rbnacl"
* require "base64"
*
* key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=")
* public_key = RbNaCl::PublicKey.new(key)
*
* box = RbNaCl::Boxes::Sealed.from_public_key(public_key)
* encrypted_secret = box.encrypt("my_secret")
*
* # Print the base64 encoded secret
* puts Base64.strict_encode64(encrypted_secret)
* ```
*/
export const useActionsCreateOrUpdateOrgSecret = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsCreateOrUpdateOrgSecretError,
ActionsCreateOrUpdateOrgSecretVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsCreateOrUpdateOrgSecretError,
ActionsCreateOrUpdateOrgSecretVariables
>(
(variables: ActionsCreateOrUpdateOrgSecretVariables) =>
fetchActionsCreateOrUpdateOrgSecret({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActionsListSelectedReposForOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
};
export type ActionsListSelectedReposForOrgSecretQueryParams = {
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
};
export type ActionsListSelectedReposForOrgSecretError =
Fetcher.ErrorWrapper;
export type ActionsListSelectedReposForOrgSecretResponse = {
repositories: Schemas.MinimalRepository[];
total_count: number;
};
export type ActionsListSelectedReposForOrgSecretVariables = {
pathParams: ActionsListSelectedReposForOrgSecretPathParams;
queryParams?: ActionsListSelectedReposForOrgSecretQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all repositories that have been selected when the `visibility` for repository access to a secret is set to `selected`. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsListSelectedReposForOrgSecret = (
variables: ActionsListSelectedReposForOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActionsListSelectedReposForOrgSecretResponse,
ActionsListSelectedReposForOrgSecretError,
undefined,
{},
ActionsListSelectedReposForOrgSecretQueryParams,
ActionsListSelectedReposForOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}/repositories',
method: 'get',
...variables,
signal,
});
/**
* Lists all repositories that have been selected when the `visibility` for repository access to a secret is set to `selected`. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsListSelectedReposForOrgSecret = <
TData = ActionsListSelectedReposForOrgSecretResponse,
>(
variables: ActionsListSelectedReposForOrgSecretVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActionsListSelectedReposForOrgSecretResponse,
ActionsListSelectedReposForOrgSecretError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActionsListSelectedReposForOrgSecretResponse,
ActionsListSelectedReposForOrgSecretError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/actions/secrets/{secret_name}/repositories',
operationId: 'actionsListSelectedReposForOrgSecret',
variables,
}),
({ signal }) =>
fetchActionsListSelectedReposForOrgSecret(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ActionsSetSelectedReposForOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
};
export type ActionsSetSelectedReposForOrgSecretError =
Fetcher.ErrorWrapper;
export type ActionsSetSelectedReposForOrgSecretRequestBody = {
/**
* An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can add and remove individual repositories using the [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret) and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints.
*/
selected_repository_ids?: number[];
};
export type ActionsSetSelectedReposForOrgSecretVariables = {
body?: ActionsSetSelectedReposForOrgSecretRequestBody;
pathParams: ActionsSetSelectedReposForOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Replaces all repositories for an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsSetSelectedReposForOrgSecret = (
variables: ActionsSetSelectedReposForOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsSetSelectedReposForOrgSecretError,
ActionsSetSelectedReposForOrgSecretRequestBody,
{},
{},
ActionsSetSelectedReposForOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}/repositories',
method: 'put',
...variables,
signal,
});
/**
* Replaces all repositories for an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsSetSelectedReposForOrgSecret = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsSetSelectedReposForOrgSecretError,
ActionsSetSelectedReposForOrgSecretVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsSetSelectedReposForOrgSecretError,
ActionsSetSelectedReposForOrgSecretVariables
>(
(variables: ActionsSetSelectedReposForOrgSecretVariables) =>
fetchActionsSetSelectedReposForOrgSecret({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsRemoveSelectedRepoFromOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
repositoryId: number;
};
export type ActionsRemoveSelectedRepoFromOrgSecretError =
Fetcher.ErrorWrapper;
export type ActionsRemoveSelectedRepoFromOrgSecretVariables = {
pathParams: ActionsRemoveSelectedRepoFromOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes a repository from an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsRemoveSelectedRepoFromOrgSecret = (
variables: ActionsRemoveSelectedRepoFromOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsRemoveSelectedRepoFromOrgSecretError,
undefined,
{},
{},
ActionsRemoveSelectedRepoFromOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}/repositories/{repositoryId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes a repository from an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsRemoveSelectedRepoFromOrgSecret = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsRemoveSelectedRepoFromOrgSecretError,
ActionsRemoveSelectedRepoFromOrgSecretVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsRemoveSelectedRepoFromOrgSecretError,
ActionsRemoveSelectedRepoFromOrgSecretVariables
>(
(variables: ActionsRemoveSelectedRepoFromOrgSecretVariables) =>
fetchActionsRemoveSelectedRepoFromOrgSecret({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ActionsAddSelectedRepoToOrgSecretPathParams = {
org: string;
/**
* secret_name parameter
*/
secretName: string;
repositoryId: number;
};
export type ActionsAddSelectedRepoToOrgSecretError =
Fetcher.ErrorWrapper;
export type ActionsAddSelectedRepoToOrgSecretVariables = {
pathParams: ActionsAddSelectedRepoToOrgSecretPathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds a repository to an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const fetchActionsAddSelectedRepoToOrgSecret = (
variables: ActionsAddSelectedRepoToOrgSecretVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ActionsAddSelectedRepoToOrgSecretError,
undefined,
{},
{},
ActionsAddSelectedRepoToOrgSecretPathParams
>({
url: '/orgs/{org}/actions/secrets/{secretName}/repositories/{repositoryId}',
method: 'put',
...variables,
signal,
});
/**
* Adds a repository to an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint.
*/
export const useActionsAddSelectedRepoToOrgSecret = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ActionsAddSelectedRepoToOrgSecretError,
ActionsAddSelectedRepoToOrgSecretVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ActionsAddSelectedRepoToOrgSecretError,
ActionsAddSelectedRepoToOrgSecretVariables
>(
(variables: ActionsAddSelectedRepoToOrgSecretVariables) =>
fetchActionsAddSelectedRepoToOrgSecret({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OrgsGetAuditLogPathParams = {
org: string;
};
export type OrgsGetAuditLogQueryParams = {
/**
* A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log).
*/
phrase?: string;
/**
* The event types to include:
*
* - `web` - returns web (non-Git) events
* - `git` - returns Git events
* - `all` - returns both web and Git events
*
* The default is `web`.
*/
include?: 'web' | 'git' | 'all';
/**
* A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor.
*/
after?: string;
/**
* A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor.
*/
before?: string;
/**
* The order of audit log events. To list newest events first, specify `desc`. To list oldest events first, specify `asc`.
*
* The default is `desc`.
*/
order?: 'desc' | 'asc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsGetAuditLogError = Fetcher.ErrorWrapper;
export type OrgsGetAuditLogResponse = Schemas.AuditLogEvent[];
export type OrgsGetAuditLogVariables = {
pathParams: OrgsGetAuditLogPathParams;
queryParams?: OrgsGetAuditLogQueryParams;
} & GithubContext['fetcherOptions'];
/**
* **Note:** The audit log REST API is currently in beta and is subject to change.
*
* Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)."
*
* To use this endpoint, you must be an organization owner, and you must use an access token with the `admin:org` scope. GitHub Apps must have the `organization_administration` read permission to use this endpoint.
*/
export const fetchOrgsGetAuditLog = (
variables: OrgsGetAuditLogVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsGetAuditLogResponse,
OrgsGetAuditLogError,
undefined,
{},
OrgsGetAuditLogQueryParams,
OrgsGetAuditLogPathParams
>({ url: '/orgs/{org}/audit-log', method: 'get', ...variables, signal });
/**
* **Note:** The audit log REST API is currently in beta and is subject to change.
*
* Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)."
*
* To use this endpoint, you must be an organization owner, and you must use an access token with the `admin:org` scope. GitHub Apps must have the `organization_administration` read permission to use this endpoint.
*/
export const useOrgsGetAuditLog = (
variables: OrgsGetAuditLogVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsGetAuditLogResponse,
OrgsGetAuditLogError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsGetAuditLogResponse,
OrgsGetAuditLogError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/audit-log',
operationId: 'orgsGetAuditLog',
variables,
}),
({ signal }) =>
fetchOrgsGetAuditLog({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsListBlockedUsersPathParams = {
org: string;
};
export type OrgsListBlockedUsersError = Fetcher.ErrorWrapper<{
status: 415;
payload: Responses.PreviewHeaderMissing;
}>;
export type OrgsListBlockedUsersResponse = Schemas.SimpleUser[];
export type OrgsListBlockedUsersVariables = {
pathParams: OrgsListBlockedUsersPathParams;
} & GithubContext['fetcherOptions'];
/**
* List the users blocked by an organization.
*/
export const fetchOrgsListBlockedUsers = (
variables: OrgsListBlockedUsersVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListBlockedUsersResponse,
OrgsListBlockedUsersError,
undefined,
{},
{},
OrgsListBlockedUsersPathParams
>({ url: '/orgs/{org}/blocks', method: 'get', ...variables, signal });
/**
* List the users blocked by an organization.
*/
export const useOrgsListBlockedUsers = (
variables: OrgsListBlockedUsersVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListBlockedUsersResponse,
OrgsListBlockedUsersError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListBlockedUsersResponse,
OrgsListBlockedUsersError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/blocks',
operationId: 'orgsListBlockedUsers',
variables,
}),
({ signal }) =>
fetchOrgsListBlockedUsers({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsUnblockUserPathParams = {
org: string;
username: string;
};
export type OrgsUnblockUserError = Fetcher.ErrorWrapper;
export type OrgsUnblockUserVariables = {
pathParams: OrgsUnblockUserPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsUnblockUser = (
variables: OrgsUnblockUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsUnblockUserError,
undefined,
{},
{},
OrgsUnblockUserPathParams
>({
url: '/orgs/{org}/blocks/{username}',
method: 'delete',
...variables,
signal,
});
export const useOrgsUnblockUser = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsUnblockUserError,
OrgsUnblockUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsUnblockUserError,
OrgsUnblockUserVariables
>(
(variables: OrgsUnblockUserVariables) =>
fetchOrgsUnblockUser({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsCheckBlockedUserPathParams = {
org: string;
username: string;
};
export type OrgsCheckBlockedUserError = Fetcher.ErrorWrapper<{
status: 404;
payload: Schemas.BasicError;
}>;
export type OrgsCheckBlockedUserVariables = {
pathParams: OrgsCheckBlockedUserPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsCheckBlockedUser = (
variables: OrgsCheckBlockedUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsCheckBlockedUserError,
undefined,
{},
{},
OrgsCheckBlockedUserPathParams
>({
url: '/orgs/{org}/blocks/{username}',
method: 'get',
...variables,
signal,
});
export const useOrgsCheckBlockedUser = (
variables: OrgsCheckBlockedUserVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/orgs/{org}/blocks/{username}',
operationId: 'orgsCheckBlockedUser',
variables,
}),
({ signal }) =>
fetchOrgsCheckBlockedUser({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsBlockUserPathParams = {
org: string;
username: string;
};
export type OrgsBlockUserError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type OrgsBlockUserVariables = {
pathParams: OrgsBlockUserPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsBlockUser = (
variables: OrgsBlockUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsBlockUserError,
undefined,
{},
{},
OrgsBlockUserPathParams
>({
url: '/orgs/{org}/blocks/{username}',
method: 'put',
...variables,
signal,
});
export const useOrgsBlockUser = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsBlockUserError,
OrgsBlockUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsBlockUserError,
OrgsBlockUserVariables
>(
(variables: OrgsBlockUserVariables) =>
fetchOrgsBlockUser({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsListSamlSsoAuthorizationsPathParams = {
org: string;
};
export type OrgsListSamlSsoAuthorizationsError =
Fetcher.ErrorWrapper;
export type OrgsListSamlSsoAuthorizationsResponse =
Schemas.CredentialAuthorization[];
export type OrgsListSamlSsoAuthorizationsVariables = {
pathParams: OrgsListSamlSsoAuthorizationsPathParams;
} & GithubContext['fetcherOptions'];
/**
* Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products).
*
* An authenticated organization owner with the `read:org` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on).
*/
export const fetchOrgsListSamlSsoAuthorizations = (
variables: OrgsListSamlSsoAuthorizationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListSamlSsoAuthorizationsResponse,
OrgsListSamlSsoAuthorizationsError,
undefined,
{},
{},
OrgsListSamlSsoAuthorizationsPathParams
>({
url: '/orgs/{org}/credential-authorizations',
method: 'get',
...variables,
signal,
});
/**
* Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products).
*
* An authenticated organization owner with the `read:org` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on).
*/
export const useOrgsListSamlSsoAuthorizations = <
TData = OrgsListSamlSsoAuthorizationsResponse,
>(
variables: OrgsListSamlSsoAuthorizationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListSamlSsoAuthorizationsResponse,
OrgsListSamlSsoAuthorizationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListSamlSsoAuthorizationsResponse,
OrgsListSamlSsoAuthorizationsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/credential-authorizations',
operationId: 'orgsListSamlSsoAuthorizations',
variables,
}),
({ signal }) =>
fetchOrgsListSamlSsoAuthorizations(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsRemoveSamlSsoAuthorizationPathParams = {
org: string;
credentialId: number;
};
export type OrgsRemoveSamlSsoAuthorizationError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsRemoveSamlSsoAuthorizationVariables = {
pathParams: OrgsRemoveSamlSsoAuthorizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products).
*
* An authenticated organization owner with the `admin:org` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access.
*/
export const fetchOrgsRemoveSamlSsoAuthorization = (
variables: OrgsRemoveSamlSsoAuthorizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsRemoveSamlSsoAuthorizationError,
undefined,
{},
{},
OrgsRemoveSamlSsoAuthorizationPathParams
>({
url: '/orgs/{org}/credential-authorizations/{credentialId}',
method: 'delete',
...variables,
signal,
});
/**
* Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products).
*
* An authenticated organization owner with the `admin:org` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access.
*/
export const useOrgsRemoveSamlSsoAuthorization = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsRemoveSamlSsoAuthorizationError,
OrgsRemoveSamlSsoAuthorizationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsRemoveSamlSsoAuthorizationError,
OrgsRemoveSamlSsoAuthorizationVariables
>(
(variables: OrgsRemoveSamlSsoAuthorizationVariables) =>
fetchOrgsRemoveSamlSsoAuthorization({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActivityListPublicOrgEventsPathParams = {
org: string;
};
export type ActivityListPublicOrgEventsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActivityListPublicOrgEventsError = Fetcher.ErrorWrapper;
export type ActivityListPublicOrgEventsResponse = Schemas.Event[];
export type ActivityListPublicOrgEventsVariables = {
pathParams: ActivityListPublicOrgEventsPathParams;
queryParams?: ActivityListPublicOrgEventsQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchActivityListPublicOrgEvents = (
variables: ActivityListPublicOrgEventsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ActivityListPublicOrgEventsResponse,
ActivityListPublicOrgEventsError,
undefined,
{},
ActivityListPublicOrgEventsQueryParams,
ActivityListPublicOrgEventsPathParams
>({ url: '/orgs/{org}/events', method: 'get', ...variables, signal });
export const useActivityListPublicOrgEvents = <
TData = ActivityListPublicOrgEventsResponse,
>(
variables: ActivityListPublicOrgEventsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ActivityListPublicOrgEventsResponse,
ActivityListPublicOrgEventsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ActivityListPublicOrgEventsResponse,
ActivityListPublicOrgEventsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/events',
operationId: 'activityListPublicOrgEvents',
variables,
}),
({ signal }) =>
fetchActivityListPublicOrgEvents(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsListFailedInvitationsPathParams = {
org: string;
};
export type OrgsListFailedInvitationsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListFailedInvitationsError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsListFailedInvitationsResponse =
Schemas.OrganizationInvitation[];
export type OrgsListFailedInvitationsVariables = {
pathParams: OrgsListFailedInvitationsPathParams;
queryParams?: OrgsListFailedInvitationsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The return hash contains `failed_at` and `failed_reason` fields which represent the time at which the invitation failed and the reason for the failure.
*/
export const fetchOrgsListFailedInvitations = (
variables: OrgsListFailedInvitationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListFailedInvitationsResponse,
OrgsListFailedInvitationsError,
undefined,
{},
OrgsListFailedInvitationsQueryParams,
OrgsListFailedInvitationsPathParams
>({
url: '/orgs/{org}/failed_invitations',
method: 'get',
...variables,
signal,
});
/**
* The return hash contains `failed_at` and `failed_reason` fields which represent the time at which the invitation failed and the reason for the failure.
*/
export const useOrgsListFailedInvitations = <
TData = OrgsListFailedInvitationsResponse,
>(
variables: OrgsListFailedInvitationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListFailedInvitationsResponse,
OrgsListFailedInvitationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListFailedInvitationsResponse,
OrgsListFailedInvitationsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/failed_invitations',
operationId: 'orgsListFailedInvitations',
variables,
}),
({ signal }) =>
fetchOrgsListFailedInvitations(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsListWebhooksPathParams = {
org: string;
};
export type OrgsListWebhooksQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListWebhooksError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsListWebhooksResponse = Schemas.OrgHook[];
export type OrgsListWebhooksVariables = {
pathParams: OrgsListWebhooksPathParams;
queryParams?: OrgsListWebhooksQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsListWebhooks = (
variables: OrgsListWebhooksVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListWebhooksResponse,
OrgsListWebhooksError,
undefined,
{},
OrgsListWebhooksQueryParams,
OrgsListWebhooksPathParams
>({ url: '/orgs/{org}/hooks', method: 'get', ...variables, signal });
export const useOrgsListWebhooks = (
variables: OrgsListWebhooksVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListWebhooksResponse,
OrgsListWebhooksError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListWebhooksResponse,
OrgsListWebhooksError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/hooks',
operationId: 'orgsListWebhooks',
variables,
}),
({ signal }) =>
fetchOrgsListWebhooks({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsCreateWebhookPathParams = {
org: string;
};
export type OrgsCreateWebhookError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OrgsCreateWebhookRequestBody = {
/**
* Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.
*
* @default true
*/
active?: boolean;
/**
* Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#create-hook-config-params).
*/
config: {
content_type?: Schemas.WebhookConfigContentType;
insecure_ssl?: Schemas.WebhookConfigInsecureSsl;
/**
* @example "password"
*/
password?: string;
secret?: Schemas.WebhookConfigSecret;
url: Schemas.WebhookConfigUrl;
/**
* @example "kdaigle"
*/
username?: string;
};
/**
* Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for.
*
* @default push
*/
events?: string[];
/**
* Must be passed as "web".
*/
name: string;
};
export type OrgsCreateWebhookVariables = {
body: OrgsCreateWebhookRequestBody;
pathParams: OrgsCreateWebhookPathParams;
} & GithubContext['fetcherOptions'];
/**
* Here's how you can create a hook that posts payloads in JSON format:
*/
export const fetchOrgsCreateWebhook = (
variables: OrgsCreateWebhookVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrgHook,
OrgsCreateWebhookError,
OrgsCreateWebhookRequestBody,
{},
{},
OrgsCreateWebhookPathParams
>({ url: '/orgs/{org}/hooks', method: 'post', ...variables, signal });
/**
* Here's how you can create a hook that posts payloads in JSON format:
*/
export const useOrgsCreateWebhook = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.OrgHook,
OrgsCreateWebhookError,
OrgsCreateWebhookVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.OrgHook,
OrgsCreateWebhookError,
OrgsCreateWebhookVariables
>(
(variables: OrgsCreateWebhookVariables) =>
fetchOrgsCreateWebhook({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsDeleteWebhookPathParams = {
org: string;
hookId: number;
};
export type OrgsDeleteWebhookError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsDeleteWebhookVariables = {
pathParams: OrgsDeleteWebhookPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsDeleteWebhook = (
variables: OrgsDeleteWebhookVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsDeleteWebhookError,
undefined,
{},
{},
OrgsDeleteWebhookPathParams
>({
url: '/orgs/{org}/hooks/{hookId}',
method: 'delete',
...variables,
signal,
});
export const useOrgsDeleteWebhook = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsDeleteWebhookError,
OrgsDeleteWebhookVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsDeleteWebhookError,
OrgsDeleteWebhookVariables
>(
(variables: OrgsDeleteWebhookVariables) =>
fetchOrgsDeleteWebhook({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsGetWebhookPathParams = {
org: string;
hookId: number;
};
export type OrgsGetWebhookError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsGetWebhookVariables = {
pathParams: OrgsGetWebhookPathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns a webhook configured in an organization. To get only the webhook `config` properties, see "[Get a webhook configuration for an organization](/rest/reference/orgs#get-a-webhook-configuration-for-an-organization)."
*/
export const fetchOrgsGetWebhook = (
variables: OrgsGetWebhookVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrgHook,
OrgsGetWebhookError,
undefined,
{},
{},
OrgsGetWebhookPathParams
>({ url: '/orgs/{org}/hooks/{hookId}', method: 'get', ...variables, signal });
/**
* Returns a webhook configured in an organization. To get only the webhook `config` properties, see "[Get a webhook configuration for an organization](/rest/reference/orgs#get-a-webhook-configuration-for-an-organization)."
*/
export const useOrgsGetWebhook = (
variables: OrgsGetWebhookVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/orgs/{org}/hooks/{hook_id}',
operationId: 'orgsGetWebhook',
variables,
}),
({ signal }) =>
fetchOrgsGetWebhook({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsUpdateWebhookPathParams = {
org: string;
hookId: number;
};
export type OrgsUpdateWebhookError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OrgsUpdateWebhookRequestBody = {
/**
* Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.
*
* @default true
*/
active?: boolean;
/**
* Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#update-hook-config-params).
*/
config?: {
content_type?: Schemas.WebhookConfigContentType;
insecure_ssl?: Schemas.WebhookConfigInsecureSsl;
secret?: Schemas.WebhookConfigSecret;
url: Schemas.WebhookConfigUrl;
};
/**
* Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for.
*
* @default push
*/
events?: string[];
/**
* @example "web"
*/
name?: string;
};
export type OrgsUpdateWebhookVariables = {
body?: OrgsUpdateWebhookRequestBody;
pathParams: OrgsUpdateWebhookPathParams;
} & GithubContext['fetcherOptions'];
/**
* Updates a webhook configured in an organization. When you update a webhook, the `secret` will be overwritten. If you previously had a `secret` set, you must provide the same `secret` or set a new `secret` or the secret will be removed. If you are only updating individual webhook `config` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)."
*/
export const fetchOrgsUpdateWebhook = (
variables: OrgsUpdateWebhookVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrgHook,
OrgsUpdateWebhookError,
OrgsUpdateWebhookRequestBody,
{},
{},
OrgsUpdateWebhookPathParams
>({
url: '/orgs/{org}/hooks/{hookId}',
method: 'patch',
...variables,
signal,
});
/**
* Updates a webhook configured in an organization. When you update a webhook, the `secret` will be overwritten. If you previously had a `secret` set, you must provide the same `secret` or set a new `secret` or the secret will be removed. If you are only updating individual webhook `config` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)."
*/
export const useOrgsUpdateWebhook = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.OrgHook,
OrgsUpdateWebhookError,
OrgsUpdateWebhookVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.OrgHook,
OrgsUpdateWebhookError,
OrgsUpdateWebhookVariables
>(
(variables: OrgsUpdateWebhookVariables) =>
fetchOrgsUpdateWebhook({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsGetWebhookConfigForOrgPathParams = {
org: string;
hookId: number;
};
export type OrgsGetWebhookConfigForOrgError = Fetcher.ErrorWrapper;
export type OrgsGetWebhookConfigForOrgVariables = {
pathParams: OrgsGetWebhookConfigForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)."
*
* Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:read` permission.
*/
export const fetchOrgsGetWebhookConfigForOrg = (
variables: OrgsGetWebhookConfigForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.WebhookConfig,
OrgsGetWebhookConfigForOrgError,
undefined,
{},
{},
OrgsGetWebhookConfigForOrgPathParams
>({
url: '/orgs/{org}/hooks/{hookId}/config',
method: 'get',
...variables,
signal,
});
/**
* Returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)."
*
* Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:read` permission.
*/
export const useOrgsGetWebhookConfigForOrg = (
variables: OrgsGetWebhookConfigForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.WebhookConfig,
OrgsGetWebhookConfigForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.WebhookConfig,
OrgsGetWebhookConfigForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/hooks/{hook_id}/config',
operationId: 'orgsGetWebhookConfigForOrg',
variables,
}),
({ signal }) =>
fetchOrgsGetWebhookConfigForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsUpdateWebhookConfigForOrgPathParams = {
org: string;
hookId: number;
};
export type OrgsUpdateWebhookConfigForOrgError =
Fetcher.ErrorWrapper;
export type OrgsUpdateWebhookConfigForOrgRequestBody = {
content_type?: Schemas.WebhookConfigContentType;
insecure_ssl?: Schemas.WebhookConfigInsecureSsl;
secret?: Schemas.WebhookConfigSecret;
url?: Schemas.WebhookConfigUrl;
};
export type OrgsUpdateWebhookConfigForOrgVariables = {
body?: OrgsUpdateWebhookConfigForOrgRequestBody;
pathParams: OrgsUpdateWebhookConfigForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)."
*
* Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:write` permission.
*/
export const fetchOrgsUpdateWebhookConfigForOrg = (
variables: OrgsUpdateWebhookConfigForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.WebhookConfig,
OrgsUpdateWebhookConfigForOrgError,
OrgsUpdateWebhookConfigForOrgRequestBody,
{},
{},
OrgsUpdateWebhookConfigForOrgPathParams
>({
url: '/orgs/{org}/hooks/{hookId}/config',
method: 'patch',
...variables,
signal,
});
/**
* Updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)."
*
* Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:write` permission.
*/
export const useOrgsUpdateWebhookConfigForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.WebhookConfig,
OrgsUpdateWebhookConfigForOrgError,
OrgsUpdateWebhookConfigForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.WebhookConfig,
OrgsUpdateWebhookConfigForOrgError,
OrgsUpdateWebhookConfigForOrgVariables
>(
(variables: OrgsUpdateWebhookConfigForOrgVariables) =>
fetchOrgsUpdateWebhookConfigForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsPingWebhookPathParams = {
org: string;
hookId: number;
};
export type OrgsPingWebhookError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsPingWebhookVariables = {
pathParams: OrgsPingWebhookPathParams;
} & GithubContext['fetcherOptions'];
/**
* This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook.
*/
export const fetchOrgsPingWebhook = (
variables: OrgsPingWebhookVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsPingWebhookError,
undefined,
{},
{},
OrgsPingWebhookPathParams
>({
url: '/orgs/{org}/hooks/{hookId}/pings',
method: 'post',
...variables,
signal,
});
/**
* This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook.
*/
export const useOrgsPingWebhook = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsPingWebhookError,
OrgsPingWebhookVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsPingWebhookError,
OrgsPingWebhookVariables
>(
(variables: OrgsPingWebhookVariables) =>
fetchOrgsPingWebhook({ ...fetcherOptions, ...variables }),
options,
);
};
export type AppsGetOrgInstallationPathParams = {
org: string;
};
export type AppsGetOrgInstallationError = Fetcher.ErrorWrapper;
export type AppsGetOrgInstallationVariables = {
pathParams: AppsGetOrgInstallationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Enables an authenticated GitHub App to find the organization's installation information.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const fetchAppsGetOrgInstallation = (
variables: AppsGetOrgInstallationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Installation,
AppsGetOrgInstallationError,
undefined,
{},
{},
AppsGetOrgInstallationPathParams
>({ url: '/orgs/{org}/installation', method: 'get', ...variables, signal });
/**
* Enables an authenticated GitHub App to find the organization's installation information.
*
* You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
*/
export const useAppsGetOrgInstallation = (
variables: AppsGetOrgInstallationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Installation,
AppsGetOrgInstallationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Installation,
AppsGetOrgInstallationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/installation',
operationId: 'appsGetOrgInstallation',
variables,
}),
({ signal }) =>
fetchAppsGetOrgInstallation({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsListAppInstallationsPathParams = {
org: string;
};
export type OrgsListAppInstallationsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListAppInstallationsError = Fetcher.ErrorWrapper;
export type OrgsListAppInstallationsResponse = {
installations: Schemas.Installation[];
total_count: number;
};
export type OrgsListAppInstallationsVariables = {
pathParams: OrgsListAppInstallationsPathParams;
queryParams?: OrgsListAppInstallationsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with `admin:read` scope to use this endpoint.
*/
export const fetchOrgsListAppInstallations = (
variables: OrgsListAppInstallationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListAppInstallationsResponse,
OrgsListAppInstallationsError,
undefined,
{},
OrgsListAppInstallationsQueryParams,
OrgsListAppInstallationsPathParams
>({ url: '/orgs/{org}/installations', method: 'get', ...variables, signal });
/**
* Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with `admin:read` scope to use this endpoint.
*/
export const useOrgsListAppInstallations = <
TData = OrgsListAppInstallationsResponse,
>(
variables: OrgsListAppInstallationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListAppInstallationsResponse,
OrgsListAppInstallationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListAppInstallationsResponse,
OrgsListAppInstallationsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/installations',
operationId: 'orgsListAppInstallations',
variables,
}),
({ signal }) =>
fetchOrgsListAppInstallations(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type InteractionsRemoveRestrictionsForOrgPathParams = {
org: string;
};
export type InteractionsRemoveRestrictionsForOrgError =
Fetcher.ErrorWrapper;
export type InteractionsRemoveRestrictionsForOrgVariables = {
pathParams: InteractionsRemoveRestrictionsForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.
*/
export const fetchInteractionsRemoveRestrictionsForOrg = (
variables: InteractionsRemoveRestrictionsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
InteractionsRemoveRestrictionsForOrgError,
undefined,
{},
{},
InteractionsRemoveRestrictionsForOrgPathParams
>({
url: '/orgs/{org}/interaction-limits',
method: 'delete',
...variables,
signal,
});
/**
* Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.
*/
export const useInteractionsRemoveRestrictionsForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
InteractionsRemoveRestrictionsForOrgError,
InteractionsRemoveRestrictionsForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
InteractionsRemoveRestrictionsForOrgError,
InteractionsRemoveRestrictionsForOrgVariables
>(
(variables: InteractionsRemoveRestrictionsForOrgVariables) =>
fetchInteractionsRemoveRestrictionsForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type InteractionsGetRestrictionsForOrgPathParams = {
org: string;
};
export type InteractionsGetRestrictionsForOrgError =
Fetcher.ErrorWrapper;
export type InteractionsGetRestrictionsForOrgVariables = {
pathParams: InteractionsGetRestrictionsForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response.
*/
export const fetchInteractionsGetRestrictionsForOrg = (
variables: InteractionsGetRestrictionsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.InteractionLimitResponse,
InteractionsGetRestrictionsForOrgError,
undefined,
{},
{},
InteractionsGetRestrictionsForOrgPathParams
>({
url: '/orgs/{org}/interaction-limits',
method: 'get',
...variables,
signal,
});
/**
* Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response.
*/
export const useInteractionsGetRestrictionsForOrg = <
TData = Schemas.InteractionLimitResponse,
>(
variables: InteractionsGetRestrictionsForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.InteractionLimitResponse,
InteractionsGetRestrictionsForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.InteractionLimitResponse,
InteractionsGetRestrictionsForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/interaction-limits',
operationId: 'interactionsGetRestrictionsForOrg',
variables,
}),
({ signal }) =>
fetchInteractionsGetRestrictionsForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type InteractionsSetRestrictionsForOrgPathParams = {
org: string;
};
export type InteractionsSetRestrictionsForOrgError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type InteractionsSetRestrictionsForOrgVariables = {
body: Schemas.InteractionLimit;
pathParams: InteractionsSetRestrictionsForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization.
*/
export const fetchInteractionsSetRestrictionsForOrg = (
variables: InteractionsSetRestrictionsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.InteractionLimitResponse,
InteractionsSetRestrictionsForOrgError,
Schemas.InteractionLimit,
{},
{},
InteractionsSetRestrictionsForOrgPathParams
>({
url: '/orgs/{org}/interaction-limits',
method: 'put',
...variables,
signal,
});
/**
* Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization.
*/
export const useInteractionsSetRestrictionsForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.InteractionLimitResponse,
InteractionsSetRestrictionsForOrgError,
InteractionsSetRestrictionsForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.InteractionLimitResponse,
InteractionsSetRestrictionsForOrgError,
InteractionsSetRestrictionsForOrgVariables
>(
(variables: InteractionsSetRestrictionsForOrgVariables) =>
fetchInteractionsSetRestrictionsForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OrgsListPendingInvitationsPathParams = {
org: string;
};
export type OrgsListPendingInvitationsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListPendingInvitationsError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsListPendingInvitationsResponse =
Schemas.OrganizationInvitation[];
export type OrgsListPendingInvitationsVariables = {
pathParams: OrgsListPendingInvitationsPathParams;
queryParams?: OrgsListPendingInvitationsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.
*/
export const fetchOrgsListPendingInvitations = (
variables: OrgsListPendingInvitationsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListPendingInvitationsResponse,
OrgsListPendingInvitationsError,
undefined,
{},
OrgsListPendingInvitationsQueryParams,
OrgsListPendingInvitationsPathParams
>({ url: '/orgs/{org}/invitations', method: 'get', ...variables, signal });
/**
* The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.
*/
export const useOrgsListPendingInvitations = <
TData = OrgsListPendingInvitationsResponse,
>(
variables: OrgsListPendingInvitationsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListPendingInvitationsResponse,
OrgsListPendingInvitationsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListPendingInvitationsResponse,
OrgsListPendingInvitationsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/invitations',
operationId: 'orgsListPendingInvitations',
variables,
}),
({ signal }) =>
fetchOrgsListPendingInvitations(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsCreateInvitationPathParams = {
org: string;
};
export type OrgsCreateInvitationError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OrgsCreateInvitationRequestBody = {
/**
* **Required unless you provide `invitee_id`**. Email address of the person you are inviting, which can be an existing GitHub user.
*/
email?: string;
/**
* **Required unless you provide `email`**. GitHub user ID for the person you are inviting.
*/
invitee_id?: number;
/**
* Specify role for new member. Can be one of:
* \* `admin` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams.
* \* `direct_member` - Non-owner organization members with ability to see other members and join teams by invitation.
* \* `billing_manager` - Non-owner organization members with ability to manage the billing settings of your organization.
*
* @default direct_member
*/
role?: 'admin' | 'direct_member' | 'billing_manager';
/**
* Specify IDs for the teams you want to invite new members to.
*/
team_ids?: number[];
};
export type OrgsCreateInvitationVariables = {
body?: OrgsCreateInvitationRequestBody;
pathParams: OrgsCreateInvitationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner.
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*/
export const fetchOrgsCreateInvitation = (
variables: OrgsCreateInvitationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrganizationInvitation,
OrgsCreateInvitationError,
OrgsCreateInvitationRequestBody,
{},
{},
OrgsCreateInvitationPathParams
>({ url: '/orgs/{org}/invitations', method: 'post', ...variables, signal });
/**
* Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner.
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*/
export const useOrgsCreateInvitation = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.OrganizationInvitation,
OrgsCreateInvitationError,
OrgsCreateInvitationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.OrganizationInvitation,
OrgsCreateInvitationError,
OrgsCreateInvitationVariables
>(
(variables: OrgsCreateInvitationVariables) =>
fetchOrgsCreateInvitation({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsCancelInvitationPathParams = {
org: string;
/**
* invitation_id parameter
*/
invitationId: number;
};
export type OrgsCancelInvitationError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OrgsCancelInvitationVariables = {
pathParams: OrgsCancelInvitationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications).
*/
export const fetchOrgsCancelInvitation = (
variables: OrgsCancelInvitationVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsCancelInvitationError,
undefined,
{},
{},
OrgsCancelInvitationPathParams
>({
url: '/orgs/{org}/invitations/{invitationId}',
method: 'delete',
...variables,
signal,
});
/**
* Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner.
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications).
*/
export const useOrgsCancelInvitation = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsCancelInvitationError,
OrgsCancelInvitationVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsCancelInvitationError,
OrgsCancelInvitationVariables
>(
(variables: OrgsCancelInvitationVariables) =>
fetchOrgsCancelInvitation({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsListInvitationTeamsPathParams = {
org: string;
/**
* invitation_id parameter
*/
invitationId: number;
};
export type OrgsListInvitationTeamsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListInvitationTeamsError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type OrgsListInvitationTeamsResponse = Schemas.Team[];
export type OrgsListInvitationTeamsVariables = {
pathParams: OrgsListInvitationTeamsPathParams;
queryParams?: OrgsListInvitationTeamsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner.
*/
export const fetchOrgsListInvitationTeams = (
variables: OrgsListInvitationTeamsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListInvitationTeamsResponse,
OrgsListInvitationTeamsError,
undefined,
{},
OrgsListInvitationTeamsQueryParams,
OrgsListInvitationTeamsPathParams
>({
url: '/orgs/{org}/invitations/{invitationId}/teams',
method: 'get',
...variables,
signal,
});
/**
* List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner.
*/
export const useOrgsListInvitationTeams = <
TData = OrgsListInvitationTeamsResponse,
>(
variables: OrgsListInvitationTeamsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListInvitationTeamsResponse,
OrgsListInvitationTeamsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListInvitationTeamsResponse,
OrgsListInvitationTeamsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/invitations/{invitation_id}/teams',
operationId: 'orgsListInvitationTeams',
variables,
}),
({ signal }) =>
fetchOrgsListInvitationTeams({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type IssuesListForOrgPathParams = {
org: string;
};
export type IssuesListForOrgQueryParams = {
/**
* Indicates which sorts of issues to return. Can be one of:
* \* `assigned`: Issues assigned to you
* \* `created`: Issues created by you
* \* `mentioned`: Issues mentioning you
* \* `subscribed`: Issues you're subscribed to updates for
* \* `all`: All issues the authenticated user can see, regardless of participation or creation
*
* @default assigned
*/
filter?:
| 'assigned'
| 'created'
| 'mentioned'
| 'subscribed'
| 'repos'
| 'all';
/**
* Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`.
*
* @default open
*/
state?: 'open' | 'closed' | 'all';
/**
* A list of comma separated label names. Example: `bug,ui,@high`
*/
labels?: string;
/**
* What to sort results by. Can be either `created`, `updated`, `comments`.
*
* @default created
*/
sort?: 'created' | 'updated' | 'comments';
/**
* One of `asc` (ascending) or `desc` (descending).
*
* @default desc
*/
direction?: 'asc' | 'desc';
/**
* Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
*/
since?: string;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type IssuesListForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type IssuesListForOrgResponse = Schemas.Issue[];
export type IssuesListForOrgVariables = {
pathParams: IssuesListForOrgPathParams;
queryParams?: IssuesListForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List issues in an organization assigned to the authenticated user.
*
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this
* reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
* the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
* request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const fetchIssuesListForOrg = (
variables: IssuesListForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
IssuesListForOrgResponse,
IssuesListForOrgError,
undefined,
{},
IssuesListForOrgQueryParams,
IssuesListForOrgPathParams
>({ url: '/orgs/{org}/issues', method: 'get', ...variables, signal });
/**
* List issues in an organization assigned to the authenticated user.
*
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this
* reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
* the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
* request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const useIssuesListForOrg = (
variables: IssuesListForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
IssuesListForOrgResponse,
IssuesListForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
IssuesListForOrgResponse,
IssuesListForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/issues',
operationId: 'issuesListForOrg',
variables,
}),
({ signal }) =>
fetchIssuesListForOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsListMembersPathParams = {
org: string;
};
export type OrgsListMembersQueryParams = {
/**
* Filter members returned in the list. Can be one of:
* \* `2fa_disabled` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners.
* \* `all` - All members the authenticated user can see.
*
* @default all
*/
filter?: '2fa_disabled' | 'all';
/**
* Filter members returned by their role. Can be one of:
* \* `all` - All members of the organization, regardless of role.
* \* `admin` - Organization owners.
* \* `member` - Non-owner organization members.
*
* @default all
*/
role?: 'all' | 'admin' | 'member';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListMembersError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailed;
}>;
export type OrgsListMembersResponse = Schemas.SimpleUser[];
export type OrgsListMembersVariables = {
pathParams: OrgsListMembersPathParams;
queryParams?: OrgsListMembersQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.
*/
export const fetchOrgsListMembers = (
variables: OrgsListMembersVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListMembersResponse,
OrgsListMembersError,
undefined,
{},
OrgsListMembersQueryParams,
OrgsListMembersPathParams
>({ url: '/orgs/{org}/members', method: 'get', ...variables, signal });
/**
* List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.
*/
export const useOrgsListMembers = (
variables: OrgsListMembersVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListMembersResponse,
OrgsListMembersError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListMembersResponse,
OrgsListMembersError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/members',
operationId: 'orgsListMembers',
variables,
}),
({ signal }) =>
fetchOrgsListMembers({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsRemoveMemberPathParams = {
org: string;
username: string;
};
export type OrgsRemoveMemberError = Fetcher.ErrorWrapper<{
status: 403;
payload: Responses.Forbidden;
}>;
export type OrgsRemoveMemberVariables = {
pathParams: OrgsRemoveMemberPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.
*/
export const fetchOrgsRemoveMember = (
variables: OrgsRemoveMemberVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsRemoveMemberError,
undefined,
{},
{},
OrgsRemoveMemberPathParams
>({
url: '/orgs/{org}/members/{username}',
method: 'delete',
...variables,
signal,
});
/**
* Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.
*/
export const useOrgsRemoveMember = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsRemoveMemberError,
OrgsRemoveMemberVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsRemoveMemberError,
OrgsRemoveMemberVariables
>(
(variables: OrgsRemoveMemberVariables) =>
fetchOrgsRemoveMember({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsCheckMembershipForUserPathParams = {
org: string;
username: string;
};
export type OrgsCheckMembershipForUserError = Fetcher.ErrorWrapper;
export type OrgsCheckMembershipForUserVariables = {
pathParams: OrgsCheckMembershipForUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* Check if a user is, publicly or privately, a member of the organization.
*/
export const fetchOrgsCheckMembershipForUser = (
variables: OrgsCheckMembershipForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsCheckMembershipForUserError,
undefined,
{},
{},
OrgsCheckMembershipForUserPathParams
>({
url: '/orgs/{org}/members/{username}',
method: 'get',
...variables,
signal,
});
/**
* Check if a user is, publicly or privately, a member of the organization.
*/
export const useOrgsCheckMembershipForUser = (
variables: OrgsCheckMembershipForUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
undefined,
OrgsCheckMembershipForUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/orgs/{org}/members/{username}',
operationId: 'orgsCheckMembershipForUser',
variables,
}),
({ signal }) =>
fetchOrgsCheckMembershipForUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsRemoveMembershipForUserPathParams = {
org: string;
username: string;
};
export type OrgsRemoveMembershipForUserError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type OrgsRemoveMembershipForUserVariables = {
pathParams: OrgsRemoveMembershipForUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* In order to remove a user's membership with an organization, the authenticated user must be an organization owner.
*
* If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.
*/
export const fetchOrgsRemoveMembershipForUser = (
variables: OrgsRemoveMembershipForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsRemoveMembershipForUserError,
undefined,
{},
{},
OrgsRemoveMembershipForUserPathParams
>({
url: '/orgs/{org}/memberships/{username}',
method: 'delete',
...variables,
signal,
});
/**
* In order to remove a user's membership with an organization, the authenticated user must be an organization owner.
*
* If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.
*/
export const useOrgsRemoveMembershipForUser = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsRemoveMembershipForUserError,
OrgsRemoveMembershipForUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsRemoveMembershipForUserError,
OrgsRemoveMembershipForUserVariables
>(
(variables: OrgsRemoveMembershipForUserVariables) =>
fetchOrgsRemoveMembershipForUser({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsGetMembershipForUserPathParams = {
org: string;
username: string;
};
export type OrgsGetMembershipForUserError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type OrgsGetMembershipForUserVariables = {
pathParams: OrgsGetMembershipForUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* In order to get a user's membership with an organization, the authenticated user must be an organization member.
*/
export const fetchOrgsGetMembershipForUser = (
variables: OrgsGetMembershipForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrgMembership,
OrgsGetMembershipForUserError,
undefined,
{},
{},
OrgsGetMembershipForUserPathParams
>({
url: '/orgs/{org}/memberships/{username}',
method: 'get',
...variables,
signal,
});
/**
* In order to get a user's membership with an organization, the authenticated user must be an organization member.
*/
export const useOrgsGetMembershipForUser = (
variables: OrgsGetMembershipForUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.OrgMembership,
OrgsGetMembershipForUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.OrgMembership,
OrgsGetMembershipForUserError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/memberships/{username}',
operationId: 'orgsGetMembershipForUser',
variables,
}),
({ signal }) =>
fetchOrgsGetMembershipForUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsSetMembershipForUserPathParams = {
org: string;
username: string;
};
export type OrgsSetMembershipForUserError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type OrgsSetMembershipForUserRequestBody = {
/**
* The role to give the user in the organization. Can be one of:
* \* `admin` - The user will become an owner of the organization.
* \* `member` - The user will become a non-owner member of the organization.
*
* @default member
*/
role?: 'admin' | 'member';
};
export type OrgsSetMembershipForUserVariables = {
body?: OrgsSetMembershipForUserRequestBody;
pathParams: OrgsSetMembershipForUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* Only authenticated organization owners can add a member to the organization or update the member's role.
*
* * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be `pending` until they accept the invitation.
*
* * Authenticated users can _update_ a user's membership by passing the `role` parameter. If the authenticated user changes a member's role to `admin`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to `member`, no email will be sent.
*
* **Rate limits**
*
* To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.
*/
export const fetchOrgsSetMembershipForUser = (
variables: OrgsSetMembershipForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.OrgMembership,
OrgsSetMembershipForUserError,
OrgsSetMembershipForUserRequestBody,
{},
{},
OrgsSetMembershipForUserPathParams
>({
url: '/orgs/{org}/memberships/{username}',
method: 'put',
...variables,
signal,
});
/**
* Only authenticated organization owners can add a member to the organization or update the member's role.
*
* * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be `pending` until they accept the invitation.
*
* * Authenticated users can _update_ a user's membership by passing the `role` parameter. If the authenticated user changes a member's role to `admin`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to `member`, no email will be sent.
*
* **Rate limits**
*
* To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.
*/
export const useOrgsSetMembershipForUser = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.OrgMembership,
OrgsSetMembershipForUserError,
OrgsSetMembershipForUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.OrgMembership,
OrgsSetMembershipForUserError,
OrgsSetMembershipForUserVariables
>(
(variables: OrgsSetMembershipForUserVariables) =>
fetchOrgsSetMembershipForUser({ ...fetcherOptions, ...variables }),
options,
);
};
export type MigrationsListForOrgPathParams = {
org: string;
};
export type MigrationsListForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Exclude attributes from the API response to improve performance
*/
exclude?: 'repositories'[];
};
export type MigrationsListForOrgError = Fetcher.ErrorWrapper;
export type MigrationsListForOrgResponse = Schemas.Migration[];
export type MigrationsListForOrgVariables = {
pathParams: MigrationsListForOrgPathParams;
queryParams?: MigrationsListForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the most recent migrations.
*/
export const fetchMigrationsListForOrg = (
variables: MigrationsListForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
MigrationsListForOrgResponse,
MigrationsListForOrgError,
undefined,
{},
MigrationsListForOrgQueryParams,
MigrationsListForOrgPathParams
>({ url: '/orgs/{org}/migrations', method: 'get', ...variables, signal });
/**
* Lists the most recent migrations.
*/
export const useMigrationsListForOrg = (
variables: MigrationsListForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
MigrationsListForOrgResponse,
MigrationsListForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
MigrationsListForOrgResponse,
MigrationsListForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/migrations',
operationId: 'migrationsListForOrg',
variables,
}),
({ signal }) =>
fetchMigrationsListForOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type MigrationsStartForOrgPathParams = {
org: string;
};
export type MigrationsStartForOrgError = Fetcher.ErrorWrapper<
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type MigrationsStartForOrgRequestBody = {
exclude?: string[];
/**
* Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).
*
* @default false
*/
exclude_attachments?: boolean;
/**
* Indicates whether repositories should be locked (to prevent manipulation) while migrating data.
*
* @default false
*/
lock_repositories?: boolean;
/**
* A list of arrays indicating which repositories should be migrated.
*/
repositories: string[];
};
export type MigrationsStartForOrgVariables = {
body: MigrationsStartForOrgRequestBody;
pathParams: MigrationsStartForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Initiates the generation of a migration archive.
*/
export const fetchMigrationsStartForOrg = (
variables: MigrationsStartForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Migration,
MigrationsStartForOrgError,
MigrationsStartForOrgRequestBody,
{},
{},
MigrationsStartForOrgPathParams
>({ url: '/orgs/{org}/migrations', method: 'post', ...variables, signal });
/**
* Initiates the generation of a migration archive.
*/
export const useMigrationsStartForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Migration,
MigrationsStartForOrgError,
MigrationsStartForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Migration,
MigrationsStartForOrgError,
MigrationsStartForOrgVariables
>(
(variables: MigrationsStartForOrgVariables) =>
fetchMigrationsStartForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type MigrationsGetStatusForOrgPathParams = {
org: string;
/**
* migration_id parameter
*/
migrationId: number;
};
export type MigrationsGetStatusForOrgQueryParams = {
/**
* Exclude attributes from the API response to improve performance
*/
exclude?: 'repositories'[];
};
export type MigrationsGetStatusForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type MigrationsGetStatusForOrgVariables = {
pathParams: MigrationsGetStatusForOrgPathParams;
queryParams?: MigrationsGetStatusForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Fetches the status of a migration.
*
* The `state` of a migration can be one of the following values:
*
* * `pending`, which means the migration hasn't started yet.
* * `exporting`, which means the migration is in progress.
* * `exported`, which means the migration finished successfully.
* * `failed`, which means the migration failed.
*/
export const fetchMigrationsGetStatusForOrg = (
variables: MigrationsGetStatusForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Migration,
MigrationsGetStatusForOrgError,
undefined,
{},
MigrationsGetStatusForOrgQueryParams,
MigrationsGetStatusForOrgPathParams
>({
url: '/orgs/{org}/migrations/{migrationId}',
method: 'get',
...variables,
signal,
});
/**
* Fetches the status of a migration.
*
* The `state` of a migration can be one of the following values:
*
* * `pending`, which means the migration hasn't started yet.
* * `exporting`, which means the migration is in progress.
* * `exported`, which means the migration finished successfully.
* * `failed`, which means the migration failed.
*/
export const useMigrationsGetStatusForOrg = (
variables: MigrationsGetStatusForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Migration,
MigrationsGetStatusForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Migration,
MigrationsGetStatusForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/migrations/{migration_id}',
operationId: 'migrationsGetStatusForOrg',
variables,
}),
({ signal }) =>
fetchMigrationsGetStatusForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type MigrationsDeleteArchiveForOrgPathParams = {
org: string;
/**
* migration_id parameter
*/
migrationId: number;
};
export type MigrationsDeleteArchiveForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type MigrationsDeleteArchiveForOrgVariables = {
pathParams: MigrationsDeleteArchiveForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
*/
export const fetchMigrationsDeleteArchiveForOrg = (
variables: MigrationsDeleteArchiveForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
MigrationsDeleteArchiveForOrgError,
undefined,
{},
{},
MigrationsDeleteArchiveForOrgPathParams
>({
url: '/orgs/{org}/migrations/{migrationId}/archive',
method: 'delete',
...variables,
signal,
});
/**
* Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
*/
export const useMigrationsDeleteArchiveForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
MigrationsDeleteArchiveForOrgError,
MigrationsDeleteArchiveForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
MigrationsDeleteArchiveForOrgError,
MigrationsDeleteArchiveForOrgVariables
>(
(variables: MigrationsDeleteArchiveForOrgVariables) =>
fetchMigrationsDeleteArchiveForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type MigrationsDownloadArchiveForOrgPathParams = {
org: string;
/**
* migration_id parameter
*/
migrationId: number;
};
export type MigrationsDownloadArchiveForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type MigrationsDownloadArchiveForOrgVariables = {
pathParams: MigrationsDownloadArchiveForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Fetches the URL to a migration archive.
*/
export const fetchMigrationsDownloadArchiveForOrg = (
variables: MigrationsDownloadArchiveForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
MigrationsDownloadArchiveForOrgError,
undefined,
{},
{},
MigrationsDownloadArchiveForOrgPathParams
>({
url: '/orgs/{org}/migrations/{migrationId}/archive',
method: 'get',
...variables,
signal,
});
/**
* Fetches the URL to a migration archive.
*/
export const useMigrationsDownloadArchiveForOrg = (
variables: MigrationsDownloadArchiveForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
undefined,
MigrationsDownloadArchiveForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
undefined,
MigrationsDownloadArchiveForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/migrations/{migration_id}/archive',
operationId: 'migrationsDownloadArchiveForOrg',
variables,
}),
({ signal }) =>
fetchMigrationsDownloadArchiveForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type MigrationsUnlockRepoForOrgPathParams = {
org: string;
/**
* migration_id parameter
*/
migrationId: number;
/**
* repo_name parameter
*/
repoName: string;
};
export type MigrationsUnlockRepoForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type MigrationsUnlockRepoForOrgVariables = {
pathParams: MigrationsUnlockRepoForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data.
*/
export const fetchMigrationsUnlockRepoForOrg = (
variables: MigrationsUnlockRepoForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
MigrationsUnlockRepoForOrgError,
undefined,
{},
{},
MigrationsUnlockRepoForOrgPathParams
>({
url: '/orgs/{org}/migrations/{migrationId}/repos/{repoName}/lock',
method: 'delete',
...variables,
signal,
});
/**
* Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data.
*/
export const useMigrationsUnlockRepoForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
MigrationsUnlockRepoForOrgError,
MigrationsUnlockRepoForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
MigrationsUnlockRepoForOrgError,
MigrationsUnlockRepoForOrgVariables
>(
(variables: MigrationsUnlockRepoForOrgVariables) =>
fetchMigrationsUnlockRepoForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type MigrationsListReposForOrgPathParams = {
org: string;
/**
* migration_id parameter
*/
migrationId: number;
};
export type MigrationsListReposForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type MigrationsListReposForOrgError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type MigrationsListReposForOrgResponse = Schemas.MinimalRepository[];
export type MigrationsListReposForOrgVariables = {
pathParams: MigrationsListReposForOrgPathParams;
queryParams?: MigrationsListReposForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all the repositories for this organization migration.
*/
export const fetchMigrationsListReposForOrg = (
variables: MigrationsListReposForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
MigrationsListReposForOrgResponse,
MigrationsListReposForOrgError,
undefined,
{},
MigrationsListReposForOrgQueryParams,
MigrationsListReposForOrgPathParams
>({
url: '/orgs/{org}/migrations/{migrationId}/repositories',
method: 'get',
...variables,
signal,
});
/**
* List all the repositories for this organization migration.
*/
export const useMigrationsListReposForOrg = <
TData = MigrationsListReposForOrgResponse,
>(
variables: MigrationsListReposForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
MigrationsListReposForOrgResponse,
MigrationsListReposForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
MigrationsListReposForOrgResponse,
MigrationsListReposForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/migrations/{migration_id}/repositories',
operationId: 'migrationsListReposForOrg',
variables,
}),
({ signal }) =>
fetchMigrationsListReposForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsListOutsideCollaboratorsPathParams = {
org: string;
};
export type OrgsListOutsideCollaboratorsQueryParams = {
/**
* Filter the list of outside collaborators. Can be one of:
* \* `2fa_disabled`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled.
* \* `all`: All outside collaborators.
*
* @default all
*/
filter?: '2fa_disabled' | 'all';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListOutsideCollaboratorsError = Fetcher.ErrorWrapper;
export type OrgsListOutsideCollaboratorsResponse = Schemas.SimpleUser[];
export type OrgsListOutsideCollaboratorsVariables = {
pathParams: OrgsListOutsideCollaboratorsPathParams;
queryParams?: OrgsListOutsideCollaboratorsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all users who are outside collaborators of an organization.
*/
export const fetchOrgsListOutsideCollaborators = (
variables: OrgsListOutsideCollaboratorsVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListOutsideCollaboratorsResponse,
OrgsListOutsideCollaboratorsError,
undefined,
{},
OrgsListOutsideCollaboratorsQueryParams,
OrgsListOutsideCollaboratorsPathParams
>({
url: '/orgs/{org}/outside_collaborators',
method: 'get',
...variables,
signal,
});
/**
* List all users who are outside collaborators of an organization.
*/
export const useOrgsListOutsideCollaborators = <
TData = OrgsListOutsideCollaboratorsResponse,
>(
variables: OrgsListOutsideCollaboratorsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListOutsideCollaboratorsResponse,
OrgsListOutsideCollaboratorsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListOutsideCollaboratorsResponse,
OrgsListOutsideCollaboratorsError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/outside_collaborators',
operationId: 'orgsListOutsideCollaborators',
variables,
}),
({ signal }) =>
fetchOrgsListOutsideCollaborators(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsRemoveOutsideCollaboratorPathParams = {
org: string;
username: string;
};
export type OrgsRemoveOutsideCollaboratorError = Fetcher.ErrorWrapper<{
status: 422;
payload: {
documentation_url?: string;
message?: string;
};
}>;
export type OrgsRemoveOutsideCollaboratorVariables = {
pathParams: OrgsRemoveOutsideCollaboratorPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removing a user from this list will remove them from all the organization's repositories.
*/
export const fetchOrgsRemoveOutsideCollaborator = (
variables: OrgsRemoveOutsideCollaboratorVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsRemoveOutsideCollaboratorError,
undefined,
{},
{},
OrgsRemoveOutsideCollaboratorPathParams
>({
url: '/orgs/{org}/outside_collaborators/{username}',
method: 'delete',
...variables,
signal,
});
/**
* Removing a user from this list will remove them from all the organization's repositories.
*/
export const useOrgsRemoveOutsideCollaborator = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsRemoveOutsideCollaboratorError,
OrgsRemoveOutsideCollaboratorVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsRemoveOutsideCollaboratorError,
OrgsRemoveOutsideCollaboratorVariables
>(
(variables: OrgsRemoveOutsideCollaboratorVariables) =>
fetchOrgsRemoveOutsideCollaborator({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsConvertMemberToOutsideCollaboratorPathParams = {
org: string;
username: string;
};
export type OrgsConvertMemberToOutsideCollaboratorError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: {
documentation_url?: string;
message?: string;
};
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type OrgsConvertMemberToOutsideCollaboratorVariables = {
pathParams: OrgsConvertMemberToOutsideCollaboratorPathParams;
} & GithubContext['fetcherOptions'];
/**
* When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "[Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)".
*/
export const fetchOrgsConvertMemberToOutsideCollaborator = (
variables: OrgsConvertMemberToOutsideCollaboratorVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsConvertMemberToOutsideCollaboratorError,
undefined,
{},
{},
OrgsConvertMemberToOutsideCollaboratorPathParams
>({
url: '/orgs/{org}/outside_collaborators/{username}',
method: 'put',
...variables,
signal,
});
/**
* When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "[Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)".
*/
export const useOrgsConvertMemberToOutsideCollaborator = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsConvertMemberToOutsideCollaboratorError,
OrgsConvertMemberToOutsideCollaboratorVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsConvertMemberToOutsideCollaboratorError,
OrgsConvertMemberToOutsideCollaboratorVariables
>(
(variables: OrgsConvertMemberToOutsideCollaboratorVariables) =>
fetchOrgsConvertMemberToOutsideCollaborator({
...fetcherOptions,
...variables,
}),
options,
);
};
export type PackagesDeletePackageForOrgPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
};
export type PackagesDeletePackageForOrgError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type PackagesDeletePackageForOrgVariables = {
pathParams: PackagesDeletePackageForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes an entire package in an organization. You cannot delete a public package if any version of the package has more than 25 downloads. In this scenario, contact GitHub support for further assistance.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
*/
export const fetchPackagesDeletePackageForOrg = (
variables: PackagesDeletePackageForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
PackagesDeletePackageForOrgError,
undefined,
{},
{},
PackagesDeletePackageForOrgPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}',
method: 'delete',
...variables,
signal,
});
/**
* Deletes an entire package in an organization. You cannot delete a public package if any version of the package has more than 25 downloads. In this scenario, contact GitHub support for further assistance.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
*/
export const usePackagesDeletePackageForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
PackagesDeletePackageForOrgError,
PackagesDeletePackageForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
PackagesDeletePackageForOrgError,
PackagesDeletePackageForOrgVariables
>(
(variables: PackagesDeletePackageForOrgVariables) =>
fetchPackagesDeletePackageForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type PackagesGetPackageForOrganizationPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
};
export type PackagesGetPackageForOrganizationError =
Fetcher.ErrorWrapper;
export type PackagesGetPackageForOrganizationVariables = {
pathParams: PackagesGetPackageForOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a specific package in an organization.
*
* To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const fetchPackagesGetPackageForOrganization = (
variables: PackagesGetPackageForOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Package,
PackagesGetPackageForOrganizationError,
undefined,
{},
{},
PackagesGetPackageForOrganizationPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}',
method: 'get',
...variables,
signal,
});
/**
* Gets a specific package in an organization.
*
* To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const usePackagesGetPackageForOrganization = (
variables: PackagesGetPackageForOrganizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.Package,
PackagesGetPackageForOrganizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.Package,
PackagesGetPackageForOrganizationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/packages/{package_type}/{package_name}',
operationId: 'packagesGetPackageForOrganization',
variables,
}),
({ signal }) =>
fetchPackagesGetPackageForOrganization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type PackagesRestorePackageForOrgPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
};
export type PackagesRestorePackageForOrgQueryParams = {
/**
* package token
*/
token?: string;
};
export type PackagesRestorePackageForOrgError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type PackagesRestorePackageForOrgVariables = {
pathParams: PackagesRestorePackageForOrgPathParams;
queryParams?: PackagesRestorePackageForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Restores an entire package in an organization.
*
* You can restore a deleted package under the following conditions:
* - The package was deleted within the last 30 days.
* - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` and `packages:write` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container that you want to restore.
*/
export const fetchPackagesRestorePackageForOrg = (
variables: PackagesRestorePackageForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
PackagesRestorePackageForOrgError,
undefined,
{},
PackagesRestorePackageForOrgQueryParams,
PackagesRestorePackageForOrgPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}/restore',
method: 'post',
...variables,
signal,
});
/**
* Restores an entire package in an organization.
*
* You can restore a deleted package under the following conditions:
* - The package was deleted within the last 30 days.
* - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` and `packages:write` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container that you want to restore.
*/
export const usePackagesRestorePackageForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
PackagesRestorePackageForOrgError,
PackagesRestorePackageForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
PackagesRestorePackageForOrgError,
PackagesRestorePackageForOrgVariables
>(
(variables: PackagesRestorePackageForOrgVariables) =>
fetchPackagesRestorePackageForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type PackagesGetAllPackageVersionsForPackageOwnedByOrgPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
};
export type PackagesGetAllPackageVersionsForPackageOwnedByOrgQueryParams = {
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* The state of the package, either active or deleted.
*
* @default active
*/
state?: 'active' | 'deleted';
};
export type PackagesGetAllPackageVersionsForPackageOwnedByOrgError =
Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type PackagesGetAllPackageVersionsForPackageOwnedByOrgResponse =
Schemas.PackageVersion[];
export type PackagesGetAllPackageVersionsForPackageOwnedByOrgVariables = {
pathParams: PackagesGetAllPackageVersionsForPackageOwnedByOrgPathParams;
queryParams?: PackagesGetAllPackageVersionsForPackageOwnedByOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Returns all package versions for a package owned by an organization.
*
* To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const fetchPackagesGetAllPackageVersionsForPackageOwnedByOrg = (
variables: PackagesGetAllPackageVersionsForPackageOwnedByOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
PackagesGetAllPackageVersionsForPackageOwnedByOrgResponse,
PackagesGetAllPackageVersionsForPackageOwnedByOrgError,
undefined,
{},
PackagesGetAllPackageVersionsForPackageOwnedByOrgQueryParams,
PackagesGetAllPackageVersionsForPackageOwnedByOrgPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}/versions',
method: 'get',
...variables,
signal,
});
/**
* Returns all package versions for a package owned by an organization.
*
* To use this endpoint, you must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const usePackagesGetAllPackageVersionsForPackageOwnedByOrg = <
TData = PackagesGetAllPackageVersionsForPackageOwnedByOrgResponse,
>(
variables: PackagesGetAllPackageVersionsForPackageOwnedByOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
PackagesGetAllPackageVersionsForPackageOwnedByOrgResponse,
PackagesGetAllPackageVersionsForPackageOwnedByOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
PackagesGetAllPackageVersionsForPackageOwnedByOrgResponse,
PackagesGetAllPackageVersionsForPackageOwnedByOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/packages/{package_type}/{package_name}/versions',
operationId: 'packagesGetAllPackageVersionsForPackageOwnedByOrg',
variables,
}),
({ signal }) =>
fetchPackagesGetAllPackageVersionsForPackageOwnedByOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type PackagesDeletePackageVersionForOrgPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
/**
* Unique identifier of the package version.
*/
packageVersionId: number;
};
export type PackagesDeletePackageVersionForOrgError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type PackagesDeletePackageVersionForOrgVariables = {
pathParams: PackagesDeletePackageVersionForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a specific package version in an organization. If the package is public and the package version has more than 25 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
*/
export const fetchPackagesDeletePackageVersionForOrg = (
variables: PackagesDeletePackageVersionForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
PackagesDeletePackageVersionForOrgError,
undefined,
{},
{},
PackagesDeletePackageVersionForOrgPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}/versions/{packageVersionId}',
method: 'delete',
...variables,
signal,
});
/**
* Deletes a specific package version in an organization. If the package is public and the package version has more than 25 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container you want to delete.
*/
export const usePackagesDeletePackageVersionForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
PackagesDeletePackageVersionForOrgError,
PackagesDeletePackageVersionForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
PackagesDeletePackageVersionForOrgError,
PackagesDeletePackageVersionForOrgVariables
>(
(variables: PackagesDeletePackageVersionForOrgVariables) =>
fetchPackagesDeletePackageVersionForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type PackagesGetPackageVersionForOrganizationPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
/**
* Unique identifier of the package version.
*/
packageVersionId: number;
};
export type PackagesGetPackageVersionForOrganizationError =
Fetcher.ErrorWrapper;
export type PackagesGetPackageVersionForOrganizationVariables = {
pathParams: PackagesGetPackageVersionForOrganizationPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a specific package version in an organization.
*
* You must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const fetchPackagesGetPackageVersionForOrganization = (
variables: PackagesGetPackageVersionForOrganizationVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.PackageVersion,
PackagesGetPackageVersionForOrganizationError,
undefined,
{},
{},
PackagesGetPackageVersionForOrganizationPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}/versions/{packageVersionId}',
method: 'get',
...variables,
signal,
});
/**
* Gets a specific package version in an organization.
*
* You must authenticate using an access token with the `packages:read` scope.
* If `package_type` is not `container`, your token must also include the `repo` scope.
*/
export const usePackagesGetPackageVersionForOrganization = <
TData = Schemas.PackageVersion,
>(
variables: PackagesGetPackageVersionForOrganizationVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.PackageVersion,
PackagesGetPackageVersionForOrganizationError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.PackageVersion,
PackagesGetPackageVersionForOrganizationError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}',
operationId: 'packagesGetPackageVersionForOrganization',
variables,
}),
({ signal }) =>
fetchPackagesGetPackageVersionForOrganization(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type PackagesRestorePackageVersionForOrgPathParams = {
/**
* The type of supported package. Can be one of `npm`, `maven`, `rubygems`, `nuget`, `docker`, or `container`. For Docker images that use the package namespace `https://ghcr.io/owner/package-name`, use `container`.
*/
packageType: 'npm' | 'maven' | 'rubygems' | 'docker' | 'nuget' | 'container';
/**
* The name of the package.
*/
packageName: string;
org: string;
/**
* Unique identifier of the package version.
*/
packageVersionId: number;
};
export type PackagesRestorePackageVersionForOrgError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type PackagesRestorePackageVersionForOrgVariables = {
pathParams: PackagesRestorePackageVersionForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Restores a specific package version in an organization.
*
* You can restore a deleted package under the following conditions:
* - The package was deleted within the last 30 days.
* - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` and `packages:write` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container that you want to restore.
*/
export const fetchPackagesRestorePackageVersionForOrg = (
variables: PackagesRestorePackageVersionForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
PackagesRestorePackageVersionForOrgError,
undefined,
{},
{},
PackagesRestorePackageVersionForOrgPathParams
>({
url: '/orgs/{org}/packages/{packageType}/{packageName}/versions/{packageVersionId}/restore',
method: 'post',
...variables,
signal,
});
/**
* Restores a specific package version in an organization.
*
* You can restore a deleted package under the following conditions:
* - The package was deleted within the last 30 days.
* - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
*
* To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the `packages:read` and `packages:write` scope. In addition:
* - If `package_type` is not `container`, your token must also include the `repo` scope.
* - If `package_type` is `container`, you must also have admin permissions to the container that you want to restore.
*/
export const usePackagesRestorePackageVersionForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
PackagesRestorePackageVersionForOrgError,
PackagesRestorePackageVersionForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
PackagesRestorePackageVersionForOrgError,
PackagesRestorePackageVersionForOrgVariables
>(
(variables: PackagesRestorePackageVersionForOrgVariables) =>
fetchPackagesRestorePackageVersionForOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ProjectsListForOrgPathParams = {
org: string;
};
export type ProjectsListForOrgQueryParams = {
/**
* Indicates the state of the projects to return. Can be either `open`, `closed`, or `all`.
*
* @default open
*/
state?: 'open' | 'closed' | 'all';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ProjectsListForOrgError = Fetcher.ErrorWrapper<{
status: 422;
payload: Responses.ValidationFailedSimple;
}>;
export type ProjectsListForOrgResponse = Schemas.Project[];
export type ProjectsListForOrgVariables = {
pathParams: ProjectsListForOrgPathParams;
queryParams?: ProjectsListForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the projects in an organization. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const fetchProjectsListForOrg = (
variables: ProjectsListForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ProjectsListForOrgResponse,
ProjectsListForOrgError,
undefined,
{},
ProjectsListForOrgQueryParams,
ProjectsListForOrgPathParams
>({ url: '/orgs/{org}/projects', method: 'get', ...variables, signal });
/**
* Lists the projects in an organization. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const useProjectsListForOrg = (
variables: ProjectsListForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ProjectsListForOrgResponse,
ProjectsListForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ProjectsListForOrgResponse,
ProjectsListForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/projects',
operationId: 'projectsListForOrg',
variables,
}),
({ signal }) =>
fetchProjectsListForOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsCreateForOrgPathParams = {
org: string;
};
export type ProjectsCreateForOrgError = Fetcher.ErrorWrapper<
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 410;
payload: Responses.Gone;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type ProjectsCreateForOrgRequestBody = {
/**
* The description of the project.
*/
body?: string;
/**
* The name of the project.
*/
name: string;
};
export type ProjectsCreateForOrgVariables = {
body: ProjectsCreateForOrgRequestBody;
pathParams: ProjectsCreateForOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates an organization project board. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const fetchProjectsCreateForOrg = (
variables: ProjectsCreateForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Project,
ProjectsCreateForOrgError,
ProjectsCreateForOrgRequestBody,
{},
{},
ProjectsCreateForOrgPathParams
>({ url: '/orgs/{org}/projects', method: 'post', ...variables, signal });
/**
* Creates an organization project board. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const useProjectsCreateForOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Project,
ProjectsCreateForOrgError,
ProjectsCreateForOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Project,
ProjectsCreateForOrgError,
ProjectsCreateForOrgVariables
>(
(variables: ProjectsCreateForOrgVariables) =>
fetchProjectsCreateForOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type OrgsListPublicMembersPathParams = {
org: string;
};
export type OrgsListPublicMembersQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type OrgsListPublicMembersError = Fetcher.ErrorWrapper;
export type OrgsListPublicMembersResponse = Schemas.SimpleUser[];
export type OrgsListPublicMembersVariables = {
pathParams: OrgsListPublicMembersPathParams;
queryParams?: OrgsListPublicMembersQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Members of an organization can choose to have their membership publicized or not.
*/
export const fetchOrgsListPublicMembers = (
variables: OrgsListPublicMembersVariables,
signal?: AbortSignal,
) =>
githubFetch<
OrgsListPublicMembersResponse,
OrgsListPublicMembersError,
undefined,
{},
OrgsListPublicMembersQueryParams,
OrgsListPublicMembersPathParams
>({ url: '/orgs/{org}/public_members', method: 'get', ...variables, signal });
/**
* Members of an organization can choose to have their membership publicized or not.
*/
export const useOrgsListPublicMembers = (
variables: OrgsListPublicMembersVariables,
options?: Omit<
reactQuery.UseQueryOptions<
OrgsListPublicMembersResponse,
OrgsListPublicMembersError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
OrgsListPublicMembersResponse,
OrgsListPublicMembersError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/public_members',
operationId: 'orgsListPublicMembers',
variables,
}),
({ signal }) =>
fetchOrgsListPublicMembers({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type OrgsRemovePublicMembershipForAuthenticatedUserPathParams = {
org: string;
username: string;
};
export type OrgsRemovePublicMembershipForAuthenticatedUserError =
Fetcher.ErrorWrapper;
export type OrgsRemovePublicMembershipForAuthenticatedUserVariables = {
pathParams: OrgsRemovePublicMembershipForAuthenticatedUserPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsRemovePublicMembershipForAuthenticatedUser = (
variables: OrgsRemovePublicMembershipForAuthenticatedUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsRemovePublicMembershipForAuthenticatedUserError,
undefined,
{},
{},
OrgsRemovePublicMembershipForAuthenticatedUserPathParams
>({
url: '/orgs/{org}/public_members/{username}',
method: 'delete',
...variables,
signal,
});
export const useOrgsRemovePublicMembershipForAuthenticatedUser = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsRemovePublicMembershipForAuthenticatedUserError,
OrgsRemovePublicMembershipForAuthenticatedUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsRemovePublicMembershipForAuthenticatedUserError,
OrgsRemovePublicMembershipForAuthenticatedUserVariables
>(
(variables: OrgsRemovePublicMembershipForAuthenticatedUserVariables) =>
fetchOrgsRemovePublicMembershipForAuthenticatedUser({
...fetcherOptions,
...variables,
}),
options,
);
};
export type OrgsCheckPublicMembershipForUserPathParams = {
org: string;
username: string;
};
export type OrgsCheckPublicMembershipForUserError =
Fetcher.ErrorWrapper;
export type OrgsCheckPublicMembershipForUserVariables = {
pathParams: OrgsCheckPublicMembershipForUserPathParams;
} & GithubContext['fetcherOptions'];
export const fetchOrgsCheckPublicMembershipForUser = (
variables: OrgsCheckPublicMembershipForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsCheckPublicMembershipForUserError,
undefined,
{},
{},
OrgsCheckPublicMembershipForUserPathParams
>({
url: '/orgs/{org}/public_members/{username}',
method: 'get',
...variables,
signal,
});
export const useOrgsCheckPublicMembershipForUser = (
variables: OrgsCheckPublicMembershipForUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
undefined,
OrgsCheckPublicMembershipForUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
undefined,
OrgsCheckPublicMembershipForUserError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/public_members/{username}',
operationId: 'orgsCheckPublicMembershipForUser',
variables,
}),
({ signal }) =>
fetchOrgsCheckPublicMembershipForUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type OrgsSetPublicMembershipForAuthenticatedUserPathParams = {
org: string;
username: string;
};
export type OrgsSetPublicMembershipForAuthenticatedUserError =
Fetcher.ErrorWrapper<{
status: 403;
payload: Responses.Forbidden;
}>;
export type OrgsSetPublicMembershipForAuthenticatedUserVariables = {
pathParams: OrgsSetPublicMembershipForAuthenticatedUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* The user can publicize their own membership. (A user cannot publicize the membership for another user.)
*
* Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
export const fetchOrgsSetPublicMembershipForAuthenticatedUser = (
variables: OrgsSetPublicMembershipForAuthenticatedUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
OrgsSetPublicMembershipForAuthenticatedUserError,
undefined,
{},
{},
OrgsSetPublicMembershipForAuthenticatedUserPathParams
>({
url: '/orgs/{org}/public_members/{username}',
method: 'put',
...variables,
signal,
});
/**
* The user can publicize their own membership. (A user cannot publicize the membership for another user.)
*
* Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
export const useOrgsSetPublicMembershipForAuthenticatedUser = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
OrgsSetPublicMembershipForAuthenticatedUserError,
OrgsSetPublicMembershipForAuthenticatedUserVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
OrgsSetPublicMembershipForAuthenticatedUserError,
OrgsSetPublicMembershipForAuthenticatedUserVariables
>(
(variables: OrgsSetPublicMembershipForAuthenticatedUserVariables) =>
fetchOrgsSetPublicMembershipForAuthenticatedUser({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ReposListForOrgPathParams = {
org: string;
};
export type ReposListForOrgQueryParams = {
/**
* Specifies the types of repositories you want returned. Can be one of `all`, `public`, `private`, `forks`, `sources`, `member`, `internal`. Note: For GitHub AE, can be one of `all`, `private`, `forks`, `sources`, `member`, `internal`. Default: `all`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, `type` can also be `internal`.
*/
type?:
| 'all'
| 'public'
| 'private'
| 'forks'
| 'sources'
| 'member'
| 'internal';
/**
* Can be one of `created`, `updated`, `pushed`, `full_name`.
*
* @default created
*/
sort?: 'created' | 'updated' | 'pushed' | 'full_name';
/**
* Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc`
*/
direction?: 'asc' | 'desc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ReposListForOrgError = Fetcher.ErrorWrapper;
export type ReposListForOrgResponse = Schemas.MinimalRepository[];
export type ReposListForOrgVariables = {
pathParams: ReposListForOrgPathParams;
queryParams?: ReposListForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists repositories for the specified organization.
*/
export const fetchReposListForOrg = (
variables: ReposListForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ReposListForOrgResponse,
ReposListForOrgError,
undefined,
{},
ReposListForOrgQueryParams,
ReposListForOrgPathParams
>({ url: '/orgs/{org}/repos', method: 'get', ...variables, signal });
/**
* Lists repositories for the specified organization.
*/
export const useReposListForOrg = (
variables: ReposListForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ReposListForOrgResponse,
ReposListForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ReposListForOrgResponse,
ReposListForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/repos',
operationId: 'reposListForOrg',
variables,
}),
({ signal }) =>
fetchReposListForOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ReposCreateInOrgPathParams = {
org: string;
};
export type ReposCreateInOrgError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ReposCreateInOrgRequestBody = {
/**
* Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
*
* @default true
*/
allow_merge_commit?: boolean;
/**
* Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
*
* @default true
*/
allow_rebase_merge?: boolean;
/**
* Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
*
* @default true
*/
allow_squash_merge?: boolean;
/**
* Pass `true` to create an initial commit with empty README.
*
* @default false
*/
auto_init?: boolean;
/**
* Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion.
*
* @default false
*/
delete_branch_on_merge?: boolean;
/**
* A short description of the repository.
*/
description?: string;
/**
* Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, "Haskell".
*/
gitignore_template?: string;
/**
* Either `true` to enable issues for this repository or `false` to disable them.
*
* @default true
*/
has_issues?: boolean;
/**
* Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.
*
* @default true
*/
has_projects?: boolean;
/**
* Either `true` to enable the wiki for this repository or `false` to disable it.
*
* @default true
*/
has_wiki?: boolean;
/**
* A URL with more information about the repository.
*/
homepage?: string;
/**
* Either `true` to make this repo available as a template repository or `false` to prevent it.
*
* @default false
*/
is_template?: boolean;
/**
* Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://help.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the `license_template` string. For example, "mit" or "mpl-2.0".
*/
license_template?: string;
/**
* The name of the repository.
*/
name: string;
/**
* Whether the repository is private.
*
* @default false
*/
private?: boolean;
/**
* The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
*/
team_id?: number;
/**
* Can be `public` or `private`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, `visibility` can also be `internal`. Note: For GitHub Enterprise Server and GitHub AE, this endpoint will only list repositories available to all users on the enterprise. For more information, see "[Creating an internal repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-repository-visibility#about-internal-repositories)" in the GitHub Help documentation.
* The `visibility` parameter overrides the `private` parameter when you use both parameters with the `nebula-preview` preview header.
*/
visibility?: 'public' | 'private' | 'visibility' | 'internal';
};
export type ReposCreateInOrgVariables = {
body: ReposCreateInOrgRequestBody;
pathParams: ReposCreateInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates a new repository in the specified organization. The authenticated user must be a member of the organization.
*
* **OAuth scope requirements**
*
* When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include:
*
* * `public_repo` scope or `repo` scope to create a public repository. Note: For GitHub AE, use `repo` scope to create an internal repository.
* * `repo` scope to create a private repository
*/
export const fetchReposCreateInOrg = (
variables: ReposCreateInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Repository,
ReposCreateInOrgError,
ReposCreateInOrgRequestBody,
{},
{},
ReposCreateInOrgPathParams
>({ url: '/orgs/{org}/repos', method: 'post', ...variables, signal });
/**
* Creates a new repository in the specified organization. The authenticated user must be a member of the organization.
*
* **OAuth scope requirements**
*
* When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include:
*
* * `public_repo` scope or `repo` scope to create a public repository. Note: For GitHub AE, use `repo` scope to create an internal repository.
* * `repo` scope to create a private repository
*/
export const useReposCreateInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Repository,
ReposCreateInOrgError,
ReposCreateInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Repository,
ReposCreateInOrgError,
ReposCreateInOrgVariables
>(
(variables: ReposCreateInOrgVariables) =>
fetchReposCreateInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type BillingGetGithubActionsBillingOrgPathParams = {
org: string;
};
export type BillingGetGithubActionsBillingOrgError =
Fetcher.ErrorWrapper;
export type BillingGetGithubActionsBillingOrgVariables = {
pathParams: BillingGetGithubActionsBillingOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the summary of the free and paid GitHub Actions minutes used.
*
* Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage returned includes any minute multipliers for macOS and Windows runners, and is rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const fetchBillingGetGithubActionsBillingOrg = (
variables: BillingGetGithubActionsBillingOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingOrgError,
undefined,
{},
{},
BillingGetGithubActionsBillingOrgPathParams
>({
url: '/orgs/{org}/settings/billing/actions',
method: 'get',
...variables,
signal,
});
/**
* Gets the summary of the free and paid GitHub Actions minutes used.
*
* Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage returned includes any minute multipliers for macOS and Windows runners, and is rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const useBillingGetGithubActionsBillingOrg = <
TData = Schemas.ActionsBillingUsage,
>(
variables: BillingGetGithubActionsBillingOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ActionsBillingUsage,
BillingGetGithubActionsBillingOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/settings/billing/actions',
operationId: 'billingGetGithubActionsBillingOrg',
variables,
}),
({ signal }) =>
fetchBillingGetGithubActionsBillingOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type BillingGetGithubPackagesBillingOrgPathParams = {
org: string;
};
export type BillingGetGithubPackagesBillingOrgError =
Fetcher.ErrorWrapper;
export type BillingGetGithubPackagesBillingOrgVariables = {
pathParams: BillingGetGithubPackagesBillingOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the free and paid storage usued for GitHub Packages in gigabytes.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const fetchBillingGetGithubPackagesBillingOrg = (
variables: BillingGetGithubPackagesBillingOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingOrgError,
undefined,
{},
{},
BillingGetGithubPackagesBillingOrgPathParams
>({
url: '/orgs/{org}/settings/billing/packages',
method: 'get',
...variables,
signal,
});
/**
* Gets the free and paid storage usued for GitHub Packages in gigabytes.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const useBillingGetGithubPackagesBillingOrg = <
TData = Schemas.PackagesBillingUsage,
>(
variables: BillingGetGithubPackagesBillingOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.PackagesBillingUsage,
BillingGetGithubPackagesBillingOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/settings/billing/packages',
operationId: 'billingGetGithubPackagesBillingOrg',
variables,
}),
({ signal }) =>
fetchBillingGetGithubPackagesBillingOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type BillingGetSharedStorageBillingOrgPathParams = {
org: string;
};
export type BillingGetSharedStorageBillingOrgError =
Fetcher.ErrorWrapper;
export type BillingGetSharedStorageBillingOrgVariables = {
pathParams: BillingGetSharedStorageBillingOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const fetchBillingGetSharedStorageBillingOrg = (
variables: BillingGetSharedStorageBillingOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingOrgError,
undefined,
{},
{},
BillingGetSharedStorageBillingOrgPathParams
>({
url: '/orgs/{org}/settings/billing/shared-storage',
method: 'get',
...variables,
signal,
});
/**
* Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages.
*
* Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)."
*
* Access tokens must have the `repo` or `admin:org` scope.
*/
export const useBillingGetSharedStorageBillingOrg = <
TData = Schemas.CombinedBillingUsage,
>(
variables: BillingGetSharedStorageBillingOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.CombinedBillingUsage,
BillingGetSharedStorageBillingOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/settings/billing/shared-storage',
operationId: 'billingGetSharedStorageBillingOrg',
variables,
}),
({ signal }) =>
fetchBillingGetSharedStorageBillingOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsListIdpGroupsForOrgPathParams = {
org: string;
};
export type TeamsListIdpGroupsForOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page token
*/
page?: string;
};
export type TeamsListIdpGroupsForOrgError = Fetcher.ErrorWrapper;
export type TeamsListIdpGroupsForOrgVariables = {
pathParams: TeamsListIdpGroupsForOrgPathParams;
queryParams?: TeamsListIdpGroupsForOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* List IdP groups available in an organization. You can limit your page results using the `per_page` parameter. GitHub generates a url-encoded `page` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)."
*
* The `per_page` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user `octocat` wants to see two groups per page in `octo-org` via cURL, it would look like this:
*/
export const fetchTeamsListIdpGroupsForOrg = (
variables: TeamsListIdpGroupsForOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GroupMapping,
TeamsListIdpGroupsForOrgError,
undefined,
{},
TeamsListIdpGroupsForOrgQueryParams,
TeamsListIdpGroupsForOrgPathParams
>({
url: '/orgs/{org}/team-sync/groups',
method: 'get',
...variables,
signal,
});
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* List IdP groups available in an organization. You can limit your page results using the `per_page` parameter. GitHub generates a url-encoded `page` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)."
*
* The `per_page` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user `octocat` wants to see two groups per page in `octo-org` via cURL, it would look like this:
*/
export const useTeamsListIdpGroupsForOrg = (
variables: TeamsListIdpGroupsForOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.GroupMapping,
TeamsListIdpGroupsForOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.GroupMapping,
TeamsListIdpGroupsForOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/team-sync/groups',
operationId: 'teamsListIdpGroupsForOrg',
variables,
}),
({ signal }) =>
fetchTeamsListIdpGroupsForOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsListPathParams = {
org: string;
};
export type TeamsListQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListError = Fetcher.ErrorWrapper<{
status: 403;
payload: Responses.Forbidden;
}>;
export type TeamsListResponse = Schemas.Team[];
export type TeamsListVariables = {
pathParams: TeamsListPathParams;
queryParams?: TeamsListQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists all teams in an organization that are visible to the authenticated user.
*/
export const fetchTeamsList = (
variables: TeamsListVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListResponse,
TeamsListError,
undefined,
{},
TeamsListQueryParams,
TeamsListPathParams
>({ url: '/orgs/{org}/teams', method: 'get', ...variables, signal });
/**
* Lists all teams in an organization that are visible to the authenticated user.
*/
export const useTeamsList = (
variables: TeamsListVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/orgs/{org}/teams',
operationId: 'teamsList',
variables,
}),
({ signal }) => fetchTeamsList({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsCreatePathParams = {
org: string;
};
export type TeamsCreateError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type TeamsCreateRequestBody = {
/**
* The description of the team.
*/
description?: string;
/**
* List GitHub IDs for organization members who will become team maintainers.
*/
maintainers?: string[];
/**
* The name of the team.
*/
name: string;
/**
* The ID of a team to set as the parent team.
*/
parent_team_id?: number;
/**
* **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* \* `pull` - team members can pull, but not push to or administer newly-added repositories.
* \* `push` - team members can pull and push, but not administer newly-added repositories.
* \* `admin` - team members can pull, push and administer newly-added repositories.
*
* @default pull
*/
permission?: 'pull' | 'push' | 'admin';
/**
* The level of privacy this team should have. The options are:
* **For a non-nested team:**
* \* `secret` - only visible to organization owners and members of this team.
* \* `closed` - visible to all members of this organization.
* Default: `secret`
* **For a parent or child team:**
* \* `closed` - visible to all members of this organization.
* Default for child team: `closed`
*/
privacy?: 'secret' | 'closed';
/**
* The full name (e.g., "organization-name/repository-name") of repositories to add the team to.
*/
repo_names?: string[];
};
export type TeamsCreateVariables = {
body: TeamsCreateRequestBody;
pathParams: TeamsCreatePathParams;
} & GithubContext['fetcherOptions'];
/**
* To create a team, the authenticated user must be a member or owner of `{org}`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "[Setting team creation permissions](https://help.github.com/en/articles/setting-team-creation-permissions-in-your-organization)."
*
* When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of `maintainers`. For more information, see "[About teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams)".
*/
export const fetchTeamsCreate = (
variables: TeamsCreateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamFull,
TeamsCreateError,
TeamsCreateRequestBody,
{},
{},
TeamsCreatePathParams
>({ url: '/orgs/{org}/teams', method: 'post', ...variables, signal });
/**
* To create a team, the authenticated user must be a member or owner of `{org}`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "[Setting team creation permissions](https://help.github.com/en/articles/setting-team-creation-permissions-in-your-organization)."
*
* When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of `maintainers`. For more information, see "[About teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams)".
*/
export const useTeamsCreate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamFull,
TeamsCreateError,
TeamsCreateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamFull,
TeamsCreateError,
TeamsCreateVariables
>(
(variables: TeamsCreateVariables) =>
fetchTeamsCreate({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsDeleteInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsDeleteInOrgError = Fetcher.ErrorWrapper;
export type TeamsDeleteInOrgVariables = {
pathParams: TeamsDeleteInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* To delete a team, the authenticated user must be an organization owner or team maintainer.
*
* If you are an organization owner, deleting a parent team will delete all of its child teams as well.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}`.
*/
export const fetchTeamsDeleteInOrg = (
variables: TeamsDeleteInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsDeleteInOrgError,
undefined,
{},
{},
TeamsDeleteInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}',
method: 'delete',
...variables,
signal,
});
/**
* To delete a team, the authenticated user must be an organization owner or team maintainer.
*
* If you are an organization owner, deleting a parent team will delete all of its child teams as well.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}`.
*/
export const useTeamsDeleteInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsDeleteInOrgError,
TeamsDeleteInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsDeleteInOrgError,
TeamsDeleteInOrgVariables
>(
(variables: TeamsDeleteInOrgVariables) =>
fetchTeamsDeleteInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsGetByNamePathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsGetByNameError = Fetcher.ErrorWrapper<{
status: 404;
payload: Responses.NotFound;
}>;
export type TeamsGetByNameVariables = {
pathParams: TeamsGetByNamePathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a team using the team's `slug`. GitHub generates the `slug` from the team `name`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}`.
*/
export const fetchTeamsGetByName = (
variables: TeamsGetByNameVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamFull,
TeamsGetByNameError,
undefined,
{},
{},
TeamsGetByNamePathParams
>({
url: '/orgs/{org}/teams/{teamSlug}',
method: 'get',
...variables,
signal,
});
/**
* Gets a team using the team's `slug`. GitHub generates the `slug` from the team `name`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}`.
*/
export const useTeamsGetByName = (
variables: TeamsGetByNameVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}',
operationId: 'teamsGetByName',
variables,
}),
({ signal }) =>
fetchTeamsGetByName({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsUpdateInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsUpdateInOrgError = Fetcher.ErrorWrapper;
export type TeamsUpdateInOrgRequestBody = {
/**
* The description of the team.
*/
description?: string;
/**
* The name of the team.
*/
name?: string;
/**
* The ID of a team to set as the parent team.
*/
parent_team_id?: number | null;
/**
* **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* \* `pull` - team members can pull, but not push to or administer newly-added repositories.
* \* `push` - team members can pull and push, but not administer newly-added repositories.
* \* `admin` - team members can pull, push and administer newly-added repositories.
*
* @default pull
*/
permission?: 'pull' | 'push' | 'admin';
/**
* The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. When a team is nested, the `privacy` for parent teams cannot be `secret`. The options are:
* **For a non-nested team:**
* \* `secret` - only visible to organization owners and members of this team.
* \* `closed` - visible to all members of this organization.
* **For a parent or child team:**
* \* `closed` - visible to all members of this organization.
*/
privacy?: 'secret' | 'closed';
};
export type TeamsUpdateInOrgVariables = {
body?: TeamsUpdateInOrgRequestBody;
pathParams: TeamsUpdateInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* To edit a team, the authenticated user must either be an organization owner or a team maintainer.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}`.
*/
export const fetchTeamsUpdateInOrg = (
variables: TeamsUpdateInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamFull,
TeamsUpdateInOrgError,
TeamsUpdateInOrgRequestBody,
{},
{},
TeamsUpdateInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}',
method: 'patch',
...variables,
signal,
});
/**
* To edit a team, the authenticated user must either be an organization owner or a team maintainer.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}`.
*/
export const useTeamsUpdateInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamFull,
TeamsUpdateInOrgError,
TeamsUpdateInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamFull,
TeamsUpdateInOrgError,
TeamsUpdateInOrgVariables
>(
(variables: TeamsUpdateInOrgVariables) =>
fetchTeamsUpdateInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsListDiscussionsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListDiscussionsInOrgQueryParams = {
/**
* One of `asc` (ascending) or `desc` (descending).
*
* @default desc
*/
direction?: 'asc' | 'desc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
/**
* Pinned discussions only filter
*/
pinned?: string;
};
export type TeamsListDiscussionsInOrgError = Fetcher.ErrorWrapper;
export type TeamsListDiscussionsInOrgResponse = Schemas.TeamDiscussion[];
export type TeamsListDiscussionsInOrgVariables = {
pathParams: TeamsListDiscussionsInOrgPathParams;
queryParams?: TeamsListDiscussionsInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all discussions on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions`.
*/
export const fetchTeamsListDiscussionsInOrg = (
variables: TeamsListDiscussionsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListDiscussionsInOrgResponse,
TeamsListDiscussionsInOrgError,
undefined,
{},
TeamsListDiscussionsInOrgQueryParams,
TeamsListDiscussionsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions',
method: 'get',
...variables,
signal,
});
/**
* List all discussions on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions`.
*/
export const useTeamsListDiscussionsInOrg = <
TData = TeamsListDiscussionsInOrgResponse,
>(
variables: TeamsListDiscussionsInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListDiscussionsInOrgResponse,
TeamsListDiscussionsInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListDiscussionsInOrgResponse,
TeamsListDiscussionsInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions',
operationId: 'teamsListDiscussionsInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListDiscussionsInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsCreateDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsCreateDiscussionInOrgError = Fetcher.ErrorWrapper;
export type TeamsCreateDiscussionInOrgRequestBody = {
/**
* The discussion post's body text.
*/
body: string;
/**
* Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to `true` to create a private post.
*
* @default false
*/
private?: boolean;
/**
* The discussion post's title.
*/
title: string;
};
export type TeamsCreateDiscussionInOrgVariables = {
body: TeamsCreateDiscussionInOrgRequestBody;
pathParams: TeamsCreateDiscussionInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates a new discussion post on a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions`.
*/
export const fetchTeamsCreateDiscussionInOrg = (
variables: TeamsCreateDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussion,
TeamsCreateDiscussionInOrgError,
TeamsCreateDiscussionInOrgRequestBody,
{},
{},
TeamsCreateDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions',
method: 'post',
...variables,
signal,
});
/**
* Creates a new discussion post on a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions`.
*/
export const useTeamsCreateDiscussionInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamDiscussion,
TeamsCreateDiscussionInOrgError,
TeamsCreateDiscussionInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamDiscussion,
TeamsCreateDiscussionInOrgError,
TeamsCreateDiscussionInOrgVariables
>(
(variables: TeamsCreateDiscussionInOrgVariables) =>
fetchTeamsCreateDiscussionInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsDeleteDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type TeamsDeleteDiscussionInOrgError = Fetcher.ErrorWrapper;
export type TeamsDeleteDiscussionInOrgVariables = {
pathParams: TeamsDeleteDiscussionInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Delete a discussion from a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const fetchTeamsDeleteDiscussionInOrg = (
variables: TeamsDeleteDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsDeleteDiscussionInOrgError,
undefined,
{},
{},
TeamsDeleteDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}',
method: 'delete',
...variables,
signal,
});
/**
* Delete a discussion from a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const useTeamsDeleteDiscussionInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsDeleteDiscussionInOrgError,
TeamsDeleteDiscussionInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsDeleteDiscussionInOrgError,
TeamsDeleteDiscussionInOrgVariables
>(
(variables: TeamsDeleteDiscussionInOrgVariables) =>
fetchTeamsDeleteDiscussionInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsGetDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type TeamsGetDiscussionInOrgError = Fetcher.ErrorWrapper;
export type TeamsGetDiscussionInOrgVariables = {
pathParams: TeamsGetDiscussionInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Get a specific discussion on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const fetchTeamsGetDiscussionInOrg = (
variables: TeamsGetDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussion,
TeamsGetDiscussionInOrgError,
undefined,
{},
{},
TeamsGetDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}',
method: 'get',
...variables,
signal,
});
/**
* Get a specific discussion on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const useTeamsGetDiscussionInOrg = (
variables: TeamsGetDiscussionInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.TeamDiscussion,
TeamsGetDiscussionInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.TeamDiscussion,
TeamsGetDiscussionInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}',
operationId: 'teamsGetDiscussionInOrg',
variables,
}),
({ signal }) =>
fetchTeamsGetDiscussionInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsUpdateDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type TeamsUpdateDiscussionInOrgError = Fetcher.ErrorWrapper;
export type TeamsUpdateDiscussionInOrgRequestBody = {
/**
* The discussion post's body text.
*/
body?: string;
/**
* The discussion post's title.
*/
title?: string;
};
export type TeamsUpdateDiscussionInOrgVariables = {
body?: TeamsUpdateDiscussionInOrgRequestBody;
pathParams: TeamsUpdateDiscussionInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const fetchTeamsUpdateDiscussionInOrg = (
variables: TeamsUpdateDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussion,
TeamsUpdateDiscussionInOrgError,
TeamsUpdateDiscussionInOrgRequestBody,
{},
{},
TeamsUpdateDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}',
method: 'patch',
...variables,
signal,
});
/**
* Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`.
*/
export const useTeamsUpdateDiscussionInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamDiscussion,
TeamsUpdateDiscussionInOrgError,
TeamsUpdateDiscussionInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamDiscussion,
TeamsUpdateDiscussionInOrgError,
TeamsUpdateDiscussionInOrgVariables
>(
(variables: TeamsUpdateDiscussionInOrgVariables) =>
fetchTeamsUpdateDiscussionInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsListDiscussionCommentsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type TeamsListDiscussionCommentsInOrgQueryParams = {
/**
* One of `asc` (ascending) or `desc` (descending).
*
* @default desc
*/
direction?: 'asc' | 'desc';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListDiscussionCommentsInOrgError =
Fetcher.ErrorWrapper;
export type TeamsListDiscussionCommentsInOrgResponse =
Schemas.TeamDiscussionComment[];
export type TeamsListDiscussionCommentsInOrgVariables = {
pathParams: TeamsListDiscussionCommentsInOrgPathParams;
queryParams?: TeamsListDiscussionCommentsInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List all comments on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.
*/
export const fetchTeamsListDiscussionCommentsInOrg = (
variables: TeamsListDiscussionCommentsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListDiscussionCommentsInOrgResponse,
TeamsListDiscussionCommentsInOrgError,
undefined,
{},
TeamsListDiscussionCommentsInOrgQueryParams,
TeamsListDiscussionCommentsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments',
method: 'get',
...variables,
signal,
});
/**
* List all comments on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.
*/
export const useTeamsListDiscussionCommentsInOrg = <
TData = TeamsListDiscussionCommentsInOrgResponse,
>(
variables: TeamsListDiscussionCommentsInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListDiscussionCommentsInOrgResponse,
TeamsListDiscussionCommentsInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListDiscussionCommentsInOrgResponse,
TeamsListDiscussionCommentsInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments',
operationId: 'teamsListDiscussionCommentsInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListDiscussionCommentsInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsCreateDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type TeamsCreateDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type TeamsCreateDiscussionCommentInOrgRequestBody = {
/**
* The discussion comment's body text.
*/
body: string;
};
export type TeamsCreateDiscussionCommentInOrgVariables = {
body: TeamsCreateDiscussionCommentInOrgRequestBody;
pathParams: TeamsCreateDiscussionCommentInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Creates a new comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.
*/
export const fetchTeamsCreateDiscussionCommentInOrg = (
variables: TeamsCreateDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussionComment,
TeamsCreateDiscussionCommentInOrgError,
TeamsCreateDiscussionCommentInOrgRequestBody,
{},
{},
TeamsCreateDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments',
method: 'post',
...variables,
signal,
});
/**
* Creates a new comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`.
*/
export const useTeamsCreateDiscussionCommentInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamDiscussionComment,
TeamsCreateDiscussionCommentInOrgError,
TeamsCreateDiscussionCommentInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamDiscussionComment,
TeamsCreateDiscussionCommentInOrgError,
TeamsCreateDiscussionCommentInOrgVariables
>(
(variables: TeamsCreateDiscussionCommentInOrgVariables) =>
fetchTeamsCreateDiscussionCommentInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsDeleteDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
};
export type TeamsDeleteDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type TeamsDeleteDiscussionCommentInOrgVariables = {
pathParams: TeamsDeleteDiscussionCommentInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const fetchTeamsDeleteDiscussionCommentInOrg = (
variables: TeamsDeleteDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsDeleteDiscussionCommentInOrgError,
undefined,
{},
{},
TeamsDeleteDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}',
method: 'delete',
...variables,
signal,
});
/**
* Deletes a comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const useTeamsDeleteDiscussionCommentInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsDeleteDiscussionCommentInOrgError,
TeamsDeleteDiscussionCommentInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsDeleteDiscussionCommentInOrgError,
TeamsDeleteDiscussionCommentInOrgVariables
>(
(variables: TeamsDeleteDiscussionCommentInOrgVariables) =>
fetchTeamsDeleteDiscussionCommentInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsGetDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
};
export type TeamsGetDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type TeamsGetDiscussionCommentInOrgVariables = {
pathParams: TeamsGetDiscussionCommentInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Get a specific comment on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const fetchTeamsGetDiscussionCommentInOrg = (
variables: TeamsGetDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussionComment,
TeamsGetDiscussionCommentInOrgError,
undefined,
{},
{},
TeamsGetDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}',
method: 'get',
...variables,
signal,
});
/**
* Get a specific comment on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const useTeamsGetDiscussionCommentInOrg = <
TData = Schemas.TeamDiscussionComment,
>(
variables: TeamsGetDiscussionCommentInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.TeamDiscussionComment,
TeamsGetDiscussionCommentInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.TeamDiscussionComment,
TeamsGetDiscussionCommentInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}',
operationId: 'teamsGetDiscussionCommentInOrg',
variables,
}),
({ signal }) =>
fetchTeamsGetDiscussionCommentInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsUpdateDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
};
export type TeamsUpdateDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type TeamsUpdateDiscussionCommentInOrgRequestBody = {
/**
* The discussion comment's body text.
*/
body: string;
};
export type TeamsUpdateDiscussionCommentInOrgVariables = {
body: TeamsUpdateDiscussionCommentInOrgRequestBody;
pathParams: TeamsUpdateDiscussionCommentInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Edits the body text of a discussion comment. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const fetchTeamsUpdateDiscussionCommentInOrg = (
variables: TeamsUpdateDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamDiscussionComment,
TeamsUpdateDiscussionCommentInOrgError,
TeamsUpdateDiscussionCommentInOrgRequestBody,
{},
{},
TeamsUpdateDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}',
method: 'patch',
...variables,
signal,
});
/**
* Edits the body text of a discussion comment. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`.
*/
export const useTeamsUpdateDiscussionCommentInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamDiscussionComment,
TeamsUpdateDiscussionCommentInOrgError,
TeamsUpdateDiscussionCommentInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamDiscussionComment,
TeamsUpdateDiscussionCommentInOrgError,
TeamsUpdateDiscussionCommentInOrgVariables
>(
(variables: TeamsUpdateDiscussionCommentInOrgVariables) =>
fetchTeamsUpdateDiscussionCommentInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ReactionsListForTeamDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
};
export type ReactionsListForTeamDiscussionCommentInOrgQueryParams = {
/**
* Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment.
*/
content?:
| '+1'
| '-1'
| 'laugh'
| 'confused'
| 'heart'
| 'hooray'
| 'rocket'
| 'eyes';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ReactionsListForTeamDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type ReactionsListForTeamDiscussionCommentInOrgResponse =
Schemas.Reaction[];
export type ReactionsListForTeamDiscussionCommentInOrgVariables = {
pathParams: ReactionsListForTeamDiscussionCommentInOrgPathParams;
queryParams?: ReactionsListForTeamDiscussionCommentInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`.
*/
export const fetchReactionsListForTeamDiscussionCommentInOrg = (
variables: ReactionsListForTeamDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ReactionsListForTeamDiscussionCommentInOrgResponse,
ReactionsListForTeamDiscussionCommentInOrgError,
undefined,
{},
ReactionsListForTeamDiscussionCommentInOrgQueryParams,
ReactionsListForTeamDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}/reactions',
method: 'get',
...variables,
signal,
});
/**
* List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`.
*/
export const useReactionsListForTeamDiscussionCommentInOrg = <
TData = ReactionsListForTeamDiscussionCommentInOrgResponse,
>(
variables: ReactionsListForTeamDiscussionCommentInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ReactionsListForTeamDiscussionCommentInOrgResponse,
ReactionsListForTeamDiscussionCommentInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ReactionsListForTeamDiscussionCommentInOrgResponse,
ReactionsListForTeamDiscussionCommentInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions',
operationId: 'reactionsListForTeamDiscussionCommentInOrg',
variables,
}),
({ signal }) =>
fetchReactionsListForTeamDiscussionCommentInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ReactionsCreateForTeamDiscussionCommentInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
};
export type ReactionsCreateForTeamDiscussionCommentInOrgError =
Fetcher.ErrorWrapper;
export type ReactionsCreateForTeamDiscussionCommentInOrgRequestBody = {
/**
* The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment.
*/
content:
| '+1'
| '-1'
| 'laugh'
| 'confused'
| 'heart'
| 'hooray'
| 'rocket'
| 'eyes';
};
export type ReactionsCreateForTeamDiscussionCommentInOrgVariables = {
body: ReactionsCreateForTeamDiscussionCommentInOrgRequestBody;
pathParams: ReactionsCreateForTeamDiscussionCommentInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion comment.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`.
*/
export const fetchReactionsCreateForTeamDiscussionCommentInOrg = (
variables: ReactionsCreateForTeamDiscussionCommentInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionCommentInOrgError,
ReactionsCreateForTeamDiscussionCommentInOrgRequestBody,
{},
{},
ReactionsCreateForTeamDiscussionCommentInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}/reactions',
method: 'post',
...variables,
signal,
});
/**
* Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion comment.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`.
*/
export const useReactionsCreateForTeamDiscussionCommentInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionCommentInOrgError,
ReactionsCreateForTeamDiscussionCommentInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionCommentInOrgError,
ReactionsCreateForTeamDiscussionCommentInOrgVariables
>(
(variables: ReactionsCreateForTeamDiscussionCommentInOrgVariables) =>
fetchReactionsCreateForTeamDiscussionCommentInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ReactionsDeleteForTeamDiscussionCommentPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
commentNumber: number;
reactionId: number;
};
export type ReactionsDeleteForTeamDiscussionCommentError =
Fetcher.ErrorWrapper;
export type ReactionsDeleteForTeamDiscussionCommentVariables = {
pathParams: ReactionsDeleteForTeamDiscussionCommentPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id`.
*
* Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*/
export const fetchReactionsDeleteForTeamDiscussionComment = (
variables: ReactionsDeleteForTeamDiscussionCommentVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ReactionsDeleteForTeamDiscussionCommentError,
undefined,
{},
{},
ReactionsDeleteForTeamDiscussionCommentPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/comments/{commentNumber}/reactions/{reactionId}',
method: 'delete',
...variables,
signal,
});
/**
* **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id`.
*
* Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*/
export const useReactionsDeleteForTeamDiscussionComment = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ReactionsDeleteForTeamDiscussionCommentError,
ReactionsDeleteForTeamDiscussionCommentVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ReactionsDeleteForTeamDiscussionCommentError,
ReactionsDeleteForTeamDiscussionCommentVariables
>(
(variables: ReactionsDeleteForTeamDiscussionCommentVariables) =>
fetchReactionsDeleteForTeamDiscussionComment({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ReactionsListForTeamDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type ReactionsListForTeamDiscussionInOrgQueryParams = {
/**
* Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion.
*/
content?:
| '+1'
| '-1'
| 'laugh'
| 'confused'
| 'heart'
| 'hooray'
| 'rocket'
| 'eyes';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ReactionsListForTeamDiscussionInOrgError =
Fetcher.ErrorWrapper;
export type ReactionsListForTeamDiscussionInOrgResponse = Schemas.Reaction[];
export type ReactionsListForTeamDiscussionInOrgVariables = {
pathParams: ReactionsListForTeamDiscussionInOrgPathParams;
queryParams?: ReactionsListForTeamDiscussionInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`.
*/
export const fetchReactionsListForTeamDiscussionInOrg = (
variables: ReactionsListForTeamDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
ReactionsListForTeamDiscussionInOrgResponse,
ReactionsListForTeamDiscussionInOrgError,
undefined,
{},
ReactionsListForTeamDiscussionInOrgQueryParams,
ReactionsListForTeamDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/reactions',
method: 'get',
...variables,
signal,
});
/**
* List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`.
*/
export const useReactionsListForTeamDiscussionInOrg = <
TData = ReactionsListForTeamDiscussionInOrgResponse,
>(
variables: ReactionsListForTeamDiscussionInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ReactionsListForTeamDiscussionInOrgResponse,
ReactionsListForTeamDiscussionInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ReactionsListForTeamDiscussionInOrgResponse,
ReactionsListForTeamDiscussionInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions',
operationId: 'reactionsListForTeamDiscussionInOrg',
variables,
}),
({ signal }) =>
fetchReactionsListForTeamDiscussionInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ReactionsCreateForTeamDiscussionInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
};
export type ReactionsCreateForTeamDiscussionInOrgError =
Fetcher.ErrorWrapper;
export type ReactionsCreateForTeamDiscussionInOrgRequestBody = {
/**
* The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion.
*/
content:
| '+1'
| '-1'
| 'laugh'
| 'confused'
| 'heart'
| 'hooray'
| 'rocket'
| 'eyes';
};
export type ReactionsCreateForTeamDiscussionInOrgVariables = {
body: ReactionsCreateForTeamDiscussionInOrgRequestBody;
pathParams: ReactionsCreateForTeamDiscussionInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`.
*/
export const fetchReactionsCreateForTeamDiscussionInOrg = (
variables: ReactionsCreateForTeamDiscussionInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionInOrgError,
ReactionsCreateForTeamDiscussionInOrgRequestBody,
{},
{},
ReactionsCreateForTeamDiscussionInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/reactions',
method: 'post',
...variables,
signal,
});
/**
* Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`.
*/
export const useReactionsCreateForTeamDiscussionInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionInOrgError,
ReactionsCreateForTeamDiscussionInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Reaction,
ReactionsCreateForTeamDiscussionInOrgError,
ReactionsCreateForTeamDiscussionInOrgVariables
>(
(variables: ReactionsCreateForTeamDiscussionInOrgVariables) =>
fetchReactionsCreateForTeamDiscussionInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type ReactionsDeleteForTeamDiscussionPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
discussionNumber: number;
reactionId: number;
};
export type ReactionsDeleteForTeamDiscussionError =
Fetcher.ErrorWrapper;
export type ReactionsDeleteForTeamDiscussionVariables = {
pathParams: ReactionsDeleteForTeamDiscussionPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id`.
*
* Delete a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*/
export const fetchReactionsDeleteForTeamDiscussion = (
variables: ReactionsDeleteForTeamDiscussionVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ReactionsDeleteForTeamDiscussionError,
undefined,
{},
{},
ReactionsDeleteForTeamDiscussionPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/discussions/{discussionNumber}/reactions/{reactionId}',
method: 'delete',
...variables,
signal,
});
/**
* **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id`.
*
* Delete a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
*/
export const useReactionsDeleteForTeamDiscussion = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ReactionsDeleteForTeamDiscussionError,
ReactionsDeleteForTeamDiscussionVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ReactionsDeleteForTeamDiscussionError,
ReactionsDeleteForTeamDiscussionVariables
>(
(variables: ReactionsDeleteForTeamDiscussionVariables) =>
fetchReactionsDeleteForTeamDiscussion({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsListPendingInvitationsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListPendingInvitationsInOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListPendingInvitationsInOrgError =
Fetcher.ErrorWrapper;
export type TeamsListPendingInvitationsInOrgResponse =
Schemas.OrganizationInvitation[];
export type TeamsListPendingInvitationsInOrgVariables = {
pathParams: TeamsListPendingInvitationsInOrgPathParams;
queryParams?: TeamsListPendingInvitationsInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/invitations`.
*/
export const fetchTeamsListPendingInvitationsInOrg = (
variables: TeamsListPendingInvitationsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListPendingInvitationsInOrgResponse,
TeamsListPendingInvitationsInOrgError,
undefined,
{},
TeamsListPendingInvitationsInOrgQueryParams,
TeamsListPendingInvitationsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/invitations',
method: 'get',
...variables,
signal,
});
/**
* The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/invitations`.
*/
export const useTeamsListPendingInvitationsInOrg = <
TData = TeamsListPendingInvitationsInOrgResponse,
>(
variables: TeamsListPendingInvitationsInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListPendingInvitationsInOrgResponse,
TeamsListPendingInvitationsInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListPendingInvitationsInOrgResponse,
TeamsListPendingInvitationsInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/invitations',
operationId: 'teamsListPendingInvitationsInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListPendingInvitationsInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsListMembersInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListMembersInOrgQueryParams = {
/**
* Filters members returned by their role in the team. Can be one of:
* \* `member` - normal members of the team.
* \* `maintainer` - team maintainers.
* \* `all` - all members of the team.
*
* @default all
*/
role?: 'member' | 'maintainer' | 'all';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListMembersInOrgError = Fetcher.ErrorWrapper;
export type TeamsListMembersInOrgResponse = Schemas.SimpleUser[];
export type TeamsListMembersInOrgVariables = {
pathParams: TeamsListMembersInOrgPathParams;
queryParams?: TeamsListMembersInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Team members will include the members of child teams.
*
* To list members in a team, the team must be visible to the authenticated user.
*/
export const fetchTeamsListMembersInOrg = (
variables: TeamsListMembersInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListMembersInOrgResponse,
TeamsListMembersInOrgError,
undefined,
{},
TeamsListMembersInOrgQueryParams,
TeamsListMembersInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/members',
method: 'get',
...variables,
signal,
});
/**
* Team members will include the members of child teams.
*
* To list members in a team, the team must be visible to the authenticated user.
*/
export const useTeamsListMembersInOrg = (
variables: TeamsListMembersInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListMembersInOrgResponse,
TeamsListMembersInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListMembersInOrgResponse,
TeamsListMembersInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/members',
operationId: 'teamsListMembersInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListMembersInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsRemoveMembershipForUserInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
username: string;
};
export type TeamsRemoveMembershipForUserInOrgError =
Fetcher.ErrorWrapper;
export type TeamsRemoveMembershipForUserInOrgVariables = {
pathParams: TeamsRemoveMembershipForUserInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.
*
* **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)."
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*/
export const fetchTeamsRemoveMembershipForUserInOrg = (
variables: TeamsRemoveMembershipForUserInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsRemoveMembershipForUserInOrgError,
undefined,
{},
{},
TeamsRemoveMembershipForUserInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/memberships/{username}',
method: 'delete',
...variables,
signal,
});
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.
*
* **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)."
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*/
export const useTeamsRemoveMembershipForUserInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsRemoveMembershipForUserInOrgError,
TeamsRemoveMembershipForUserInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsRemoveMembershipForUserInOrgError,
TeamsRemoveMembershipForUserInOrgVariables
>(
(variables: TeamsRemoveMembershipForUserInOrgVariables) =>
fetchTeamsRemoveMembershipForUserInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsGetMembershipForUserInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
username: string;
};
export type TeamsGetMembershipForUserInOrgError =
Fetcher.ErrorWrapper;
export type TeamsGetMembershipForUserInOrgVariables = {
pathParams: TeamsGetMembershipForUserInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Team members will include the members of child teams.
*
* To get a user's membership with a team, the team must be visible to the authenticated user.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*
* **Note:** The `role` for organization owners returns as `maintainer`. For more information about `maintainer` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team).
*/
export const fetchTeamsGetMembershipForUserInOrg = (
variables: TeamsGetMembershipForUserInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamMembership,
TeamsGetMembershipForUserInOrgError,
undefined,
{},
{},
TeamsGetMembershipForUserInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/memberships/{username}',
method: 'get',
...variables,
signal,
});
/**
* Team members will include the members of child teams.
*
* To get a user's membership with a team, the team must be visible to the authenticated user.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*
* **Note:** The `role` for organization owners returns as `maintainer`. For more information about `maintainer` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team).
*/
export const useTeamsGetMembershipForUserInOrg = <
TData = Schemas.TeamMembership,
>(
variables: TeamsGetMembershipForUserInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.TeamMembership,
TeamsGetMembershipForUserInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.TeamMembership,
TeamsGetMembershipForUserInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/memberships/{username}',
operationId: 'teamsGetMembershipForUserInOrg',
variables,
}),
({ signal }) =>
fetchTeamsGetMembershipForUserInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsAddOrUpdateMembershipForUserInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
username: string;
};
export type TeamsAddOrUpdateMembershipForUserInOrgError = Fetcher.ErrorWrapper<{
status: 422;
payload: {
errors?: {
code?: string;
field?: string;
resource?: string;
}[];
message?: string;
};
}>;
export type TeamsAddOrUpdateMembershipForUserInOrgRequestBody = {
/**
* The role that this user should have in the team. Can be one of:
* \* `member` - a normal member of the team.
* \* `maintainer` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description.
*
* @default member
*/
role?: 'member' | 'maintainer';
};
export type TeamsAddOrUpdateMembershipForUserInOrgVariables = {
body?: TeamsAddOrUpdateMembershipForUserInOrgRequestBody;
pathParams: TeamsAddOrUpdateMembershipForUserInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team.
*
* **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)."
*
* An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team.
*
* If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*/
export const fetchTeamsAddOrUpdateMembershipForUserInOrg = (
variables: TeamsAddOrUpdateMembershipForUserInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamMembership,
TeamsAddOrUpdateMembershipForUserInOrgError,
TeamsAddOrUpdateMembershipForUserInOrgRequestBody,
{},
{},
TeamsAddOrUpdateMembershipForUserInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/memberships/{username}',
method: 'put',
...variables,
signal,
});
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team.
*
* **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)."
*
* An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team.
*
* If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/memberships/{username}`.
*/
export const useTeamsAddOrUpdateMembershipForUserInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.TeamMembership,
TeamsAddOrUpdateMembershipForUserInOrgError,
TeamsAddOrUpdateMembershipForUserInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.TeamMembership,
TeamsAddOrUpdateMembershipForUserInOrgError,
TeamsAddOrUpdateMembershipForUserInOrgVariables
>(
(variables: TeamsAddOrUpdateMembershipForUserInOrgVariables) =>
fetchTeamsAddOrUpdateMembershipForUserInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsListProjectsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListProjectsInOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListProjectsInOrgError = Fetcher.ErrorWrapper;
export type TeamsListProjectsInOrgResponse = Schemas.TeamProject[];
export type TeamsListProjectsInOrgVariables = {
pathParams: TeamsListProjectsInOrgPathParams;
queryParams?: TeamsListProjectsInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the organization projects for a team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects`.
*/
export const fetchTeamsListProjectsInOrg = (
variables: TeamsListProjectsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListProjectsInOrgResponse,
TeamsListProjectsInOrgError,
undefined,
{},
TeamsListProjectsInOrgQueryParams,
TeamsListProjectsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/projects',
method: 'get',
...variables,
signal,
});
/**
* Lists the organization projects for a team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects`.
*/
export const useTeamsListProjectsInOrg = <
TData = TeamsListProjectsInOrgResponse,
>(
variables: TeamsListProjectsInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListProjectsInOrgResponse,
TeamsListProjectsInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListProjectsInOrgResponse,
TeamsListProjectsInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/projects',
operationId: 'teamsListProjectsInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListProjectsInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsRemoveProjectInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
projectId: number;
};
export type TeamsRemoveProjectInOrgError = Fetcher.ErrorWrapper;
export type TeamsRemoveProjectInOrgVariables = {
pathParams: TeamsRemoveProjectInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. This endpoint removes the project from the team, but does not delete the project.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const fetchTeamsRemoveProjectInOrg = (
variables: TeamsRemoveProjectInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsRemoveProjectInOrgError,
undefined,
{},
{},
TeamsRemoveProjectInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/projects/{projectId}',
method: 'delete',
...variables,
signal,
});
/**
* Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. This endpoint removes the project from the team, but does not delete the project.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const useTeamsRemoveProjectInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsRemoveProjectInOrgError,
TeamsRemoveProjectInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsRemoveProjectInOrgError,
TeamsRemoveProjectInOrgVariables
>(
(variables: TeamsRemoveProjectInOrgVariables) =>
fetchTeamsRemoveProjectInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsCheckPermissionsForProjectInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
projectId: number;
};
export type TeamsCheckPermissionsForProjectInOrgError =
Fetcher.ErrorWrapper;
export type TeamsCheckPermissionsForProjectInOrgVariables = {
pathParams: TeamsCheckPermissionsForProjectInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Checks whether a team has `read`, `write`, or `admin` permissions for an organization project. The response includes projects inherited from a parent team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const fetchTeamsCheckPermissionsForProjectInOrg = (
variables: TeamsCheckPermissionsForProjectInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.TeamProject,
TeamsCheckPermissionsForProjectInOrgError,
undefined,
{},
{},
TeamsCheckPermissionsForProjectInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/projects/{projectId}',
method: 'get',
...variables,
signal,
});
/**
* Checks whether a team has `read`, `write`, or `admin` permissions for an organization project. The response includes projects inherited from a parent team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const useTeamsCheckPermissionsForProjectInOrg = <
TData = Schemas.TeamProject,
>(
variables: TeamsCheckPermissionsForProjectInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.TeamProject,
TeamsCheckPermissionsForProjectInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.TeamProject,
TeamsCheckPermissionsForProjectInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/projects/{project_id}',
operationId: 'teamsCheckPermissionsForProjectInOrg',
variables,
}),
({ signal }) =>
fetchTeamsCheckPermissionsForProjectInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsAddOrUpdateProjectPermissionsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
projectId: number;
};
export type TeamsAddOrUpdateProjectPermissionsInOrgError =
Fetcher.ErrorWrapper<{
status: 403;
payload: {
documentation_url?: string;
message?: string;
};
}>;
export type TeamsAddOrUpdateProjectPermissionsInOrgVariables = {
body?: {
/**
* The permission to grant to the team for this project. Can be one of:
* \* `read` - team members can read, but not write to or administer this project.
* \* `write` - team members can read and write, but not administer this project.
* \* `admin` - team members can read, write and administer this project.
* Default: the team's `permission` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
permission?: 'read' | 'write' | 'admin';
} | null;
pathParams: TeamsAddOrUpdateProjectPermissionsInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const fetchTeamsAddOrUpdateProjectPermissionsInOrg = (
variables: TeamsAddOrUpdateProjectPermissionsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsAddOrUpdateProjectPermissionsInOrgError,
{
/**
* The permission to grant to the team for this project. Can be one of:
* \* `read` - team members can read, but not write to or administer this project.
* \* `write` - team members can read and write, but not administer this project.
* \* `admin` - team members can read, write and administer this project.
* Default: the team's `permission` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*/
permission?: 'read' | 'write' | 'admin';
} | null,
{},
{},
TeamsAddOrUpdateProjectPermissionsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/projects/{projectId}',
method: 'put',
...variables,
signal,
});
/**
* Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}`.
*/
export const useTeamsAddOrUpdateProjectPermissionsInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsAddOrUpdateProjectPermissionsInOrgError,
TeamsAddOrUpdateProjectPermissionsInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsAddOrUpdateProjectPermissionsInOrgError,
TeamsAddOrUpdateProjectPermissionsInOrgVariables
>(
(variables: TeamsAddOrUpdateProjectPermissionsInOrgVariables) =>
fetchTeamsAddOrUpdateProjectPermissionsInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsListReposInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListReposInOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListReposInOrgError = Fetcher.ErrorWrapper;
export type TeamsListReposInOrgResponse = Schemas.MinimalRepository[];
export type TeamsListReposInOrgVariables = {
pathParams: TeamsListReposInOrgPathParams;
queryParams?: TeamsListReposInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists a team's repositories visible to the authenticated user.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`.
*/
export const fetchTeamsListReposInOrg = (
variables: TeamsListReposInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListReposInOrgResponse,
TeamsListReposInOrgError,
undefined,
{},
TeamsListReposInOrgQueryParams,
TeamsListReposInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/repos',
method: 'get',
...variables,
signal,
});
/**
* Lists a team's repositories visible to the authenticated user.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`.
*/
export const useTeamsListReposInOrg = (
variables: TeamsListReposInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListReposInOrgResponse,
TeamsListReposInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListReposInOrgResponse,
TeamsListReposInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/repos',
operationId: 'teamsListReposInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListReposInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsRemoveRepoInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
owner: string;
repo: string;
};
export type TeamsRemoveRepoInOrgError = Fetcher.ErrorWrapper;
export type TeamsRemoveRepoInOrgVariables = {
pathParams: TeamsRemoveRepoInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*/
export const fetchTeamsRemoveRepoInOrg = (
variables: TeamsRemoveRepoInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsRemoveRepoInOrgError,
undefined,
{},
{},
TeamsRemoveRepoInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/repos/{owner}/{repo}',
method: 'delete',
...variables,
signal,
});
/**
* If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*/
export const useTeamsRemoveRepoInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsRemoveRepoInOrgError,
TeamsRemoveRepoInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsRemoveRepoInOrgError,
TeamsRemoveRepoInOrgVariables
>(
(variables: TeamsRemoveRepoInOrgVariables) =>
fetchTeamsRemoveRepoInOrg({ ...fetcherOptions, ...variables }),
options,
);
};
export type TeamsCheckPermissionsForRepoInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
owner: string;
repo: string;
};
export type TeamsCheckPermissionsForRepoInOrgError =
Fetcher.ErrorWrapper;
export type TeamsCheckPermissionsForRepoInOrgVariables = {
pathParams: TeamsCheckPermissionsForRepoInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Checks whether a team has `admin`, `push`, `maintain`, `triage`, or `pull` permission for a repository. Repositories inherited through a parent team will also be checked.
*
* You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `application/vnd.github.v3.repository+json` accept header.
*
* If a team doesn't have permission for the repository, you will receive a `404 Not Found` response status.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*/
export const fetchTeamsCheckPermissionsForRepoInOrg = (
variables: TeamsCheckPermissionsForRepoInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsCheckPermissionsForRepoInOrgError,
undefined,
{},
{},
TeamsCheckPermissionsForRepoInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/repos/{owner}/{repo}',
method: 'get',
...variables,
signal,
});
/**
* Checks whether a team has `admin`, `push`, `maintain`, `triage`, or `pull` permission for a repository. Repositories inherited through a parent team will also be checked.
*
* You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `application/vnd.github.v3.repository+json` accept header.
*
* If a team doesn't have permission for the repository, you will receive a `404 Not Found` response status.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*/
export const useTeamsCheckPermissionsForRepoInOrg = (
variables: TeamsCheckPermissionsForRepoInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
undefined,
TeamsCheckPermissionsForRepoInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
undefined,
TeamsCheckPermissionsForRepoInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}',
operationId: 'teamsCheckPermissionsForRepoInOrg',
variables,
}),
({ signal }) =>
fetchTeamsCheckPermissionsForRepoInOrg(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type TeamsAddOrUpdateRepoPermissionsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
owner: string;
repo: string;
};
export type TeamsAddOrUpdateRepoPermissionsInOrgError =
Fetcher.ErrorWrapper;
export type TeamsAddOrUpdateRepoPermissionsInOrgRequestBody = {
/**
* The permission to grant the team on this repository. Can be one of:
* \* `pull` - team members can pull, but not push to or administer this repository.
* \* `push` - team members can pull and push, but not administer this repository.
* \* `admin` - team members can pull, push and administer this repository.
* \* `maintain` - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations.
* \* `triage` - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations.
*
* If no permission is specified, the team's `permission` attribute will be used to determine what permission to grant the team on this repository.
*/
permission?: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
};
export type TeamsAddOrUpdateRepoPermissionsInOrgVariables = {
body?: TeamsAddOrUpdateRepoPermissionsInOrgRequestBody;
pathParams: TeamsAddOrUpdateRepoPermissionsInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*
* For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)".
*/
export const fetchTeamsAddOrUpdateRepoPermissionsInOrg = (
variables: TeamsAddOrUpdateRepoPermissionsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
TeamsAddOrUpdateRepoPermissionsInOrgError,
TeamsAddOrUpdateRepoPermissionsInOrgRequestBody,
{},
{},
TeamsAddOrUpdateRepoPermissionsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/repos/{owner}/{repo}',
method: 'put',
...variables,
signal,
});
/**
* To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)."
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`.
*
* For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)".
*/
export const useTeamsAddOrUpdateRepoPermissionsInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
TeamsAddOrUpdateRepoPermissionsInOrgError,
TeamsAddOrUpdateRepoPermissionsInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
TeamsAddOrUpdateRepoPermissionsInOrgError,
TeamsAddOrUpdateRepoPermissionsInOrgVariables
>(
(variables: TeamsAddOrUpdateRepoPermissionsInOrgVariables) =>
fetchTeamsAddOrUpdateRepoPermissionsInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsListIdpGroupsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListIdpGroupsInOrgError = Fetcher.ErrorWrapper;
export type TeamsListIdpGroupsInOrgVariables = {
pathParams: TeamsListIdpGroupsInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* List IdP groups connected to a team on GitHub.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`.
*/
export const fetchTeamsListIdpGroupsInOrg = (
variables: TeamsListIdpGroupsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GroupMapping,
TeamsListIdpGroupsInOrgError,
undefined,
{},
{},
TeamsListIdpGroupsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/team-sync/group-mappings',
method: 'get',
...variables,
signal,
});
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* List IdP groups connected to a team on GitHub.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`.
*/
export const useTeamsListIdpGroupsInOrg = (
variables: TeamsListIdpGroupsInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.GroupMapping,
TeamsListIdpGroupsInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.GroupMapping,
TeamsListIdpGroupsInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/team-sync/group-mappings',
operationId: 'teamsListIdpGroupsInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListIdpGroupsInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type TeamsCreateOrUpdateIdpGroupConnectionsInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsCreateOrUpdateIdpGroupConnectionsInOrgError =
Fetcher.ErrorWrapper;
export type TeamsCreateOrUpdateIdpGroupConnectionsInOrgRequestBody = {
/**
* The IdP groups you want to connect to a GitHub team. When updating, the new `groups` object will replace the original one. You must include any existing groups that you don't want to remove.
*/
groups: {
/**
* Description of the IdP group.
*/
group_description: string;
/**
* ID of the IdP group.
*/
group_id: string;
/**
* Name of the IdP group.
*/
group_name: string;
}[];
};
export type TeamsCreateOrUpdateIdpGroupConnectionsInOrgVariables = {
body: TeamsCreateOrUpdateIdpGroupConnectionsInOrgRequestBody;
pathParams: TeamsCreateOrUpdateIdpGroupConnectionsInOrgPathParams;
} & GithubContext['fetcherOptions'];
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty `groups` array will remove all connections for a team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`.
*/
export const fetchTeamsCreateOrUpdateIdpGroupConnectionsInOrg = (
variables: TeamsCreateOrUpdateIdpGroupConnectionsInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.GroupMapping,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgError,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgRequestBody,
{},
{},
TeamsCreateOrUpdateIdpGroupConnectionsInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/team-sync/group-mappings',
method: 'patch',
...variables,
signal,
});
/**
* Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
*
* Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty `groups` array will remove all connections for a team.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`.
*/
export const useTeamsCreateOrUpdateIdpGroupConnectionsInOrg = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.GroupMapping,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgError,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.GroupMapping,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgError,
TeamsCreateOrUpdateIdpGroupConnectionsInOrgVariables
>(
(variables: TeamsCreateOrUpdateIdpGroupConnectionsInOrgVariables) =>
fetchTeamsCreateOrUpdateIdpGroupConnectionsInOrg({
...fetcherOptions,
...variables,
}),
options,
);
};
export type TeamsListChildInOrgPathParams = {
org: string;
/**
* team_slug parameter
*/
teamSlug: string;
};
export type TeamsListChildInOrgQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type TeamsListChildInOrgError = Fetcher.ErrorWrapper;
export type TeamsListChildInOrgResponse = Schemas.Team[];
export type TeamsListChildInOrgVariables = {
pathParams: TeamsListChildInOrgPathParams;
queryParams?: TeamsListChildInOrgQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the child teams of the team specified by `{team_slug}`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/teams`.
*/
export const fetchTeamsListChildInOrg = (
variables: TeamsListChildInOrgVariables,
signal?: AbortSignal,
) =>
githubFetch<
TeamsListChildInOrgResponse,
TeamsListChildInOrgError,
undefined,
{},
TeamsListChildInOrgQueryParams,
TeamsListChildInOrgPathParams
>({
url: '/orgs/{org}/teams/{teamSlug}/teams',
method: 'get',
...variables,
signal,
});
/**
* Lists the child teams of the team specified by `{team_slug}`.
*
* **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/teams`.
*/
export const useTeamsListChildInOrg = (
variables: TeamsListChildInOrgVariables,
options?: Omit<
reactQuery.UseQueryOptions<
TeamsListChildInOrgResponse,
TeamsListChildInOrgError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
TeamsListChildInOrgResponse,
TeamsListChildInOrgError,
TData
>(
queryKeyFn({
path: '/orgs/{org}/teams/{team_slug}/teams',
operationId: 'teamsListChildInOrg',
variables,
}),
({ signal }) =>
fetchTeamsListChildInOrg({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsDeleteCardPathParams = {
/**
* card_id parameter
*/
cardId: number;
};
export type ProjectsDeleteCardError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: {
documentation_url?: string;
errors?: string[];
message?: string;
};
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ProjectsDeleteCardVariables = {
pathParams: ProjectsDeleteCardPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsDeleteCard = (
variables: ProjectsDeleteCardVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ProjectsDeleteCardError,
undefined,
{},
{},
ProjectsDeleteCardPathParams
>({
url: '/projects/columns/cards/{cardId}',
method: 'delete',
...variables,
signal,
});
export const useProjectsDeleteCard = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ProjectsDeleteCardError,
ProjectsDeleteCardVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ProjectsDeleteCardError,
ProjectsDeleteCardVariables
>(
(variables: ProjectsDeleteCardVariables) =>
fetchProjectsDeleteCard({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsGetCardPathParams = {
/**
* card_id parameter
*/
cardId: number;
};
export type ProjectsGetCardError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ProjectsGetCardVariables = {
pathParams: ProjectsGetCardPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsGetCard = (
variables: ProjectsGetCardVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectCard,
ProjectsGetCardError,
undefined,
{},
{},
ProjectsGetCardPathParams
>({
url: '/projects/columns/cards/{cardId}',
method: 'get',
...variables,
signal,
});
export const useProjectsGetCard = (
variables: ProjectsGetCardVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ProjectCard,
ProjectsGetCardError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/projects/columns/cards/{card_id}',
operationId: 'projectsGetCard',
variables,
}),
({ signal }) =>
fetchProjectsGetCard({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsUpdateCardPathParams = {
/**
* card_id parameter
*/
cardId: number;
};
export type ProjectsUpdateCardError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type ProjectsUpdateCardRequestBody = {
/**
* Whether or not the card is archived
*
* @example false
*/
archived?: boolean;
/**
* The project card's note
*
* @example Update all gems
*/
note?: string | null;
};
export type ProjectsUpdateCardVariables = {
body?: ProjectsUpdateCardRequestBody;
pathParams: ProjectsUpdateCardPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsUpdateCard = (
variables: ProjectsUpdateCardVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectCard,
ProjectsUpdateCardError,
ProjectsUpdateCardRequestBody,
{},
{},
ProjectsUpdateCardPathParams
>({
url: '/projects/columns/cards/{cardId}',
method: 'patch',
...variables,
signal,
});
export const useProjectsUpdateCard = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ProjectCard,
ProjectsUpdateCardError,
ProjectsUpdateCardVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ProjectCard,
ProjectsUpdateCardError,
ProjectsUpdateCardVariables
>(
(variables: ProjectsUpdateCardVariables) =>
fetchProjectsUpdateCard({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsMoveCardPathParams = {
/**
* card_id parameter
*/
cardId: number;
};
export type ProjectsMoveCardError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: {
documentation_url?: string;
errors?: {
code?: string;
field?: string;
message?: string;
resource?: string;
}[];
message?: string;
};
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
| {
status: 503;
payload: {
code?: string;
documentation_url?: string;
errors?: {
code?: string;
message?: string;
}[];
message?: string;
};
}
>;
export type ProjectsMoveCardRequestBody = {
/**
* The unique identifier of the column the card should be moved to
*
* @example 42
*/
column_id?: number;
/**
* The position of the card in a column
*
* @example bottom
* @pattern ^(?:top|bottom|after:\d+)$
*/
position: string;
};
export type ProjectsMoveCardVariables = {
body: ProjectsMoveCardRequestBody;
pathParams: ProjectsMoveCardPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsMoveCard = (
variables: ProjectsMoveCardVariables,
signal?: AbortSignal,
) =>
githubFetch<
{},
ProjectsMoveCardError,
ProjectsMoveCardRequestBody,
{},
{},
ProjectsMoveCardPathParams
>({
url: '/projects/columns/cards/{cardId}/moves',
method: 'post',
...variables,
signal,
});
export const useProjectsMoveCard = (
options?: Omit<
reactQuery.UseMutationOptions<
{},
ProjectsMoveCardError,
ProjectsMoveCardVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
{},
ProjectsMoveCardError,
ProjectsMoveCardVariables
>(
(variables: ProjectsMoveCardVariables) =>
fetchProjectsMoveCard({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsDeleteColumnPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsDeleteColumnError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ProjectsDeleteColumnVariables = {
pathParams: ProjectsDeleteColumnPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsDeleteColumn = (
variables: ProjectsDeleteColumnVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ProjectsDeleteColumnError,
undefined,
{},
{},
ProjectsDeleteColumnPathParams
>({
url: '/projects/columns/{columnId}',
method: 'delete',
...variables,
signal,
});
export const useProjectsDeleteColumn = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ProjectsDeleteColumnError,
ProjectsDeleteColumnVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ProjectsDeleteColumnError,
ProjectsDeleteColumnVariables
>(
(variables: ProjectsDeleteColumnVariables) =>
fetchProjectsDeleteColumn({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsGetColumnPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsGetColumnError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ProjectsGetColumnVariables = {
pathParams: ProjectsGetColumnPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsGetColumn = (
variables: ProjectsGetColumnVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectColumn,
ProjectsGetColumnError,
undefined,
{},
{},
ProjectsGetColumnPathParams
>({
url: '/projects/columns/{columnId}',
method: 'get',
...variables,
signal,
});
export const useProjectsGetColumn = (
variables: ProjectsGetColumnVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.ProjectColumn,
ProjectsGetColumnError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.ProjectColumn,
ProjectsGetColumnError,
TData
>(
queryKeyFn({
path: '/projects/columns/{column_id}',
operationId: 'projectsGetColumn',
variables,
}),
({ signal }) =>
fetchProjectsGetColumn({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsUpdateColumnPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsUpdateColumnError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ProjectsUpdateColumnRequestBody = {
/**
* Name of the project column
*
* @example Remaining tasks
*/
name: string;
};
export type ProjectsUpdateColumnVariables = {
body: ProjectsUpdateColumnRequestBody;
pathParams: ProjectsUpdateColumnPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsUpdateColumn = (
variables: ProjectsUpdateColumnVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectColumn,
ProjectsUpdateColumnError,
ProjectsUpdateColumnRequestBody,
{},
{},
ProjectsUpdateColumnPathParams
>({
url: '/projects/columns/{columnId}',
method: 'patch',
...variables,
signal,
});
export const useProjectsUpdateColumn = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ProjectColumn,
ProjectsUpdateColumnError,
ProjectsUpdateColumnVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ProjectColumn,
ProjectsUpdateColumnError,
ProjectsUpdateColumnVariables
>(
(variables: ProjectsUpdateColumnVariables) =>
fetchProjectsUpdateColumn({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsListCardsPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsListCardsQueryParams = {
/**
* Filters the project cards that are returned by the card's state. Can be one of `all`,`archived`, or `not_archived`.
*
* @default not_archived
*/
archived_state?: 'all' | 'archived' | 'not_archived';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ProjectsListCardsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ProjectsListCardsResponse = Schemas.ProjectCard[];
export type ProjectsListCardsVariables = {
pathParams: ProjectsListCardsPathParams;
queryParams?: ProjectsListCardsQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsListCards = (
variables: ProjectsListCardsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ProjectsListCardsResponse,
ProjectsListCardsError,
undefined,
{},
ProjectsListCardsQueryParams,
ProjectsListCardsPathParams
>({
url: '/projects/columns/{columnId}/cards',
method: 'get',
...variables,
signal,
});
export const useProjectsListCards = (
variables: ProjectsListCardsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ProjectsListCardsResponse,
ProjectsListCardsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ProjectsListCardsResponse,
ProjectsListCardsError,
TData
>(
queryKeyFn({
path: '/projects/columns/{column_id}/cards',
operationId: 'projectsListCards',
variables,
}),
({ signal }) =>
fetchProjectsListCards({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsCreateCardPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsCreateCardError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Schemas.ValidationError | Schemas.ValidationErrorSimple;
}
| {
status: 503;
payload: {
code?: string;
documentation_url?: string;
errors?: {
code?: string;
message?: string;
}[];
message?: string;
};
}
>;
export type ProjectsCreateCardVariables = {
body?:
| {
/**
* The project card's note
*
* @example Update all gems
*/
note: string | null;
}
| {
/**
* The unique identifier of the content associated with the card
*
* @example 42
*/
content_id: number;
/**
* The piece of content associated with the card
*
* @example PullRequest
*/
content_type: string;
};
pathParams: ProjectsCreateCardPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key.
*
* Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const fetchProjectsCreateCard = (
variables: ProjectsCreateCardVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectCard,
ProjectsCreateCardError,
| {
/**
* The project card's note
*
* @example Update all gems
*/
note: string | null;
}
| {
/**
* The unique identifier of the content associated with the card
*
* @example 42
*/
content_id: number;
/**
* The piece of content associated with the card
*
* @example PullRequest
*/
content_type: string;
},
{},
{},
ProjectsCreateCardPathParams
>({
url: '/projects/columns/{columnId}/cards',
method: 'post',
...variables,
signal,
});
/**
* **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key.
*
* Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint.
*/
export const useProjectsCreateCard = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ProjectCard,
ProjectsCreateCardError,
ProjectsCreateCardVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ProjectCard,
ProjectsCreateCardError,
ProjectsCreateCardVariables
>(
(variables: ProjectsCreateCardVariables) =>
fetchProjectsCreateCard({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsMoveColumnPathParams = {
/**
* column_id parameter
*/
columnId: number;
};
export type ProjectsMoveColumnError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type ProjectsMoveColumnRequestBody = {
/**
* The position of the column in a project
*
* @example last
* @pattern ^(?:first|last|after:\d+)$
*/
position: string;
};
export type ProjectsMoveColumnVariables = {
body: ProjectsMoveColumnRequestBody;
pathParams: ProjectsMoveColumnPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsMoveColumn = (
variables: ProjectsMoveColumnVariables,
signal?: AbortSignal,
) =>
githubFetch<
{},
ProjectsMoveColumnError,
ProjectsMoveColumnRequestBody,
{},
{},
ProjectsMoveColumnPathParams
>({
url: '/projects/columns/{columnId}/moves',
method: 'post',
...variables,
signal,
});
export const useProjectsMoveColumn = (
options?: Omit<
reactQuery.UseMutationOptions<
{},
ProjectsMoveColumnError,
ProjectsMoveColumnVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
{},
ProjectsMoveColumnError,
ProjectsMoveColumnVariables
>(
(variables: ProjectsMoveColumnVariables) =>
fetchProjectsMoveColumn({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsDeletePathParams = {
projectId: number;
};
export type ProjectsDeleteError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: {
documentation_url?: string;
errors?: string[];
message?: string;
};
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 410;
payload: Responses.Gone;
}
>;
export type ProjectsDeleteVariables = {
pathParams: ProjectsDeletePathParams;
} & GithubContext['fetcherOptions'];
/**
* Deletes a project board. Returns a `404 Not Found` status if projects are disabled.
*/
export const fetchProjectsDelete = (
variables: ProjectsDeleteVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ProjectsDeleteError,
undefined,
{},
{},
ProjectsDeletePathParams
>({ url: '/projects/{projectId}', method: 'delete', ...variables, signal });
/**
* Deletes a project board. Returns a `404 Not Found` status if projects are disabled.
*/
export const useProjectsDelete = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ProjectsDeleteError,
ProjectsDeleteVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ProjectsDeleteError,
ProjectsDeleteVariables
>(
(variables: ProjectsDeleteVariables) =>
fetchProjectsDelete({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsGetPathParams = {
projectId: number;
};
export type ProjectsGetError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ProjectsGetVariables = {
pathParams: ProjectsGetPathParams;
} & GithubContext['fetcherOptions'];
/**
* Gets a project by its `id`. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const fetchProjectsGet = (
variables: ProjectsGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Project,
ProjectsGetError,
undefined,
{},
{},
ProjectsGetPathParams
>({ url: '/projects/{projectId}', method: 'get', ...variables, signal });
/**
* Gets a project by its `id`. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const useProjectsGet = (
variables: ProjectsGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/projects/{project_id}',
operationId: 'projectsGet',
variables,
}),
({ signal }) =>
fetchProjectsGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsUpdatePathParams = {
projectId: number;
};
export type ProjectsUpdateError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: {
documentation_url?: string;
errors?: string[];
message?: string;
};
}
| {
status: 410;
payload: Responses.Gone;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type ProjectsUpdateRequestBody = {
/**
* Body of the project
*
* @example This project represents the sprint of the first week in January
*/
body?: string | null;
/**
* Name of the project
*
* @example Week One Sprint
*/
name?: string;
/**
* The baseline permission that all organization members have on this project
*/
organization_permission?: 'read' | 'write' | 'admin' | 'none';
/**
* Whether or not this project can be seen by everyone.
*/
private?: boolean;
/**
* State of the project; either 'open' or 'closed'
*
* @example open
*/
state?: string;
};
export type ProjectsUpdateVariables = {
body?: ProjectsUpdateRequestBody;
pathParams: ProjectsUpdatePathParams;
} & GithubContext['fetcherOptions'];
/**
* Updates a project board's information. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const fetchProjectsUpdate = (
variables: ProjectsUpdateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.Project,
ProjectsUpdateError,
ProjectsUpdateRequestBody,
{},
{},
ProjectsUpdatePathParams
>({ url: '/projects/{projectId}', method: 'patch', ...variables, signal });
/**
* Updates a project board's information. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned.
*/
export const useProjectsUpdate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.Project,
ProjectsUpdateError,
ProjectsUpdateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.Project,
ProjectsUpdateError,
ProjectsUpdateVariables
>(
(variables: ProjectsUpdateVariables) =>
fetchProjectsUpdate({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsListCollaboratorsPathParams = {
projectId: number;
};
export type ProjectsListCollaboratorsQueryParams = {
/**
* Filters the collaborators by their affiliation. Can be one of:
* \* `outside`: Outside collaborators of a project that are not a member of the project's organization.
* \* `direct`: Collaborators with permissions to a project, regardless of organization membership status.
* \* `all`: All collaborators the authenticated user can see.
*
* @default all
*/
affiliation?: 'outside' | 'direct' | 'all';
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ProjectsListCollaboratorsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ProjectsListCollaboratorsResponse = Schemas.SimpleUser[];
export type ProjectsListCollaboratorsVariables = {
pathParams: ProjectsListCollaboratorsPathParams;
queryParams?: ProjectsListCollaboratorsQueryParams;
} & GithubContext['fetcherOptions'];
/**
* Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project `admin` to list collaborators.
*/
export const fetchProjectsListCollaborators = (
variables: ProjectsListCollaboratorsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ProjectsListCollaboratorsResponse,
ProjectsListCollaboratorsError,
undefined,
{},
ProjectsListCollaboratorsQueryParams,
ProjectsListCollaboratorsPathParams
>({
url: '/projects/{projectId}/collaborators',
method: 'get',
...variables,
signal,
});
/**
* Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project `admin` to list collaborators.
*/
export const useProjectsListCollaborators = <
TData = ProjectsListCollaboratorsResponse,
>(
variables: ProjectsListCollaboratorsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ProjectsListCollaboratorsResponse,
ProjectsListCollaboratorsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ProjectsListCollaboratorsResponse,
ProjectsListCollaboratorsError,
TData
>(
queryKeyFn({
path: '/projects/{project_id}/collaborators',
operationId: 'projectsListCollaborators',
variables,
}),
({ signal }) =>
fetchProjectsListCollaborators(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ProjectsRemoveCollaboratorPathParams = {
projectId: number;
username: string;
};
export type ProjectsRemoveCollaboratorError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ProjectsRemoveCollaboratorVariables = {
pathParams: ProjectsRemoveCollaboratorPathParams;
} & GithubContext['fetcherOptions'];
/**
* Removes a collaborator from an organization project. You must be an organization owner or a project `admin` to remove a collaborator.
*/
export const fetchProjectsRemoveCollaborator = (
variables: ProjectsRemoveCollaboratorVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ProjectsRemoveCollaboratorError,
undefined,
{},
{},
ProjectsRemoveCollaboratorPathParams
>({
url: '/projects/{projectId}/collaborators/{username}',
method: 'delete',
...variables,
signal,
});
/**
* Removes a collaborator from an organization project. You must be an organization owner or a project `admin` to remove a collaborator.
*/
export const useProjectsRemoveCollaborator = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ProjectsRemoveCollaboratorError,
ProjectsRemoveCollaboratorVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ProjectsRemoveCollaboratorError,
ProjectsRemoveCollaboratorVariables
>(
(variables: ProjectsRemoveCollaboratorVariables) =>
fetchProjectsRemoveCollaborator({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsAddCollaboratorPathParams = {
projectId: number;
username: string;
};
export type ProjectsAddCollaboratorError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ProjectsAddCollaboratorRequestBody = {
/**
* The permission to grant the collaborator.
*
* @default write
* @example write
*/
permission?: 'read' | 'write' | 'admin';
};
export type ProjectsAddCollaboratorVariables = {
body?: ProjectsAddCollaboratorRequestBody;
pathParams: ProjectsAddCollaboratorPathParams;
} & GithubContext['fetcherOptions'];
/**
* Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project `admin` to add a collaborator.
*/
export const fetchProjectsAddCollaborator = (
variables: ProjectsAddCollaboratorVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ProjectsAddCollaboratorError,
ProjectsAddCollaboratorRequestBody,
{},
{},
ProjectsAddCollaboratorPathParams
>({
url: '/projects/{projectId}/collaborators/{username}',
method: 'put',
...variables,
signal,
});
/**
* Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project `admin` to add a collaborator.
*/
export const useProjectsAddCollaborator = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ProjectsAddCollaboratorError,
ProjectsAddCollaboratorVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ProjectsAddCollaboratorError,
ProjectsAddCollaboratorVariables
>(
(variables: ProjectsAddCollaboratorVariables) =>
fetchProjectsAddCollaborator({ ...fetcherOptions, ...variables }),
options,
);
};
export type ProjectsGetPermissionForUserPathParams = {
projectId: number;
username: string;
};
export type ProjectsGetPermissionForUserError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ProjectsGetPermissionForUserVariables = {
pathParams: ProjectsGetPermissionForUserPathParams;
} & GithubContext['fetcherOptions'];
/**
* Returns the collaborator's permission level for an organization project. Possible values for the `permission` key: `admin`, `write`, `read`, `none`. You must be an organization owner or a project `admin` to review a user's permission level.
*/
export const fetchProjectsGetPermissionForUser = (
variables: ProjectsGetPermissionForUserVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RepositoryCollaboratorPermission,
ProjectsGetPermissionForUserError,
undefined,
{},
{},
ProjectsGetPermissionForUserPathParams
>({
url: '/projects/{projectId}/collaborators/{username}/permission',
method: 'get',
...variables,
signal,
});
/**
* Returns the collaborator's permission level for an organization project. Possible values for the `permission` key: `admin`, `write`, `read`, `none`. You must be an organization owner or a project `admin` to review a user's permission level.
*/
export const useProjectsGetPermissionForUser = <
TData = Schemas.RepositoryCollaboratorPermission,
>(
variables: ProjectsGetPermissionForUserVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.RepositoryCollaboratorPermission,
ProjectsGetPermissionForUserError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.RepositoryCollaboratorPermission,
ProjectsGetPermissionForUserError,
TData
>(
queryKeyFn({
path: '/projects/{project_id}/collaborators/{username}/permission',
operationId: 'projectsGetPermissionForUser',
variables,
}),
({ signal }) =>
fetchProjectsGetPermissionForUser(
{ ...fetcherOptions, ...variables },
signal,
),
{
...options,
...queryOptions,
},
);
};
export type ProjectsListColumnsPathParams = {
projectId: number;
};
export type ProjectsListColumnsQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ProjectsListColumnsError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
>;
export type ProjectsListColumnsResponse = Schemas.ProjectColumn[];
export type ProjectsListColumnsVariables = {
pathParams: ProjectsListColumnsPathParams;
queryParams?: ProjectsListColumnsQueryParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsListColumns = (
variables: ProjectsListColumnsVariables,
signal?: AbortSignal,
) =>
githubFetch<
ProjectsListColumnsResponse,
ProjectsListColumnsError,
undefined,
{},
ProjectsListColumnsQueryParams,
ProjectsListColumnsPathParams
>({
url: '/projects/{projectId}/columns',
method: 'get',
...variables,
signal,
});
export const useProjectsListColumns = (
variables: ProjectsListColumnsVariables,
options?: Omit<
reactQuery.UseQueryOptions<
ProjectsListColumnsResponse,
ProjectsListColumnsError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
ProjectsListColumnsResponse,
ProjectsListColumnsError,
TData
>(
queryKeyFn({
path: '/projects/{project_id}/columns',
operationId: 'projectsListColumns',
variables,
}),
({ signal }) =>
fetchProjectsListColumns({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ProjectsCreateColumnPathParams = {
projectId: number;
};
export type ProjectsCreateColumnError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 422;
payload: Responses.ValidationFailedSimple;
}
>;
export type ProjectsCreateColumnRequestBody = {
/**
* Name of the project column
*
* @example Remaining tasks
*/
name: string;
};
export type ProjectsCreateColumnVariables = {
body: ProjectsCreateColumnRequestBody;
pathParams: ProjectsCreateColumnPathParams;
} & GithubContext['fetcherOptions'];
export const fetchProjectsCreateColumn = (
variables: ProjectsCreateColumnVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.ProjectColumn,
ProjectsCreateColumnError,
ProjectsCreateColumnRequestBody,
{},
{},
ProjectsCreateColumnPathParams
>({
url: '/projects/{projectId}/columns',
method: 'post',
...variables,
signal,
});
export const useProjectsCreateColumn = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.ProjectColumn,
ProjectsCreateColumnError,
ProjectsCreateColumnVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.ProjectColumn,
ProjectsCreateColumnError,
ProjectsCreateColumnVariables
>(
(variables: ProjectsCreateColumnVariables) =>
fetchProjectsCreateColumn({ ...fetcherOptions, ...variables }),
options,
);
};
export type RateLimitGetError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type RateLimitGetVariables = GithubContext['fetcherOptions'];
/**
* **Note:** Accessing this endpoint does not count against your REST API rate limit.
*
* **Note:** The `rate` object is deprecated. If you're writing new API client code or updating existing code, you should use the `core` object instead of the `rate` object. The `core` object contains the same information that is present in the `rate` object.
*/
export const fetchRateLimitGet = (
variables: RateLimitGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.RateLimitOverview,
RateLimitGetError,
undefined,
{},
{},
{}
>({ url: '/rate_limit', method: 'get', ...variables, signal });
/**
* **Note:** Accessing this endpoint does not count against your REST API rate limit.
*
* **Note:** The `rate` object is deprecated. If you're writing new API client code or updating existing code, you should use the `core` object instead of the `rate` object. The `core` object contains the same information that is present in the `rate` object.
*/
export const useRateLimitGet = (
variables: RateLimitGetVariables,
options?: Omit<
reactQuery.UseQueryOptions<
Schemas.RateLimitOverview,
RateLimitGetError,
TData
>,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery<
Schemas.RateLimitOverview,
RateLimitGetError,
TData
>(
queryKeyFn({ path: '/rate_limit', operationId: 'rateLimitGet', variables }),
({ signal }) =>
fetchRateLimitGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ReactionsDeleteLegacyPathParams = {
reactionId: number;
};
export type ReactionsDeleteLegacyError = Fetcher.ErrorWrapper<
| {
status: 304;
payload: Responses.NotModified;
}
| {
status: 401;
payload: Responses.RequiresAuthentication;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 410;
payload: Responses.Gone;
}
| {
status: 415;
payload: Responses.PreviewHeaderMissing;
}
>;
export type ReactionsDeleteLegacyVariables = {
pathParams: ReactionsDeleteLegacyPathParams;
} & GithubContext['fetcherOptions'];
/**
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/).
*
* OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments).
*/
export const fetchReactionsDeleteLegacy = (
variables: ReactionsDeleteLegacyVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ReactionsDeleteLegacyError,
undefined,
{},
{},
ReactionsDeleteLegacyPathParams
>({ url: '/reactions/{reactionId}', method: 'delete', ...variables, signal });
/**
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/).
*
* OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments).
*/
export const useReactionsDeleteLegacy = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ReactionsDeleteLegacyError,
ReactionsDeleteLegacyVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ReactionsDeleteLegacyError,
ReactionsDeleteLegacyVariables
>(
(variables: ReactionsDeleteLegacyVariables) =>
fetchReactionsDeleteLegacy({ ...fetcherOptions, ...variables }),
options,
);
};
export type ReposDeletePathParams = {
owner: string;
repo: string;
};
export type ReposDeleteError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: {
documentation_url?: string;
message?: string;
};
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ReposDeleteVariables = {
pathParams: ReposDeletePathParams;
} & GithubContext['fetcherOptions'];
/**
* Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
*
* If an organization owner has configured the organization to prevent members from deleting organization-owned
* repositories, you will get a `403 Forbidden` response.
*/
export const fetchReposDelete = (
variables: ReposDeleteVariables,
signal?: AbortSignal,
) =>
githubFetch<
undefined,
ReposDeleteError,
undefined,
{},
{},
ReposDeletePathParams
>({ url: '/repos/{owner}/{repo}', method: 'delete', ...variables, signal });
/**
* Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
*
* If an organization owner has configured the organization to prevent members from deleting organization-owned
* repositories, you will get a `403 Forbidden` response.
*/
export const useReposDelete = (
options?: Omit<
reactQuery.UseMutationOptions<
undefined,
ReposDeleteError,
ReposDeleteVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
undefined,
ReposDeleteError,
ReposDeleteVariables
>(
(variables: ReposDeleteVariables) =>
fetchReposDelete({ ...fetcherOptions, ...variables }),
options,
);
};
export type ReposGetPathParams = {
owner: string;
repo: string;
};
export type ReposGetError = Fetcher.ErrorWrapper<
| {
status: 301;
payload: Responses.MovedPermanently;
}
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
>;
export type ReposGetVariables = {
pathParams: ReposGetPathParams;
} & GithubContext['fetcherOptions'];
/**
* When you pass the `scarlet-witch-preview` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file.
*
* The `parent` and `source` objects are present when the repository is a fork. `parent` is the repository this repository was forked from, `source` is the ultimate source for the network.
*/
export const fetchReposGet = (
variables: ReposGetVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.FullRepository,
ReposGetError,
undefined,
{},
{},
ReposGetPathParams
>({ url: '/repos/{owner}/{repo}', method: 'get', ...variables, signal });
/**
* When you pass the `scarlet-witch-preview` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file.
*
* The `parent` and `source` objects are present when the repository is a fork. `parent` is the repository this repository was forked from, `source` is the ultimate source for the network.
*/
export const useReposGet = (
variables: ReposGetVariables,
options?: Omit<
reactQuery.UseQueryOptions,
'queryKey' | 'queryFn'
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } =
useGithubContext(options);
return reactQuery.useQuery(
queryKeyFn({
path: '/repos/{owner}/{repo}',
operationId: 'reposGet',
variables,
}),
({ signal }) => fetchReposGet({ ...fetcherOptions, ...variables }, signal),
{
...options,
...queryOptions,
},
);
};
export type ReposUpdatePathParams = {
owner: string;
repo: string;
};
export type ReposUpdateError = Fetcher.ErrorWrapper<
| {
status: 403;
payload: Responses.Forbidden;
}
| {
status: 404;
payload: Responses.NotFound;
}
| {
status: 422;
payload: Responses.ValidationFailed;
}
>;
export type ReposUpdateRequestBody = {
/**
* Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
*
* @default true
*/
allow_merge_commit?: boolean;
/**
* Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
*
* @default true
*/
allow_rebase_merge?: boolean;
/**
* Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
*
* @default true
*/
allow_squash_merge?: boolean;
/**
* `true` to archive this repository. **Note**: You cannot unarchive repositories through the API.
*
* @default false
*/
archived?: boolean;
/**
* Updates the default branch for this repository.
*/
default_branch?: string;
/**
* Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion.
*
* @default false
*/
delete_branch_on_merge?: boolean;
/**
* A short description of the repository.
*/
description?: string;
/**
* Either `true` to enable issues for this repository or `false` to disable them.
*
* @default true
*/
has_issues?: boolean;
/**
* Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.
*
* @default true
*/
has_projects?: boolean;
/**
* Either `true` to enable the wiki for this repository or `false` to disable it.
*
* @default true
*/
has_wiki?: boolean;
/**
* A URL with more information about the repository.
*/
homepage?: string;
/**
* Either `true` to make this repo available as a template repository or `false` to prevent it.
*
* @default false
*/
is_template?: boolean;
/**
* The name of the repository.
*/
name?: string;
/**
* Either `true` to make the repository private or `false` to make it public. Default: `false`.
* **Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. **Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private.
*
* @default false
*/
private?: boolean;
/**
* Can be `public` or `private`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, `visibility` can also be `internal`. The `visibility` parameter overrides the `private` parameter when you use both along with the `nebula-preview` preview header.
*/
visibility?: 'public' | 'private' | 'visibility' | 'internal';
};
export type ReposUpdateVariables = {
body?: ReposUpdateRequestBody;
pathParams: ReposUpdatePathParams;
} & GithubContext['fetcherOptions'];
/**
* **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint.
*/
export const fetchReposUpdate = (
variables: ReposUpdateVariables,
signal?: AbortSignal,
) =>
githubFetch<
Schemas.FullRepository,
ReposUpdateError,
ReposUpdateRequestBody,
{},
{},
ReposUpdatePathParams
>({ url: '/repos/{owner}/{repo}', method: 'patch', ...variables, signal });
/**
* **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint.
*/
export const useReposUpdate = (
options?: Omit<
reactQuery.UseMutationOptions<
Schemas.FullRepository,
ReposUpdateError,
ReposUpdateVariables
>,
'mutationFn'
>,
) => {
const { fetcherOptions } = useGithubContext();
return reactQuery.useMutation<
Schemas.FullRepository,
ReposUpdateError,
ReposUpdateVariables
>(
(variables: ReposUpdateVariables) =>
fetchReposUpdate({ ...fetcherOptions, ...variables }),
options,
);
};
export type ActionsListArtifactsForRepoPathParams = {
owner: string;
repo: string;
};
export type ActionsListArtifactsForRepoQueryParams = {
/**
* Results per page (max 100).
*
* @default 30
*/
per_page?: number;
/**
* Page number of the results to fetch.
*
* @default 1
*/
page?: number;
};
export type ActionsListArtifactsForRepoError = Fetcher.ErrorWrapper