diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..2fd3e140 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +TEST_FILE_NAME=github-swagger.ts +TEST_SCHEMA_VERSION=v3 +TEST_WITH_DEBUG=true \ No newline at end of file diff --git a/.prettierignore b/.eslintignore similarity index 65% rename from .prettierignore rename to .eslintignore index 6c59c16b..50f51994 100644 --- a/.prettierignore +++ b/.eslintignore @@ -1,3 +1,16 @@ +.eslintrc +node_modules +.husky +.vscode +swagger-test-cli +tests +*.ejs +*.eta +.kube +.idea +*.json +.eslintrc.js +vite.config.ts tests/**/*.ts tests/**/schema.js tests/**/schema.ts @@ -7,7 +20,6 @@ swagger-test-cli.* templates *.md .github -node_modules .openapi-generator .vscode assets diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..a16d99b4 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,29 @@ +module.exports = { + parserOptions: { + "ecmaVersion": "latest" + }, + env: { + "node": true, + "es6": true + }, + extends: [ + 'eslint:recommended', + 'plugin:prettier/recommended', + ], + plugins: [ + 'prettier', + ], + rules: { + 'prettier/prettier': [ + 'error', + { + endOfLine: 'auto', + printWidth: 80, + tabWidth: 2, + trailingComma: 'all', + semi: true, + singleQuote: true, + }, + ], + }, +}; diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d60d94a4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + open-pull-requests-limit: 100 + schedule: + interval: "daily" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 692bb8bb..c57edf77 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,37 +1,94 @@ -# This is a basic workflow to help you get started with Actions +name: Builds, tests & co -name: Run tests - -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the master branch - pull_request: - branches: [ master, next ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + - push + - pull_request -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + build-and-test: strategy: + fail-fast: false matrix: - node-version: [11.x, 13.x, 15.x] + os: + - macos-latest + - ubuntu-latest + - windows-latest + node-version: + - 16.x + - 18.x - name: Node.js (test-all) ${{ matrix.node-version }} + runs-on: ${{ matrix.os }} - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - name: Checkout tree + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install npm packages + run: npm ci --ignore-scripts + + - name: Run the tests + run: npm run test-all + + dependabot-auto-approve: + name: Dependabot auto-approve + + permissions: + pull-requests: write + + needs: + - build-and-test + + if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }} + + runs-on: ubuntu-latest - # Runs a single command using the runners shell - - name: install deps - run: npm i + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 + + - name: Get the PR review decision + id: gh-pr-review + run: echo "decision=$(gh pr view --json reviewDecision --jq '. | .reviewDecision' "$PR_URL")" >>"$GITHUB_OUTPUT" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ github.token }} + + - name: Approve a PR + if: ${{ steps.gh-pr-review.outputs.decision != 'APPROVED' && steps.metadata.outputs.update-type == 'version-update:semver-patch' }} + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ github.token }} + + dependabot-auto-merge: + name: Dependabot auto-merge + + permissions: + contents: write + pull-requests: write + + if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }} + + needs: + - build-and-test + - dependabot-auto-approve + + runs-on: ubuntu-latest + + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 - # Runs a set of commands using the runners shell - - name: test - run: npm run test-all-extended + - name: Merge Dependabot PR + if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index 34934614..d8bc3b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules .idea swagger-test-cli.* swagger-test-cli -dist \ No newline at end of file +dist +.env \ No newline at end of file diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100644 index 00000000..115d75c7 --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +git update-index -g \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..83af4040 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run lint:fix diff --git a/.ncurc.json b/.ncurc.json new file mode 100644 index 00000000..da7ff7a5 --- /dev/null +++ b/.ncurc.json @@ -0,0 +1,7 @@ +{ + "upgrade": true, + "reject": [ + "nanoid", + "eta" + ] +} \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index 0ff38047..8d2a4516 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.16.0 \ No newline at end of file +18.16.1 \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index f7587a35..00000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "printWidth": 120, - "tabWidth": 2, - "trailingComma": "all" -} diff --git a/.vscode/launch.json b/.vscode/launch.json index 7b737404..a74256c5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,14 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": "Debug generate", - "type": "node", - "request": "launch", - "cwd": "${workspaceFolder}", - "runtimeExecutable": "npm", - "runtimeArgs": ["run-script", "generate:debug"] - }, { "name": "Debug JSON CLI", "type": "node", @@ -60,14 +52,6 @@ "runtimeExecutable": "npm", "runtimeArgs": ["run-script", "test-all"] }, - { - "name": "Debug test-all-extended", - "type": "node", - "request": "launch", - "cwd": "${workspaceFolder}", - "runtimeExecutable": "npm", - "runtimeArgs": ["run-script", "test-all-extended"] - }, { "name": "Debug test:--extract-request-body", "type": "node", diff --git a/CHANGELOG.md b/CHANGELOG.md index c63f9c5f..b04e27b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,60 @@ # next release +BREAKING_CHANGE: disable support NodeJS 14.x +BREAKING_CHANGE: change swagger-typescript-api NodeJS "generateApi" function return type +BREAKING_CHANGE: remove `rawModelTypes` from output api configuration +feat: `--custom-config ` option (#503) +feat: `--sort-routes` option, ability to sort routes; +fix: critical bugs based with extract types and enums +fix: sort types option (sort was not correctly work with nested or extracted types) +fix: problems based with extracting enums; +fix: nullable enum with integer values (#543) +fix: generation enum numbers as strings one (#534) +chore: refactoring the axios imports +fix: non-object custom spec extensions (#500) +fix(docs): input instead of output in readme +internal: remove redundant internal scripts +internal: change process with using custom templates + +```diff +interface GenerateApiOutput { +... +- files: { name: string; content: string; declaration: { name: string; content: string } | null }[]; ++ files: { fileName: string; fileContent: string; fileExtension: string }[]; +... +} +``` + +internal: refactor schema parser code (preparing it for async code execution) +fix: problem with filtering primitive in complex types (#459) +feat: add discriminator property support (#456) +internal: prepare code + templates for async code execution (next plans) +fix: problems with dot in query params (hard fix) (#460) +feature: ability to send custom Ts output code translator to js. Example: +```ts + const { Translator } = require("swagger-typescript-api/src/translators/translator"); + const { JavascriptTranslator } = require("swagger-typescript-api/src/translators/javascript"); + + class MyTranslator extends Translator { // or use extends JavascriptTranslator + translate({ fileName, fileExtension, fileContent }) { + // format ts\js code with using this codeFormatter (prettier + ts import fixer) + this.codeFormatter.format(fileContent) + // config of the code gen process + this.config. + // logger + this.logger. + + return [ + { + fileName, + fileExtension, + fileContent, + } + ] + } + } +``` + ## 12.0.4 fix: onCreateRoute skip behaviour @@ -484,7 +539,7 @@ Features: name?: string; path?: string; }) => string - formatTSContent: (content: string) => string; + formatTSContent: (content: string) => Promise; // ... diff --git a/README.md b/README.md index e865891b..12994d4f 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ const { generateApi, generateTemplates } = require('swagger-typescript-api'); const path = require("path"); const fs = require("fs"); -/* NOTE: all fields are optional expect one of `output`, `url`, `spec` */ +/* NOTE: all fields are optional expect one of `input`, `url`, `spec` */ generateApi({ name: "MySuperbApi.ts", // set to `false` to prevent the tool from writing to disk diff --git a/cli/constants.js b/cli/constants.js index 02b90d01..ed50bc9f 100644 --- a/cli/constants.js +++ b/cli/constants.js @@ -1,7 +1,7 @@ -const root_command = Symbol("root"); -const skip_command = Symbol("skip"); +const root_command = Symbol('root'); +const skip_command = Symbol('skip'); -const reservedOptions = ["version", "help"]; +const reservedOptions = ['version', 'help']; module.exports = { root_command, diff --git a/cli/execute.js b/cli/execute.js index c2525b26..263ffd85 100644 --- a/cli/execute.js +++ b/cli/execute.js @@ -1,10 +1,11 @@ -const _ = require("lodash"); -const { root_command, skip_command } = require("./constants"); -const { parseArgs } = require("./parse-args"); -const didYouMean = require("didyoumean"); +const _ = require('lodash'); +const { root_command, skip_command } = require('./constants'); +const { parseArgs } = require('./parse-args'); +const didYouMean = require('didyoumean'); didYouMean.threshold = 0.5; +// eslint-disable-next-line no-unused-vars const execute = (params, commands, instance) => { const args = parseArgs(params.args, params.from); @@ -17,7 +18,9 @@ const execute = (params, commands, instance) => { } if (!usageOptions.length && command.name === root_command) { - usageOptions.push(command.options.find((option) => option.flags.name === "help")); + usageOptions.push( + command.options.find((option) => option.flags.name === 'help'), + ); } const operationOptions = usageOptions.filter((option) => option.operation); @@ -29,20 +32,23 @@ const execute = (params, commands, instance) => { }); return; } else { - let error = ""; + let error = ''; - const processUserOptionData = (data, option) => { - if (!data.length && !option.flags.value) { - return !option.flags.isNoFlag; - } - if (option.flags.value) { - if (option.flags.value.variadic) { - return data.reduce((acc, d) => { - acc.push(...d.split(",").map(option.flags.value.formatter)); - return acc; - }, []); - } else { - return option.flags.value.formatter(data[0] || option.default); + const processUserOptionData = (userOption, option) => { + if (userOption) { + const data = userOption.$data; + if (!data.length && !option.flags.value) { + return !option.flags.isNoFlag; + } + if (option.flags.value) { + if (option.flags.value.variadic) { + return data.reduce((acc, d) => { + acc.push(...d.split(',').map(option.flags.value.formatter)); + return acc; + }, []); + } else { + return option.flags.value.formatter(data[0] || option.default); + } } } @@ -52,17 +58,21 @@ const execute = (params, commands, instance) => { const parsedOptionsObject = command.options.reduce((acc, option) => { if (error) return acc; - const userOption = usageOptions.find((o) => o.flags.name === option.flags.name); + const userOption = usageOptions.find( + (o) => o.flags.name === option.flags.name, + ); if (!userOption && option.required) { error = `required option '${option.flags.raw}' not specified`; return acc; } - if (userOption) { - acc[option.flags.name] = processUserOptionData(userOption.$data, option); - } else { - acc[option.flags.name] = option.default; + const flagValue = processUserOptionData(userOption, option); + if (!option.operation) { + const internal = option.internal || {}; + acc[internal.name || option.flags.name] = internal.formatter + ? internal.formatter(flagValue) + : flagValue; } return acc; @@ -84,7 +94,7 @@ const processArgs = (commands, args) => { let command = null; let usageOptions = []; let walkingOption = null; - let error = ""; + let error = ''; let allFlagKeys = []; @@ -94,33 +104,44 @@ const processArgs = (commands, args) => { if (i === 0) { command = commands[arg]; - if (!command && !arg.startsWith("-")) { + if (!command && !arg.startsWith('-')) { const tip = didYouMean(arg, _.keys(commands)); - error = `unknown command ${arg}${tip ? `\n(Did you mean ${tip} ?)` : ""}`; + error = `unknown command ${arg}${ + tip ? `\n(Did you mean ${tip} ?)` : '' + }`; } else if (!command) { command = commands[root_command]; } if (command) { - allFlagKeys = command.options.reduce((acc, option) => [...acc, ...option.flags.keys], []); + allFlagKeys = command.options.reduce( + (acc, option) => [...acc, ...option.flags.keys], + [], + ); } } if (error) return; - if (arg.startsWith("-")) { - const option = command.options.find((option) => option.flags.keys.includes(arg)); + if (arg.startsWith('-')) { + const option = command.options.find((option) => + option.flags.keys.includes(arg), + ); if (!option) { const tip = didYouMean(arg, allFlagKeys); - error = `unknown option ${arg}${tip ? `\n(Did you mean ${tip} ?)` : ""}`; + error = `unknown option ${arg}${ + tip ? `\n(Did you mean ${tip} ?)` : '' + }`; } if (option) { if (walkingOption && walkingOption.flags.name === option.flags.name) { return; } - const existedOption = usageOptions.find((o) => o.flags.name === option.flags.name); + const existedOption = usageOptions.find( + (o) => o.flags.name === option.flags.name, + ); if (existedOption) { walkingOption = existedOption; } else { diff --git a/cli/index.d.ts b/cli/index.d.ts index 0595ad3b..32e60d0a 100644 --- a/cli/index.d.ts +++ b/cli/index.d.ts @@ -1,9 +1,8 @@ -import { skip_command } from "./constants"; - type CliStructOption = { flags?: string; description?: string; default?: unknown; + internal?: { name?: string; formatter?: (value: any) => any }; }; type CliStruct = { diff --git a/cli/index.js b/cli/index.js index c858d811..9d867f4f 100644 --- a/cli/index.js +++ b/cli/index.js @@ -1,9 +1,9 @@ -const _ = require("lodash"); -const { reservedOptions, root_command } = require("./constants"); -const { processOption } = require("./process-option"); -const { execute } = require("./execute"); -const { displayHelp } = require("./operations/display-help"); -const { displayVersion } = require("./operations/display-version"); +const _ = require('lodash'); +const { reservedOptions, root_command } = require('./constants'); +const { processOption } = require('./process-option'); +const { execute } = require('./execute'); +const { displayHelp } = require('./operations/display-help'); +const { displayVersion } = require('./operations/display-version'); const cli = (input) => { const commands = {}; @@ -11,15 +11,15 @@ const cli = (input) => { const addCommand = (command, { addVersion = false, addHelp = true } = {}) => { commands[command.name] = { name: command.name, - description: `${command.description || ""}`, + description: `${command.description || ''}`, options: _.compact(_.map(command.options, processOption)), }; if (addVersion) { commands[command.name].options.unshift( processOption({ - flags: "-v, --version", - description: "output the current version", + flags: '-v, --version', + description: 'output the current version', operation: () => displayVersion(instance), }), ); @@ -28,9 +28,10 @@ const cli = (input) => { if (addHelp) { commands[command.name].options.push( processOption({ - flags: "-h, --help", - description: "display help for command", - operation: () => displayHelp(commands, instance, commands[command.name]), + flags: '-h, --help', + description: 'display help for command', + operation: () => + displayHelp(commands, instance, commands[command.name]), }), ); } @@ -62,7 +63,7 @@ const cli = (input) => { if (!processed) return; if (reservedOptions.includes(processed.name)) { - console.warn("reserved option", processed.name); + console.warn('reserved option', processed.name); return; } @@ -71,16 +72,16 @@ const cli = (input) => { commands[root_command].options.unshift( processOption({ - flags: "-v, --version", - description: "output the current version", + flags: '-v, --version', + description: 'output the current version', operation: () => displayVersion(instance), }), ); commands[root_command].options.push( processOption({ - flags: "-h, --help", - description: "display help for command", + flags: '-h, --help', + description: 'display help for command', operation: () => displayHelp(commands, instance, commands[root_command]), }), ); diff --git a/cli/operations/display-help.js b/cli/operations/display-help.js index cb3e85be..c1267908 100644 --- a/cli/operations/display-help.js +++ b/cli/operations/display-help.js @@ -1,14 +1,21 @@ -const _ = require("lodash"); -const { root_command } = require("../constants"); +const _ = require('lodash'); +const { root_command } = require('../constants'); const generateOptionsOutput = (options) => options.reduce( (acc, option) => { - const flags = `${option.flags.keys.join(", ")}${option.flags.value?.raw ? ` ${option.flags.value?.raw}` : ""}`; - const description = `${option.description || ""}${ - option.default === undefined || (option.flags.isNoFlag && option.default === true) - ? "" - : ` (default: ${typeof option.default === "string" ? `"${option.default}"` : option.default})` + const flags = `${option.flags.keys.join(', ')}${ + option.flags.value?.raw ? ` ${option.flags.value?.raw}` : '' + }`; + const description = `${option.description || ''}${ + option.default === undefined || + (option.flags.isNoFlag && option.default === true) + ? '' + : ` (default: ${ + typeof option.default === 'string' + ? `"${option.default}"` + : option.default + })` }`; if (flags.length > acc.maxLength) { @@ -30,10 +37,10 @@ const generateOptionsOutput = (options) => const generateOptionsTextOutput = (options, maxLength, spaces) => options .map((option) => { - const spacesText = Array(spaces).fill(" ").join(""); - const leftStr = `${spacesText}${option.flags.padEnd(maxLength, " ")} `; - const leftStrFiller = Array(leftStr.length).fill(" ").join(""); - const descriptionLines = option.description.split("\n"); + const spacesText = Array(spaces).fill(' ').join(''); + const leftStr = `${spacesText}${option.flags.padEnd(maxLength, ' ')} `; + const leftStrFiller = Array(leftStr.length).fill(' ').join(''); + const descriptionLines = option.description.split('\n'); return ( leftStr + @@ -45,13 +52,15 @@ const generateOptionsTextOutput = (options, maxLength, spaces) => return `\n${leftStrFiller}${line}`; }) - .join("") + .join('') ); }) - .join("\n"); + .join('\n'); const displayAllHelp = (commands, instance) => { - const { options, maxLength: maxOptionLength } = generateOptionsOutput(commands[root_command].options); + const { options, maxLength: maxOptionLength } = generateOptionsOutput( + commands[root_command].options, + ); const { commands: commandLabels, maxLength: maxCommandLength } = _.filter( commands, @@ -59,7 +68,7 @@ const displayAllHelp = (commands, instance) => { ).reduce( (acc, command) => { const options = generateOptionsOutput(command.options); - const name = `${command.name}${options.length ? " [options]" : ""}`; + const name = `${command.name}${options.length ? ' [options]' : ''}`; const description = command.description; const maxLength = Math.max(name.length, options.maxLength); @@ -84,10 +93,17 @@ const displayAllHelp = (commands, instance) => { const commandsOutput = commandLabels .map((commandLabel) => { - const leftStr = ` ${commandLabel.name.padEnd(maxCommandLength, " ")} `; - const leftStrFiller = Array(leftStr.length).fill(" ").join(""); - const descriptionLines = commandLabel.description.split("\n"); - const optionsTextOutput = generateOptionsTextOutput(commandLabel.options.options, maxCommandLength, 4); + const leftStr = ` ${commandLabel.name.padEnd( + maxCommandLength, + ' ', + )} `; + const leftStrFiller = Array(leftStr.length).fill(' ').join(''); + const descriptionLines = commandLabel.description.split('\n'); + const optionsTextOutput = generateOptionsTextOutput( + commandLabel.options.options, + maxCommandLength, + 4, + ); return ( leftStr + @@ -99,11 +115,11 @@ const displayAllHelp = (commands, instance) => { return `\n${leftStrFiller}${line}`; }) - .join("") + - (optionsTextOutput.length ? `\n${optionsTextOutput}` : "") + .join('') + + (optionsTextOutput.length ? `\n${optionsTextOutput}` : '') ); }) - .join("\n"); + .join('\n'); const outputTest = [ optionsOutput && @@ -114,11 +130,13 @@ ${optionsOutput}`, ${commandsOutput}`, ] .filter(Boolean) - .join("\n\n"); + .join('\n\n'); - console.log(`Usage: ${[instance.input.name, instance.input.alias].filter(Boolean).join("|")}${ - optionsOutput ? " [options]" : "" - }${commandsOutput ? " [command]" : ""} + console.log(`Usage: ${[instance.input.name, instance.input.alias] + .filter(Boolean) + .join('|')}${optionsOutput ? ' [options]' : ''}${ + commandsOutput ? ' [command]' : '' + } ${ instance.input.description && ` @@ -131,7 +149,9 @@ ${outputTest}`); const displayHelp = (commands, instance, command) => { if (command.name === root_command) return displayAllHelp(commands, instance); - const { options, maxLength: maxOptionLength } = generateOptionsOutput(command.options); + const { options, maxLength: maxOptionLength } = generateOptionsOutput( + command.options, + ); const optionsOutput = generateOptionsTextOutput(options, maxOptionLength, 2); const outputTest = [ @@ -140,9 +160,11 @@ const displayHelp = (commands, instance, command) => { ${optionsOutput}`, ] .filter(Boolean) - .join("\n\n"); + .join('\n\n'); - console.log(`Usage: ${instance.input.name} ${command.name}${optionsOutput ? " [options]" : ""} + console.log(`Usage: ${instance.input.name} ${command.name}${ + optionsOutput ? ' [options]' : '' + } ${ command.description && ` diff --git a/cli/parse-args.js b/cli/parse-args.js index b99f14fc..4f961d6f 100644 --- a/cli/parse-args.js +++ b/cli/parse-args.js @@ -1,18 +1,18 @@ const parseArgs = (args, type) => { if (args == null || !Array.isArray(args)) { - throw "args should be array"; + throw 'args should be array'; } const argsCopy = args.slice(); switch (type) { - case "electron": { + case 'electron': { if (process.defaultApp) { return argsCopy.slice(2); } return argsCopy.slice(1); } - case "user": { + case 'user': { return argsCopy; } default: { diff --git a/cli/process-option.js b/cli/process-option.js index 98eb913f..7a96d5f7 100644 --- a/cli/process-option.js +++ b/cli/process-option.js @@ -1,4 +1,4 @@ -const _ = require("lodash"); +const _ = require('lodash'); const optionFormatters = { number: (str) => +str, @@ -13,29 +13,36 @@ const processFlags = (flags) => { let name = null; const keys = []; let value = null; - const isNoFlag = flags.includes("--no-"); + const isNoFlag = flags.includes('--no-'); - _.compact(_.split(flags, " ").map((str) => str.replace(/\,/g, ""))).forEach((str) => { - if (str.startsWith("-")) { - keys.push(str); - } else if (value === null) { - if (str.startsWith("{") || str.startsWith("[") || str.startsWith("<")) { - const rawValue = str.replace(/[\{\[\<\>\}\]\.]/g, ""); - const variadic = str.includes("..."); - value = { - raw: str, - variadic, - name: rawValue, - formatter: optionFormatters[rawValue] || optionFormatters.string, - }; + _.compact(_.split(flags, ' ').map((str) => str.replace(/,/g, ''))).forEach( + (str) => { + if (str.startsWith('-')) { + keys.push(str); + } else if (value === null) { + if (str.startsWith('{') || str.startsWith('[') || str.startsWith('<')) { + const rawValue = str.replace(/[{[<>}\].]/g, ''); + const variadic = str.includes('...'); + value = { + raw: str, + variadic, + name: rawValue, + formatter: optionFormatters[rawValue] || optionFormatters.string, + }; + } } - } - }); + }, + ); const longestKey = keys.slice().sort((a, b) => b.length - a.length)[0]; if (!_.isEmpty(longestKey)) { - name = _.camelCase((isNoFlag ? longestKey.replace("--no-", "") : longestKey).replace(/(--?)/, "")); + name = _.camelCase( + (isNoFlag ? longestKey.replace('--no-', '') : longestKey).replace( + /(--?)/, + '', + ), + ); } return { @@ -51,16 +58,17 @@ const processOption = (option) => { const processedFlags = processFlags(option.flags); if (!processedFlags.name) { - console.warn("invalid option", option); + console.warn('invalid option', option); return null; } return { required: !!option.required, - description: `${option.description || ""}`, + description: `${option.description || ''}`, default: option.default, flags: processedFlags, operation: option.operation, + internal: option.internal, }; }; diff --git a/index.d.ts b/index.d.ts index 97ddaa3f..9f063a38 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,3 +1,5 @@ +import {MonoSchemaParser} from "./src/schema-parser/mono-schema-parser"; + type HttpClientType = "axios" | "fetch"; interface GenerateApiParamsBase { @@ -7,7 +9,7 @@ interface GenerateApiParamsBase { name?: string; /** - * path to folder where will been located the created api module. + * path to folder where will be located the created api module. * * may set to `false` to skip writing content to disk. in this case, * you may access the `files` on the return value. @@ -59,6 +61,11 @@ interface GenerateApiParamsBase { */ sortTypes?: boolean; + /** + * sort routes in alphabetical order + */ + sortRoutes?: boolean; + /** * generate js api module with declaration file (default: false) */ @@ -168,6 +175,55 @@ interface GenerateApiParamsBase { /** configuration for fetching swagger schema requests */ requestOptions?: null | Partial; + + /** ts compiler configuration object (for --to-js option) */ + compilerTsConfig?: Record; + + /** + * custom ts->* translator + * do not use constructor args, it can break functionality of this property, just send class reference + * + * @example + * ```ts + * const { Translator } = require("swagger-typescript-api/src/translators/translator"); + * + * class MyTranslator extends Translator { + * + * translate({ fileName, fileExtension, fileContent }) { + * this.codeFormatter.format() + * this.config. + * this.logger. + * + * return [ + * { + * fileName, + * fileExtension, + * fileContent, + * } + * ] + * } + * } + * ``` + */ + customTranslator?: new () => typeof import("./src/translators/translator").Translator; + /** fallback name for enum key resolver */ + enumKeyResolverName?: string; + /** fallback name for type name resolver */ + typeNameResolverName?: string; + /** fallback name for specific arg name resolver */ + specificArgNameResolverName?: string; + schemaParsers?: { + complexOneOf?:MonoSchemaParser; + complexAllOf?:MonoSchemaParser; + complexAnyOf?:MonoSchemaParser; + complexNot?:MonoSchemaParser; + enum?:MonoSchemaParser; + object?:MonoSchemaParser; + complex?:MonoSchemaParser; + primitive?:MonoSchemaParser; + discriminator?:MonoSchemaParser; + array?: MonoSchemaParser; + } } type CodeGenConstruct = { @@ -282,7 +338,10 @@ export interface Hooks { /** calls after parse route (return type: customized route (ParsedRoute), nothing change (void), false (ignore this route)) */ onCreateRoute: (routeData: ParsedRoute) => ParsedRoute | void | false; /** Start point of work this tool (after fetching schema) */ - onInit?: (configuration: C) => C | void; + onInit?: ( + configuration: C, + codeGenProcess: import("./src/code-gen-process").CodeGenProcess, + ) => C | void; /** customize configuration object before sending it to ETA templates */ onPrepareConfig?: (currentConfiguration: C) => C | void; /** customize route name as you need */ @@ -367,7 +426,7 @@ export interface SchemaComponent { }; $parsed: ParsedSchema; }; - componentName: string; + componentName: "schemas" | "paths"; typeData: ParsedSchema | null; } @@ -443,10 +502,16 @@ type ExtractingOptions = { responseBodySuffix: string[]; responseErrorSuffix: string[]; requestParamsSuffix: string[]; + enumSuffix: string[]; + discriminatorMappingSuffix: string[]; + discriminatorAbstractPrefix: string[]; requestBodyNameResolver: (name: string, reservedNames: string) => string | undefined; responseBodyNameResolver: (name: string, reservedNames: string) => string | undefined; responseErrorNameResolver: (name: string, reservedNames: string) => string | undefined; requestParamsNameResolver: (name: string, reservedNames: string) => string | undefined; + enumNameResolver: (name: string, reservedNames: string) => string | undefined; + discriminatorMappingNameResolver: (name: string, reservedNames: string) => string | undefined; + discriminatorAbstractResolver: (name: string, reservedNames: string) => string | undefined; }; export interface GenerateApiConfiguration { @@ -463,6 +528,18 @@ export interface GenerateApiConfiguration { url: string; spec: any; fileName: string; + templatePaths: { + /** `templates/base` */ + base: string; + /** `templates/default` */ + default: string; + /** `templates/modular` */ + modular: string; + /** usage path if `--templates` option is not set */ + original: string; + /** custom path to templates (`--templates`) */ + custom: string | null; + }; authorizationToken?: string; generateResponses: boolean; defaultResponseAsSuccess: boolean; @@ -481,6 +558,7 @@ export interface GenerateApiConfiguration { extractRequestParams: boolean; unwrapResponseData: boolean; sortTypes: boolean; + sortRoutes: boolean; singleHttpClient: boolean; typePrefix: string; typeSuffix: string; @@ -505,10 +583,16 @@ export interface GenerateApiConfiguration { hooks: Hooks; enumNamesAsValues: boolean; version: string; + compilerTsConfig: Record; + enumKeyResolverName: string; + typeNameResolverName: string; + specificArgNameResolverName: string; + /** do not use constructor args, it can break functionality of this property, just send class reference */ + customTranslator?: new (...args: never[]) => typeof import("./src/translators/translator").Translator; internalTemplateOptions: { addUtilRequiredKeysType: boolean; }; - componentTypeNameResolver: typeof import("./src/util/name-resolver").ComponentTypeNameResolver; + componentTypeNameResolver: typeof import("./src/component-type-name-resolver").ComponentTypeNameResolver; fileNames: { dataContracts: string; routeTypes: string; @@ -533,7 +617,6 @@ export interface GenerateApiConfiguration { extractingOptions: ExtractingOptions; }; modelTypes: ModelType[]; - rawModelTypes: SchemaComponent[]; hasFormDataRoutes: boolean; hasSecurityRoutes: boolean; hasQueryRoutes: boolean; @@ -569,9 +652,18 @@ export interface GenerateApiConfiguration { }; } +type FileInfo = { + /** @example myFilename */ + fileName: string; + /** @example .d.ts */ + fileExtension: string; + /** content of the file */ + fileContent: string; +}; + export interface GenerateApiOutput { configuration: GenerateApiConfiguration; - files: { name: string; content: string; declaration: { name: string; content: string } | null }[]; + files: FileInfo[]; createFile: (params: { path: string; fileName: string; content: string; withPrefix?: boolean }) => void; renderTemplate: ( templateContent: string, @@ -579,7 +671,7 @@ export interface GenerateApiOutput { etaOptions?: import("eta/dist/types/config").PartialConfig, ) => string; getTemplate: (params: { fileName?: string; name?: string; path?: string }) => string; - formatTSContent: (content: string) => string; + formatTSContent: (content: string) => Promise; } export declare function generateApi(params: GenerateApiParams): Promise; diff --git a/index.js b/index.js index ea90c79e..5f382e89 100644 --- a/index.js +++ b/index.js @@ -6,245 +6,290 @@ // License text available at https://opensource.org/licenses/MIT // Repository https://github.com/acacode/swagger-typescript-api -const _ = require("lodash"); -const { version, name } = require("./package.json"); -const { cli } = require("./cli"); -const { generateApi, generateTemplates } = require("./src"); -const { HTTP_CLIENT } = require("./src/constants"); -const { resolve } = require("path"); -const { CodeGenConfig } = require("./src/configuration"); -const { TemplatesGenConfig } = require("./src/commands/generate-templates/configuration"); +const { version, name } = require('./package.json'); +const { cli } = require('./cli'); +const { generateApi, generateTemplates } = require('./src'); +const { HTTP_CLIENT } = require('./src/constants'); +const { resolve } = require('path'); +const { CodeGenConfig } = require('./src/configuration'); +const { + TemplatesGenConfig, +} = require('./src/commands/generate-templates/configuration'); const codeGenBaseConfig = new CodeGenConfig({}); const templateGenBaseConfig = new TemplatesGenConfig({}); const program = cli({ name: name, - alias: "sta", + alias: 'sta', version: version, - description: "Generate api via swagger scheme.\nSupports OA 3.0, 2.0, JSON, yaml.", + description: + 'Generate api via swagger scheme.\nSupports OA 3.0, 2.0, JSON, yaml.', options: [ { - flags: "-p, --path ", - description: "path/url to swagger scheme", + flags: '-p, --path ', + description: 'path/url to swagger scheme', required: true, }, { - flags: "-o, --output ", - description: "output path of typescript api file", - default: "./", + flags: '-o, --output ', + description: 'output path of typescript api file', + default: './', }, { - flags: "-n, --name ", - description: "name of output typescript api file", + flags: '-n, --name ', + description: 'name of output typescript api file', default: codeGenBaseConfig.fileName, }, { - flags: "-t, --templates ", - description: "path to folder containing templates", + flags: '-t, --templates ', + description: 'path to folder containing templates', }, { - flags: "-d, --default-as-success", + flags: '-d, --default-as-success', description: 'use "default" response status code as success response too.\n' + 'some swagger schemas use "default" response status code as success response type by default.', default: codeGenBaseConfig.defaultResponseAsSuccess, + internal: { name: 'defaultResponseAsSuccess' }, }, { - flags: "-r, --responses", - description: "generate additional information about request responses\n" + "also add typings for bad responses", + flags: '-r, --responses', + description: + 'generate additional information about request responses\n' + + 'also add typings for bad responses', default: codeGenBaseConfig.generateResponses, + internal: { name: 'generateResponses' }, }, { - flags: "--union-enums", + flags: '--union-enums', description: 'generate all "enum" types as union types (T1 | T2 | TN)', default: codeGenBaseConfig.generateUnionEnums, + internal: { name: 'generateUnionEnums' }, }, { - flags: "--add-readonly", - description: "generate readonly properties", + flags: '--add-readonly', + description: 'generate readonly properties', default: codeGenBaseConfig.addReadonly, }, { - flags: "--route-types", - description: "generate type definitions for API routes", + flags: '--route-types', + description: 'generate type definitions for API routes', default: codeGenBaseConfig.generateRouteTypes, + internal: { name: 'generateRouteTypes' }, }, { - flags: "--no-client", - description: "do not generate an API class", + flags: '--no-client', + description: 'do not generate an API class', default: codeGenBaseConfig.generateClient, }, { - flags: "--enum-names-as-values", - description: "use values in 'x-enumNames' as enum values (not only as keys)", + flags: '--enum-names-as-values', + description: + "use values in 'x-enumNames' as enum values (not only as keys)", default: codeGenBaseConfig.enumNamesAsValues, }, { - flags: "--extract-request-params", + flags: '--extract-request-params', description: - "extract request params to data contract (Also combine path params and query params into one object)", + 'extract request params to data contract (Also combine path params and query params into one object)', default: codeGenBaseConfig.extractRequestParams, + internal: { formatter: Boolean }, }, { - flags: "--extract-request-body", - description: "extract request body type to data contract", + flags: '--extract-request-body', + description: 'extract request body type to data contract', default: codeGenBaseConfig.extractRequestBody, + internal: { formatter: Boolean }, }, { - flags: "--extract-response-body", - description: "extract response body type to data contract", + flags: '--extract-response-body', + description: 'extract response body type to data contract', default: codeGenBaseConfig.extractResponseBody, + internal: { formatter: Boolean }, }, { - flags: "--extract-response-error", - description: "extract response error type to data contract", + flags: '--extract-response-error', + description: 'extract response error type to data contract', default: codeGenBaseConfig.extractResponseError, + internal: { formatter: Boolean }, }, { - flags: "--modular", - description: "generate separated files for http client, data contracts, and routes", + flags: '--modular', + description: + 'generate separated files for http client, data contracts, and routes', default: codeGenBaseConfig.modular, + internal: { formatter: Boolean }, }, { - flags: "--js", - description: "generate js api module with declaration file", + flags: '--js', + description: 'generate js api module with declaration file', default: codeGenBaseConfig.toJS, + internal: { formatter: Boolean, name: 'toJS' }, }, { - flags: "--module-name-index ", + flags: '--module-name-index ', description: - "determines which path index should be used for routes separation (example: GET:/fruites/getFruit -> index:0 -> moduleName -> fruites)", + 'determines which path index should be used for routes separation (example: GET:/fruites/getFruit -> index:0 -> moduleName -> fruites)', default: codeGenBaseConfig.moduleNameIndex, + internal: { formatter: (moduleNameIndex) => +moduleNameIndex || 0 }, }, { - flags: "--module-name-first-tag", - description: "splits routes based on the first tag", + flags: '--module-name-first-tag', + description: 'splits routes based on the first tag', default: codeGenBaseConfig.moduleNameFirstTag, }, { - flags: "--disableStrictSSL", - description: "disabled strict SSL", + flags: '--disableStrictSSL', + description: 'disabled strict SSL', default: codeGenBaseConfig.disableStrictSSL, + internal: { formatter: Boolean }, }, { - flags: "--disableProxy", - description: "disabled proxy", + flags: '--disableProxy', + description: 'disabled proxy', default: codeGenBaseConfig.disableProxy, + internal: { formatter: Boolean }, }, { - flags: "--axios", - description: "generate axios http client", - default: codeGenBaseConfig.httpClientType === "axios", + flags: '--axios', + description: 'generate axios http client', + default: codeGenBaseConfig.httpClientType === HTTP_CLIENT.AXIOS, }, { - flags: "--unwrap-response-data", - description: "unwrap the data item from the response", + flags: '--unwrap-response-data', + description: 'unwrap the data item from the response', default: codeGenBaseConfig.unwrapResponseData, }, { - flags: "--disable-throw-on-error", - description: "Do not throw an error when response.ok is not true", + flags: '--disable-throw-on-error', + description: 'Do not throw an error when response.ok is not true', default: codeGenBaseConfig.disableThrowOnError, }, { - flags: "--single-http-client", - description: "Ability to send HttpClient instance to Api constructor", + flags: '--single-http-client', + description: 'Ability to send HttpClient instance to Api constructor', default: codeGenBaseConfig.singleHttpClient, + internal: { formatter: Boolean }, }, { - flags: "--silent", - description: "Output only errors to console", + flags: '--silent', + description: 'Output only errors to console', default: codeGenBaseConfig.silent, + internal: { formatter: Boolean }, }, { - flags: "--default-response ", - description: "default type for empty response schema", + flags: '--default-response ', + description: 'default type for empty response schema', default: codeGenBaseConfig.defaultResponseType, + internal: { name: 'defaultResponseType' }, }, { - flags: "--type-prefix ", - description: "data contract name prefix", + flags: '--type-prefix ', + description: 'data contract name prefix', default: codeGenBaseConfig.typePrefix, }, { - flags: "--type-suffix ", - description: "data contract name suffix", + flags: '--type-suffix ', + description: 'data contract name suffix', default: codeGenBaseConfig.typeSuffix, }, { - flags: "--clean-output", - description: "clean output folder before generate api. WARNING: May cause data loss", + flags: '--clean-output', + description: + 'clean output folder before generate api. WARNING: May cause data loss', default: codeGenBaseConfig.cleanOutput, + internal: { formatter: Boolean }, }, { - flags: "--api-class-name ", - description: "name of the api class", + flags: '--api-class-name ', + description: 'name of the api class', default: codeGenBaseConfig.apiClassName, }, { - flags: "--patch", - description: "fix up small errors in the swagger source definition", + flags: '--patch', + description: 'fix up small errors in the swagger source definition', default: codeGenBaseConfig.patch, + internal: { formatter: Boolean }, }, { - flags: "--debug", - description: "additional information about processes inside this tool", + flags: '--debug', + description: 'additional information about processes inside this tool', default: codeGenBaseConfig.debug, }, { - flags: "--another-array-type", - description: "generate array types as Array (by default Type[])", + flags: '--another-array-type', + description: 'generate array types as Array (by default Type[])', default: codeGenBaseConfig.anotherArrayType, }, { - flags: "--sort-types", - description: "sort fields and types", + flags: '--sort-types', + description: 'sort fields and types', default: codeGenBaseConfig.sortTypes, }, { - flags: "--extract-enums", - description: "extract all enums from inline interface\\type content to typescript enum construction", + flags: '--extract-enums', + description: + 'extract all enums from inline interface\\type content to typescript enum construction', default: codeGenBaseConfig.extractEnums, }, + { + flags: '--sort-routes', + description: 'sort routes in alphabetical order', + default: codeGenBaseConfig.sortRoutes, + }, + { + flags: '--custom-config ', + description: 'custom config: primitiveTypeConstructs, hooks, ... ', + default: '', + }, ], }); program.addCommand({ - name: "generate-templates", + name: 'generate-templates', description: `Generate ".ejs" templates needed for generate api`, options: [ { - flags: "-o, --output ", - description: "output path of generated templates", + flags: '-o, --output ', + description: 'output path of generated templates', default: templateGenBaseConfig.output, }, { - flags: "-m, --modular", - description: "generate templates needed to separate files for http client, data contracts, and routes", + flags: '-m, --modular', + description: + 'generate templates needed to separate files for http client, data contracts, and routes', default: templateGenBaseConfig.modular, + internal: { formatter: Boolean }, }, { - flags: "--http-client ", - description: `http client type (possible values: ${Object.values(HTTP_CLIENT) + flags: '--http-client ', + description: `http client type (possible values: ${Object.values( + HTTP_CLIENT, + ) .map((v) => `"${v}"`) - .join(", ")})`, + .join(', ')})`, default: templateGenBaseConfig.httpClientType, + internal: { name: 'httpClientType' }, }, { - flags: "-c, --clean-output", - description: "clean output folder before generate template. WARNING: May cause data loss", + flags: '-c, --clean-output', + description: + 'clean output folder before generate template. WARNING: May cause data loss', default: templateGenBaseConfig.cleanOutput, + internal: { formatter: Boolean }, }, { - flags: "-r, --rewrite", - description: "rewrite content in existing templates", + flags: '-r, --rewrite', + description: 'rewrite content in existing templates', default: templateGenBaseConfig.rewrite, + internal: { formatter: Boolean }, }, { - flags: "--silent", - description: "Output only errors to console", + flags: '--silent', + description: 'Output only errors to console', default: templateGenBaseConfig.silent, + internal: { formatter: Boolean }, }, ], }); @@ -252,59 +297,36 @@ program.addCommand({ const main = async () => { const { command, options } = await program.execute({ args: process.argv }); + let customConfig = null; + + if (options.customConfig) { + try { + const customConfigPath = resolve(process.cwd(), options.customConfig); + console.log(`✨ found custom config at: ${customConfigPath}`); + customConfig = require(customConfigPath); + } catch (e) { + /* empty */ + } + } + try { switch (command) { case null: { await generateApi({ + ...options, name: options.name, url: options.path, generateRouteTypes: options.routeTypes, generateClient: !!(options.axios || options.client), httpClientType: options.axios ? HTTP_CLIENT.AXIOS : HTTP_CLIENT.FETCH, - defaultResponseAsSuccess: options.defaultAsSuccess, - defaultResponseType: options.defaultResponse, - unwrapResponseData: options.unwrapResponseData, - disableThrowOnError: options.disableThrowOnError, - sortTypes: options.sortTypes, - generateUnionEnums: options.unionEnums, - addReadonly: options.addReadonly, - generateResponses: options.responses, - extractRequestParams: !!options.extractRequestParams, - extractRequestBody: !!options.extractRequestBody, - extractResponseBody: !!options.extractResponseBody, - extractResponseError: !!options.extractResponseError, input: resolve(process.cwd(), options.path), - output: resolve(process.cwd(), options.output || "."), - templates: options.templates, - modular: !!options.modular, - toJS: !!options.js, - enumNamesAsValues: options.enumNamesAsValues, - moduleNameIndex: +(options.moduleNameIndex || 0), - moduleNameFirstTag: options.moduleNameFirstTag, - disableStrictSSL: !!options.disableStrictSSL, - disableProxy: !!options.disableProxy, - singleHttpClient: !!options.singleHttpClient, - cleanOutput: !!options.cleanOutput, - silent: !!options.silent, - typePrefix: options.typePrefix, - typeSuffix: options.typeSuffix, - patch: !!options.patch, - apiClassName: options.apiClassName, - debug: options.debug, - anotherArrayType: options.anotherArrayType, - extractEnums: options.extractEnums, + output: resolve(process.cwd(), options.output || '.'), + ...customConfig, }); break; } - case "generate-templates": { - await generateTemplates({ - cleanOutput: options.cleanOutput, - output: options.output, - httpClientType: options.httpClient, - modular: options.modular, - silent: options.silent, - rewrite: options.rewrite, - }); + case 'generate-templates': { + await generateTemplates(options); break; } default: { diff --git a/package-lock.json b/package-lock.json index 49eeb789..813b6046 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,43 +1,57 @@ { "name": "swagger-typescript-api", - "version": "12.0.4", + "version": "13.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "swagger-typescript-api", - "version": "12.0.4", + "version": "13.0.0", "license": "MIT", "dependencies": { "@types/swagger-schema-official": "2.0.22", - "cosmiconfig": "7.0.1", + "cosmiconfig": "8.2.0", "didyoumean": "^1.2.2", - "eta": "^2.0.0", + "eta": "^2.2.0", "js-yaml": "4.1.0", "lodash": "4.17.21", - "make-dir": "3.1.0", - "nanoid": "3.3.4", - "node-emoji": "1.11.0", - "node-fetch": "^3.2.10", - "prettier": "2.7.1", + "make-dir": "4.0.0", + "nanoid": "3.3.6", + "node-emoji": "2.1.0", + "node-fetch": "^3.3.1", + "prettier": "3.0.0", "swagger-schema-official": "2.0.0-bab6bed", "swagger2openapi": "7.0.8", - "typescript": "4.8.4" + "typescript": "5.1.6" }, "bin": { "sta": "index.js", "swagger-typescript-api": "index.js" }, "devDependencies": { - "@types/lodash": "^4.14.186", - "@types/node": "^18.11.7", - "@types/prettier": "^2.7.1", - "all-contributors-cli": "^6.20.0", - "axios": "^1.1.3", + "@types/lodash": "^4.14.195", + "@types/node": "^20.4.1", + "@types/prettier": "^2.7.3", + "all-contributors-cli": "^6.26.1", + "axios": "^1.4.0", "cross-env": "^7.0.3", + "dotenv": "^16.3.1", + "eslint": "^8.44.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^5.0.0", "git-diff": "^2.0.6", - "husky": "^4.3.6", - "pretty-quick": "^3.1.0" + "husky": "^8.0.3", + "pretty-quick": "^3.1.3", + "rimraf": "^5.0.1" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/@babel/code-frame": { @@ -84,15 +98,282 @@ "node": ">=6.9.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", + "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", + "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@exodus/schemasafe": { "version": "1.0.0-rc.7", "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.0.0-rc.7.tgz", "integrity": "sha512-+1mBLsa+vvlV0lwEAP1hwgmOPkjMnoJ8hyCMfCCJga0sVDwDzrPJjnxZwdDaUmOh/vbFHQGBTk+FxsVjoI/CjQ==" }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", + "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@pkgr/utils/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + }, + "node_modules/@sindresorhus/is": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-3.1.2.tgz", + "integrity": "sha512-JiX9vxoKMmu8Y3Zr2RVathBL1Cdu4Nt4MuNWemt1Nc06A0RAin9c5FArkhGsyMBWfCu4zj+9b+GxtjAnE4qqLQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, "node_modules/@types/lodash": { - "version": "4.14.186", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.186.tgz", - "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==", + "version": "4.14.195", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", + "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==", "dev": true }, "node_modules/@types/minimatch": { @@ -102,20 +383,15 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.7.tgz", - "integrity": "sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, - "node_modules/@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, "node_modules/@types/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", "dev": true }, "node_modules/@types/swagger-schema-official": { @@ -123,18 +399,55 @@ "resolved": "https://registry.npmjs.org/@types/swagger-schema-official/-/swagger-schema-official-2.0.22.tgz", "integrity": "sha512-7yQiX6MWSFSvc/1wW5smJMZTZ4fHOd+hqLr3qr/HONDxHEa2bnYAsOcGBOEqFIjd4yetwMOdEDdeW+udRAQnHA==" }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/all-contributors-cli": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/all-contributors-cli/-/all-contributors-cli-6.20.0.tgz", - "integrity": "sha512-trEQlL1s1u8FSWSwY2w9uL4GCG7Fo9HIW5rm5LtlE0SQHSolfXQBzJib07Qes5j52/t72wjuE6sEKkuRrwiuuQ==", + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/all-contributors-cli/-/all-contributors-cli-6.26.1.tgz", + "integrity": "sha512-Ymgo3FJACRBEd1eE653FD1J/+uD0kqpUNYfr9zNC1Qby0LgbhDBzB3EF6uvkAbYpycStkk41J+0oo37Lc02yEw==", "dev": true, "dependencies": { "@babel/runtime": "^7.7.6", - "async": "^3.0.1", + "async": "^3.1.0", "chalk": "^4.0.0", "didyoumean": "^1.2.1", - "inquirer": "^7.0.4", - "json-fixer": "^1.5.1", + "inquirer": "^7.3.3", + "json-fixer": "^1.6.8", "lodash": "^4.11.2", "node-fetch": "^2.6.0", "pify": "^5.0.0", @@ -145,6 +458,9 @@ }, "engines": { "node": ">=4" + }, + "optionalDependencies": { + "prettier": "^2" } }, "node_modules/all-contributors-cli/node_modules/ansi-styles": { @@ -236,6 +552,22 @@ } } }, + "node_modules/all-contributors-cli/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "optional": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/all-contributors-cli/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -382,9 +714,9 @@ "dev": true }, "node_modules/axios": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz", - "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", "dev": true, "dependencies": { "follow-redirects": "^1.15.0", @@ -398,6 +730,27 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "node_modules/big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/bplist-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", + "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "dev": true, + "dependencies": { + "big-integer": "^1.6.44" + }, + "engines": { + "node": ">= 5.10.0" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -408,6 +761,33 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bundle-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", + "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", + "dev": true, + "dependencies": { + "run-applescript": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -443,18 +823,20 @@ "node": ">=4" } }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "engines": { + "node": ">=10" + } + }, "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -514,12 +896,6 @@ "node": ">= 0.8" } }, - "node_modules/compare-versions": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", - "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", - "dev": true - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -527,18 +903,20 @@ "dev": true }, "node_modules/cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", "dependencies": { - "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "path-type": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" } }, "node_modules/cross-env": { @@ -581,6 +959,23 @@ "node": ">= 12" } }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -590,76 +985,612 @@ "node": ">=0.10.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/default-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", + "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", "dev": true, + "dependencies": { + "bundle-name": "^3.0.0", + "default-browser-id": "^3.0.0", + "execa": "^7.1.1", + "titleize": "^3.0.0" + }, "engines": { - "node": ">=0.4.0" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/didyoumean": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", - "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" - }, - "node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "node_modules/default-browser-id": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", + "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", "dev": true, + "dependencies": { + "bplist-parser": "^0.2.0", + "untildify": "^4.0.0" + }, "engines": { - "node": ">=0.3.1" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/default-browser/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/default-browser/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/emojilib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz", + "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.44.0.tgz", + "integrity": "sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.1.0", + "@eslint/js": "8.44.0", + "@humanwhocodes/config-array": "^0.11.10", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.6.0", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz", + "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { - "once": "^1.4.0" + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { - "is-arrayish": "^0.2.1" + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/es6-promise": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", - "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==" + "node_modules/espree": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz", + "integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, "engines": { - "node": ">=6" + "node": ">=0.10" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, "engines": { - "node": ">=0.8.0" + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/eta": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-2.0.0.tgz", - "integrity": "sha512-NqE7S2VmVwgMS8yBxsH4VgNQjNjLq1gfGU0u9I6Cjh468nPRMoDfGdK9n1p/3Dvsw3ebklDkZsFAnKJ9sefjBA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eta/-/eta-2.2.0.tgz", + "integrity": "sha512-UVQ72Rqjy/ZKQalzV5dCCJP80GrmPrMxh6NlNf+erV6ObL0ZFkhCstWRawS85z3smdr3d2wXPsZEY7rDPfGd2g==", "engines": { "node": ">=6.0.0" }, @@ -704,11 +1635,72 @@ "node": ">=4" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -746,6 +1738,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -759,21 +1775,40 @@ "node": ">=8" } }, - "node_modules/find-versions": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", - "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, "dependencies": { - "semver-regex": "^3.1.2" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=10" + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, "node_modules/follow-redirects": { "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", @@ -794,6 +1829,34 @@ } } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", + "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -890,6 +1953,51 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -925,103 +2033,18 @@ } }, "node_modules/husky": { - "version": "4.3.8", - "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", - "integrity": "sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "chalk": "^4.0.0", - "ci-info": "^2.0.0", - "compare-versions": "^3.6.0", - "cosmiconfig": "^7.0.0", - "find-versions": "^4.0.0", - "opencollective-postinstall": "^2.0.2", - "pkg-dir": "^5.0.0", - "please-upgrade-node": "^3.2.0", - "slash": "^3.0.0", - "which-pm-runs": "^1.0.0" - }, - "bin": { - "husky-run": "bin/run.js", - "husky-upgrade": "lib/upgrader/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/husky" - } - }, - "node_modules/husky/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/husky/node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/husky/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/husky/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/husky/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/husky/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "bin": { + "husky": "lib/bin.js" }, "engines": { - "node": ">=8" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" } }, "node_modules/iconv-lite": { @@ -1037,9 +2060,9 @@ } }, "node_modules/ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" @@ -1060,6 +2083,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1196,6 +2228,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1204,6 +2260,54 @@ "node": ">=8" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -1213,12 +2317,57 @@ "node": ">=8" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-wsl/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/jackspeak": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", + "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1324,6 +2473,31 @@ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -1346,6 +2520,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/loglevel": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz", @@ -1359,34 +2539,59 @@ "url": "https://tidelift.com/funding/github/npm/loglevel" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -1429,6 +2634,15 @@ "node": "*" } }, + "node_modules/minipass": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", + "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mri": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", @@ -1438,6 +2652,12 @@ "node": ">=4" } }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/multimatch": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", @@ -1461,9 +2681,15 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -1471,6 +2697,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -1490,17 +2722,20 @@ } }, "node_modules/node-emoji": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", - "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.0.tgz", + "integrity": "sha512-tcsBm9C6FmPN5Wo7OjFi9lgMyJjvkAeirmjR/ax8Ttfqy4N8PoFic26uqFTIgayHPNI5FH4ltUvfh9kHzwcK9A==", "dependencies": { - "lodash": "^4.17.21" + "@sindresorhus/is": "^3.1.2", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" } }, "node_modules/node-fetch": { - "version": "3.2.10", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", - "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", + "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -1634,13 +2869,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/opencollective-postinstall": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", - "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "node_modules/open": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", + "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", "dev": true, - "bin": { - "opencollective-postinstall": "index.js" + "dependencies": { + "default-browser": "^4.0.0", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" } }, "node_modules/os-tmpdir": { @@ -1749,6 +3010,31 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -1769,54 +3055,29 @@ "node": ">=0.10" } }, - "node_modules/pify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", - "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pkg-dir": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", - "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", - "dev": true, - "dependencies": { - "find-up": "^5.0.0" - }, - "engines": { - "node": ">=10" - } + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, "engines": { - "node": ">=10" + "node": ">=8.6" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "node_modules/pify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", + "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, "engines": { "node": ">=10" }, @@ -1824,63 +3085,45 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.8.0" } }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" + "node_modules/prettier": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", + "bin": { + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10" + "node": ">=14" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/please-upgrade-node": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", - "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, "dependencies": { - "semver-compare": "^1.0.0" - } - }, - "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", - "bin": { - "prettier": "bin-prettier.js" + "fast-diff": "^1.1.2" }, "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" + "node": ">=6.0.0" } }, "node_modules/pretty-quick": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.0.tgz", - "integrity": "sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", + "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", "dev": true, "dependencies": { "chalk": "^3.0.0", @@ -1983,6 +3226,35 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -2061,6 +3333,139 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", + "dev": true, + "dependencies": { + "glob": "^10.2.5" + }, + "bin": { + "rimraf": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-applescript": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", + "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-applescript/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/run-applescript/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-applescript/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -2070,6 +3475,29 @@ "node": ">=0.12.0" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -2088,22 +3516,18 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "node_modules/semver-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", - "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", - "dev": true - }, - "node_modules/semver-regex": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.4.tgz", - "integrity": "sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA==", - "dev": true, - "engines": { - "node": ">=8" + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/set-blocking": { @@ -2208,16 +3632,18 @@ "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==" }, "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, + "node_modules/skin-tone": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", + "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", + "dependencies": { + "unicode-emoji-modifier-base": "^1.0.0" + }, "engines": { "node": ">=8" } @@ -2235,6 +3661,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -2246,6 +3687,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -2255,6 +3709,18 @@ "node": ">=6" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -2328,12 +3794,52 @@ } } }, + "node_modules/synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "dependencies": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/synckit/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, + "node_modules/titleize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", + "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -2346,6 +3852,18 @@ "node": ">=0.6.0" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -2357,6 +3875,18 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -2370,15 +3900,41 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" + } + }, + "node_modules/unicode-emoji-modifier-base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", + "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/untildify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" } }, "node_modules/web-streams-polyfill": { @@ -2424,12 +3980,6 @@ "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", "dev": true }, - "node_modules/which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -2446,6 +3996,57 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -2490,6 +4091,11 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", diff --git a/package.json b/package.json index d9d76cda..965fd513 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,25 @@ { "name": "swagger-typescript-api", - "version": "12.0.4", + "version": "13.0.0", "description": "Generate typescript/javascript api from swagger schema", "scripts": { + "update-deps-to-latest": "npx --yes npm-check-updates && npm i", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts", "cli:yaml": "node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts", "node": "node swagger-test-cli/generate.js", "node:debug": "node --nolazy swagger-test-cli/generate.js", "contributors": "all-contributors generate", "cli:help": "node index.js -h", - "test-all": "node --unhandled-rejections=strict ./scriptsRunner.js generate validate test:*", - "test-all(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true node --unhandled-rejections=strict ./scriptsRunner.js generate validate test:*", - "test-all-extended": "node --unhandled-rejections=strict ./scriptsRunner.js generate-extended validate generate validate test:*", - "test-specific": "node ./scriptsRunner.js generate validate test:*", - "test-specific-only": "node ./scriptsRunner.js test:*", - "prepare": "npm run test-all-extended", + "test-all": "npm run test-extended && npm run test-simple && npm run test-specific", + "test-all(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true npm run test-all", + "test-simple": "node --unhandled-rejections=strict scripts_runner.js generate validate", + "test-extended": "node --unhandled-rejections=strict scripts_runner.js generate-extended validate", + "test-specific": "node --unhandled-rejections=strict scripts_runner.js test:*", + "test-specific(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true node --unhandled-rejections=strict scripts_runner.js test:*", "generate": "node tests/generate.js", "generate-extended": "node tests/generate-extended.js", - "generate:debug": "node --nolazy tests/generate.js", "validate": "node tests/validate.js", "validate:debug": "node --nolazy tests/validate.js", "test:--route-types": "node tests/spec/routeTypes/test.js", @@ -48,7 +50,7 @@ "test:--type-suffix--type-prefix": "node tests/spec/typeSuffixPrefix/test.js", "test:--dot-path-params": "node tests/spec/dot-path-params/test.js", "test:--primitive-type-constructs": "node tests/spec/primitive-type-constructs/test.js", - "test:--cli": "node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js", + "test:--cli": "rimraf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js", "test:partialBaseTemplate": "node tests/spec/partialBaseTemplate/test.js", "test:partialDefaultTemplate": "node tests/spec/partialDefaultTemplate/test.js", "test:--patch": "node tests/spec/patch/test.js", @@ -60,49 +62,51 @@ "test:another-query-params": "node tests/spec/another-query-params/test.js", "test:on-insert-path-param": "node tests/spec/on-insert-path-param/test.js", "test:extra-templates": "node tests/spec/extra-templates/test.js", - "test:extract-enums": "node tests/spec/extract-enums/test.js" + "test:extract-enums": "node tests/spec/extract-enums/test.js", + "test:discriminator": "node tests/spec/discriminator/test.js", + "test:sort-types": "node tests/spec/sortTypes/test.js", + "test:sort-types-false": "node tests/spec/sortTypes-false/test.js" }, "author": "acacode", "license": "MIT", "typings": "./index.d.ts", "main": "src/index.js", "devDependencies": { - "@types/lodash": "^4.14.186", - "@types/node": "^18.11.7", - "@types/prettier": "^2.7.1", - "all-contributors-cli": "^6.20.0", - "axios": "^1.1.3", + "eslint": "^8.44.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^5.0.0", + "@types/lodash": "^4.14.195", + "@types/node": "^20.4.1", + "@types/prettier": "^2.7.3", + "all-contributors-cli": "^6.26.1", + "axios": "^1.4.0", "cross-env": "^7.0.3", + "dotenv": "^16.3.1", "git-diff": "^2.0.6", - "husky": "^4.3.6", - "pretty-quick": "^3.1.0" + "husky": "^8.0.3", + "pretty-quick": "^3.1.3", + "rimraf": "^5.0.1" }, "dependencies": { "@types/swagger-schema-official": "2.0.22", - "cosmiconfig": "7.0.1", + "cosmiconfig": "8.2.0", "didyoumean": "^1.2.2", - "eta": "^2.0.0", + "eta": "^2.2.0", "js-yaml": "4.1.0", "lodash": "4.17.21", - "make-dir": "3.1.0", - "nanoid": "3.3.4", - "node-emoji": "1.11.0", - "node-fetch": "^3.2.10", - "prettier": "2.7.1", + "make-dir": "4.0.0", + "nanoid": "3.3.6", + "node-emoji": "2.1.0", + "node-fetch": "^3.3.1", + "prettier": "3.0.0", "swagger-schema-official": "2.0.0-bab6bed", "swagger2openapi": "7.0.8", - "typescript": "4.8.4" + "typescript": "5.1.6" }, "bin": { "swagger-typescript-api": "index.js", "sta": "index.js" }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick --staged", - "post-commit": "git update-index -g" - } - }, "keywords": [ "openapi", "swagger", diff --git a/scriptsRunner.js b/scripts_runner.js similarity index 57% rename from scriptsRunner.js rename to scripts_runner.js index 20890221..4597265f 100644 --- a/scriptsRunner.js +++ b/scripts_runner.js @@ -1,5 +1,5 @@ -const packageJson = require("./package.json"); -const { exec, spawn } = require("child_process"); +const packageJson = require('./package.json'); +const { spawn } = require('child_process'); const commands = process.argv.slice(2); @@ -8,25 +8,28 @@ const packageScripts = Object.keys(packageJson.scripts); const execute = (scriptName) => new Promise((resolve, reject) => { console.log(`npm run ${scriptName}`); - const spawned = spawn(/^win/.test(process.platform) ? "npm.cmd" : "npm", ["run", scriptName]); + const spawned = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', [ + 'run', + scriptName, + ]); - spawned.stdout.on("data", (data) => { + spawned.stdout.on('data', (data) => { process.stdout.write(data); }); - spawned.stderr.on("data", (data) => { + spawned.stderr.on('data', (data) => { process.stderr.write(data); }); - spawned.on("error", (error) => { + spawned.on('error', (error) => { console.error(error); }); - spawned.on("message", (message) => { + spawned.on('message', (message) => { console.log(message); }); - spawned.on("close", (code) => { + spawned.on('close', (code) => { if (code) { reject(code); } else { @@ -43,10 +46,13 @@ const run = async () => { await execute(scriptName); } - if (command.includes("*")) { - const commandPart = command.replace("*", ""); + if (command.includes('*')) { + const commandPart = command.replace('*', ''); // TODO: refactor - if (scriptName.startsWith(commandPart) || scriptName.endsWith(commandPart)) { + if ( + scriptName.startsWith(commandPart) || + scriptName.endsWith(commandPart) + ) { await execute(scriptName); } } diff --git a/src/code-formatter.js b/src/code-formatter.js index 8c1efc44..a9bfa88e 100644 --- a/src/code-formatter.js +++ b/src/code-formatter.js @@ -1,6 +1,6 @@ -const _ = require("lodash"); -const ts = require("typescript"); -const prettier = require("prettier"); +const _ = require('lodash'); +const ts = require('typescript'); +const prettier = require('prettier'); class CodeFormatter { /** @@ -8,18 +8,18 @@ class CodeFormatter { */ config; - constructor(config) { + constructor({ config }) { this.config = config; } removeUnusedImports = (content) => { - const tempFileName = "file.ts"; + const tempFileName = 'file.ts'; const host = new TsLanguageServiceHost(tempFileName, content); const languageService = ts.createLanguageService(host); const fileTextChanges = languageService.organizeImports( - { type: "file", fileName: tempFileName }, + { type: 'file', fileName: tempFileName }, { newLineCharacter: ts.sys.newLine }, )[0]; @@ -27,7 +27,9 @@ class CodeFormatter { return _.reduceRight( fileTextChanges.textChanges, (content, { span, newText }) => - `${content.slice(0, span.start)}${newText}${content.slice(span.start + span.length)}`, + `${content.slice(0, span.start)}${newText}${content.slice( + span.start + span.length, + )}`, content, ); } @@ -35,16 +37,27 @@ class CodeFormatter { return content; }; - prettierFormat = (content) => { - return prettier.format(content, this.config.prettierOptions); + /** + * @param content + * @returns {Promise} + */ + prettierFormat = async (content) => { + const formatted = await prettier.format( + content, + this.config.prettierOptions, + ); + return formatted; }; - formatCode = (code, { removeUnusedImports = true, prettierFormat = true } = {}) => { + formatCode = async ( + code, + { removeUnusedImports = true, prettierFormat = true } = {}, + ) => { if (removeUnusedImports) { code = this.removeUnusedImports(code); } if (prettierFormat) { - code = this.prettierFormat(code); + code = await this.prettierFormat(code); } return code; }; @@ -58,13 +71,15 @@ class TsLanguageServiceHost { fileName, content, compilerOptions: tsconfig - ? ts.convertCompilerOptionsFromJson(ts.readConfigFile(tsconfig, ts.sys.readFile).config.compilerOptions).options + ? ts.convertCompilerOptionsFromJson( + ts.readConfigFile(tsconfig, ts.sys.readFile).config.compilerOptions, + ).options : ts.getDefaultCompilerOptions(), }); } getNewLine() { - return "newLine" in ts.sys ? ts.sys.newLine : "\n"; + return 'newLine' in ts.sys ? ts.sys.newLine : '\n'; } getScriptFileNames() { return [this.fileName]; diff --git a/src/code-gen-process.js b/src/code-gen-process.js index d373517e..a8e0a7b6 100644 --- a/src/code-gen-process.js +++ b/src/code-gen-process.js @@ -1,57 +1,59 @@ -const { SwaggerSchemaResolver } = require("./swagger-schema-resolver.js"); -const { SchemaComponentsMap } = require("./schema-components-map.js"); -const { NameResolver } = require("./util/name-resolver"); -const { Logger } = require("./util/logger.js"); -const { TypeName } = require("./type-name.js"); -const _ = require("lodash"); -const { SchemaParser } = require("./schema-parser/schema-parser.js"); -const { SchemaRoutes } = require("./schema-parser/schema-routes.js"); -const { CodeGenConfig } = require("./configuration.js"); -const { FileSystem } = require("./util/file-system"); -const { Templates } = require("./templates"); -const { translate: translateToJS } = require("./translators/JavaScript"); -const ts = require("typescript"); -const { CodeFormatter } = require("./code-formatter"); -const { pascalCase } = require("./util/pascal-case"); -const { internalCase } = require("./util/internal-case"); +const { SwaggerSchemaResolver } = require('./swagger-schema-resolver.js'); +const { SchemaComponentsMap } = require('./schema-components-map.js'); +const { NameResolver } = require('./util/name-resolver'); +const { Logger } = require('./util/logger.js'); +const { TypeNameFormatter } = require('./type-name-formatter.js'); +const _ = require('lodash'); +const { SchemaParserFabric } = require('./schema-parser/schema-parser-fabric'); +const { SchemaRoutes } = require('./schema-routes/schema-routes.js'); +const { CodeGenConfig } = require('./configuration.js'); +const { SchemaWalker } = require('./schema-walker'); +const { FileSystem } = require('./util/file-system'); +const { TemplatesWorker } = require('./templates-worker'); +const { JavascriptTranslator } = require('./translators/javascript'); +const ts = require('typescript'); +const { CodeFormatter } = require('./code-formatter'); +const { pascalCase } = require('./util/pascal-case'); +const { internalCase } = require('./util/internal-case'); +const { sortByProperty } = require('./util/sort-by-property'); + +const PATCHABLE_INSTANCES = [ + 'schemaWalker', + 'swaggerSchemaResolver', + 'schemaComponentsMap', + 'typeNameFormatter', + 'templatesWorker', + 'codeFormatter', + 'schemaParserFabric', + 'schemaRoutes', + 'javascriptTranslator', +]; class CodeGenProcess { - /** - * @type {CodeGenConfig} - */ + /** @type {CodeGenConfig} */ config; - /** - * @type {SwaggerSchemaResolver} - */ + /** @type {SwaggerSchemaResolver} */ swaggerSchemaResolver; - /** - * @type {SchemaComponentsMap} - */ - schemaComponentMap; - /** - * @type {Logger} - */ + /** @type {SchemaComponentsMap} */ + schemaComponentsMap; + /** @type {Logger} */ logger; - /** - * @type {TypeName} - */ - typeName; - /** - * @type {SchemaParser} - */ - schemaParser; - /** - * @type {SchemaRoutes} - */ + /** @type {TypeNameFormatter} */ + typeNameFormatter; + /** @type {SchemaParserFabric} */ + schemaParserFabric; + /** @type {SchemaRoutes} */ schemaRoutes; - /** - * @type {FileSystem} - */ + /** @type {FileSystem} */ fileSystem; - /** - * @type {CodeFormatter} - */ + /** @type {CodeFormatter} */ codeFormatter; + /** type {TemplatesWorker} */ + templatesWorker; + /** @type {SchemaWalker} */ + schemaWalker; + /** @type {JavascriptTranslator} */ + javascriptTranslator; /** * @@ -59,34 +61,27 @@ class CodeGenProcess { */ constructor(config) { this.config = new CodeGenConfig(config); - this.logger = new Logger(this.config); - this.fileSystem = new FileSystem(); - this.swaggerSchemaResolver = new SwaggerSchemaResolver(this.config, this.logger, this.fileSystem); - this.schemaComponentMap = new SchemaComponentsMap(this.config); - this.typeName = new TypeName(this.config, this.logger); - this.templates = new Templates(this.config, this.logger, this.fileSystem, this.getRenderTemplateData); - this.codeFormatter = new CodeFormatter(this.config); - this.schemaParser = new SchemaParser( - this.config, - this.logger, - this.templates, - this.schemaComponentMap, - this.typeName, - ); - this.schemaRoutes = new SchemaRoutes( - this.config, - this.schemaParser, - this.schemaComponentMap, - this.logger, - this.templates, - this.typeName, - ); + this.logger = new Logger(this); + this.fileSystem = new FileSystem(this); + this.schemaWalker = new SchemaWalker(this); + this.swaggerSchemaResolver = new SwaggerSchemaResolver(this); + this.schemaComponentsMap = new SchemaComponentsMap(this); + this.typeNameFormatter = new TypeNameFormatter(this); + this.templatesWorker = new TemplatesWorker(this); + this.codeFormatter = new CodeFormatter(this); + this.schemaParserFabric = new SchemaParserFabric(this); + this.schemaRoutes = new SchemaRoutes(this); + this.javascriptTranslator = new JavascriptTranslator(this); this.config.componentTypeNameResolver.logger = this.logger; } async start() { - this.config.update({ templatePaths: this.templates.getTemplatePaths(this.config) }); - this.config.update({ templatesToRender: this.templates.getTemplates(this.config) }); + this.config.update({ + templatePaths: this.templatesWorker.getTemplatePaths(this.config), + }); + this.config.update({ + templatesToRender: this.templatesWorker.getTemplates(this.config), + }); const swagger = await this.swaggerSchemaResolver.create(); @@ -97,64 +92,50 @@ class CodeGenProcess { originalSchema: swagger.originalSchema, }); - this.logger.event("start generating your typescript api"); + this.schemaWalker.addSchema('$usage', swagger.usageSchema); + this.schemaWalker.addSchema('$original', swagger.originalSchema); - this.config.update(this.config.hooks.onInit(this.config) || this.config); + this.logger.event('start generating your typescript api'); - this.schemaComponentMap.processSchema(swagger.usageSchema); + this.config.update( + this.config.hooks.onInit(this.config, this) || this.config, + ); - const componentSchemaNames = this.schemaComponentMap.filter("schemas").map((c) => c.typeName); + this.schemaComponentsMap.clear(); + + _.each(swagger.usageSchema.components, (component, componentName) => + _.each(component, (rawTypeData, typeName) => { + this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef([ + 'components', + componentName, + typeName, + ]), + rawTypeData, + ); + }), + ); - this.config.componentTypeNameResolver.reserve(componentSchemaNames); + const schemaComponents = this.schemaComponentsMap.filter('schemas'); - const parsedSchemas = _.map(_.get(swagger.usageSchema.components, "schemas"), (schema, typeName) => - this.schemaParser.parseSchema(schema, typeName), - ); + const parsedSchemas = schemaComponents.map((schemaComponent) => { + const parsed = this.schemaParserFabric.parseSchema( + schemaComponent.rawTypeData, + schemaComponent.typeName, + ); + schemaComponent.typeData = parsed; + return parsed; + }); this.schemaRoutes.attachSchema({ usageSchema: swagger.usageSchema, parsedSchemas, }); - const usageComponentSchemas = this.schemaComponentMap.filter("schemas"); - const sortByProperty = (propertyName) => (o1, o2) => { - if (o1[propertyName] > o2[propertyName]) { - return 1; - } - if (o1[propertyName] < o2[propertyName]) { - return -1; - } - return 0; - }; - - const sortSchemas = (schemas) => { - if (this.config.sortTypes) { - return schemas.sort(sortByProperty("typeName")).map((schema) => { - if (schema.rawTypeData?.properties) { - return { - ...schema, - rawTypeData: { - ...schema.rawTypeData, - $parsed: schema.rawTypeData["$parsed"] && { - ...schema.rawTypeData["$parsed"], - content: Array.isArray(schema.rawTypeData["$parsed"].content) - ? schema.rawTypeData["$parsed"].content.sort(sortByProperty("name")) - : schema.rawTypeData["$parsed"].content, - }, - }, - }; - } - return schema; - }); - } - return schemas; - }; - const rawConfiguration = { apiConfig: this.createApiConfig(swagger.usageSchema), config: this.config, - modelTypes: _.map(sortSchemas(usageComponentSchemas), this.prepareModelType).filter(Boolean), - rawModelTypes: usageComponentSchemas, + modelTypes: this.collectModelTypes(), hasSecurityRoutes: this.schemaRoutes.hasSecurityRoutes, hasQueryRoutes: this.schemaRoutes.hasQueryRoutes, hasFormDataRoutes: this.schemaRoutes.hasFormDataRoutes, @@ -163,10 +144,14 @@ class CodeGenProcess { extraTemplates: this.config.extraTemplates, fileName: this.config.fileName, translateToJavaScript: this.config.toJS, + customTranslator: this.config.customTranslator + ? new this.config.customTranslator(this) + : null, utils: this.getRenderTemplateData().utils, }; - const configuration = this.config.hooks.onPrepareConfig(rawConfiguration) || rawConfiguration; + const configuration = + this.config.hooks.onPrepareConfig(rawConfiguration) || rawConfiguration; if (this.fileSystem.pathIsExist(this.config.output)) { if (this.config.cleanOutput) { @@ -174,51 +159,40 @@ class CodeGenProcess { this.fileSystem.cleanDir(this.config.output); } } else { - this.logger.debug(`path ${this.config.output} is not exist. creating dir by this path`); + this.logger.debug( + `path ${this.config.output} is not exist. creating dir by this path`, + ); this.fileSystem.createDir(this.config.output); } - const files = this.generateOutputFiles({ + const files = await this.generateOutputFiles({ configuration: configuration, }); const isDirPath = this.fileSystem.pathIsDir(this.config.output); - const generatedFiles = files.map((file) => { - if (!isDirPath) return file; - - if (this.config.toJS) { - this.fileSystem.createFile({ - path: this.config.output, - fileName: file.name, - content: file.content, - withPrefix: true, - }); - this.fileSystem.createFile({ - path: this.config.output, - fileName: file.declaration.name, - content: file.declaration.content, - withPrefix: true, - }); - this.logger.success(`javascript api file`, file.name, `created in ${this.config.output}`); - } else { + if (isDirPath) { + files.forEach((file) => { this.fileSystem.createFile({ path: this.config.output, - fileName: file.name, - content: file.content, + fileName: `${file.fileName}${file.fileExtension}`, + content: file.fileContent, withPrefix: true, }); - this.logger.success(`typescript api file`, file.name, `created in ${this.config.output}`); - } - return file; - }); + this.logger.success( + `api file`, + `"${file.fileName}${file.fileExtension}"`, + `created in ${this.config.output}`, + ); + }); + } return { - files: generatedFiles, + files, configuration, - getTemplate: this.templates.getTemplate, - renderTemplate: this.templates.renderTemplate, + getTemplate: this.templatesWorker.getTemplate, + renderTemplate: this.templatesWorker.renderTemplate, createFile: this.fileSystem.createFile, formatTSContent: this.codeFormatter.formatCode, }; @@ -228,45 +202,89 @@ class CodeGenProcess { return { utils: { Ts: this.config.Ts, - formatDescription: this.schemaParser.schemaFormatters.formatDescription, + formatDescription: + this.schemaParserFabric.schemaFormatters.formatDescription, internalCase: internalCase, classNameCase: pascalCase, pascalCase: pascalCase, - getInlineParseContent: this.schemaParser.getInlineParseContent, - getParseContent: this.schemaParser.getParseContent, - getComponentByRef: this.schemaComponentMap.get, - parseSchema: this.schemaParser.parseSchema, - checkAndAddNull: this.schemaParser.schemaUtils.safeAddNullToType, - safeAddNullToType: this.schemaParser.schemaUtils.safeAddNullToType, - isNeedToAddNull: this.schemaParser.schemaUtils.isNullMissingInType, - inlineExtraFormatters: this.schemaParser.schemaFormatters.inline, - formatters: this.schemaParser.schemaFormatters.base, - formatModelName: this.typeName.format, + getInlineParseContent: this.schemaParserFabric.getInlineParseContent, + getParseContent: this.schemaParserFabric.getParseContent, + getComponentByRef: this.schemaComponentsMap.get, + parseSchema: this.schemaParserFabric.parseSchema, + checkAndAddNull: this.schemaParserFabric.schemaUtils.safeAddNullToType, + safeAddNullToType: + this.schemaParserFabric.schemaUtils.safeAddNullToType, + isNeedToAddNull: + this.schemaParserFabric.schemaUtils.isNullMissingInType, + inlineExtraFormatters: this.schemaParserFabric.schemaFormatters.inline, + formatters: this.schemaParserFabric.schemaFormatters.base, + formatModelName: this.typeNameFormatter.format, fmtToJSDocLine: function fmtToJSDocLine(line, { eol = true }) { - return ` * ${line}${eol ? "\n" : ""}`; + return ` * ${line}${eol ? '\n' : ''}`; }, NameResolver: NameResolver, _, - require: this.templates.requireFnFromTemplate, + require: this.templatesWorker.requireFnFromTemplate, }, config: this.config, }; }; + collectModelTypes = () => { + const components = this.schemaComponentsMap.getComponents(); + let modelTypes = []; + + const getSchemaComponentsCount = () => + components.filter((c) => c.componentName === 'schemas').length; + + let schemaComponentsCount = getSchemaComponentsCount(); + let processedCount = 0; + + while (processedCount < schemaComponentsCount) { + modelTypes = []; + processedCount = 0; + for (const component of components) { + if (component.componentName === 'schemas') { + const modelType = this.prepareModelType(component); + if (modelType) { + modelTypes.push(modelType); + } + processedCount++; + } + } + schemaComponentsCount = getSchemaComponentsCount(); + } + + if (this.config.sortTypes) { + return modelTypes.sort(sortByProperty('name')); + } + + return modelTypes; + }; + prepareModelType = (typeInfo) => { + if (typeInfo.$prepared) return typeInfo.$prepared; + if (!typeInfo.typeData) { - typeInfo.typeData = this.schemaParser.parseSchema(typeInfo.rawTypeData, typeInfo.typeName); + typeInfo.typeData = this.schemaParserFabric.parseSchema( + typeInfo.rawTypeData, + typeInfo.typeName, + ); } const rawTypeData = typeInfo.typeData; - const typeData = this.schemaParser.schemaFormatters.base[rawTypeData.type] - ? this.schemaParser.schemaFormatters.base[rawTypeData.type](rawTypeData) + const typeData = this.schemaParserFabric.schemaFormatters.base[ + rawTypeData.type + ] + ? this.schemaParserFabric.schemaFormatters.base[rawTypeData.type]( + rawTypeData, + ) : rawTypeData; let { typeIdentifier, name: originalName, content, description } = typeData; - const name = this.typeName.format(originalName); + const name = this.typeNameFormatter.format(originalName); if (name === null) return null; - return { + const preparedModelType = { ...typeData, typeIdentifier, name, @@ -276,161 +294,237 @@ class CodeGenProcess { content: content, typeData, }; + + typeInfo.$prepared = preparedModelType; + + return preparedModelType; }; - generateOutputFiles = ({ configuration }) => { + /** + * + * @param configuration + * @returns {Promise} + */ + generateOutputFiles = async ({ configuration }) => { const { modular, templatesToRender } = this.config; const output = modular - ? this.createMultipleFileInfos(templatesToRender, configuration) - : this.createSingleFileInfo(templatesToRender, configuration); + ? await this.createMultipleFileInfos(templatesToRender, configuration) + : await this.createSingleFileInfo(templatesToRender, configuration); if (!_.isEmpty(configuration.extraTemplates)) { - output.push( - ..._.map(configuration.extraTemplates, (extraTemplate) => { - return this.createOutputFileInfo( + for (const extraTemplate of configuration.extraTemplates) { + const content = this.templatesWorker.renderTemplate( + this.fileSystem.getFileContent(extraTemplate.path), + configuration, + ); + output.push( + ...(await this.createOutputFileInfo( configuration, extraTemplate.name, - this.templates.renderTemplate(this.fileSystem.getFileContent(extraTemplate.path), configuration), - ); - }), - ); + content, + )), + ); + } } - return output.filter((fileInfo) => !!fileInfo && !!fileInfo.content); + return output.filter((fileInfo) => !!fileInfo && !!fileInfo.fileContent); }; - createMultipleFileInfos = (templatesToRender, configuration) => { + /** + * @param templatesToRender + * @param configuration + * @returns {Promise} + */ + createMultipleFileInfos = async (templatesToRender, configuration) => { const { routes } = configuration; - const { fileNames, generateRouteTypes, generateClient } = configuration.config; + const { fileNames, generateRouteTypes, generateClient } = + configuration.config; + /** + * @type {TranslatorIO[]} + */ const modularApiFileInfos = []; if (routes.$outOfModule) { if (generateRouteTypes) { - const outOfModuleRouteContent = this.templates.renderTemplate(templatesToRender.routeTypes, { - ...configuration, - route: configuration.routes.$outOfModule, - }); + const outOfModuleRouteContent = this.templatesWorker.renderTemplate( + templatesToRender.routeTypes, + { + ...configuration, + route: configuration.routes.$outOfModule, + }, + ); modularApiFileInfos.push( - this.createOutputFileInfo(configuration, fileNames.outOfModuleApi, outOfModuleRouteContent), + ...(await this.createOutputFileInfo( + configuration, + fileNames.outOfModuleApi, + outOfModuleRouteContent, + )), ); } if (generateClient) { - const outOfModuleApiContent = this.templates.renderTemplate(templatesToRender.api, { - ...configuration, - route: configuration.routes.$outOfModule, - }); + const outOfModuleApiContent = this.templatesWorker.renderTemplate( + templatesToRender.api, + { + ...configuration, + route: configuration.routes.$outOfModule, + }, + ); modularApiFileInfos.push( - this.createOutputFileInfo(configuration, fileNames.outOfModuleApi, outOfModuleApiContent), + ...(await this.createOutputFileInfo( + configuration, + fileNames.outOfModuleApi, + outOfModuleApiContent, + )), ); } } if (routes.combined) { - modularApiFileInfos.push( - ..._.reduce( - routes.combined, - (apiFileInfos, route) => { - if (generateRouteTypes) { - const routeModuleContent = this.templates.renderTemplate(templatesToRender.routeTypes, { - ...configuration, - route, - }); - - apiFileInfos.push( - this.createOutputFileInfo(configuration, pascalCase(`${route.moduleName}_Route`), routeModuleContent), - ); - } - - if (generateClient) { - const apiModuleContent = this.templates.renderTemplate(templatesToRender.api, { - ...configuration, - route, - }); - - apiFileInfos.push( - this.createOutputFileInfo(configuration, pascalCase(route.moduleName), apiModuleContent), - ); - } - - return apiFileInfos; - }, - [], - ), - ); + for (const route of routes.combined) { + if (generateRouteTypes) { + const routeModuleContent = this.templatesWorker.renderTemplate( + templatesToRender.routeTypes, + { + ...configuration, + route, + }, + ); + + modularApiFileInfos.push( + ...(await this.createOutputFileInfo( + configuration, + pascalCase(`${route.moduleName}_Route`), + routeModuleContent, + )), + ); + } + + if (generateClient) { + const apiModuleContent = this.templatesWorker.renderTemplate( + templatesToRender.api, + { + ...configuration, + route, + }, + ); + + modularApiFileInfos.push( + ...(await this.createOutputFileInfo( + configuration, + pascalCase(route.moduleName), + apiModuleContent, + )), + ); + } + } } return [ - this.createOutputFileInfo( + ...(await this.createOutputFileInfo( configuration, fileNames.dataContracts, - this.templates.renderTemplate(templatesToRender.dataContracts, configuration), - ), - generateClient && - this.createOutputFileInfo( + this.templatesWorker.renderTemplate( + templatesToRender.dataContracts, configuration, - fileNames.httpClient, - this.templates.renderTemplate(templatesToRender.httpClient, configuration), ), + )), + ...(generateClient + ? await this.createOutputFileInfo( + configuration, + fileNames.httpClient, + this.templatesWorker.renderTemplate( + templatesToRender.httpClient, + configuration, + ), + ) + : []), ...modularApiFileInfos, ]; }; - createSingleFileInfo = (templatesToRender, configuration) => { + /** + * + * @param templatesToRender + * @param configuration + * @returns {Promise} + */ + createSingleFileInfo = async (templatesToRender, configuration) => { const { generateRouteTypes, generateClient } = configuration.config; - return [ - this.createOutputFileInfo( - configuration, - configuration.fileName, - _.compact([ - this.templates.renderTemplate(templatesToRender.dataContracts, configuration), - generateRouteTypes && this.templates.renderTemplate(templatesToRender.routeTypes, configuration), - generateClient && this.templates.renderTemplate(templatesToRender.httpClient, configuration), - generateClient && this.templates.renderTemplate(templatesToRender.api, configuration), - ]).join("\n"), - ), - ]; + return await this.createOutputFileInfo( + configuration, + configuration.fileName, + _.compact([ + this.templatesWorker.renderTemplate( + templatesToRender.dataContracts, + configuration, + ), + generateRouteTypes && + this.templatesWorker.renderTemplate( + templatesToRender.routeTypes, + configuration, + ), + generateClient && + this.templatesWorker.renderTemplate( + templatesToRender.httpClient, + configuration, + ), + generateClient && + this.templatesWorker.renderTemplate( + templatesToRender.api, + configuration, + ), + ]).join('\n'), + ); }; - createOutputFileInfo = (configuration, fileName, content) => { - const fixedFileName = this.fileSystem.cropExtension(fileName); + /** + * + * @param configuration + * @param fileNameFull + * @param content + * @returns {Promise} + */ + createOutputFileInfo = async (configuration, fileNameFull, content) => { + const fileName = this.fileSystem.cropExtension(fileNameFull); + const fileExtension = ts.Extension.Ts; if (configuration.translateToJavaScript) { - const { sourceContent, declarationContent } = translateToJS(`${fixedFileName}${ts.Extension.Ts}`, content); - - this.logger.debug("generating output for", `${fixedFileName}${ts.Extension.Js}`); - this.logger.debug(sourceContent); - - this.logger.debug("generating output for", `${fixedFileName}${ts.Extension.Js}`); - this.logger.debug(declarationContent); + this.logger.debug('using js translator for', fileName); + return await this.javascriptTranslator.translate({ + fileName: fileName, + fileExtension: fileExtension, + fileContent: content, + }); + } - return { - name: `${fixedFileName}${ts.Extension.Js}`, - content: this.codeFormatter.formatCode(sourceContent), - declaration: { - name: `${fixedFileName}${ts.Extension.Dts}`, - content: this.codeFormatter.formatCode(declarationContent), - }, - }; + if (configuration.customTranslator) { + this.logger.debug('using custom translator for', fileName); + return await configuration.customTranslator.translate({ + fileName: fileName, + fileExtension: fileExtension, + fileContent: content, + }); } - this.logger.debug("generating output for", `${fixedFileName}${ts.Extension.Js}`); - this.logger.debug(content); + this.logger.debug('generating output for', `${fileName}${fileExtension}`); - return { - name: `${fixedFileName}${ts.Extension.Ts}`, - content: this.codeFormatter.formatCode(content), - declaration: null, - }; + return [ + { + fileName, + fileExtension: fileExtension, + fileContent: await this.codeFormatter.formatCode(content), + }, + ]; }; createApiConfig = (swaggerSchema) => { const { info, servers, host, basePath, externalDocs, tags } = swaggerSchema; - const server = (servers && servers[0]) || { url: "" }; - const { title = "No title", version, description: schemaDescription = "" } = info || {}; + const server = (servers && servers[0]) || { url: '' }; + const { title = 'No title', version } = info || {}; const { url: serverUrl } = server; return { @@ -440,8 +534,8 @@ class CodeGenProcess { host, externalDocs: _.merge( { - url: "", - description: "", + url: '', + description: '', }, externalDocs, ), @@ -451,6 +545,15 @@ class CodeGenProcess { version, }; }; + + injectClassInstance = (key, value) => { + this[key] = value; + PATCHABLE_INSTANCES.forEach((instanceKey) => { + if (instanceKey !== key && key in this[instanceKey]) { + this[instanceKey][key] = value; + } + }); + }; } module.exports = { diff --git a/src/commands/generate-templates/configuration.js b/src/commands/generate-templates/configuration.js index dd1529c2..e9aaabc0 100644 --- a/src/commands/generate-templates/configuration.js +++ b/src/commands/generate-templates/configuration.js @@ -1,5 +1,5 @@ -const { objectAssign } = require("../../util/object-assign"); -const { HTTP_CLIENT, PROJECT_VERSION } = require("../../constants"); +const { objectAssign } = require('../../util/object-assign'); +const { HTTP_CLIENT, PROJECT_VERSION } = require('../../constants'); /** * @type {GenerateTemplatesParams}} diff --git a/src/commands/generate-templates/index.js b/src/commands/generate-templates/index.js index ee4e5237..2abc69cf 100644 --- a/src/commands/generate-templates/index.js +++ b/src/commands/generate-templates/index.js @@ -6,8 +6,7 @@ // License text available at https://opensource.org/licenses/MIT // Repository https://github.com/acacode/swagger-typescript-api -const _ = require("lodash"); -const { TemplatesGenProcess } = require("./templates-gen-process"); +const { TemplatesGenProcess } = require('./templates-gen-process'); module.exports = { generateTemplates: async (config) => { diff --git a/src/commands/generate-templates/templates-gen-process.js b/src/commands/generate-templates/templates-gen-process.js index 89568665..186e1420 100644 --- a/src/commands/generate-templates/templates-gen-process.js +++ b/src/commands/generate-templates/templates-gen-process.js @@ -1,8 +1,7 @@ -const _ = require("lodash"); -const { TemplatesGenConfig } = require("./configuration"); -const { FileSystem } = require("../../util/file-system"); -const { Logger } = require("../../util/logger"); -const path = require("path"); +const { TemplatesGenConfig } = require('./configuration'); +const { FileSystem } = require('../../util/file-system'); +const { Logger } = require('../../util/logger'); +const path = require('path'); class TemplatesGenProcess { /** @@ -18,33 +17,35 @@ class TemplatesGenProcess { */ logger; - rootDir = path.resolve(__dirname, "../../../"); + rootDir = path.resolve(__dirname, '../../../'); paths = { - baseTemplates: "templates/base", - httpClientTemplates: "templates/base/http-clients", - moduleApiTemplates: "templates/modular", - defaultApiTemplates: "templates/default", + baseTemplates: 'templates/base', + httpClientTemplates: 'templates/base/http-clients', + moduleApiTemplates: 'templates/modular', + defaultApiTemplates: 'templates/default', }; - importTemplatePrefixes = ["@base", "@modular", "@default"]; + importTemplatePrefixes = ['@base', '@modular', '@default']; constructor(config) { this.config = new TemplatesGenConfig(config); - this.logger = new Logger(this.config); - this.fileSystem = new FileSystem(); + this.logger = new Logger(this); + this.fileSystem = new FileSystem(this); } /** * @return {Promise} */ async start() { - this.logger.event('start generating source templates ".ejs" for code generator'); + this.logger.event( + 'start generating source templates ".ejs" for code generator', + ); const templates = this.getTemplates(); if (this.config.output) { - this.logger.log("preparing output directory for source templates"); + this.logger.log('preparing output directory for source templates'); const outputPath = path.resolve(process.cwd(), this.config.output); if (this.fileSystem.pathIsExist(outputPath)) { @@ -59,8 +60,10 @@ class TemplatesGenProcess { const templateName = this.fileSystem.cropExtension(template.name); const templateEjsPath = path.resolve(outputPath, `${templateName}.ejs`); const templateEtaPath = path.resolve(outputPath, `${templateName}.eta`); - const templateEjsPathExist = this.fileSystem.pathIsExist(templateEjsPath); - const templateEtaPathExist = this.fileSystem.pathIsExist(templateEtaPath); + const templateEjsPathExist = + this.fileSystem.pathIsExist(templateEjsPath); + const templateEtaPathExist = + this.fileSystem.pathIsExist(templateEtaPath); const templateNotExist = !templateEjsPathExist && !templateEtaPathExist; @@ -90,7 +93,9 @@ class TemplatesGenProcess { } }); - this.logger.success(`source templates has been successfully created in "${outputPath}"`); + this.logger.success( + `source templates has been successfully created in "${outputPath}"`, + ); } return { @@ -102,27 +107,37 @@ class TemplatesGenProcess { getTemplates = () => { const outputFiles = []; - const baseTemplates = this.getTemplateNamesFromDir(this.paths.baseTemplates); - const httpClientTemplates = this.getTemplateNamesFromDir(this.paths.httpClientTemplates); - const apiTemplatesPath = this.config.modular ? this.paths.moduleApiTemplates : this.paths.defaultApiTemplates; + const baseTemplates = this.getTemplateNamesFromDir( + this.paths.baseTemplates, + ); + const httpClientTemplates = this.getTemplateNamesFromDir( + this.paths.httpClientTemplates, + ); + const apiTemplatesPath = this.config.modular + ? this.paths.moduleApiTemplates + : this.paths.defaultApiTemplates; const apiTemplates = this.getTemplateNamesFromDir(apiTemplatesPath); const usingHttpClientTemplate = httpClientTemplates.find((template) => template.startsWith(`${this.config.httpClientType}-`), ); - let httpClientTemplateContent = ""; + let httpClientTemplateContent = ''; if (usingHttpClientTemplate) { httpClientTemplateContent = this.fixTemplateContent( - this.getTemplateContent(`${this.paths.httpClientTemplates}/${usingHttpClientTemplate}`), + this.getTemplateContent( + `${this.paths.httpClientTemplates}/${usingHttpClientTemplate}`, + ), ); } for (const fileName of baseTemplates) { const templateContent = - (fileName === "http-client.ejs" && httpClientTemplateContent) || - this.fixTemplateContent(this.getTemplateContent(`${this.paths.baseTemplates}/${fileName}`)); + (fileName === 'http-client.ejs' && httpClientTemplateContent) || + this.fixTemplateContent( + this.getTemplateContent(`${this.paths.baseTemplates}/${fileName}`), + ); outputFiles.push({ name: fileName, @@ -133,7 +148,9 @@ class TemplatesGenProcess { for (const fileName of apiTemplates) { outputFiles.push({ name: fileName, - content: this.fixTemplateContent(this.getTemplateContent(`${apiTemplatesPath}/${fileName}`)), + content: this.fixTemplateContent( + this.getTemplateContent(`${apiTemplatesPath}/${fileName}`), + ), }); } @@ -143,32 +160,42 @@ class TemplatesGenProcess { fixTemplateContent = (content) => { // includeFile("@base/ const importsRegExp1 = new RegExp( - `includeFile\\\("(${this.importTemplatePrefixes.map((v) => `(${v})`).join("|")})\/`, - "g", + `includeFile\\("(${this.importTemplatePrefixes + .map((v) => `(${v})`) + .join('|')})/`, + 'g', ); // includeFile(`@base/ const importsRegExp2 = new RegExp( - `includeFile\\\(\`(${this.importTemplatePrefixes.map((v) => `(${v})`).join("|")})\/`, - "g", + `includeFile\\(\`(${this.importTemplatePrefixes + .map((v) => `(${v})`) + .join('|')})/`, + 'g', ); // includeFile('@base/ const importsRegExp3 = new RegExp( - `includeFile\\\(\'(${this.importTemplatePrefixes.map((v) => `(${v})`).join("|")})\/`, - "g", + `includeFile\\('(${this.importTemplatePrefixes + .map((v) => `(${v})`) + .join('|')})/`, + 'g', ); return content .replace(importsRegExp1, 'includeFile("./') - .replace(importsRegExp2, "includeFile(`./") + .replace(importsRegExp2, 'includeFile(`./') .replace(importsRegExp3, "includeFile('./"); }; getTemplateNamesFromDir = (dir) => { - return this.fileSystem.readDir(path.resolve(this.rootDir, dir)).filter((file) => file.endsWith(".ejs")); + return this.fileSystem + .readDir(path.resolve(this.rootDir, dir)) + .filter((file) => file.endsWith('.ejs')); }; getTemplateContent = (pathToFile) => { - return this.fileSystem.getFileContent(path.resolve(this.rootDir, pathToFile)); + return this.fileSystem.getFileContent( + path.resolve(this.rootDir, pathToFile), + ); }; } diff --git a/src/component-type-name-resolver.js b/src/component-type-name-resolver.js new file mode 100644 index 00000000..1d64b885 --- /dev/null +++ b/src/component-type-name-resolver.js @@ -0,0 +1,44 @@ +const { getRandomInt } = require('./util/random'); +const { NameResolver } = require('./util/name-resolver'); + +class ComponentTypeNameResolver extends NameResolver { + counter = 1; + fallbackNameCounter = 1; + countersByVariant = new Map(); + + /** + * @param {CodeGenConfig} config; + * @param {Logger} logger; + * @param {string[]} reservedNames + */ + constructor(config, logger, reservedNames) { + super(config, logger, reservedNames, (variants) => { + const randomVariant = variants[getRandomInt(0, variants.length - 1)]; + if (randomVariant) { + if (!this.countersByVariant.has(randomVariant)) { + this.countersByVariant.set(randomVariant, 0); + } + const variantCounter = this.countersByVariant.get(randomVariant) + 1; + this.countersByVariant.set(randomVariant, variantCounter); + const dirtyResolvedName = `${randomVariant}${variantCounter}`; + this.logger.debug( + 'generated dirty resolved type name for component - ', + dirtyResolvedName, + ); + return dirtyResolvedName; + } + + const fallbackName = `${this.config.componentTypeNameResolver}${this + .fallbackNameCounter++}`; + this.logger.debug( + 'generated fallback type name for component - ', + fallbackName, + ); + return fallbackName; + }); + } +} + +module.exports = { + ComponentTypeNameResolver, +}; diff --git a/src/configuration.js b/src/configuration.js index 9631dbb7..44bf5735 100644 --- a/src/configuration.js +++ b/src/configuration.js @@ -1,32 +1,34 @@ -const { objectAssign } = require("./util/object-assign"); -const _ = require("lodash"); -const CONSTANTS = require("./constants"); -const { ComponentTypeNameResolver } = require("./util/name-resolver"); -const { cosmiconfigSync } = require("cosmiconfig"); +/* eslint-disable no-unused-vars */ +const { objectAssign } = require('./util/object-assign'); +const _ = require('lodash'); +const CONSTANTS = require('./constants'); +const { ComponentTypeNameResolver } = require('./component-type-name-resolver'); +const { cosmiconfigSync } = require('cosmiconfig'); +const ts = require('typescript'); const TsKeyword = { - Number: "number", - String: "string", - Boolean: "boolean", - Any: "any", - Void: "void", - Unknown: "unknown", - Null: "null", - Undefined: "undefined", - Object: "object", - File: "File", - Date: "Date", - Type: "type", - Enum: "enum", - Interface: "interface", - Array: "Array", - Record: "Record", - Intersection: "&", - Union: "|", + Number: 'number', + String: 'string', + Boolean: 'boolean', + Any: 'any', + Void: 'void', + Unknown: 'unknown', + Null: 'null', + Undefined: 'undefined', + Object: 'object', + File: 'File', + Date: 'Date', + Type: 'type', + Enum: 'enum', + Interface: 'interface', + Array: 'Array', + Record: 'Record', + Intersection: '&', + Union: '|', }; const TsCodeGenKeyword = { - UtilRequiredKeys: "UtilRequiredKeys", + UtilRequiredKeys: 'UtilRequiredKeys', }; /** @@ -35,7 +37,7 @@ const TsCodeGenKeyword = { class CodeGenConfig { version = CONSTANTS.PROJECT_VERSION; /** CLI flag */ - templates = "../templates/default"; + templates = ''; /** CLI flag */ generateResponses = false; /** CLI flag */ @@ -74,10 +76,10 @@ class CodeGenConfig { extractResponseError = false; extractEnums = false; fileNames = { - dataContracts: "data-contracts", - routeTypes: "route-types", - httpClient: "http-client", - outOfModuleApi: "Common", + dataContracts: 'data-contracts', + routeTypes: 'route-types', + httpClient: 'http-client', + outOfModuleApi: 'Common', }; routeNameDuplicatesMap = new Map(); prettierOptions = { ...CONSTANTS.PRETTIER_OPTIONS }; @@ -89,7 +91,7 @@ class CodeGenConfig { onPreParseSchema: (originalSchema, typeName, schemaType) => void 0, onParseSchema: (originalSchema, parsedSchema) => parsedSchema, onCreateRoute: (routeData) => routeData, - onInit: (config) => config, + onInit: (config, codeGenProcess) => config, onPrepareConfig: (apiConfig) => apiConfig, onCreateRequestParams: (rawType) => {}, onCreateRouteName: () => {}, @@ -102,72 +104,114 @@ class CodeGenConfig { unwrapResponseData = false; disableThrowOnError = false; sortTypes = false; + sortRoutes = false; templatePaths = { /** `templates/base` */ - base: "", + base: '', /** `templates/default` */ - default: "", + default: '', /** `templates/modular` */ - modular: "", + modular: '', /** usage path if `--templates` option is not set */ - original: "", + original: '', /** custom path to templates (`--templates`) */ - custom: "", + custom: '', }; /** Record */ templatesToRender = { - api: "", - dataContracts: "", - dataContractJsDoc: "", - interfaceDataContract: "", - typeDataContract: "", - enumDataContract: "", - objectFieldJsDoc: "", - httpClient: "", - routeTypes: "", - routeName: "", + api: '', + dataContracts: '', + dataContractJsDoc: '', + interfaceDataContract: '', + typeDataContract: '', + enumDataContract: '', + objectFieldJsDoc: '', + httpClient: '', + routeTypes: '', + routeName: '', }; + /** + * @type {Record MonoSchemaParser>} + */ + schemaParsers = {}; toJS = false; silent = false; - typePrefix = ""; - typeSuffix = ""; - enumKeyPrefix = ""; - enumKeySuffix = ""; + typePrefix = ''; + typeSuffix = ''; + enumKeyPrefix = ''; + enumKeySuffix = ''; patch = false; - componentTypeNameResolver = new ComponentTypeNameResolver(null, []); + /** @type {ComponentTypeNameResolver} */ + componentTypeNameResolver; /** name of the main exported class */ - apiClassName = "Api"; + apiClassName = 'Api'; debug = false; anotherArrayType = false; internalTemplateOptions = { addUtilRequiredKeysType: false, }; extraTemplates = []; - input = ""; + input = ''; modular = false; - output = ""; - url = ""; + output = ''; + url = ''; cleanOutput = false; spec = null; - fileName = "Api.ts"; + fileName = 'Api.ts'; authorizationToken = void 0; requestOptions = null; jsPrimitiveTypes = []; jsEmptyTypes = []; - fixInvalidTypeNamePrefix = "Type"; - fixInvalidEnumKeyPrefix = "Value"; + fixInvalidTypeNamePrefix = 'Type'; + fixInvalidEnumKeyPrefix = 'Value'; + + enumKeyResolverName = 'Value'; + typeNameResolverName = 'ComponentType'; + specificArgNameResolverName = 'arg'; successResponseStatusRange = [200, 299]; /** @type {ExtractingOptions} */ extractingOptions = { - requestBodySuffix: ["Payload", "Body", "Input"], - requestParamsSuffix: ["Params"], - responseBodySuffix: ["Data", "Result", "Output"], - responseErrorSuffix: ["Error", "Fail", "Fails", "ErrorData", "HttpError", "BadResponse"], + requestBodySuffix: ['Payload', 'Body', 'Input'], + requestParamsSuffix: ['Params'], + responseBodySuffix: ['Data', 'Result', 'Output'], + responseErrorSuffix: [ + 'Error', + 'Fail', + 'Fails', + 'ErrorData', + 'HttpError', + 'BadResponse', + ], + enumSuffix: ['Enum'], + discriminatorMappingSuffix: ['Mapping', 'Mapper', 'MapType'], + discriminatorAbstractPrefix: [ + 'Base', + 'Abstract', + 'Discriminator', + 'Internal', + 'Polymorph', + ], }; + compilerTsConfig = { + module: 'ESNext', + noImplicitReturns: true, + alwaysStrict: true, + target: ts.ScriptTarget.ESNext, + declaration: true, + noImplicitAny: false, + sourceMap: false, + removeComments: false, + disableSizeLimit: true, + esModuleInterop: true, + emitDecoratorMetadata: true, + skipLibCheck: true, + }; + customTranslator; + Ts = { Keyword: _.cloneDeep(TsKeyword), CodeGenKeyword: _.cloneDeep(TsCodeGenKeyword), @@ -200,28 +244,39 @@ class CodeGenConfig { /** * $A1 | $A2 */ - UnionType: (contents) => _.join(_.uniq(contents), ` ${this.Ts.Keyword.Union} `), + UnionType: (contents) => + _.join(_.uniq(contents), ` ${this.Ts.Keyword.Union} `), /** * ($A1) */ - ExpressionGroup: (content) => (content ? `(${content})` : ""), + ExpressionGroup: (content) => (content ? `(${content})` : ''), /** * $A1 & $A2 */ - IntersectionType: (contents) => _.join(_.uniq(contents), ` ${this.Ts.Keyword.Intersection} `), + IntersectionType: (contents) => + _.join(_.uniq(contents), ` ${this.Ts.Keyword.Intersection} `), /** * Record<$A1, $A2> */ - RecordType: (key, value) => this.Ts.TypeWithGeneric(this.Ts.Keyword.Record, [key, value]), + RecordType: (key, value) => + this.Ts.TypeWithGeneric(this.Ts.Keyword.Record, [key, value]), /** * readonly $key?:$value */ TypeField: ({ readonly, key, optional, value }) => - _.compact([readonly && "readonly ", key, optional && "?", ": ", value]).join(""), + _.compact([ + readonly && 'readonly ', + key, + optional && '?', + ': ', + value, + ]).join(''), /** * [key: $A1]: $A2 */ InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`, + + EnumUsageKey: (enumStruct, key) => `${enumStruct}.${key}`, /** * $A1 = $A2 */ @@ -232,7 +287,10 @@ class CodeGenConfig { * $AN.key = $AN.value, */ EnumFieldsWrapper: (contents) => - _.map(contents, ({ key, value }) => ` ${this.Ts.EnumField(key, value)}`).join(",\n"), + _.map( + contents, + ({ key, value }) => ` ${this.Ts.EnumField(key, value)}`, + ).join(',\n'), /** * {\n $A \n} */ @@ -244,19 +302,21 @@ class CodeGenConfig { [ ...(contents.length === 1 ? [`/** ${contents[0]} */`] - : ["/**", ...contents.map((content) => ` * ${content}`), " */"]), + : ['/**', ...contents.map((content) => ` * ${content}`), ' */']), ].map((part) => `${formatFn ? formatFn(part) : part}\n`), /** * $A1<...$A2.join(,)> */ TypeWithGeneric: (typeName, genericArgs) => { - return `${typeName}${genericArgs.length ? `<${genericArgs.join(",")}>` : ""}`; + return `${typeName}${ + genericArgs.length ? `<${genericArgs.join(',')}>` : '' + }`; }, /** * [$A1, $A2, ...$AN] */ Tuple: (values) => { - return `[${values.join(", ")}]`; + return `[${values.join(', ')}]`; }, }; @@ -277,43 +337,39 @@ class CodeGenConfig { /** formats */ binary: () => this.Ts.Keyword.File, file: () => this.Ts.Keyword.File, - "date-time": () => this.Ts.Keyword.String, + 'date-time': () => this.Ts.Keyword.String, time: () => this.Ts.Keyword.String, date: () => this.Ts.Keyword.String, duration: () => this.Ts.Keyword.String, email: () => this.Ts.Keyword.String, - "idn-email": () => this.Ts.Keyword.String, - "idn-hostname": () => this.Ts.Keyword.String, + 'idn-email': () => this.Ts.Keyword.String, + 'idn-hostname': () => this.Ts.Keyword.String, ipv4: () => this.Ts.Keyword.String, ipv6: () => this.Ts.Keyword.String, uuid: () => this.Ts.Keyword.String, uri: () => this.Ts.Keyword.String, - "uri-reference": () => this.Ts.Keyword.String, - "uri-template": () => this.Ts.Keyword.String, - "json-pointer": () => this.Ts.Keyword.String, - "relative-json-pointer": () => this.Ts.Keyword.String, + 'uri-reference': () => this.Ts.Keyword.String, + 'uri-template': () => this.Ts.Keyword.String, + 'json-pointer': () => this.Ts.Keyword.String, + 'relative-json-pointer': () => this.Ts.Keyword.String, regex: () => this.Ts.Keyword.String, }, - array: ({ items, ...schemaPart }, parser) => { - const content = parser.getInlineParseContent(items); - return parser.schemaUtils.safeAddNullToType(schemaPart, this.Ts.ArrayType(content)); - }, }; templateInfos = [ - { name: "api", fileName: "api" }, - { name: "dataContracts", fileName: "data-contracts" }, - { name: "dataContractJsDoc", fileName: "data-contract-jsdoc" }, - { name: "interfaceDataContract", fileName: "interface-data-contract" }, - { name: "typeDataContract", fileName: "type-data-contract" }, - { name: "enumDataContract", fileName: "enum-data-contract" }, - { name: "objectFieldJsDoc", fileName: "object-field-jsdoc" }, - { name: "httpClient", fileName: "http-client" }, - { name: "routeTypes", fileName: "route-types" }, - { name: "routeName", fileName: "route-name" }, + { name: 'api', fileName: 'api' }, + { name: 'dataContracts', fileName: 'data-contracts' }, + { name: 'dataContractJsDoc', fileName: 'data-contract-jsdoc' }, + { name: 'interfaceDataContract', fileName: 'interface-data-contract' }, + { name: 'typeDataContract', fileName: 'type-data-contract' }, + { name: 'enumDataContract', fileName: 'enum-data-contract' }, + { name: 'objectFieldJsDoc', fileName: 'object-field-jsdoc' }, + { name: 'httpClient', fileName: 'http-client' }, + { name: 'routeTypes', fileName: 'route-types' }, + { name: 'routeName', fileName: 'route-name' }, ]; - templateExtensions = [".eta", ".ejs"]; + templateExtensions = ['.eta', '.ejs']; /** * @param config {Partial} @@ -325,7 +381,7 @@ class CodeGenConfig { constants, templateInfos, hooks, - ...params + ...otherConfig }) { objectAssign(this.Ts, codeGenConstructs); objectAssign(this.primitiveTypes, primitiveTypeConstructs); @@ -333,8 +389,11 @@ class CodeGenConfig { this.defaultResponseType = this.Ts.Keyword.Void; this.update({ - ...params, - prettierOptions: prettierOptions === undefined ? getDefaultPrettierOptions() : prettierOptions, + ...otherConfig, + prettierOptions: + prettierOptions === undefined + ? getDefaultPrettierOptions() + : prettierOptions, hooks: _.merge(this.hooks, hooks || {}), constants: { ...CONSTANTS, @@ -343,8 +402,17 @@ class CodeGenConfig { templateInfos: templateInfos || this.templateInfos, }); - this.jsPrimitiveTypes = [this.Ts.Keyword.Number, this.Ts.Keyword.String, this.Ts.Keyword.Boolean]; + this.jsPrimitiveTypes = [ + this.Ts.Keyword.Number, + this.Ts.Keyword.String, + this.Ts.Keyword.Boolean, + ]; this.jsEmptyTypes = [this.Ts.Keyword.Null, this.Ts.Keyword.Undefined]; + this.componentTypeNameResolver = new ComponentTypeNameResolver( + this, + null, + [], + ); } /** @@ -357,12 +425,12 @@ class CodeGenConfig { } const getDefaultPrettierOptions = () => { - const prettier = cosmiconfigSync("prettier").search(); + const prettier = cosmiconfigSync('prettier').search(); if (prettier) { return { ...prettier.config, - parser: "typescript", + parser: 'typescript', }; } diff --git a/src/constants.js b/src/constants.js index 0e27e373..61b55e14 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,27 +1,33 @@ -const packageJson = require("../package.json"); -const RESERVED_QUERY_ARG_NAMES = ["query", "queryParams", "queryArg"]; -const RESERVED_BODY_ARG_NAMES = ["data", "body", "reqBody"]; -const RESERVED_REQ_PARAMS_ARG_NAMES = ["params", "requestParams", "reqParams", "httpParams"]; -const RESERVED_PATH_ARG_NAMES = ["path", "pathParams"]; -const RESERVED_HEADER_ARG_NAMES = ["headers", "headersParams"]; +const packageJson = require('../package.json'); +const RESERVED_QUERY_ARG_NAMES = ['query', 'queryParams', 'queryArg']; +const RESERVED_BODY_ARG_NAMES = ['data', 'body', 'reqBody']; +const RESERVED_REQ_PARAMS_ARG_NAMES = [ + 'params', + 'requestParams', + 'reqParams', + 'httpParams', +]; +const RESERVED_PATH_ARG_NAMES = ['path', 'pathParams']; +const RESERVED_HEADER_ARG_NAMES = ['headers', 'headersParams']; const SCHEMA_TYPES = { - ARRAY: "array", - OBJECT: "object", - ENUM: "enum", - REF: "$ref", - PRIMITIVE: "primitive", - COMPLEX: "complex", - COMPLEX_ONE_OF: "oneOf", - COMPLEX_ANY_OF: "anyOf", - COMPLEX_ALL_OF: "allOf", - COMPLEX_NOT: "not", - COMPLEX_UNKNOWN: "__unknown", + ARRAY: 'array', + OBJECT: 'object', + ENUM: 'enum', + REF: '$ref', + PRIMITIVE: 'primitive', + COMPLEX: 'complex', + DISCRIMINATOR: 'discriminator', + COMPLEX_ONE_OF: 'oneOf', + COMPLEX_ANY_OF: 'anyOf', + COMPLEX_ALL_OF: 'allOf', + COMPLEX_NOT: 'not', + COMPLEX_UNKNOWN: '__unknown', }; const HTTP_CLIENT = { - FETCH: "fetch", - AXIOS: "axios", + FETCH: 'fetch', + AXIOS: 'axios', }; const PROJECT_VERSION = packageJson.version; @@ -41,7 +47,7 @@ const FILE_PREFIX = `/* eslint-disable */ module.exports = { FILE_PREFIX, - DEFAULT_BODY_ARG_NAME: "data", + DEFAULT_BODY_ARG_NAME: 'data', PROJECT_VERSION, SCHEMA_TYPES, HTTP_CLIENT, @@ -53,7 +59,7 @@ module.exports = { PRETTIER_OPTIONS: { printWidth: 120, tabWidth: 2, - trailingComma: "all", - parser: "typescript", + trailingComma: 'all', + parser: 'typescript', }, }; diff --git a/src/index.js b/src/index.js index 9bb3ec77..cfbce631 100644 --- a/src/index.js +++ b/src/index.js @@ -6,10 +6,9 @@ // License text available at https://opensource.org/licenses/MIT // Repository https://github.com/acacode/swagger-typescript-api -const _ = require("lodash"); -const constants = require("./constants"); -const { CodeGenProcess } = require("./code-gen-process.js"); -const { generateTemplates } = require("./commands/generate-templates"); +const constants = require('./constants'); +const { CodeGenProcess } = require('./code-gen-process.js'); +const { generateTemplates } = require('./commands/generate-templates'); module.exports = { constants: constants, diff --git a/src/schema-components-map.js b/src/schema-components-map.js index 7019a454..fee41793 100644 --- a/src/schema-components-map.js +++ b/src/schema-components-map.js @@ -1,31 +1,31 @@ -const _ = require("lodash"); +const _ = require('lodash'); class SchemaComponentsMap { - /** - * @type {Record} - */ - data = {}; - /** - * @type {CodeGenConfig} - */ + /** @type {SchemaComponent[]} */ + _data = []; + /** @type {CodeGenConfig} */ config; - constructor(config, schema) { + constructor({ config }) { this.config = config; - this.processSchema(schema); } - processSchema(schema) { - this.data = {}; - if (!schema) return; - _.each(schema.components, (component, componentName) => - _.each(component, (rawTypeData, typeName) => this.createComponent(componentName, typeName, rawTypeData)), - ); + clear() { + this._data = []; } - createComponent(componentName, typeName, rawTypeData) { - const $ref = `#/components/${componentName}/${typeName}`; + createRef = (paths) => { + return ['#', ...paths].join('/'); + }; + + parseRef = (ref) => { + return ref.split('/'); + }; + createComponent($ref, rawTypeData) { + const parsed = this.parseRef($ref); + const typeName = parsed[parsed.length - 1]; + const componentName = parsed[parsed.length - 2]; const componentSchema = { $ref, typeName, @@ -35,23 +35,39 @@ class SchemaComponentsMap { typeData: null, }; - const usageComponent = this.config.hooks.onCreateComponent(componentSchema) || componentSchema; + const usageComponent = + this.config.hooks.onCreateComponent(componentSchema) || componentSchema; + + const refIndex = this._data.findIndex((c) => c.$ref === $ref); - this.data[$ref] = usageComponent; + if (refIndex === -1) { + this._data.push(usageComponent); + } else { + this._data[refIndex] = usageComponent; + } return usageComponent; } + /** + * @returns {SchemaComponent[]} + */ + getComponents() { + return this._data; + } + /** * @param componentName {string} * @returns {SchemaComponent[]} */ filter(componentName) { - return _.filter(this.data, (v, ref) => _.startsWith(ref, `#/components/${componentName}`)); + return _.filter(this._data, (v) => + _.startsWith(v.$ref, `#/components/${componentName}`), + ); } - get(ref) { - return this.data[ref] || null; + get($ref) { + return this._data.find((c) => c.$ref === $ref) || null; } } diff --git a/src/schema-parser/base-schema-parsers/array.js b/src/schema-parser/base-schema-parsers/array.js new file mode 100644 index 00000000..977153f5 --- /dev/null +++ b/src/schema-parser/base-schema-parsers/array.js @@ -0,0 +1,43 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); + +class ArraySchemaParser extends MonoSchemaParser { + parse() { + let contentType; + const { type, description, items } = this.schema || {}; + + if (_.isArray(items) && type === SCHEMA_TYPES.ARRAY) { + const tupleContent = []; + for (const item of items) { + tupleContent.push( + this.schemaParserFabric + .createSchemaParser({ schema: item, schemaPath: this.schemaPath }) + .getInlineParseContent(), + ); + } + contentType = this.config.Ts.Tuple(tupleContent); + } else { + const content = this.schemaParserFabric + .createSchemaParser({ schema: items, schemaPath: this.schemaPath }) + .getInlineParseContent(); + contentType = this.config.Ts.ArrayType(content); + } + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $schemaPath: this.schemaPath.slice(), + $parsedSchema: true, + schemaType: SCHEMA_TYPES.PRIMITIVE, + type: SCHEMA_TYPES.PRIMITIVE, + typeIdentifier: this.config.Ts.Keyword.Type, + name: this.typeName, + description: this.schemaFormatters.formatDescription(description), + content: this.schemaUtils.safeAddNullToType(this.schema, contentType), + }; + } +} + +module.exports = { + ArraySchemaParser, +}; diff --git a/src/schema-parser/base-schema-parsers/complex.js b/src/schema-parser/base-schema-parsers/complex.js new file mode 100644 index 00000000..a23dac4c --- /dev/null +++ b/src/schema-parser/base-schema-parsers/complex.js @@ -0,0 +1,51 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); + +class ComplexSchemaParser extends MonoSchemaParser { + parse() { + const complexType = this.schemaUtils.getComplexType(this.schema); + const simpleSchema = _.omit( + _.clone(this.schema), + _.keys(this.schemaParser._complexSchemaParsers), + ); + const complexSchemaContent = this.schemaParser._complexSchemaParsers[ + complexType + ](this.schema); + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $schemaPath: this.schemaPath.slice(), + $parsedSchema: true, + schemaType: SCHEMA_TYPES.COMPLEX, + type: SCHEMA_TYPES.PRIMITIVE, + typeIdentifier: this.config.Ts.Keyword.Type, + name: this.typeName, + description: this.schemaFormatters.formatDescription( + this.schema.description || + _.compact(_.map(this.schema[complexType], 'description'))[0] || + '', + ), + content: + this.config.Ts.IntersectionType( + _.compact([ + this.config.Ts.ExpressionGroup(complexSchemaContent), + this.schemaUtils.getInternalSchemaType(simpleSchema) === + SCHEMA_TYPES.OBJECT && + this.config.Ts.ExpressionGroup( + this.schemaParserFabric + .createSchemaParser({ + schema: simpleSchema, + schemaPath: this.schemaPath, + }) + .getInlineParseContent(), + ), + ]), + ) || this.config.Ts.Keyword.Any, + }; + } +} + +module.exports = { + ComplexSchemaParser, +}; diff --git a/src/schema-parser/base-schema-parsers/discriminator.js b/src/schema-parser/base-schema-parsers/discriminator.js new file mode 100644 index 00000000..d6c247d9 --- /dev/null +++ b/src/schema-parser/base-schema-parsers/discriminator.js @@ -0,0 +1,301 @@ +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); +const { MonoSchemaParser } = require('../mono-schema-parser'); + +class DiscriminatorSchemaParser extends MonoSchemaParser { + parse() { + const { discriminator, ...noDiscriminatorSchema } = this.schema; + + if (!discriminator.mapping) { + return this.schemaParserFabric + .createSchemaParser({ + schema: noDiscriminatorSchema, + typeName: this.typeName, + schemaPath: this.schemaPath, + }) + .parseSchema(); + } + + // https://github.com/acacode/swagger-typescript-api/issues/456 + // const skipMappingType = !!noDiscriminatorSchema.oneOf; + const skipMappingType = false; + + const abstractSchemaStruct = this.createAbstractSchemaStruct(); + // const complexSchemaStruct = this.createComplexSchemaStruct(); + const discriminatorSchemaStruct = this.createDiscriminatorSchema({ + skipMappingType, + abstractSchemaStruct, + }); + + const schemaContent = this.config.Ts.IntersectionType( + [ + abstractSchemaStruct?.content, + discriminatorSchemaStruct?.content, + ].filter(Boolean), + ); + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $schemaPath: this.schemaPath.slice(), + $parsedSchema: true, + schemaType: SCHEMA_TYPES.COMPLEX, + type: SCHEMA_TYPES.PRIMITIVE, + typeIdentifier: this.config.Ts.Keyword.Type, + name: this.typeName, + description: this.schemaFormatters.formatDescription( + this.schema.description, + ), + content: schemaContent, + }; + } + + createDiscriminatorSchema = ({ skipMappingType, abstractSchemaStruct }) => { + const refPath = this.schemaComponentsMap.createRef([ + 'components', + 'schemas', + this.typeName, + ]); + const { discriminator } = this.schema; + const mappingEntries = _.entries(discriminator.mapping); + const ableToCreateMappingType = + !skipMappingType && + !!(abstractSchemaStruct?.typeName && mappingEntries.length); + const mappingContents = []; + let mappingTypeName; + + /** { mapping_key: SchemaEnum.MappingKey, ... } */ + const mappingPropertySchemaEnumKeysMap = + this.createMappingPropertySchemaEnumKeys({ + abstractSchemaStruct, + discPropertyName: discriminator.propertyName, + }); + + if (ableToCreateMappingType) { + mappingTypeName = this.schemaUtils.resolveTypeName( + `${abstractSchemaStruct.typeName} ${discriminator.propertyName}`, + { + suffixes: this.config.extractingOptions.discriminatorMappingSuffix, + resolver: + this.config.extractingOptions.discriminatorMappingNameResolver, + }, + ); + this.schemaParserFabric.createSchema({ + linkedComponent: this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef([ + 'components', + 'schemas', + mappingTypeName, + ]), + ), + content: this.config.Ts.IntersectionType([ + this.config.Ts.ObjectWrapper( + this.config.Ts.TypeField({ + key: discriminator.propertyName, + value: 'Key', + }), + ), + 'Type', + ]), + genericArgs: [{ name: 'Key' }, { name: 'Type' }], + internal: true, + }); + } + + /** returns (GenericType<"mapping_key", MappingType>) or ({ discriminatorProperty: "mapping_key" } & MappingType) */ + const createMappingContent = (mappingSchema, mappingKey) => { + const content = this.schemaParserFabric + .createSchemaParser({ + schema: mappingSchema, + schemaPath: this.schemaPath, + }) + .getInlineParseContent(); + + const mappingUsageKey = + mappingPropertySchemaEnumKeysMap[mappingKey] || + this.config.Ts.StringValue(mappingKey); + + if (ableToCreateMappingType) { + return this.config.Ts.TypeWithGeneric(mappingTypeName, [ + mappingUsageKey, + content, + ]); + } else { + return this.config.Ts.ExpressionGroup( + this.config.Ts.IntersectionType([ + this.config.Ts.ObjectWrapper( + this.config.Ts.TypeField({ + key: discriminator.propertyName, + value: mappingUsageKey, + }), + ), + content, + ]), + ); + } + }; + + for (const [mappingKey, schema] of mappingEntries) { + const mappingSchema = + typeof schema === 'string' ? { $ref: schema } : schema; + + this.mutateMappingDependentSchema({ + discPropertyName: discriminator.propertyName, + abstractSchemaStruct, + mappingSchema, + refPath, + mappingPropertySchemaEnumKeysMap, + }); + + mappingContents.push(createMappingContent(mappingSchema, mappingKey)); + } + + if (skipMappingType) return null; + + const content = this.config.Ts.ExpressionGroup( + this.config.Ts.UnionType(mappingContents), + ); + + return { + content, + }; + }; + + createMappingPropertySchemaEnumKeys = ({ + abstractSchemaStruct, + discPropertyName, + }) => { + let mappingPropertySchemaEnumKeysMap = {}; + let mappingPropertySchema = _.get( + abstractSchemaStruct?.component?.rawTypeData, + ['properties', discPropertyName], + ); + if (this.schemaUtils.isRefSchema(mappingPropertySchema)) { + mappingPropertySchema = this.schemaUtils.getSchemaRefType( + mappingPropertySchema, + ); + } + + if ( + mappingPropertySchema?.rawTypeData?.$parsed?.type === SCHEMA_TYPES.ENUM + ) { + mappingPropertySchemaEnumKeysMap = _.reduce( + mappingPropertySchema.rawTypeData.$parsed.enum, + (acc, key, index) => { + const enumKey = + mappingPropertySchema.rawTypeData.$parsed.content[index].key; + acc[key] = this.config.Ts.EnumUsageKey( + mappingPropertySchema.rawTypeData.$parsed.typeName, + enumKey, + ); + return acc; + }, + {}, + ); + } + + return mappingPropertySchemaEnumKeysMap; + }; + + mutateMappingDependentSchema = ({ + discPropertyName, + abstractSchemaStruct, + mappingSchema, + refPath, + mappingPropertySchemaEnumKeysMap, + }) => { + const complexSchemaKeys = _.keys(this.schemaParser._complexSchemaParsers); + // override parent dependencies + if (mappingSchema.$ref && abstractSchemaStruct?.component?.$ref) { + const mappingRefSchema = + this.schemaUtils.getSchemaRefType(mappingSchema)?.rawTypeData; + if (mappingRefSchema) { + complexSchemaKeys.forEach((schemaKey) => { + if (_.isArray(mappingRefSchema[schemaKey])) { + mappingRefSchema[schemaKey] = mappingRefSchema[schemaKey].map( + (schema) => { + if (schema.$ref === refPath) { + return { + ...schema, + $ref: abstractSchemaStruct.component.$ref, + }; + } + if ( + this.schemaUtils.getInternalSchemaType(schema) === + SCHEMA_TYPES.OBJECT + ) { + for (const schemaPropertyName in schema.properties) { + const schemaProperty = + schema.properties[schemaPropertyName]; + if ( + schemaPropertyName === discPropertyName && + this.schemaUtils.getInternalSchemaType(schemaProperty) === + SCHEMA_TYPES.ENUM && + schemaProperty.enum.length === 1 && + mappingPropertySchemaEnumKeysMap[schemaProperty.enum[0]] + ) { + schema.properties[schemaPropertyName] = + this.schemaParserFabric.createSchema({ + content: + mappingPropertySchemaEnumKeysMap[ + schemaProperty.enum[0] + ], + }); + } + } + } + return schema; + }, + ); + } + }); + } + } + }; + + createAbstractSchemaStruct = () => { + // eslint-disable-next-line no-unused-vars + const { discriminator, ...noDiscriminatorSchema } = this.schema; + const complexSchemaKeys = _.keys(this.schemaParser._complexSchemaParsers); + const schema = _.omit(_.clone(noDiscriminatorSchema), complexSchemaKeys); + const schemaIsEmpty = !_.keys(schema).length; + + if (schemaIsEmpty) return null; + + const typeName = this.schemaUtils.resolveTypeName(this.typeName, { + prefixes: this.config.extractingOptions.discriminatorAbstractPrefix, + resolver: this.config.extractingOptions.discriminatorAbstractResolver, + }); + const component = this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef(['components', 'schemas', typeName]), + { + ...schema, + internal: true, + }, + ); + const content = this.schemaParserFabric + .createSchemaParser({ schema: component, schemaPath: this.schemaPath }) + .getInlineParseContent(); + + return { + typeName, + component, + content, + }; + }; + + createComplexSchemaStruct = () => { + const complexType = this.schemaUtils.getComplexType(this.schema); + + if (complexType === SCHEMA_TYPES.COMPLEX_UNKNOWN) return null; + + return { + content: this.config.Ts.ExpressionGroup( + this.schemaParser._complexSchemaParsers[complexType](this.schema), + ), + }; + }; +} + +module.exports = { + DiscriminatorSchemaParser, +}; diff --git a/src/schema-parser/base-schema-parsers/enum.js b/src/schema-parser/base-schema-parsers/enum.js new file mode 100644 index 00000000..9a9f18dc --- /dev/null +++ b/src/schema-parser/base-schema-parsers/enum.js @@ -0,0 +1,158 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); +const { EnumKeyResolver } = require('../util/enum-key-resolver'); + +class EnumSchemaParser extends MonoSchemaParser { + /** @type {EnumKeyResolver} */ + enumKeyResolver; + + constructor(...args) { + super(...args); + this.enumKeyResolver = new EnumKeyResolver(this.config, this.logger, []); + } + + extractEnum = (pathTypeName) => { + const generatedTypeName = this.schemaUtils.resolveTypeName(pathTypeName, { + suffixes: this.config.extractingOptions.enumSuffix, + resolver: this.config.extractingOptions.enumNameResolver, + }); + const customComponent = this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef([ + 'components', + 'schemas', + generatedTypeName, + ]), + { + ...this.schema, + }, + ); + return this.schemaParserFabric.parseSchema(customComponent); + }; + + parse() { + const pathTypeName = this.buildTypeNameFromPath(); + + if (this.config.extractEnums && !this.typeName && pathTypeName != null) { + return this.extractEnum(pathTypeName); + } + + const refType = this.schemaUtils.getSchemaRefType(this.schema); + const $ref = (refType && refType.$ref) || null; + + // fix schema when enum has length 1+ but value is [] + if (Array.isArray(this.schema.enum)) { + this.schema.enum = this.schema.enum.filter((key) => key != null); + } + + if (Array.isArray(this.schema.enum) && Array.isArray(this.schema.enum[0])) { + return this.schemaParserFabric.parseSchema( + { + oneOf: this.schema.enum.map((enumNames) => ({ + type: 'array', + items: enumNames.map((enumName) => ({ + type: 'string', + enum: [enumName], + })), + })), + }, + this.typeName, + this.schemaPath, + ); + } + + const keyType = this.schemaUtils.getSchemaType(this.schema); + const enumNames = this.schemaUtils.getEnumNames(this.schema); + let content = null; + + const formatValue = (value) => { + if (value === null) { + return this.config.Ts.NullValue(value); + } + if ( + _.includes(keyType, this.schemaUtils.getSchemaType({ type: 'number' })) + ) { + return this.config.Ts.NumberValue(value); + } + if ( + _.includes(keyType, this.schemaUtils.getSchemaType({ type: 'boolean' })) + ) { + return this.config.Ts.BooleanValue(value); + } + + return this.config.Ts.StringValue(value); + }; + + if (_.isArray(enumNames) && _.size(enumNames)) { + content = _.map(enumNames, (enumName, index) => { + const enumValue = _.get(this.schema.enum, index); + const formattedKey = this.formatEnumKey({ + key: enumName, + value: enumValue, + }); + + if (this.config.enumNamesAsValues || _.isUndefined(enumValue)) { + return { + key: formattedKey, + type: this.config.Ts.Keyword.String, + value: this.config.Ts.StringValue(enumName), + }; + } + + return { + key: formattedKey, + type: keyType, + value: formatValue(enumValue), + }; + }); + } else { + content = _.map(this.schema.enum, (value) => { + return { + key: this.formatEnumKey({ value }), + type: keyType, + value: formatValue(value), + }; + }); + } + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $ref: $ref, + typeName: this.typeName || ($ref && refType.typeName) || null, + $parsedSchema: true, + schemaType: SCHEMA_TYPES.ENUM, + type: SCHEMA_TYPES.ENUM, + keyType: keyType, + typeIdentifier: this.config.generateUnionEnums + ? this.config.Ts.Keyword.Type + : this.config.Ts.Keyword.Enum, + name: this.typeName, + description: this.schemaFormatters.formatDescription( + this.schema.description, + ), + content, + }; + } + + formatEnumKey = ({ key, value }) => { + let formatted; + + if (key) { + formatted = this.typeNameFormatter.format(key, { + type: 'enum-key', + }); + } + + if (!formatted) { + formatted = this.typeNameFormatter.format(`${value}`, { + type: 'enum-key', + }); + } + + return this.enumKeyResolver.resolve([formatted]); + }; +} + +module.exports = { + EnumSchemaParser, +}; diff --git a/src/schema-parser/base-schema-parsers/object.js b/src/schema-parser/base-schema-parsers/object.js new file mode 100644 index 00000000..034b20ed --- /dev/null +++ b/src/schema-parser/base-schema-parsers/object.js @@ -0,0 +1,105 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); + +class ObjectSchemaParser extends MonoSchemaParser { + parse() { + const contentProperties = this.getObjectSchemaContent(this.schema); + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $schemaPath: this.schemaPath.slice(), + $parsedSchema: true, + schemaType: SCHEMA_TYPES.OBJECT, + type: SCHEMA_TYPES.OBJECT, + typeIdentifier: this.config.Ts.Keyword.Interface, + name: this.typeName, + description: this.schemaFormatters.formatDescription( + this.schema.description, + ), + allFieldsAreOptional: !_.some( + _.values(contentProperties), + (part) => part.isRequired, + ), + content: contentProperties, + }; + } + + getObjectSchemaContent = (schema) => { + const { properties, additionalProperties } = schema || {}; + + const propertiesContent = _.map(properties, (property, name) => { + const required = this.schemaUtils.isPropertyRequired( + name, + property, + schema, + ); + const rawTypeData = _.get( + this.schemaUtils.getSchemaRefType(property), + 'rawTypeData', + {}, + ); + const nullable = !!(rawTypeData.nullable || property.nullable); + const fieldName = this.typeNameFormatter.isValidName(name) + ? name + : this.config.Ts.StringValue(name); + const fieldValue = this.schemaParserFabric + .createSchemaParser({ + schema: property, + schemaPath: [...this.schemaPath, name], + }) + .getInlineParseContent(); + const readOnly = property.readOnly; + + return { + ...property, + $$raw: property, + title: property.title, + description: + property.description || + _.compact( + _.map( + property[this.schemaUtils.getComplexType(property)], + 'description', + ), + )[0] || + rawTypeData.description || + _.compact( + _.map( + rawTypeData[this.schemaUtils.getComplexType(rawTypeData)], + 'description', + ), + )[0] || + '', + isRequired: required, + isNullable: nullable, + name: fieldName, + value: fieldValue, + field: this.config.Ts.TypeField({ + readonly: readOnly && this.config.addReadonly, + optional: !required, + key: fieldName, + value: fieldValue, + }), + }; + }); + + if (additionalProperties) { + propertiesContent.push({ + $$raw: { additionalProperties }, + description: '', + isRequired: false, + field: this.config.Ts.InterfaceDynamicField( + this.config.Ts.Keyword.String, + this.config.Ts.Keyword.Any, + ), + }); + } + + return propertiesContent; + }; +} + +module.exports = { + ObjectSchemaParser, +}; diff --git a/src/schema-parser/base-schema-parsers/primitive.js b/src/schema-parser/base-schema-parsers/primitive.js new file mode 100644 index 00000000..48fee765 --- /dev/null +++ b/src/schema-parser/base-schema-parsers/primitive.js @@ -0,0 +1,63 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../../constants'); + +class PrimitiveSchemaParser extends MonoSchemaParser { + parse() { + let contentType = null; + const { additionalProperties, type, description, items } = + this.schema || {}; + + if (type === this.config.Ts.Keyword.Object && additionalProperties) { + const fieldType = _.isObject(additionalProperties) + ? this.schemaParserFabric + .createSchemaParser({ + schema: additionalProperties, + schemaPath: this.schemaPath, + }) + .getInlineParseContent() + : this.config.Ts.Keyword.Any; + contentType = this.config.Ts.RecordType( + this.config.Ts.Keyword.String, + fieldType, + ); + } + + if (_.isArray(type) && type.length) { + contentType = this.schemaParser._complexSchemaParsers.oneOf({ + ...(_.isObject(this.schema) ? this.schema : {}), + oneOf: type.map((type) => ({ type })), + }); + } + + if (_.isArray(items) && type === SCHEMA_TYPES.ARRAY) { + contentType = this.config.Ts.Tuple( + items.map((item) => + this.schemaParserFabric + .createSchemaParser({ schema: item, schemaPath: this.schemaPath }) + .getInlineParseContent(), + ), + ); + } + + return { + ...(_.isObject(this.schema) ? this.schema : {}), + $schemaPath: this.schemaPath.slice(), + $parsedSchema: true, + schemaType: SCHEMA_TYPES.PRIMITIVE, + type: SCHEMA_TYPES.PRIMITIVE, + typeIdentifier: this.config.Ts.Keyword.Type, + name: this.typeName, + description: this.schemaFormatters.formatDescription(description), + // TODO: probably it should be refactored. `type === 'null'` is not flexible + content: + type === this.config.Ts.Keyword.Null + ? type + : contentType || this.schemaUtils.getSchemaType(this.schema), + }; + } +} + +module.exports = { + PrimitiveSchemaParser, +}; diff --git a/src/schema-parser/complex-schema-parsers/all-of.js b/src/schema-parser/complex-schema-parsers/all-of.js new file mode 100644 index 00000000..8cbe0df5 --- /dev/null +++ b/src/schema-parser/complex-schema-parsers/all-of.js @@ -0,0 +1,26 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); + +// T1 & T2 +class AllOfSchemaParser extends MonoSchemaParser { + parse() { + const ignoreTypes = [this.config.Ts.Keyword.Any]; + const combined = _.map(this.schema.allOf, (childSchema) => + this.schemaParserFabric.getInlineParseContent( + this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), + null, + this.schemaPath, + ), + ); + const filtered = this.schemaUtils.filterSchemaContents( + combined, + (content) => !ignoreTypes.includes(content), + ); + + const type = this.config.Ts.IntersectionType(filtered); + + return this.schemaUtils.safeAddNullToType(this.schema, type); + } +} + +module.exports = { AllOfSchemaParser }; diff --git a/src/schema-parser/complex-schema-parsers/any-of.js b/src/schema-parser/complex-schema-parsers/any-of.js new file mode 100644 index 00000000..6a684274 --- /dev/null +++ b/src/schema-parser/complex-schema-parsers/any-of.js @@ -0,0 +1,34 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); + +// T1 | T2 | (T1 & T2) +class AnyOfSchemaParser extends MonoSchemaParser { + parse() { + const ignoreTypes = [this.config.Ts.Keyword.Any]; + const combined = _.map(this.schema.anyOf, (childSchema) => + this.schemaParserFabric.getInlineParseContent( + this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), + null, + this.schemaPath, + ), + ); + const filtered = this.schemaUtils.filterSchemaContents( + combined, + (content) => !ignoreTypes.includes(content), + ); + + const type = this.config.Ts.UnionType( + _.compact([ + ...filtered, + filtered.length > 1 && + this.config.Ts.ExpressionGroup( + this.config.Ts.IntersectionType(filtered), + ), + ]), + ); + + return this.schemaUtils.safeAddNullToType(this.schema, type); + } +} + +module.exports = { AnyOfSchemaParser }; diff --git a/src/schema-parser/complex-schema-parsers/not.js b/src/schema-parser/complex-schema-parsers/not.js new file mode 100644 index 00000000..b4b9bc71 --- /dev/null +++ b/src/schema-parser/complex-schema-parsers/not.js @@ -0,0 +1,9 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); + +class NotSchemaParser extends MonoSchemaParser { + parse() { + return this.config.Ts.Keyword.Any; + } +} + +module.exports = { NotSchemaParser }; diff --git a/src/schema-parser/complex-schema-parsers/one-of.js b/src/schema-parser/complex-schema-parsers/one-of.js new file mode 100644 index 00000000..ec8edf38 --- /dev/null +++ b/src/schema-parser/complex-schema-parsers/one-of.js @@ -0,0 +1,27 @@ +const { MonoSchemaParser } = require('../mono-schema-parser'); +const _ = require('lodash'); + +// T1 | T2 +class OneOfSchemaParser extends MonoSchemaParser { + parse() { + const ignoreTypes = [this.config.Ts.Keyword.Any]; + const combined = _.map(this.schema.oneOf, (childSchema) => + this.schemaParserFabric.getInlineParseContent( + this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), + null, + this.schemaPath, + ), + ); + + const filtered = this.schemaUtils.filterSchemaContents( + combined, + (content) => !ignoreTypes.includes(content), + ); + + const type = this.config.Ts.UnionType(filtered); + + return this.schemaUtils.safeAddNullToType(this.schema, type); + } +} + +module.exports = { OneOfSchemaParser }; diff --git a/src/schema-parser/mono-schema-parser.js b/src/schema-parser/mono-schema-parser.js new file mode 100644 index 00000000..6c4d2aa9 --- /dev/null +++ b/src/schema-parser/mono-schema-parser.js @@ -0,0 +1,48 @@ +class MonoSchemaParser { + schema; + typeName; + schemaPath; + + /** @type {Logger} */ + logger; + /** @type {SchemaParser} */ + schemaParser; + /** @type {SchemaParserFabric} */ + schemaParserFabric; + /** @type {TypeNameFormatter} */ + typeNameFormatter; + /** @type {SchemaComponentsMap} */ + schemaComponentsMap; + /** @type {SchemaUtils} */ + schemaUtils; + /** @type {CodeGenConfig} */ + config; + /** @type {SchemaFormatters} */ + schemaFormatters; + + constructor(schemaParser, schema, typeName = null, schemaPath = []) { + this.schemaParser = schemaParser; + this.schemaParserFabric = schemaParser.schemaParserFabric; + this.logger = schemaParser.logger; + this.schema = schema; + this.typeName = typeName; + this.typeNameFormatter = schemaParser.typeNameFormatter; + this.schemaPath = schemaPath; + this.schemaComponentsMap = this.schemaParser.schemaComponentsMap; + this.schemaUtils = this.schemaParser.schemaUtils; + this.config = this.schemaParser.config; + this.schemaFormatters = this.schemaParser.schemaFormatters; + } + + parse() { + throw new Error('not implemented'); + } + + buildTypeNameFromPath = () => { + return this.schemaUtils.buildTypeNameFromPath(this.schemaPath); + }; +} + +module.exports = { + MonoSchemaParser, +}; diff --git a/src/schema-parser/schema-formatters.js b/src/schema-parser/schema-formatters.js index 82c790c6..2ef9f229 100644 --- a/src/schema-parser/schema-formatters.js +++ b/src/schema-parser/schema-formatters.js @@ -1,29 +1,24 @@ -const { SCHEMA_TYPES } = require("../constants"); -const _ = require("lodash"); +const { SCHEMA_TYPES } = require('../constants'); +const _ = require('lodash'); class SchemaFormatters { - /** - * @type {CodeGenConfig} - */ + /** @type {CodeGenConfig} */ config; - /** - * @type {Logger} - */ + /** @type {Logger} */ logger; + /** @type {TemplatesWorker} */ + templatesWorker; + /** @type {SchemaUtils} */ + schemaUtils; + /** - * @type {SchemaParser} - */ - schemaParser; - /** - * @type {Templates} + * @param schemaParser {SchemaParser | SchemaParserFabric} */ - templates; - - constructor(config, logger, schemaParser, templates) { - this.config = config; - this.logger = logger; - this.schemaParser = schemaParser; - this.templates = templates; + constructor(schemaParser) { + this.config = schemaParser.config; + this.logger = schemaParser.logger; + this.schemaUtils = schemaParser.schemaUtils; + this.templatesWorker = schemaParser.templatesWorker; } base = { @@ -32,7 +27,9 @@ class SchemaFormatters { return { ...parsedSchema, $content: parsedSchema.content, - content: this.config.Ts.UnionType(_.map(parsedSchema.content, ({ value }) => value)), + content: this.config.Ts.UnionType( + _.map(parsedSchema.content, ({ value }) => value), + ), }; } @@ -43,7 +40,8 @@ class SchemaFormatters { }; }, [SCHEMA_TYPES.OBJECT]: (parsedSchema) => { - if (parsedSchema.nullable) return this.inline[SCHEMA_TYPES.OBJECT](parsedSchema); + if (parsedSchema.nullable) + return this.inline[SCHEMA_TYPES.OBJECT](parsedSchema); return { ...parsedSchema, $content: parsedSchema.content, @@ -68,7 +66,7 @@ class SchemaFormatters { ..._.map(parsedSchema.content, ({ value }) => `${value}`), parsedSchema.nullable && this.config.Ts.Keyword.Null, ]), - ), + ) || this.config.Ts.Keyword.Any, }; }, [SCHEMA_TYPES.OBJECT]: (parsedSchema) => { @@ -76,18 +74,23 @@ class SchemaFormatters { return { ...parsedSchema, typeIdentifier: this.config.Ts.Keyword.Type, - content: this.schemaParser.schemaUtils.safeAddNullToType(parsedSchema.content), + content: this.schemaUtils.safeAddNullToType(parsedSchema.content), }; } return { ...parsedSchema, typeIdentifier: this.config.Ts.Keyword.Type, - content: this.schemaParser.schemaUtils.safeAddNullToType( + content: this.schemaUtils.safeAddNullToType( parsedSchema, parsedSchema.content.length - ? this.config.Ts.ObjectWrapper(this.formatObjectContent(parsedSchema.content)) - : this.config.Ts.RecordType(Ts.Keyword.String, this.config.Ts.Keyword.Any), + ? this.config.Ts.ObjectWrapper( + this.formatObjectContent(parsedSchema.content), + ) + : this.config.Ts.RecordType( + this.config.Ts.Keyword.String, + this.config.Ts.Keyword.Any, + ), ), }; }, @@ -97,20 +100,22 @@ class SchemaFormatters { * @param parsedSchema {Record} * @param formatType {"base" | "inline"} */ - formatSchema = (parsedSchema, formatType = "base") => { - const schemaType = _.get(parsedSchema, ["schemaType"]) || _.get(parsedSchema, ["$parsed", "schemaType"]); + formatSchema = (parsedSchema, formatType = 'base') => { + const schemaType = + _.get(parsedSchema, ['schemaType']) || + _.get(parsedSchema, ['$parsed', 'schemaType']); const formatterFn = _.get(this, [formatType, schemaType]); return (formatterFn && formatterFn(parsedSchema)) || parsedSchema; }; formatDescription = (description, inline) => { - if (!description) return ""; + if (!description) return ''; let prettified = description; - prettified = _.replace(prettified, /\*\//g, "*/"); + prettified = _.replace(prettified, /\*\//g, '*/'); - const hasMultipleLines = _.includes(prettified, "\n"); + const hasMultipleLines = _.includes(prettified, '\n'); if (!hasMultipleLines) return prettified; @@ -119,31 +124,40 @@ class SchemaFormatters { .split(/\n/g) .map((part) => _.trim(part)) .compact() - .join(" ") + .join(' ') .valueOf(); } - return _.replace(prettified, /\n$/g, ""); + return _.replace(prettified, /\n$/g, ''); }; formatObjectContent = (content) => { - return _.map(content, (part) => { - const extraSpace = " "; + const fields = []; + + for (const part of content) { + const extraSpace = ' '; const result = `${extraSpace}${part.field},\n`; - const renderedJsDoc = this.templates.renderTemplate(this.config.templatesToRender.dataContractJsDoc, { - data: part, - }); + const renderedJsDoc = this.templatesWorker.renderTemplate( + this.config.templatesToRender.dataContractJsDoc, + { + data: part, + }, + ); const routeNameFromTemplate = renderedJsDoc - .split("\n") + .split('\n') .map((c) => `${extraSpace}${c}`) - .join("\n"); + .join('\n'); - if (routeNameFromTemplate) return `${routeNameFromTemplate}${result}`; + if (routeNameFromTemplate) { + fields.push(`${routeNameFromTemplate}${result}`); + } else { + fields.push(`${result}`); + } + } - return `${result}`; - }).join(""); + return fields.join(''); }; } diff --git a/src/schema-parser/schema-parser-fabric.js b/src/schema-parser/schema-parser-fabric.js new file mode 100644 index 00000000..0827e4f0 --- /dev/null +++ b/src/schema-parser/schema-parser-fabric.js @@ -0,0 +1,131 @@ +const _ = require('lodash'); +const { SchemaFormatters } = require('./schema-formatters'); +const { SchemaUtils } = require('./schema-utils'); +const { SchemaParser } = require('./schema-parser'); + +class SchemaParserFabric { + /** @type {CodeGenConfig} */ + config; + /** @type {Logger} */ + logger; + /** @type {SchemaComponentsMap} */ + schemaComponentsMap; + /** @type {TypeNameFormatter} */ + typeNameFormatter; + /** @type {SchemaFormatters} */ + schemaFormatters; + /** @type {TemplatesWorker} */ + templatesWorker; + /** @type {SchemaUtils} */ + schemaUtils; + /** @type {SchemaWalker} */ + schemaWalker; + + constructor({ + config, + logger, + templatesWorker, + schemaComponentsMap, + typeNameFormatter, + schemaWalker, + }) { + this.config = config; + this.logger = logger; + this.schemaComponentsMap = schemaComponentsMap; + this.typeNameFormatter = typeNameFormatter; + this.templatesWorker = templatesWorker; + this.schemaWalker = schemaWalker; + this.schemaUtils = new SchemaUtils(this); + this.schemaFormatters = new SchemaFormatters(this); + } + + createSchemaParser = ({ schema, typeName, schemaPath }) => { + return new SchemaParser(this, { schema, typeName, schemaPath }); + }; + + /** + * + * @param content schema content + * @param linkedSchema link content to attached schema + * @param linkedComponent link content and other schema props to attached component + * @param schemaPath + * @param otherSchemaProps + * @returns {{}} + */ + createSchema = ({ + content, + linkedSchema = {}, + linkedComponent, + schemaPath, + ...otherSchemaProps + }) => { + const parser = this.createSchemaParser({ + schema: linkedComponent || linkedSchema, + schemaPath, + }); + const parsed = parser.parseSchema(); + parsed.content = content; + Object.assign(parsed, otherSchemaProps); + if (linkedComponent) { + linkedComponent.typeData = parsed; + } + return parser.schema; + }; + + createParsedComponent = ({ typeName, schema, schemaPath }) => { + const schemaCopy = _.cloneDeep(schema); + const customComponent = this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef(['components', 'schemas', typeName]), + schemaCopy, + ); + const parsed = this.parseSchema(schemaCopy, null, schemaPath); + parsed.name = typeName; + customComponent.typeData = parsed; + + return customComponent; + }; + + /** + * + * @param schema {any} + * @param typeName {null | string} + * @param [schemaPath] {string[]} + * @return {Record} + */ + parseSchema = (schema, typeName = null, schemaPath = []) => { + const schemaParser = this.createSchemaParser({ + schema, + typeName, + schemaPath, + }); + return schemaParser.parseSchema(); + }; + + /** + * + * @param schema {any} + * @param typeName {null | string} + * @param [schemaPath] {string[]} + * @return {Record} + */ + getInlineParseContent = (schema, typeName, schemaPath) => { + const parser = this.createSchemaParser({ schema, typeName, schemaPath }); + return parser.getInlineParseContent(); + }; + + /** + * + * @param schema {any} + * @param typeName {null | string} + * @param [schemaPath] {string[]} + * @return {Record} + */ + getParseContent = (schema, typeName, schemaPath) => { + const parser = this.createSchemaParser({ schema, typeName, schemaPath }); + return parser.getParseContent(); + }; +} + +module.exports = { + SchemaParserFabric, +}; diff --git a/src/schema-parser/schema-parser.js b/src/schema-parser/schema-parser.js index 1ef7da5c..d27d310b 100644 --- a/src/schema-parser/schema-parser.js +++ b/src/schema-parser/schema-parser.js @@ -1,421 +1,272 @@ -const { SCHEMA_TYPES } = require("../constants.js"); -const _ = require("lodash"); -const { SchemaFormatters } = require("./schema-formatters"); -const { internalCase } = require("../util/internal-case"); -const { SchemaUtils } = require("./schema-utils"); -const { camelCase } = require("lodash"); -const { pascalCase } = require("../util/pascal-case"); +/* eslint-disable no-unused-vars */ +const { SCHEMA_TYPES } = require('../constants.js'); +const _ = require('lodash'); +const { SchemaFormatters } = require('./schema-formatters'); +const { SchemaUtils } = require('./schema-utils'); +const { + DiscriminatorSchemaParser, +} = require('./base-schema-parsers/discriminator'); +const { EnumSchemaParser } = require('./base-schema-parsers/enum'); +const { ObjectSchemaParser } = require('./base-schema-parsers/object'); +const { PrimitiveSchemaParser } = require('./base-schema-parsers/primitive'); +const { ComplexSchemaParser } = require('./base-schema-parsers/complex'); +const { OneOfSchemaParser } = require('./complex-schema-parsers/one-of'); +const { AllOfSchemaParser } = require('./complex-schema-parsers/all-of'); +const { AnyOfSchemaParser } = require('./complex-schema-parsers/any-of'); +const { NotSchemaParser } = require('./complex-schema-parsers/not'); +const { ArraySchemaParser } = require('./base-schema-parsers/array'); +const { sortByProperty } = require('../util/sort-by-property'); class SchemaParser { - /** - * @type {CodeGenConfig} - */ + /** @type {SchemaParserFabric} */ + schemaParserFabric; + /** @type {CodeGenConfig} */ config; - - /** - * @type {SchemaComponentsMap} - */ + /** @type {Logger} */ + logger; + /** @type {SchemaComponentsMap} */ schemaComponentsMap; - /** - * @type {TypeName} - */ - typeName; - /** - * @type {SchemaFormatters} - */ + /** @type {TypeNameFormatter} */ + typeNameFormatter; + /** @type {SchemaFormatters} */ schemaFormatters; - - /** - * @type {SchemaUtils} - */ + /** @type {SchemaUtils} */ schemaUtils; + /** @type {TemplatesWorker} */ + templatesWorker; + /** @type {SchemaWalker} */ + schemaWalker; - $processingSchemaPath = []; - - constructor(config, logger, templates, schemaComponentsMap, typeName) { - this.config = config; - this.schemaComponentsMap = schemaComponentsMap; - this.typeName = typeName; - this.schemaFormatters = new SchemaFormatters(config, logger, this, templates); - this.schemaUtils = new SchemaUtils(config, schemaComponentsMap); + typeName; + schema; + schemaPath = []; + + constructor(schemaParserFabric, { typeName, schema, schemaPath } = {}) { + this.schemaParserFabric = schemaParserFabric; + this.config = schemaParserFabric.config; + this.logger = schemaParserFabric.logger; + this.templatesWorker = schemaParserFabric.templatesWorker; + this.schemaComponentsMap = schemaParserFabric.schemaComponentsMap; + this.typeNameFormatter = schemaParserFabric.typeNameFormatter; + this.schemaWalker = schemaParserFabric.schemaWalker; + this.schemaFormatters = schemaParserFabric.schemaFormatters; + this.schemaUtils = schemaParserFabric.schemaUtils; + + this.typeName = typeName || null; + this.schema = schema; + this.schemaPath = [...(schemaPath || [])]; } - complexSchemaParsers = { - // T1 | T2 + _complexSchemaParsers = { [SCHEMA_TYPES.COMPLEX_ONE_OF]: (schema) => { - const ignoreTypes = [this.config.Ts.Keyword.Any]; - const combined = _.map(schema.oneOf, (childSchema) => - this.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(schema, childSchema)), + const SchemaParser = + this.config.schemaParsers.complexOneOf || OneOfSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + null, + this.schemaPath, ); - const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content)); - - const type = this.config.Ts.UnionType(filtered); - - return this.schemaUtils.safeAddNullToType(schema, type); + return schemaParser.parse(); }, - // T1 & T2 [SCHEMA_TYPES.COMPLEX_ALL_OF]: (schema) => { - const ignoreTypes = [...this.config.jsPrimitiveTypes, this.config.Ts.Keyword.Any]; - const combined = _.map(schema.allOf, (childSchema) => - this.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(schema, childSchema)), + const SchemaParser = + this.config.schemaParsers.complexAllOf || AllOfSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + null, + this.schemaPath, ); - const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content)); - - const type = this.config.Ts.IntersectionType(filtered); - - return this.schemaUtils.safeAddNullToType(schema, type); + return schemaParser.parse(); }, - // T1 | T2 | (T1 & T2) [SCHEMA_TYPES.COMPLEX_ANY_OF]: (schema) => { - const ignoreTypes = [...this.config.jsPrimitiveTypes, this.config.Ts.Keyword.Any]; - const combined = _.map(schema.anyOf, (childSchema) => - this.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(schema, childSchema)), - ); - const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content)); - - const type = this.config.Ts.UnionType( - _.compact([ - ...filtered, - filtered.length > 1 && this.config.Ts.ExpressionGroup(this.config.Ts.IntersectionType(filtered)), - ]), + const SchemaParser = + this.config.schemaParsers.complexAnyOf || AnyOfSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + null, + this.schemaPath, ); - - return this.schemaUtils.safeAddNullToType(schema, type); + return schemaParser.parse(); }, - // TODO [SCHEMA_TYPES.COMPLEX_NOT]: (schema) => { - // TODO - return this.config.Ts.Keyword.Any; + const SchemaParser = + this.config.schemaParsers.complexNot || NotSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + null, + this.schemaPath, + ); + return schemaParser.parse(); }, }; - baseSchemaParsers = { + _baseSchemaParsers = { [SCHEMA_TYPES.ENUM]: (schema, typeName) => { - if (this.config.extractEnums && !typeName) { - const generatedTypeName = this.config.componentTypeNameResolver.resolve([this.buildTypeNameFromPath()], false); - const schemaComponent = this.schemaComponentsMap.createComponent("schemas", generatedTypeName, { ...schema }); - return this.parseSchema(schemaComponent, generatedTypeName); - } - - const refType = this.schemaUtils.getSchemaRefType(schema); - const $ref = (refType && refType.$ref) || null; - - if (Array.isArray(schema.enum) && Array.isArray(schema.enum[0])) { - return this.parseSchema( - { - oneOf: schema.enum.map((enumNames) => ({ - type: "array", - items: enumNames.map((enumName) => ({ type: "string", enum: [enumName] })), - })), - }, - typeName, - ); - } - - const keyType = this.getSchemaType(schema); - const enumNames = this.schemaUtils.getEnumNames(schema); - let content = null; - - const formatValue = (value) => { - if (value === null) { - return this.config.Ts.NullValue(value); - } - if (keyType === this.getSchemaType({ type: "number" })) { - return this.config.Ts.NumberValue(value); - } - if (keyType === this.getSchemaType({ type: "boolean" })) { - return this.config.Ts.BooleanValue(value); - } - - return this.config.Ts.StringValue(value); - }; - - if (_.isArray(enumNames) && _.size(enumNames)) { - content = _.map(enumNames, (enumName, index) => { - const enumValue = _.get(schema.enum, index); - const formattedKey = - (enumName && - this.typeName.format(enumName, { - type: "enum-key", - })) || - this.typeName.format(`${enumValue}`, { - type: "enum-key", - }); - - if (this.config.enumNamesAsValues || _.isUndefined(enumValue)) { - return { - key: formattedKey, - type: this.config.Ts.Keyword.String, - value: this.config.Ts.StringValue(enumName), - }; - } - - return { - key: formattedKey, - type: keyType, - value: formatValue(enumValue), - }; - }); - } else { - content = _.map(schema.enum, (key) => { - return { - key: this.typeName.format(`${key}`, { - type: "enum-key", - }), - type: keyType, - value: formatValue(key), - }; - }); - } - - return { - ...(_.isObject(schema) ? schema : {}), - $ref: $ref, - typeName: typeName || ($ref && refType.typeName) || null, - $parsedSchema: true, - schemaType: SCHEMA_TYPES.ENUM, - type: SCHEMA_TYPES.ENUM, - keyType: keyType, - typeIdentifier: this.config.generateUnionEnums ? this.config.Ts.Keyword.Type : this.config.Ts.Keyword.Enum, - name: typeName, - description: this.schemaFormatters.formatDescription(schema.description), - content, - }; + const SchemaParser = this.config.schemaParsers.enum || EnumSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + typeName, + this.schemaPath, + ); + return schemaParser.parse(); }, [SCHEMA_TYPES.OBJECT]: (schema, typeName) => { - const contentProperties = this.getObjectSchemaContent(schema); - - return { - ...(_.isObject(schema) ? schema : {}), - $parsedSchema: true, - schemaType: SCHEMA_TYPES.OBJECT, - type: SCHEMA_TYPES.OBJECT, - typeIdentifier: this.config.Ts.Keyword.Interface, - name: typeName, - description: this.schemaFormatters.formatDescription(schema.description), - allFieldsAreOptional: !_.some(_.values(contentProperties), (part) => part.isRequired), - content: contentProperties, - }; + const SchemaParser = + this.config.schemaParsers.object || ObjectSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + typeName, + this.schemaPath, + ); + return schemaParser.parse(); }, [SCHEMA_TYPES.COMPLEX]: (schema, typeName) => { - const complexType = this.getComplexType(schema); - const simpleSchema = _.omit(_.clone(schema), _.keys(this.complexSchemaParsers)); - const complexSchemaContent = this.complexSchemaParsers[complexType](schema); - - return { - ...(_.isObject(schema) ? schema : {}), - $parsedSchema: true, - schemaType: SCHEMA_TYPES.COMPLEX, - type: SCHEMA_TYPES.PRIMITIVE, - typeIdentifier: this.config.Ts.Keyword.Type, - name: typeName, - description: this.schemaFormatters.formatDescription( - schema.description || _.compact(_.map(schema[complexType], "description"))[0] || "", - ), - content: - this.config.Ts.IntersectionType( - _.compact([ - this.config.Ts.ExpressionGroup(complexSchemaContent), - this.getInternalSchemaType(simpleSchema) === SCHEMA_TYPES.OBJECT && - this.config.Ts.ExpressionGroup(this.getInlineParseContent(simpleSchema)), - ]), - ) || this.config.Ts.Keyword.Any, - }; + const SchemaParser = + this.config.schemaParsers.complex || ComplexSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + typeName, + this.schemaPath, + ); + return schemaParser.parse(); }, [SCHEMA_TYPES.PRIMITIVE]: (schema, typeName) => { - let contentType = null; - const { additionalProperties, type, description, items } = schema || {}; - - if (type === this.config.Ts.Keyword.Object && additionalProperties) { - const fieldType = _.isObject(additionalProperties) - ? this.getInlineParseContent(additionalProperties) - : this.config.Ts.Keyword.Any; - contentType = this.config.Ts.RecordType(this.config.Ts.Keyword.String, fieldType); - } - - if (_.isArray(type) && type.length) { - contentType = this.complexSchemaParsers.oneOf({ - ...(_.isObject(schema) ? schema : {}), - oneOf: type.map((type) => ({ type })), - }); - } - - if (_.isArray(items) && type === SCHEMA_TYPES.ARRAY) { - contentType = this.config.Ts.Tuple(items.map((item) => this.getInlineParseContent(item))); - } - - return { - ...(_.isObject(schema) ? schema : {}), - $parsedSchema: true, - schemaType: SCHEMA_TYPES.PRIMITIVE, - type: SCHEMA_TYPES.PRIMITIVE, - typeIdentifier: this.config.Ts.Keyword.Type, - name: typeName, - description: this.schemaFormatters.formatDescription(description), - // TODO: probably it should be refactored. `type === 'null'` is not flexible - content: type === this.config.Ts.Keyword.Null ? type : contentType || this.getSchemaType(schema), - }; + const SchemaParser = + this.config.schemaParsers.primitive || PrimitiveSchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + typeName, + this.schemaPath, + ); + return schemaParser.parse(); }, - }; - - getInternalSchemaType = (schema) => { - if (!_.isEmpty(schema.enum) || !_.isEmpty(this.schemaUtils.getEnumNames(schema))) return SCHEMA_TYPES.ENUM; - if (schema.allOf || schema.oneOf || schema.anyOf || schema.not) return SCHEMA_TYPES.COMPLEX; - if (!_.isEmpty(schema.properties)) return SCHEMA_TYPES.OBJECT; - - return SCHEMA_TYPES.PRIMITIVE; - }; - - getSchemaType = (schema) => { - if (!schema) return this.config.Ts.Keyword.Any; - - const refTypeInfo = this.schemaUtils.getSchemaRefType(schema); - - if (refTypeInfo) { - return this.schemaUtils.checkAndAddRequiredKeys( + [SCHEMA_TYPES.DISCRIMINATOR]: (schema, typeName) => { + const SchemaParser = + this.config.schemaParsers.discriminator || DiscriminatorSchemaParser; + const schemaParser = new SchemaParser( + this, schema, - this.schemaUtils.safeAddNullToType(schema, this.typeName.format(refTypeInfo.typeName)), + typeName, + this.schemaPath, ); - } - - const primitiveType = this.schemaUtils.getSchemaPrimitiveType(schema); - - if (primitiveType == null) return this.config.Ts.Keyword.Any; - - let resultType; - - const typeAlias = - _.get(this.config.primitiveTypes, [primitiveType, schema.format]) || - _.get(this.config.primitiveTypes, [primitiveType, "$default"]) || - this.config.primitiveTypes[primitiveType]; - - if (_.isFunction(typeAlias)) { - resultType = typeAlias(schema, this); - } else { - resultType = typeAlias || primitiveType; - } - - if (!resultType) return this.config.Ts.Keyword.Any; - - return this.schemaUtils.checkAndAddRequiredKeys(schema, this.schemaUtils.safeAddNullToType(schema, resultType)); - }; - - getObjectSchemaContent = (schema) => { - const { properties, additionalProperties } = schema || {}; - - const propertiesContent = _.map(properties, (property, name) => { - this.$processingSchemaPath.push(name); - const required = this.schemaUtils.isPropertyRequired(name, property, schema); - const rawTypeData = _.get(this.schemaUtils.getSchemaRefType(property), "rawTypeData", {}); - const nullable = !!(rawTypeData.nullable || property.nullable); - const fieldName = this.typeName.isValidName(name) ? name : this.config.Ts.StringValue(name); - const fieldValue = this.getInlineParseContent(property); - const readOnly = property.readOnly; - - this.$processingSchemaPath.pop(); - - return { - ...property, - $$raw: property, - title: property.title, - description: - property.description || - _.compact(_.map(property[this.getComplexType(property)], "description"))[0] || - rawTypeData.description || - _.compact(_.map(rawTypeData[this.getComplexType(rawTypeData)], "description"))[0] || - "", - isRequired: required, - isNullable: nullable, - name: fieldName, - value: fieldValue, - field: this.config.Ts.TypeField({ - readonly: readOnly && this.config.addReadonly, - optional: !required, - key: fieldName, - value: fieldValue, - }), - }; - }); - - if (additionalProperties) { - propertiesContent.push({ - $$raw: { additionalProperties }, - description: "", - isRequired: false, - field: this.config.Ts.InterfaceDynamicField(this.config.Ts.Keyword.String, this.config.Ts.Keyword.Any), - }); - } - - return propertiesContent; - }; - - getComplexType = (schema) => { - if (schema.oneOf) return SCHEMA_TYPES.COMPLEX_ONE_OF; - if (schema.allOf) return SCHEMA_TYPES.COMPLEX_ALL_OF; - if (schema.anyOf) return SCHEMA_TYPES.COMPLEX_ANY_OF; - // TODO :( - if (schema.not) return SCHEMA_TYPES.COMPLEX_NOT; - - return SCHEMA_TYPES.COMPLEX_UNKNOWN; + return schemaParser.parse(); + }, + [SCHEMA_TYPES.ARRAY]: (schema, typeName) => { + const SchemaParser = this.config.schemaParsers.array || ArraySchemaParser; + const schemaParser = new SchemaParser( + this, + schema, + typeName, + this.schemaPath, + ); + return schemaParser.parse(); + }, }; /** - * - * @param schema {any} - * @param typeName {null | string} - * @param formatter {"inline" | "base"} * @return {Record} */ - parseSchema = (schema, typeName = null) => { - if (!schema) return this.baseSchemaParsers[SCHEMA_TYPES.PRIMITIVE](null, typeName); + parseSchema = () => { + if (!this.schema) + return this._baseSchemaParsers[SCHEMA_TYPES.PRIMITIVE]( + null, + this.typeName, + ); let schemaType = null; let parsedSchema = null; - if (typeof schema === "string") { - return schema; + if (typeof this.schema === 'string') { + return this.schema; } - if (!schema.$parsed) { - if (!typeName && this.schemaUtils.isRefSchema(schema)) { - typeName = this.getSchemaType(schema); + if (!this.schema.$parsed) { + if (!this.typeName && this.schemaUtils.isRefSchema(this.schema)) { + this.typeName = this.schemaUtils.getSchemaType(this.schema); } - if (schema.items && !Array.isArray(schema.items) && !schema.type) { - schema.type = SCHEMA_TYPES.ARRAY; + /** + * swagger schemas fixes + * ----> + */ + if ( + this.schema.items && + !Array.isArray(this.schema.items) && + !this.schema.type + ) { + this.schema.type = SCHEMA_TYPES.ARRAY; + } + if ( + Array.isArray(this.schema.enum) && + this.schema.enum.length === 1 && + this.schema.enum[0] == null + ) { + this.logger.debug('invalid enum schema', this.schema); + this.schema = { type: this.config.Ts.Keyword.Null }; } - schemaType = this.getInternalSchemaType(schema); + /** + * <---- + */ - this.$processingSchemaPath.push(typeName); + schemaType = this.schemaUtils.getInternalSchemaType(this.schema); - _.merge(schema, this.config.hooks.onPreParseSchema(schema, typeName, schemaType)); - parsedSchema = this.baseSchemaParsers[schemaType](schema, typeName); - schema.$parsed = this.config.hooks.onParseSchema(schema, parsedSchema) || parsedSchema; + this.schemaPath.push(this.typeName); - this.$processingSchemaPath.pop(); + _.merge( + this.schema, + this.config.hooks.onPreParseSchema( + this.schema, + this.typeName, + schemaType, + ), + ); + parsedSchema = this._baseSchemaParsers[schemaType]( + this.schema, + this.typeName, + ); + this.schema.$parsed = + this.config.hooks.onParseSchema(this.schema, parsedSchema) || + parsedSchema; + + if ( + this.config.sortTypes && + Array.isArray(this.schema.$parsed?.content) + ) { + this.schema.$parsed.content = this.schema.$parsed.content.sort( + sortByProperty('name'), + ); + } } - return schema.$parsed; - }; + this.schemaPath.pop(); - getInlineParseContent = (rawTypeData, typeName) => { - const parsedSchema = this.parseSchema(rawTypeData, typeName); - const formattedSchema = this.schemaFormatters.formatSchema(parsedSchema, "inline"); - return formattedSchema.content; + return this.schema.$parsed; }; - getParseContent = (rawTypeData, typeName) => { - const parsedSchema = this.parseSchema(rawTypeData, typeName); - const formattedSchema = this.schemaFormatters.formatSchema(parsedSchema, "base"); + getInlineParseContent = () => { + const parsedSchema = this.parseSchema(); + const formattedSchema = this.schemaFormatters.formatSchema( + parsedSchema, + 'inline', + ); return formattedSchema.content; }; - buildTypeNameFromPath = () => { - const schemaPath = _.uniq(_.compact(this.$processingSchemaPath)); - - if (!schemaPath || !schemaPath[0]) return null; - - return internalCase(camelCase(`${schemaPath[0]}_${schemaPath[schemaPath.length - 1]}`)); + getParseContent = () => { + const parsedSchema = this.parseSchema(); + const formattedSchema = this.schemaFormatters.formatSchema( + parsedSchema, + 'base', + ); + return formattedSchema.content; }; } diff --git a/src/schema-parser/schema-utils.js b/src/schema-parser/schema-utils.js index b530ddf5..c5c02643 100644 --- a/src/schema-parser/schema-utils.js +++ b/src/schema-parser/schema-utils.js @@ -1,42 +1,58 @@ -const _ = require("lodash"); -const { SCHEMA_TYPES } = require("../constants"); -const { internalCase } = require("../util/internal-case"); -const { pascalCase } = require("../util/pascal-case"); +const _ = require('lodash'); +const { SCHEMA_TYPES } = require('../constants'); +const { internalCase } = require('../util/internal-case'); +const { pascalCase } = require('../util/pascal-case'); +const { camelCase } = require('lodash'); class SchemaUtils { - /** - * @type {CodeGenConfig} - */ + /** @type {CodeGenConfig} */ config; - /** - * @type {SchemaComponentsMap} - */ + /** @type {SchemaComponentsMap} */ schemaComponentsMap; + /** @type {TypeNameFormatter} */ + typeNameFormatter; + /** @type {SchemaWalker} */ + schemaWalker; - constructor(config, schemaComponentsMap) { + constructor({ + config, + schemaComponentsMap, + typeNameFormatter, + schemaWalker, + }) { this.config = config; this.schemaComponentsMap = schemaComponentsMap; + this.typeNameFormatter = typeNameFormatter; + this.schemaWalker = schemaWalker; } getRequiredProperties = (schema) => { - return _.uniq((schema && _.isArray(schema.required) && schema.required) || []); + return _.uniq( + (schema && _.isArray(schema.required) && schema.required) || [], + ); }; isRefSchema = (schema) => { - return !!(schema && schema["$ref"]); + return !!(schema && schema['$ref']); }; getEnumNames = (schema) => { - return schema["x-enumNames"] || schema["xEnumNames"] || schema["x-enumnames"] || schema["x-enum-varnames"]; + return ( + schema['x-enumNames'] || + schema['xEnumNames'] || + schema['x-enumnames'] || + schema['x-enum-varnames'] + ); }; getSchemaRefType = (schema) => { if (!this.isRefSchema(schema)) return null; + // const resolved = this.schemaWalker.findByRef(schema.$ref); return this.schemaComponentsMap.get(schema.$ref); }; isPropertyRequired = (name, propertySchema, rootSchema) => { - if (propertySchema["x-omitempty"] === false) { + if (propertySchema['x-omitempty'] === false) { return true; } @@ -57,7 +73,9 @@ class SchemaUtils { isNullMissingInType = (schema, type) => { const { nullable, type: schemaType } = schema || {}; return ( - (nullable || !!_.get(schema, "x-nullable") || schemaType === this.config.Ts.Keyword.Null) && + (nullable || + !!_.get(schema, 'x-nullable') || + schemaType === this.config.Ts.Keyword.Null) && _.isString(type) && !type.includes(` ${this.config.Ts.Keyword.Null}`) && !type.includes(`${this.config.Ts.Keyword.Null} `) @@ -86,7 +104,7 @@ class SchemaUtils { if (_.keys(schema.properties).length) { return SCHEMA_TYPES.OBJECT; } - if (!!schema.items) { + if (schema.items) { return SCHEMA_TYPES.ARRAY; } @@ -94,16 +112,21 @@ class SchemaUtils { }; checkAndAddRequiredKeys = (schema, resultType) => { - if ("$$requiredKeys" in schema && schema.$$requiredKeys.length) { + if ('$$requiredKeys' in schema && schema.$$requiredKeys.length) { this.config.update({ internalTemplateOptions: { addUtilRequiredKeysType: true, }, }); - return this.config.Ts.TypeWithGeneric(this.config.Ts.CodeGenKeyword.UtilRequiredKeys, [ - resultType, - this.config.Ts.UnionType(schema.$$requiredKeys.map(this.config.Ts.StringValue)), - ]); + return this.config.Ts.TypeWithGeneric( + this.config.Ts.CodeGenKeyword.UtilRequiredKeys, + [ + resultType, + this.config.Ts.UnionType( + schema.$$requiredKeys.map(this.config.Ts.StringValue), + ), + ], + ); } return resultType; @@ -112,13 +135,20 @@ class SchemaUtils { makeAddRequiredToChildSchema = (parentSchema, childSchema) => { if (!childSchema) return childSchema; - const required = _.uniq([...this.getRequiredProperties(parentSchema), ...this.getRequiredProperties(childSchema)]); + const required = _.uniq([ + ...this.getRequiredProperties(parentSchema), + ...this.getRequiredProperties(childSchema), + ]); const refData = this.getSchemaRefType(childSchema); if (refData) { - const refObjectProperties = _.keys((refData.rawTypeData && refData.rawTypeData.properties) || {}); - const existedRequiredKeys = refObjectProperties.filter((key) => required.includes(key)); + const refObjectProperties = _.keys( + (refData.rawTypeData && refData.rawTypeData.properties) || {}, + ); + const existedRequiredKeys = refObjectProperties.filter((key) => + required.includes(key), + ); if (!existedRequiredKeys.length) return childSchema; @@ -128,12 +158,17 @@ class SchemaUtils { }; } else if (childSchema.properties) { const childSchemaProperties = _.keys(childSchema.properties); - const existedRequiredKeys = childSchemaProperties.filter((key) => required.includes(key)); + const existedRequiredKeys = childSchemaProperties.filter((key) => + required.includes(key), + ); if (!existedRequiredKeys.length) return childSchema; return { - required: _.uniq([...this.getRequiredProperties(childSchema), ...existedRequiredKeys]), + required: _.uniq([ + ...this.getRequiredProperties(childSchema), + ...existedRequiredKeys, + ]), ...childSchema, }; } @@ -145,20 +180,110 @@ class SchemaUtils { return _.uniq(_.filter(contents, (type) => filterFn(type))); }; - resolveTypeName = (typeName, suffixes, resolver, shouldReserve = true) => { + resolveTypeName = ( + typeName, + { suffixes, resolver, prefixes, shouldReserve = true }, + ) => { if (resolver) { - return this.config.componentTypeNameResolver.resolve((reserved) => { - const variant = resolver(pascalCase(typeName), reserved); - if (variant == null) return variant; - return pascalCase(variant); + return this.config.componentTypeNameResolver.resolve(null, (reserved) => { + return resolver(pascalCase(typeName), reserved); }); } else { return this.config.componentTypeNameResolver.resolve( - suffixes.map((suffix) => pascalCase(`${typeName} ${suffix}`)), + [ + ...(prefixes || []).map((prefix) => + pascalCase(`${prefix} ${typeName}`), + ), + ...(suffixes || []).map((suffix) => + pascalCase(`${typeName} ${suffix}`), + ), + ], shouldReserve, ); } }; + + getComplexType = (schema) => { + if (schema.oneOf) return SCHEMA_TYPES.COMPLEX_ONE_OF; + if (schema.allOf) return SCHEMA_TYPES.COMPLEX_ALL_OF; + if (schema.anyOf) return SCHEMA_TYPES.COMPLEX_ANY_OF; + // TODO :( + if (schema.not) return SCHEMA_TYPES.COMPLEX_NOT; + + return SCHEMA_TYPES.COMPLEX_UNKNOWN; + }; + + getInternalSchemaType = (schema) => { + if (!_.isEmpty(schema.enum) || !_.isEmpty(this.getEnumNames(schema))) { + return SCHEMA_TYPES.ENUM; + } + if (schema.discriminator) { + return SCHEMA_TYPES.DISCRIMINATOR; + } + if (schema.allOf || schema.oneOf || schema.anyOf || schema.not) { + return SCHEMA_TYPES.COMPLEX; + } + if (!_.isEmpty(schema.properties)) { + return SCHEMA_TYPES.OBJECT; + } + if (schema.type === SCHEMA_TYPES.ARRAY) { + return SCHEMA_TYPES.ARRAY; + } + + return SCHEMA_TYPES.PRIMITIVE; + }; + + getSchemaType = (schema) => { + if (!schema) return this.config.Ts.Keyword.Any; + + const refTypeInfo = this.getSchemaRefType(schema); + + if (refTypeInfo) { + return this.checkAndAddRequiredKeys( + schema, + this.safeAddNullToType( + schema, + this.typeNameFormatter.format(refTypeInfo.typeName), + ), + ); + } + + const primitiveType = this.getSchemaPrimitiveType(schema); + + if (primitiveType == null) return this.config.Ts.Keyword.Any; + + let resultType; + + const typeAlias = + _.get(this.config.primitiveTypes, [primitiveType, schema.format]) || + _.get(this.config.primitiveTypes, [primitiveType, '$default']) || + this.config.primitiveTypes[primitiveType]; + + if (_.isFunction(typeAlias)) { + resultType = typeAlias(schema, this); + } else { + resultType = typeAlias || primitiveType; + } + + if (!resultType) return this.config.Ts.Keyword.Any; + + return this.checkAndAddRequiredKeys( + schema, + this.safeAddNullToType(schema, resultType), + ); + }; + + buildTypeNameFromPath = (schemaPath) => { + schemaPath = _.uniq(_.compact(schemaPath)); + + if (!schemaPath || !schemaPath[0]) return null; + + return pascalCase( + camelCase( + _.uniq([schemaPath[0], schemaPath[schemaPath.length - 1]]).join('_'), + ), + ); + }; } module.exports = { diff --git a/src/schema-parser/util/enum-key-resolver.js b/src/schema-parser/util/enum-key-resolver.js new file mode 100644 index 00000000..8db6a226 --- /dev/null +++ b/src/schema-parser/util/enum-key-resolver.js @@ -0,0 +1,26 @@ +const { NameResolver } = require('../../util/name-resolver'); + +class EnumKeyResolver extends NameResolver { + counter = 1; + /** + * @param {CodeGenConfig} config; + * @param {Logger} logger; + * @param {string[]} reservedNames + */ + constructor(config, logger, reservedNames) { + super(config, logger, reservedNames, (variants) => { + const generatedVariant = + (variants[0] && `${variants[0]}${this.counter++}`) || + `${this.config.enumKeyResolverName}${this.counter++}`; + this.logger.debug( + 'generated fallback type name for enum key - ', + generatedVariant, + ); + return generatedVariant; + }); + } +} + +module.exports = { + EnumKeyResolver, +}; diff --git a/src/schema-parser/schema-routes.js b/src/schema-routes/schema-routes.js similarity index 54% rename from src/schema-parser/schema-routes.js rename to src/schema-routes/schema-routes.js index 37fd4090..ba857e36 100644 --- a/src/schema-parser/schema-routes.js +++ b/src/schema-routes/schema-routes.js @@ -1,22 +1,24 @@ -const _ = require("lodash"); -const { generateId } = require("../util/id.js"); -const { SpecificArgNameResolver } = require("../util/name-resolver.js"); +const _ = require('lodash'); +const { generateId } = require('../util/id.js'); +const { + SpecificArgNameResolver, +} = require('./util/specific-arg-name-resolver'); const { DEFAULT_BODY_ARG_NAME, RESERVED_BODY_ARG_NAMES, RESERVED_HEADER_ARG_NAMES, RESERVED_PATH_ARG_NAMES, RESERVED_QUERY_ARG_NAMES, -} = require("../constants.js"); -const { pascalCase } = require("../util/pascal-case"); +} = require('../constants.js'); +const { camelCase } = require('lodash'); const CONTENT_KIND = { - JSON: "JSON", - URL_ENCODED: "URL_ENCODED", - FORM_DATA: "FORM_DATA", - IMAGE: "IMAGE", - OTHER: "OTHER", - TEXT: "TEXT", + JSON: 'JSON', + URL_ENCODED: 'URL_ENCODED', + FORM_DATA: 'FORM_DATA', + IMAGE: 'IMAGE', + OTHER: 'OTHER', + TEXT: 'TEXT', }; class SchemaRoutes { @@ -25,29 +27,29 @@ class SchemaRoutes { */ config; /** - * @type {SchemaParser} + * @type {SchemaParserFabric} */ - schemaParser; + schemaParserFabric; /** * @type {SchemaUtils} */ schemaUtils; /** - * @type {TypeName} + * @type {TypeNameFormatter} */ - typeName; + typeNameFormatter; /** * @type {SchemaComponentsMap} */ - schemaComponentMap; + schemaComponentsMap; /** * @type {Logger} */ logger; /** - * @type {Templates} + * @type {TemplatesWorker} */ - templates; + templatesWorker; FORM_DATA_TYPES = []; @@ -56,28 +58,38 @@ class SchemaRoutes { hasQueryRoutes = false; hasFormDataRoutes = false; - constructor(config, schemaParser, schemaComponentMap, logger, templates, typeName) { + constructor({ + config, + schemaParserFabric, + schemaComponentsMap, + logger, + templatesWorker, + typeNameFormatter, + }) { this.config = config; - this.schemaParser = schemaParser; - this.schemaUtils = this.schemaParser.schemaUtils; - this.typeName = typeName; - this.schemaComponentMap = schemaComponentMap; + this.schemaParserFabric = schemaParserFabric; + this.schemaUtils = this.schemaParserFabric.schemaUtils; + this.typeNameFormatter = typeNameFormatter; + this.schemaComponentsMap = schemaComponentsMap; this.logger = logger; - this.templates = templates; + this.templatesWorker = templatesWorker; this.FORM_DATA_TYPES = _.uniq([ - this.schemaParser.getSchemaType({ type: "string", format: "file" }), - this.schemaParser.getSchemaType({ type: "string", format: "binary" }), + this.schemaUtils.getSchemaType({ type: 'string', format: 'file' }), + this.schemaUtils.getSchemaType({ type: 'string', format: 'binary' }), ]); } createRequestsMap = (routeInfoByMethodsMap) => { - const parameters = _.get(routeInfoByMethodsMap, "parameters"); + const parameters = _.get(routeInfoByMethodsMap, 'parameters'); return _.reduce( routeInfoByMethodsMap, (acc, requestInfo, method) => { - if (_.startsWith(method, "x-") || ["parameters", "$ref"].includes(method)) { + if ( + _.startsWith(method, 'x-') || + ['parameters', '$ref'].includes(method) + ) { return acc; } @@ -93,34 +105,36 @@ class SchemaRoutes { }; parseRouteName = (originalRouteName) => { - const routeName = this.config.hooks.onPreBuildRoutePath(originalRouteName) || originalRouteName; + const routeName = + this.config.hooks.onPreBuildRoutePath(originalRouteName) || + originalRouteName; - const pathParamMatches = (routeName || "").match( - /({(([a-zA-Z]-?_?\.?){1,})([0-9]{1,})?})|(:(([a-zA-Z]-?_?\.?){1,})([0-9]{1,})?:?)/g, + const pathParamMatches = (routeName || '').match( + /({(([A-z]){1}([a-zA-Z0-9]-?_?\.?)+)([0-9]+)?})|(:(([A-z]){1}([a-zA-Z0-9]-?_?\.?)+)([0-9]+)?:?)/g, ); // used in case when path parameters is not declared in requestInfo.parameters ("in": "path") const pathParams = _.reduce( pathParamMatches, (pathParams, match) => { - const paramName = _.replace(match, /\{|\}|\:/g, ""); + const paramName = _.replace(match, /\{|\}|:/g, ''); if (!paramName) return pathParams; - if (_.includes(paramName, "-")) { - this.logger.warn("wrong path param name", paramName); + if (_.includes(paramName, '-')) { + this.logger.warn('wrong path param name', paramName); } pathParams.push({ $match: match, name: _.camelCase(paramName), required: true, - type: "string", - description: "", + type: 'string', + description: '', schema: { - type: "string", + type: 'string', }, - in: "path", + in: 'path', }); return pathParams; @@ -131,10 +145,16 @@ class SchemaRoutes { let fixedRoute = _.reduce( pathParams, (fixedRoute, pathParam, i, arr) => { - const insertion = this.config.hooks.onInsertPathParam(pathParam.name, i, arr, fixedRoute) || pathParam.name; + const insertion = + this.config.hooks.onInsertPathParam( + pathParam.name, + i, + arr, + fixedRoute, + ) || pathParam.name; return _.replace(fixedRoute, pathParam.$match, `\${${insertion}}`); }, - routeName || "", + routeName || '', ); const queryParamMatches = fixedRoute.match(/(\{\?.*\})/g); @@ -142,35 +162,35 @@ class SchemaRoutes { if (queryParamMatches && queryParamMatches.length) { queryParamMatches.forEach((match) => { - fixedRoute = fixedRoute.replace(match, ""); + fixedRoute = fixedRoute.replace(match, ''); }); _.uniq( queryParamMatches - .join(",") - .replace(/(\{\?)|(\})|\s/g, "") - .split(","), + .join(',') + .replace(/(\{\?)|(\})|\s/g, '') + .split(','), ).forEach((paramName) => { - if (_.includes(paramName, "-")) { - this.logger.warn("wrong query param name", paramName); + if (_.includes(paramName, '-')) { + this.logger.warn('wrong query param name', paramName); } queryParams.push({ $match: paramName, name: _.camelCase(paramName), required: true, - type: "string", - description: "", + type: 'string', + description: '', schema: { - type: "string", + type: 'string', }, - in: "query", + in: 'query', }); }); } const result = { - originalRoute: originalRouteName || "", + originalRoute: originalRouteName || '', route: fixedRoute, pathParams, queryParams, @@ -179,7 +199,11 @@ class SchemaRoutes { return this.config.hooks.onBuildRoutePath(result) || result; }; - getRouteParams = (routeInfo, pathParamsFromRouteName, queryParamsFromRouteName) => { + getRouteParams = ( + routeInfo, + pathParamsFromRouteName, + queryParamsFromRouteName, + ) => { const { parameters } = routeInfo; const routeParams = { @@ -192,10 +216,15 @@ class SchemaRoutes { }; _.each(parameters, (parameter) => { - const refTypeInfo = this.schemaParser.schemaUtils.getSchemaRefType(parameter); + const refTypeInfo = + this.schemaParserFabric.schemaUtils.getSchemaRefType(parameter); let routeParam = null; - if (refTypeInfo && refTypeInfo.rawTypeData.in && refTypeInfo.rawTypeData) { + if ( + refTypeInfo && + refTypeInfo.rawTypeData.in && + refTypeInfo.rawTypeData + ) { if (!routeParams[refTypeInfo.rawTypeData.in]) { routeParams[refTypeInfo.rawTypeData.in] = []; } @@ -217,7 +246,7 @@ class SchemaRoutes { }; } - if (routeParam.in === "path") { + if (routeParam.in === 'path') { if (!routeParam.name) return; routeParam.name = _.camelCase(routeParam.name); @@ -230,7 +259,10 @@ class SchemaRoutes { // used in case when path parameters is not declared in requestInfo.parameters ("in": "path") _.each(pathParamsFromRouteName, (pathParam) => { - const alreadyExist = _.some(routeParams.path, (parameter) => parameter.name === pathParam.name); + const alreadyExist = _.some( + routeParams.path, + (parameter) => parameter.name === pathParam.name, + ); if (!alreadyExist) { routeParams.path.push(pathParam); @@ -238,7 +270,10 @@ class SchemaRoutes { }); // used in case when path parameters is not declared in requestInfo.parameters ("in": "path") _.each(queryParamsFromRouteName, (queryParam) => { - const alreadyExist = _.some(routeParams.query, (parameter) => parameter.name === queryParam.name); + const alreadyExist = _.some( + routeParams.query, + (parameter) => parameter.name === queryParam.name, + ); if (!alreadyExist) { routeParams.query.push(queryParam); @@ -252,31 +287,43 @@ class SchemaRoutes { _.uniq( _.compact([ ...(extraContentTypes || []), - ..._.flatten(_.map(requestInfo, (requestInfoData) => requestInfoData && _.keys(requestInfoData.content))), + ..._.flatten( + _.map( + requestInfo, + (requestInfoData) => + requestInfoData && _.keys(requestInfoData.content), + ), + ), ]), ); getContentKind = (contentTypes) => { if ( - _.some(contentTypes, (contentType) => _.startsWith(contentType, "application/json")) || - _.some(contentTypes, (contentType) => _.endsWith(contentType, "+json")) + _.some(contentTypes, (contentType) => + _.startsWith(contentType, 'application/json'), + ) || + _.some(contentTypes, (contentType) => _.endsWith(contentType, '+json')) ) { return CONTENT_KIND.JSON; } - if (contentTypes.includes("application/x-www-form-urlencoded")) { + if (contentTypes.includes('application/x-www-form-urlencoded')) { return CONTENT_KIND.URL_ENCODED; } - if (contentTypes.includes("multipart/form-data")) { + if (contentTypes.includes('multipart/form-data')) { return CONTENT_KIND.FORM_DATA; } - if (_.some(contentTypes, (contentType) => _.includes(contentType, "image/"))) { + if ( + _.some(contentTypes, (contentType) => _.includes(contentType, 'image/')) + ) { return CONTENT_KIND.IMAGE; } - if (_.some(contentTypes, (contentType) => _.startsWith(contentType, "text/"))) { + if ( + _.some(contentTypes, (contentType) => _.startsWith(contentType, 'text/')) + ) { return CONTENT_KIND.TEXT; } @@ -284,12 +331,13 @@ class SchemaRoutes { }; isSuccessStatus = (status) => - (this.config.defaultResponseAsSuccess && status === "default") || - (+status >= this.config.successResponseStatusRange[0] && +status <= this.config.successResponseStatusRange[1]) || - status === "2xx"; + (this.config.defaultResponseAsSuccess && status === 'default') || + (+status >= this.config.successResponseStatusRange[0] && + +status <= this.config.successResponseStatusRange[1]) || + status === '2xx'; getSchemaFromRequestType = (requestInfo) => { - const content = _.get(requestInfo, "content"); + const content = _.get(requestInfo, 'content'); if (!content) return null; @@ -308,22 +356,38 @@ class SchemaRoutes { return null; }; - getTypeFromRequestInfo = ({ requestInfo, parsedSchemas, operationId, defaultType, typeName }) => { + getTypeFromRequestInfo = ({ + requestInfo, + parsedSchemas, + operationId, + defaultType, + typeName, + }) => { // TODO: make more flexible pick schema without content type const schema = this.getSchemaFromRequestType(requestInfo); - const refTypeInfo = this.schemaParser.schemaUtils.getSchemaRefType(requestInfo); + const refTypeInfo = + this.schemaParserFabric.schemaUtils.getSchemaRefType(requestInfo); if (schema) { - const content = this.schemaParser.getInlineParseContent(schema, typeName); + const content = this.schemaParserFabric.getInlineParseContent( + schema, + typeName, + [operationId], + ); const foundedSchemaByName = _.find( parsedSchemas, - (parsedSchema) => this.typeName.format(parsedSchema.name) === content, + (parsedSchema) => + this.typeNameFormatter.format(parsedSchema.name) === content, + ); + const foundSchemaByContent = _.find(parsedSchemas, (parsedSchema) => + _.isEqual(parsedSchema.content, content), ); - const foundSchemaByContent = _.find(parsedSchemas, (parsedSchema) => _.isEqual(parsedSchema.content, content)); const foundSchema = foundedSchemaByName || foundSchemaByContent; - return foundSchema ? this.typeName.format(foundSchema.name) : content; + return foundSchema + ? this.typeNameFormatter.format(foundSchema.name) + : content; } if (refTypeInfo) { @@ -331,29 +395,45 @@ class SchemaRoutes { // const foundedSchemaByName = _.find(parsedSchemas, ({ name }) => name === refType || name === refTypeWithoutOpId) // TODO:HACK fix problem of swagger2opeanpi - const typeNameWithoutOpId = _.replace(refTypeInfo.typeName, operationId, ""); - if (_.find(parsedSchemas, (schema) => schema.name === typeNameWithoutOpId)) { - return this.typeName.format(typeNameWithoutOpId); + const typeNameWithoutOpId = _.replace( + refTypeInfo.typeName, + operationId, + '', + ); + if ( + _.find(parsedSchemas, (schema) => schema.name === typeNameWithoutOpId) + ) { + return this.typeNameFormatter.format(typeNameWithoutOpId); } switch (refTypeInfo.componentName) { - case "schemas": - return this.typeName.format(refTypeInfo.typeName); - case "responses": - case "requestBodies": - return this.schemaParser.getInlineParseContent( + case 'schemas': + return this.typeNameFormatter.format(refTypeInfo.typeName); + case 'responses': + case 'requestBodies': + return this.schemaParserFabric.getInlineParseContent( this.getSchemaFromRequestType(refTypeInfo.rawTypeData), refTypeInfo.typeName || null, + [operationId], ); default: - return this.schemaParser.getInlineParseContent(refTypeInfo.rawTypeData, refTypeInfo.typeName || null); + return this.schemaParserFabric.getInlineParseContent( + refTypeInfo.rawTypeData, + refTypeInfo.typeName || null, + [operationId], + ); } } return defaultType || this.config.Ts.Keyword.Any; }; - getRequestInfoTypes = ({ requestInfos, parsedSchemas, operationId, defaultType }) => + getRequestInfoTypes = ({ + requestInfos, + parsedSchemas, + operationId, + defaultType, + }) => _.reduce( requestInfos, (acc, requestInfo, status) => { @@ -365,7 +445,7 @@ class SchemaRoutes { ...(requestInfo || {}), contentTypes: contentTypes, contentKind: this.getContentKind(contentTypes), - type: this.schemaParser.schemaUtils.safeAddNullToType( + type: this.schemaParserFabric.schemaUtils.safeAddNullToType( requestInfo, this.getTypeFromRequestInfo({ requestInfo, @@ -374,7 +454,11 @@ class SchemaRoutes { defaultType, }), ), - description: this.schemaParser.schemaFormatters.formatDescription(requestInfo.description || "", true), + description: + this.schemaParserFabric.schemaFormatters.formatDescription( + requestInfo.description || '', + true, + ), status: _.isNaN(+status) ? status : +status, isSuccess: this.isSuccessStatus(status), }, @@ -386,7 +470,10 @@ class SchemaRoutes { getResponseBodyInfo = (routeInfo, parsedSchemas) => { const { produces, operationId, responses } = routeInfo; - const contentTypes = this.getContentTypes(responses, [...(produces || []), routeInfo["x-accepts"]]); + const contentTypes = this.getContentTypes(responses, [ + ...(produces || []), + routeInfo['x-accepts'], + ]); const responseInfos = this.getRequestInfoTypes({ requestInfos: responses, @@ -395,23 +482,26 @@ class SchemaRoutes { defaultType: this.config.defaultResponseType, }); - const successResponse = responseInfos.find((response) => response.isSuccess); + const successResponse = responseInfos.find( + (response) => response.isSuccess, + ); const errorResponses = responseInfos.filter( - (response) => !response.isSuccess && response.type !== this.config.Ts.Keyword.Any, + (response) => + !response.isSuccess && response.type !== this.config.Ts.Keyword.Any, ); const handleResponseHeaders = (src) => { if (!src) { - return "headers: {},"; + return 'headers: {},'; } const headerTypes = Object.fromEntries( Object.entries(src).map(([k, v]) => { - return [k, this.schemaParser.getSchemaType(v)]; + return [k, this.schemaUtils.getSchemaType(v)]; }), ); const r = `headers: { ${Object.entries(headerTypes) .map(([k, v]) => `"${k}": ${v}`) - .join(",")} },`; + .join(',')} },`; return r; }; @@ -420,20 +510,27 @@ class SchemaRoutes { responses: responseInfos, success: { schema: successResponse, - type: (successResponse && successResponse.type) || this.config.Ts.Keyword.Any, + type: + (successResponse && successResponse.type) || + this.config.Ts.Keyword.Any, }, error: { schemas: errorResponses, - type: this.config.Ts.UnionType(errorResponses.map((response) => response.type)) || this.config.Ts.Keyword.Any, + type: + this.config.Ts.UnionType( + errorResponses.map((response) => response.type), + ) || this.config.Ts.Keyword.Any, }, full: { types: this.config.Ts.UnionType( responseInfos.map( (response) => `{ - data: ${response.type}, status: ${response.status}, statusCode: ${response.status}, statusText: "${ - response.description - }", ${handleResponseHeaders(response.headers)} config: {} }`, + data: ${response.type}, status: ${response.status}, statusCode: ${ + response.status + }, statusText: "${response.description}", ${handleResponseHeaders( + response.headers, + )} config: {} }`, ), ) || this.config.Ts.Keyword.Any, }, @@ -446,20 +543,28 @@ class SchemaRoutes { (objectSchema, schemaPart) => { if (!schemaPart || !schemaPart.name) return objectSchema; + let usageName = `${schemaPart.name}`; + + if (usageName.includes('.')) { + usageName = camelCase(usageName); + } + return { ...objectSchema, properties: { ...objectSchema.properties, - [schemaPart.name]: { + [usageName]: { ...schemaPart, ...(schemaPart.schema || {}), + $origName: schemaPart.name, + name: usageName, }, }, }; }, { properties: {}, - type: "object", + type: 'object', }, ); }; @@ -467,31 +572,41 @@ class SchemaRoutes { getRequestBodyInfo = (routeInfo, routeParams, parsedSchemas, routeName) => { const { requestBody, consumes, requestBodyName, operationId } = routeInfo; let schema = null; - let type = null; + let content = null; - const contentTypes = this.getContentTypes([requestBody], [...(consumes || []), routeInfo["x-contentType"]]); + const contentTypes = this.getContentTypes( + [requestBody], + [...(consumes || []), routeInfo['x-contentType']], + ); let contentKind = this.getContentKind(contentTypes); let typeName = null; if (this.config.extractRequestBody) { - typeName = this.schemaUtils.resolveTypeName( - routeName.usage, - this.config.extractingOptions.requestBodySuffix, - this.config.extractingOptions.requestBodyNameResolver, - ); + typeName = this.schemaUtils.resolveTypeName(routeName.usage, { + suffixes: this.config.extractingOptions.requestBodySuffix, + resolver: this.config.extractingOptions.requestBodyNameResolver, + }); } if (routeParams.formData.length) { contentKind = CONTENT_KIND.FORM_DATA; schema = this.convertRouteParamsIntoObject(routeParams.formData); - type = this.schemaParser.getInlineParseContent(schema, typeName); + content = this.schemaParserFabric.getInlineParseContent( + schema, + typeName, + [operationId], + ); } else if (contentKind === CONTENT_KIND.FORM_DATA) { schema = this.getSchemaFromRequestType(requestBody); - type = this.schemaParser.getInlineParseContent(schema, typeName); + content = this.schemaParserFabric.getInlineParseContent( + schema, + typeName, + [operationId], + ); } else if (requestBody) { schema = this.getSchemaFromRequestType(requestBody); - type = this.schemaParser.schemaUtils.safeAddNullToType( + content = this.schemaParserFabric.schemaUtils.safeAddNullToType( requestBody, this.getTypeFromRequestInfo({ requestInfo: requestBody, @@ -504,23 +619,38 @@ class SchemaRoutes { // TODO: Refactor that. // It needed for cases when swagger schema is not declared request body type as form data // but request body data type contains form data types like File - if (this.FORM_DATA_TYPES.some((dataType) => _.includes(type, `: ${dataType}`))) { + if ( + this.FORM_DATA_TYPES.some((dataType) => + _.includes(content, `: ${dataType}`), + ) + ) { contentKind = CONTENT_KIND.FORM_DATA; } } if (schema && !schema.$ref && this.config.extractRequestBody) { - schema = this.schemaComponentMap.createComponent("schemas", typeName, { ...schema }); - type = this.schemaParser.getInlineParseContent(schema); + schema = this.schemaParserFabric.createParsedComponent({ + schema, + typeName, + schemaPath: [operationId], + }); + content = this.schemaParserFabric.getInlineParseContent({ + $ref: schema.$ref, + }); } return { - paramName: requestBodyName || (requestBody && requestBody.name) || DEFAULT_BODY_ARG_NAME, + paramName: + requestBodyName || + (requestBody && requestBody.name) || + DEFAULT_BODY_ARG_NAME, contentTypes, contentKind, schema, - type, - required: requestBody && (typeof requestBody.required === "undefined" || !!requestBody.required), + type: content, + required: + requestBody && + (typeof requestBody.required === 'undefined' || !!requestBody.required), }; }; @@ -539,7 +669,7 @@ class SchemaRoutes { if (pathArgSchema.name) { acc[pathArgSchema.name] = { ...pathArgSchema, - in: "path", + in: 'path', }; } @@ -549,12 +679,12 @@ class SchemaRoutes { ); const fixedQueryParams = _.reduce( - _.get(queryObjectSchema, "properties", {}), + _.get(queryObjectSchema, 'properties', {}), (acc, property, name) => { if (name && _.isObject(property)) { acc[name] = { ...property, - in: "query", + in: 'query', }; } @@ -576,34 +706,50 @@ class SchemaRoutes { if (fixedSchema) return fixedSchema; if (extractRequestParams) { - const typeName = this.schemaUtils.resolveTypeName( + const generatedTypeName = this.schemaUtils.resolveTypeName( routeName.usage, - this.config.extractingOptions.requestParamsSuffix, - this.config.extractingOptions.requestParamsNameResolver, + { + suffixes: this.config.extractingOptions.requestParamsSuffix, + resolver: this.config.extractingOptions.requestParamsNameResolver, + }, ); - return this.schemaComponentMap.createComponent("schemas", typeName, { ...schema }); + return this.schemaParserFabric.createParsedComponent({ + typeName: generatedTypeName, + schema: schema, + }); } return schema; }; extractResponseBodyIfItNeeded = (routeInfo, responseBodyInfo, routeName) => { - if (responseBodyInfo.responses.length && responseBodyInfo.success && responseBodyInfo.success.schema) { - const typeName = this.schemaUtils.resolveTypeName( - routeName.usage, - this.config.extractingOptions.responseBodySuffix, - this.config.extractingOptions.responseBodyNameResolver, - ); + if ( + responseBodyInfo.responses.length && + responseBodyInfo.success && + responseBodyInfo.success.schema + ) { + const typeName = this.schemaUtils.resolveTypeName(routeName.usage, { + suffixes: this.config.extractingOptions.responseBodySuffix, + resolver: this.config.extractingOptions.responseBodyNameResolver, + }); - const idx = responseBodyInfo.responses.indexOf(responseBodyInfo.success.schema); + const idx = responseBodyInfo.responses.indexOf( + responseBodyInfo.success.schema, + ); let successResponse = responseBodyInfo.success; if (successResponse.schema && !successResponse.schema.$ref) { const schema = this.getSchemaFromRequestType(successResponse.schema); - successResponse.schema = this.schemaComponentMap.createComponent("schemas", typeName, { ...schema }); - successResponse.type = this.schemaParser.getInlineParseContent(successResponse.schema); + successResponse.schema = this.schemaParserFabric.createParsedComponent({ + schema, + typeName, + schemaPath: [routeInfo.operationId], + }); + successResponse.type = this.schemaParserFabric.getInlineParseContent({ + $ref: successResponse.schema.$ref, + }); if (idx > -1) { _.assign(responseBodyInfo.responses[idx], { @@ -616,31 +762,45 @@ class SchemaRoutes { }; extractResponseErrorIfItNeeded = (routeInfo, responseBodyInfo, routeName) => { - if (responseBodyInfo.responses.length && responseBodyInfo.error.schemas && responseBodyInfo.error.schemas.length) { - const typeName = this.schemaUtils.resolveTypeName( - routeName.usage, - this.config.extractingOptions.responseErrorSuffix, - this.config.extractingOptions.responseErrorNameResolver, - ); + if ( + responseBodyInfo.responses.length && + responseBodyInfo.error.schemas && + responseBodyInfo.error.schemas.length + ) { + const typeName = this.schemaUtils.resolveTypeName(routeName.usage, { + suffixes: this.config.extractingOptions.responseErrorSuffix, + resolver: this.config.extractingOptions.responseErrorNameResolver, + }); - const errorSchemas = responseBodyInfo.error.schemas.map(this.getSchemaFromRequestType).filter(Boolean); + const errorSchemas = responseBodyInfo.error.schemas + .map(this.getSchemaFromRequestType) + .filter(Boolean); if (!errorSchemas.length) return; - const schema = this.schemaParser.parseSchema({ - oneOf: errorSchemas, - title: errorSchemas - .map((schema) => schema.title) - .filter(Boolean) - .join(" "), - description: errorSchemas - .map((schema) => schema.description) - .filter(Boolean) - .join("\n"), - }); - const component = this.schemaComponentMap.createComponent("schemas", typeName, { ...schema }); + const schema = this.schemaParserFabric.parseSchema( + { + oneOf: errorSchemas, + title: errorSchemas + .map((schema) => schema.title) + .filter(Boolean) + .join(' '), + description: errorSchemas + .map((schema) => schema.description) + .filter(Boolean) + .join('\n'), + }, + null, + [routeInfo.operationId], + ); + const component = this.schemaComponentsMap.createComponent( + this.schemaComponentsMap.createRef(['components', 'schemas', typeName]), + { ...schema }, + ); responseBodyInfo.error.schemas = [component]; - responseBodyInfo.error.type = this.typeName.format(component.typeName); + responseBodyInfo.error.type = this.typeNameFormatter.format( + component.typeName, + ); } }; @@ -649,16 +809,26 @@ class SchemaRoutes { const { routeNameDuplicatesMap, templatesToRender } = this.config; const routeNameTemplate = templatesToRender.routeName; - const routeNameFromTemplate = this.templates.renderTemplate(routeNameTemplate, { - routeInfo: rawRouteInfo, - }); + const routeNameFromTemplate = this.templatesWorker.renderTemplate( + routeNameTemplate, + { + routeInfo: rawRouteInfo, + }, + ); - const routeName = this.config.hooks.onFormatRouteName(rawRouteInfo, routeNameFromTemplate) || routeNameFromTemplate; + const routeName = + this.config.hooks.onFormatRouteName( + rawRouteInfo, + routeNameFromTemplate, + ) || routeNameFromTemplate; const duplicateIdentifier = `${moduleName}|${routeName}`; if (routeNameDuplicatesMap.has(duplicateIdentifier)) { - routeNameDuplicatesMap.set(duplicateIdentifier, routeNameDuplicatesMap.get(duplicateIdentifier) + 1); + routeNameDuplicatesMap.set( + duplicateIdentifier, + routeNameDuplicatesMap.get(duplicateIdentifier) + 1, + ); this.logger.warn( `Module "${moduleName}" already has method "${routeName}()"`, @@ -673,26 +843,38 @@ class SchemaRoutes { const duplicates = routeNameDuplicatesMap.get(duplicateIdentifier); const routeNameInfo = { - usage: routeName + (duplicates > 1 ? duplicates : ""), + usage: routeName + (duplicates > 1 ? duplicates : ''), original: routeName, duplicate: duplicates > 1, }; - return this.config.hooks.onCreateRouteName(routeNameInfo, rawRouteInfo) || routeNameInfo; + return ( + this.config.hooks.onCreateRouteName(routeNameInfo, rawRouteInfo) || + routeNameInfo + ); }; - parseRouteInfo = (rawRouteName, routeInfo, method, usageSchema, parsedSchemas) => { + parseRouteInfo = ( + rawRouteName, + routeInfo, + method, + usageSchema, + parsedSchemas, + ) => { const { security: globalSecurity } = usageSchema; - const { moduleNameIndex, moduleNameFirstTag, extractRequestParams } = this.config; + const { moduleNameIndex, moduleNameFirstTag, extractRequestParams } = + this.config; const { operationId, requestBody, security, + // eslint-disable-next-line no-unused-vars parameters, summary, description, tags, responses, + // eslint-disable-next-line no-unused-vars requestBodyName, produces, consumes, @@ -709,13 +891,17 @@ class SchemaRoutes { const moduleName = moduleNameFirstTag && firstTag ? _.camelCase(firstTag) - : _.camelCase(_.compact(_.split(route, "/"))[moduleNameIndex]); + : _.camelCase(_.compact(_.split(route, '/'))[moduleNameIndex]); let hasSecurity = !!(globalSecurity && globalSecurity.length); if (security) { hasSecurity = security.length > 0; } - const routeParams = this.getRouteParams(routeInfo, pathParamsFromRouteName, queryParamsFromRouteName); + const routeParams = this.getRouteParams( + routeInfo, + pathParamsFromRouteName, + queryParamsFromRouteName, + ); const pathArgs = routeParams.path.map((pathArgSchema) => ({ name: pathArgSchema.name, @@ -745,13 +931,24 @@ class SchemaRoutes { consumes, }; - const queryObjectSchema = this.convertRouteParamsIntoObject(routeParams.query); - const pathObjectSchema = this.convertRouteParamsIntoObject(routeParams.path); - const headersObjectSchema = this.convertRouteParamsIntoObject(routeParams.header); + const queryObjectSchema = this.convertRouteParamsIntoObject( + routeParams.query, + ); + const pathObjectSchema = this.convertRouteParamsIntoObject( + routeParams.path, + ); + const headersObjectSchema = this.convertRouteParamsIntoObject( + routeParams.header, + ); const routeName = this.getRouteName(rawRouteInfo); - const requestBodyInfo = this.getRequestBodyInfo(routeInfo, routeParams, parsedSchemas, routeName); + const requestBodyInfo = this.getRequestBodyInfo( + routeInfo, + routeParams, + parsedSchemas, + routeName, + ); const requestParamsSchema = this.createRequestParamsSchema({ queryParams: routeParams.query, @@ -762,42 +959,68 @@ class SchemaRoutes { }); if (this.config.extractResponseBody) { - this.extractResponseBodyIfItNeeded(routeInfo, responseBodyInfo, routeName); + this.extractResponseBodyIfItNeeded( + routeInfo, + responseBodyInfo, + routeName, + ); } if (this.config.extractResponseError) { - this.extractResponseErrorIfItNeeded(routeInfo, responseBodyInfo, routeName); + this.extractResponseErrorIfItNeeded( + routeInfo, + responseBodyInfo, + routeName, + ); } - const typeName = this.schemaUtils.resolveTypeName( - routeName.usage, - this.config.extractingOptions.requestParamsSuffix, - this.config.extractingOptions.requestParamsNameResolver, - false, - ); + const typeName = this.schemaUtils.resolveTypeName(routeName.usage, { + suffixes: this.config.extractingOptions.requestParamsSuffix, + resolver: this.config.extractingOptions.requestParamsNameResolver, + shouldReserve: false, + }); const queryType = routeParams.query.length - ? this.schemaParser.getInlineParseContent(queryObjectSchema, typeName) + ? this.schemaParserFabric.getInlineParseContent(queryObjectSchema, null, [ + typeName, + ]) : null; const pathType = routeParams.path.length - ? this.schemaParser.getInlineParseContent(pathObjectSchema, typeName) + ? this.schemaParserFabric.getInlineParseContent(pathObjectSchema, null, [ + typeName, + ]) : null; const headersType = routeParams.header.length - ? this.schemaParser.getInlineParseContent(headersObjectSchema, typeName) + ? this.schemaParserFabric.getInlineParseContent( + headersObjectSchema, + null, + [typeName], + ) : null; - const nameResolver = new SpecificArgNameResolver(this.logger, pathArgsNames); + const nameResolver = new SpecificArgNameResolver( + this.config, + this.logger, + pathArgsNames, + ); const specificArgs = { query: queryType ? { name: nameResolver.resolve(RESERVED_QUERY_ARG_NAMES), - optional: this.schemaParser.parseSchema(queryObjectSchema).allFieldsAreOptional, + optional: this.schemaParserFabric.parseSchema( + queryObjectSchema, + null, + [routeName.usage], + ).allFieldsAreOptional, type: queryType, } : void 0, body: requestBodyInfo.type ? { - name: nameResolver.resolve([requestBodyInfo.paramName, ...RESERVED_BODY_ARG_NAMES]), + name: nameResolver.resolve([ + requestBodyInfo.paramName, + ...RESERVED_BODY_ARG_NAMES, + ]), optional: !requestBodyInfo.required, type: requestBodyInfo.type, } @@ -805,26 +1028,38 @@ class SchemaRoutes { pathParams: pathType ? { name: nameResolver.resolve(RESERVED_PATH_ARG_NAMES), - optional: this.schemaParser.parseSchema(pathObjectSchema).allFieldsAreOptional, + optional: this.schemaParserFabric.parseSchema( + pathObjectSchema, + null, + [routeName.usage], + ).allFieldsAreOptional, type: pathType, } : void 0, headers: headersType ? { name: nameResolver.resolve(RESERVED_HEADER_ARG_NAMES), - optional: this.schemaParser.parseSchema(headersObjectSchema).allFieldsAreOptional, + optional: this.schemaParserFabric.parseSchema( + headersObjectSchema, + null, + [routeName.usage], + ).allFieldsAreOptional, type: headersType, } : void 0, }; pathArgs.forEach((pathArg, i) => { - pathArg.type = this.schemaParser.getInlineParseContent(routeParams.path[i].schema, typeName); + pathArg.type = this.schemaParserFabric.getInlineParseContent( + routeParams.path[i].schema, + null, + [typeName], + ); }); return { id: routeId, - namespace: _.replace(moduleName, /^(\d)/, "v$1"), + namespace: _.replace(moduleName, /^(\d)/, 'v$1'), routeName, routeParams, requestBodyInfo, @@ -870,22 +1105,29 @@ class SchemaRoutes { const routeInfosMap = this.createRequestsMap(routeInfoByMethodsMap); _.forEach(routeInfosMap, (routeInfo, method) => { - const parsedRouteInfo = this.parseRouteInfo(rawRouteName, routeInfo, method, usageSchema, parsedSchemas); - const processedRouteInfo = this.config.hooks.onCreateRoute(parsedRouteInfo); + const parsedRouteInfo = this.parseRouteInfo( + rawRouteName, + routeInfo, + method, + usageSchema, + parsedSchemas, + ); + const processedRouteInfo = + this.config.hooks.onCreateRoute(parsedRouteInfo); if (processedRouteInfo !== false) { - const route = processedRouteInfo || parsedRouteInfo; - - if (!this.hasSecurityRoutes && route.security) { - this.hasSecurityRoutes = route.security; - } - if (!this.hasQueryRoutes && route.hasQuery) { - this.hasQueryRoutes = route.hasQuery; - } - if (!this.hasFormDataRoutes && route.hasFormDataParams) { - this.hasFormDataRoutes = route.hasFormDataParams; - } - - this.routes.push(route); + const route = processedRouteInfo || parsedRouteInfo; + + if (!this.hasSecurityRoutes && route.security) { + this.hasSecurityRoutes = route.security; + } + if (!this.hasQueryRoutes && route.hasQuery) { + this.hasQueryRoutes = route.hasQuery; + } + if (!this.hasFormDataRoutes && route.hasFormDataParams) { + this.hasFormDataRoutes = route.hasFormDataParams; + } + + this.routes.push(route); } }); }); @@ -911,10 +1153,10 @@ class SchemaRoutes { }, ); - return _.reduce( + const routeGroups = _.reduce( groupedRoutes, (acc, routesGroup, moduleName) => { - if (moduleName === "$outOfModule") { + if (moduleName === '$outOfModule') { acc.outOfModule = routesGroup; } else { if (!acc.combined) acc.combined = []; @@ -922,14 +1164,19 @@ class SchemaRoutes { acc.combined.push({ moduleName, routes: _.map(routesGroup, (route) => { - const { original: originalName, usage: usageName } = route.routeName; + const { original: originalName, usage: usageName } = + route.routeName; // TODO: https://github.com/acacode/swagger-typescript-api/issues/152 // TODO: refactor if ( routesGroup.length > 1 && usageName !== originalName && - !_.some(routesGroup, ({ routeName, id }) => id !== route.id && originalName === routeName.original) + !_.some( + routesGroup, + ({ routeName, id }) => + id !== route.id && originalName === routeName.original, + ) ) { return { ...route, @@ -948,6 +1195,28 @@ class SchemaRoutes { }, {}, ); + + if (this.config.sortRoutes) { + if (routeGroups.outOfModule) { + routeGroups.outOfModule = this.sortRoutes(routeGroups.outOfModule); + } + if (routeGroups.combined) { + routeGroups.combined = this.sortRoutes(routeGroups.combined); + } + } + + return routeGroups; + }; + + sortRoutes = (routeInfo) => { + if (routeInfo) { + routeInfo.forEach((routeInfo) => { + routeInfo.routes.sort((routeA, routeB) => + routeA.routeName.usage.localeCompare(routeB.routeName.usage), + ); + }); + } + return routeInfo; }; } diff --git a/src/schema-routes/util/specific-arg-name-resolver.js b/src/schema-routes/util/specific-arg-name-resolver.js new file mode 100644 index 00000000..ca3c64f3 --- /dev/null +++ b/src/schema-routes/util/specific-arg-name-resolver.js @@ -0,0 +1,26 @@ +const { NameResolver } = require('../../util/name-resolver'); + +class SpecificArgNameResolver extends NameResolver { + counter = 1; + /** + * @param {CodeGenConfig} config; + * @param {Logger} logger; + * @param {string[]} reservedNames + */ + constructor(config, logger, reservedNames) { + super(config, logger, reservedNames, (variants) => { + const generatedVariant = + (variants[0] && `${variants[0]}${this.counter++}`) || + `${this.config.specificArgNameResolverName}${this.counter++}`; + this.logger.debug( + 'generated fallback type name for specific arg - ', + generatedVariant, + ); + return generatedVariant; + }); + } +} + +module.exports = { + SpecificArgNameResolver, +}; diff --git a/src/schema-walker.js b/src/schema-walker.js new file mode 100644 index 00000000..01c05f9d --- /dev/null +++ b/src/schema-walker.js @@ -0,0 +1,93 @@ +const _ = require('lodash'); + +// TODO: WIP +// this class will be needed to walk by schema everywhere +class SchemaWalker { + /** @type {Logger} */ + logger; + /** @type {CodeGenConfig} */ + config; + /** @type {SwaggerSchemaResolver} */ + swaggerSchemaResolver; + /** @type {Map>} */ + schemas = new Map(); + /** @type {Map>} */ + caches = new Map(); + + constructor({ config, logger }) { + this.logger = logger; + this.config = config; + } + + /** + * @param name {string} + * @param schema {Record} + */ + addSchema = (name, schema) => { + this.schemas.set(name, _.cloneDeep(schema)); + }; + + /** + * @param ref {string} + * @returns {any} + */ + findByRef = (ref) => { + this.logger.debug('try to resolve ref by path', ref); + + if (this.caches.has(ref)) { + return this.caches.get(ref); + } + + const schemas = Array.from(this.schemas.values()); + if (this._isLocalRef(ref)) { + for (const schema of schemas) { + const refData = this._getRefDataFromSchema(schema, ref); + if (refData) { + return refData; + } + } + } else if (this._isRemoteRef(ref)) { + this.logger.debug('remote refs not supported', ref); + return null; + } else { + const [address, path] = path.split('#'); + let swaggerSchemaObject; + + if (this.schemas.has(address)) { + swaggerSchemaObject = this.schemas.get(address); + } else { + const pathToSchema = path.resolve(process.cwd(), address); + const swaggerSchemaFile = + this.swaggerSchemaResolver.getSwaggerSchemaByPath(pathToSchema); + swaggerSchemaObject = + this.swaggerSchemaResolver.processSwaggerSchemaFile( + swaggerSchemaFile, + ); + this.schemas.set(address, swaggerSchemaObject); + } + + return this._getRefDataFromSchema(swaggerSchemaObject, path); + } + }; + + _isLocalRef = (ref) => { + return ref.startsWith('#'); + }; + + _isRemoteRef = (ref) => { + return ref.startsWith('http://') || ref.startsWith('https://'); + }; + + _getRefDataFromSchema = (schema, ref) => { + const path = ref.replace('#', '').split('/'); + const refData = _.get(schema, path); + if (refData) { + this.caches.set(ref, refData); + } + return refData; + }; +} + +module.exports = { + SchemaWalker, +}; diff --git a/src/swagger-schema-resolver.js b/src/swagger-schema-resolver.js index 470d2400..6725e666 100644 --- a/src/swagger-schema-resolver.js +++ b/src/swagger-schema-resolver.js @@ -1,7 +1,7 @@ -const _ = require("lodash"); -const converter = require("swagger2openapi"); -const yaml = require("js-yaml"); -const { Request } = require("./util/request"); +const _ = require('lodash'); +const converter = require('swagger2openapi'); +const yaml = require('js-yaml'); +const { Request } = require('./util/request'); class SwaggerSchemaResolver { /** @@ -21,7 +21,7 @@ class SwaggerSchemaResolver { */ request; - constructor(config, logger, fileSystem) { + constructor({ config, logger, fileSystem }) { this.config = config; this.logger = logger; this.fileSystem = fileSystem; @@ -33,7 +33,15 @@ class SwaggerSchemaResolver { * @returns {Promise<{usageSchema: Record, originalSchema: Record}>} */ async create() { - const { spec, patch, input, url, disableStrictSSL, disableProxy, authorizationToken } = this.config; + const { + spec, + patch, + input, + url, + disableStrictSSL, + disableProxy, + authorizationToken, + } = this.config; if (this.config.spec) { return await this.convertSwaggerObject(spec, { patch }); @@ -46,7 +54,8 @@ class SwaggerSchemaResolver { disableProxy, authorizationToken, ); - const swaggerSchemaObject = this.processSwaggerSchemaFile(swaggerSchemaFile); + const swaggerSchemaObject = + this.processSwaggerSchemaFile(swaggerSchemaFile); return await this.convertSwaggerObject(swaggerSchemaObject, { patch }); } @@ -61,8 +70,8 @@ class SwaggerSchemaResolver { const result = _.cloneDeep(swaggerSchema); result.info = _.merge( { - title: "No title", - version: "", + title: 'No title', + version: '', }, result.info, ); @@ -75,11 +84,15 @@ class SwaggerSchemaResolver { { ...converterOptions, warnOnly: true, - refSiblings: "preserve", - rbname: "requestBodyName", + refSiblings: 'preserve', + rbname: 'requestBodyName', }, (err, options) => { - const parsedSwaggerSchema = _.get(err, "options.openapi", _.get(options, "openapi")); + const parsedSwaggerSchema = _.get( + err, + 'options.openapi', + _.get(options, 'openapi'), + ); if (!parsedSwaggerSchema && err) { throw new Error(err); } @@ -99,10 +112,20 @@ class SwaggerSchemaResolver { }); } - async fetchSwaggerSchemaFile(pathToSwagger, urlToSwagger, disableStrictSSL, disableProxy, authToken) { + getSwaggerSchemaByPath = (pathToSwagger) => { + this.logger.log(`try to get swagger by path "${pathToSwagger}"`); + return this.fileSystem.getFileContent(pathToSwagger); + }; + + async fetchSwaggerSchemaFile( + pathToSwagger, + urlToSwagger, + disableStrictSSL, + disableProxy, + authToken, + ) { if (this.fileSystem.pathIsExist(pathToSwagger)) { - this.logger.log(`try to get swagger by path "${pathToSwagger}"`); - return this.fileSystem.getFileContent(pathToSwagger); + return this.getSwaggerSchemaByPath(pathToSwagger); } else { this.logger.log(`try to get swagger by URL "${urlToSwagger}"`); return await this.request.download({ @@ -115,7 +138,7 @@ class SwaggerSchemaResolver { } processSwaggerSchemaFile(file) { - if (typeof file !== "string") return file; + if (typeof file !== 'string') return file; try { return JSON.parse(file); @@ -125,8 +148,8 @@ class SwaggerSchemaResolver { } fixSwaggerSchema({ usageSchema, originalSchema }) { - const usagePaths = _.get(usageSchema, "paths"); - const originalPaths = _.get(originalSchema, "paths"); + const usagePaths = _.get(usageSchema, 'paths'); + const originalPaths = _.get(originalSchema, 'paths'); // walk by routes _.each(usagePaths, (usagePathObject, route) => { @@ -135,20 +158,30 @@ class SwaggerSchemaResolver { // walk by methods _.each(usagePathObject, (usageRouteInfo, methodName) => { const originalRouteInfo = _.get(originalPathObject, methodName); - const usageRouteParams = _.get(usageRouteInfo, "parameters", []); - const originalRouteParams = _.get(originalRouteInfo, "parameters", []); - - usageRouteInfo.consumes = _.uniq( - _.compact([...(usageRouteInfo.consumes || []), ...(originalRouteInfo.consumes || [])]), - ); - usageRouteInfo.produces = _.uniq( - _.compact([...(usageRouteInfo.produces || []), ...(originalRouteInfo.produces || [])]), - ); + const usageRouteParams = _.get(usageRouteInfo, 'parameters', []); + const originalRouteParams = _.get(originalRouteInfo, 'parameters', []); + + if (typeof usageRouteInfo === 'object') { + usageRouteInfo.consumes = _.uniq( + _.compact([ + ...(usageRouteInfo.consumes || []), + ...(originalRouteInfo.consumes || []), + ]), + ); + usageRouteInfo.produces = _.uniq( + _.compact([ + ...(usageRouteInfo.produces || []), + ...(originalRouteInfo.produces || []), + ]), + ); + } _.each(originalRouteParams, (originalRouteParam) => { const existUsageParam = _.find( usageRouteParams, - (param) => originalRouteParam.in === param.in && originalRouteParam.name === param.name, + (param) => + originalRouteParam.in === param.in && + originalRouteParam.name === param.name, ); if (!existUsageParam) { usageRouteParams.push(originalRouteParam); diff --git a/src/templates-worker.js b/src/templates-worker.js new file mode 100644 index 00000000..8fed4e3a --- /dev/null +++ b/src/templates-worker.js @@ -0,0 +1,240 @@ +const { resolve } = require('path'); +const _ = require('lodash'); +const Eta = require('eta'); +const path = require('path'); + +class TemplatesWorker { + /** + * @type {CodeGenConfig} + */ + config; + + /** + * @type {Logger} + */ + logger; + + /** + * @type {FileSystem} + */ + fileSystem; + + getRenderTemplateData; + + constructor({ config, logger, fileSystem, getRenderTemplateData }) { + this.config = config; + this.logger = logger; + this.fileSystem = fileSystem; + this.getRenderTemplateData = getRenderTemplateData; + } + + /** + * + * @param config {CodeGenConfig} + * @returns {CodeGenConfig.templatePaths} + */ + getTemplatePaths = (config) => { + const baseTemplatesPath = resolve(__dirname, '../templates/base'); + const defaultTemplatesPath = resolve(__dirname, '../templates/default'); + const modularTemplatesPath = resolve(__dirname, '../templates/modular'); + const originalTemplatesPath = config.modular + ? modularTemplatesPath + : defaultTemplatesPath; + const customTemplatesPath = + (config.templates && resolve(process.cwd(), config.templates)) || null; + + return { + /** `templates/base` */ + base: baseTemplatesPath, + /** `templates/default` */ + default: defaultTemplatesPath, + /** `templates/modular` */ + modular: modularTemplatesPath, + /** usage path if `--templates` option is not set */ + original: originalTemplatesPath, + /** custom path to templates (`--templates`) */ + custom: customTemplatesPath, + }; + }; + + cropExtension = (path) => + this.config.templateExtensions.reduce( + (path, ext) => (_.endsWith(path, ext) ? path.replace(ext, '') : path), + path, + ); + + getTemplateFullPath = (path, fileName) => { + const raw = resolve(path, './', this.cropExtension(fileName)); + const pathVariants = this.config.templateExtensions.map( + (extension) => `${raw}${extension}`, + ); + + return pathVariants.find( + (variant) => !!this.fileSystem.pathIsExist(variant), + ); + }; + + requireFnFromTemplate = (packageOrPath) => { + const isPath = + _.startsWith(packageOrPath, './') || _.startsWith(packageOrPath, '../'); + + if (isPath) { + return require(path.resolve( + this.config.templatePaths.custom || this.config.templatePaths.original, + packageOrPath, + )); + } + + return require(packageOrPath); + }; + + getTemplate = ({ fileName, name, path }) => { + const { templatePaths } = this.config; + + if (path) { + return this.fileSystem.getFileContent(path); + } + + if (!fileName) return ''; + + const customFullPath = + templatePaths.custom && + this.getTemplateFullPath(templatePaths.custom, fileName); + let fileContent = + customFullPath && this.fileSystem.getFileContent(customFullPath); + + if (fileContent) { + this.logger.log( + `"${_.lowerCase(name)}" template found in "${templatePaths.custom}"`, + ); + return fileContent; + } + + const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName); + + if (baseFullPath) { + fileContent = this.fileSystem.getFileContent(baseFullPath); + } else { + if (templatePaths.custom) { + this.logger.warn( + `"${_.lowerCase(name)}" template not found in "${ + templatePaths.custom + }"`, + `\nCode generator will use the default template`, + ); + } else { + this.logger.log( + `Code generator will use the default template for "${_.lowerCase( + name, + )}"`, + ); + } + } + + const originalFullPath = this.getTemplateFullPath( + templatePaths.original, + fileName, + ); + + if (originalFullPath) { + fileContent = this.fileSystem.getFileContent(originalFullPath); + } + + return fileContent; + }; + + getTemplates = ({ templatePaths }) => { + if (templatePaths.custom) { + this.logger.log( + `try to read templates from directory "${templatePaths.custom}"`, + ); + } + + return _.reduce( + this.config.templateInfos, + (acc, { fileName, name }) => ({ + ...acc, + [name]: this.getTemplate({ fileName, name }), + }), + {}, + ); + }; + + findTemplateWithExt = (path) => { + const raw = this.cropExtension(path); + const pathVariants = this.config.templateExtensions.map( + (extension) => `${raw}${extension}`, + ); + return pathVariants.find((variant) => this.fileSystem.pathIsExist(variant)); + }; + + getTemplateContent = (path) => { + const foundTemplatePathKey = _.keys(this.config.templatePaths).find((key) => + _.startsWith(path, `@${key}`), + ); + + const rawPath = resolve( + _.replace( + path, + `@${foundTemplatePathKey}`, + this.config.templatePaths[foundTemplatePathKey], + ), + ); + const fixedPath = this.findTemplateWithExt(rawPath); + + if (fixedPath) { + return this.fileSystem.getFileContent(fixedPath); + } + + const customPath = + this.config.templatePaths.custom && + this.findTemplateWithExt(resolve(this.config.templatePaths.custom, path)); + + if (customPath) { + return this.fileSystem.getFileContent(customPath); + } + + const originalPath = this.findTemplateWithExt( + resolve(this.config.templatePaths.original, path), + ); + + if (originalPath) { + return this.fileSystem.getFileContent(originalPath); + } + + return ''; + }; + + /** + * @param template + * @param configuration + * @param options + * @returns {Promise} + */ + renderTemplate = (template, configuration, options) => { + if (!template) return ''; + + return Eta.render( + template, + { + ...this.getRenderTemplateData(), + ...configuration, + }, + { + async: false, + ...(options || {}), + includeFile: (path, configuration, options) => { + return this.renderTemplate( + this.getTemplateContent(path), + configuration, + options, + ); + }, + }, + ); + }; +} + +module.exports = { + TemplatesWorker, +}; diff --git a/src/templates.js b/src/templates.js deleted file mode 100644 index 90203a9e..00000000 --- a/src/templates.js +++ /dev/null @@ -1,177 +0,0 @@ -const { resolve } = require("path"); -const _ = require("lodash"); -const Eta = require("eta"); -const path = require("path"); - -class Templates { - /** - * @type {CodeGenConfig} - */ - config; - - /** - * @type {Logger} - */ - logger; - - /** - * @type {FileSystem} - */ - fileSystem; - - getRenderTemplateData; - - constructor(config, logger, fileSystem, getRenderTemplateData) { - this.config = config; - this.logger = logger; - this.fileSystem = fileSystem; - this.getRenderTemplateData = getRenderTemplateData; - } - - getTemplatePaths = ({ templates, modular }) => { - const baseTemplatesPath = resolve(__dirname, "../templates/base"); - const defaultTemplatesPath = resolve(__dirname, "../templates/default"); - const modularTemplatesPath = resolve(__dirname, "../templates/modular"); - const originalTemplatesPath = modular ? modularTemplatesPath : defaultTemplatesPath; - const customTemplatesPath = templates ? resolve(process.cwd(), templates) : originalTemplatesPath; - - return { - /** `templates/base` */ - base: baseTemplatesPath, - /** `templates/default` */ - default: defaultTemplatesPath, - /** `templates/modular` */ - modular: modularTemplatesPath, - /** usage path if `--templates` option is not set */ - original: originalTemplatesPath, - /** custom path to templates (`--templates`) */ - custom: customTemplatesPath, - }; - }; - - cropExtension = (path) => - this.config.templateExtensions.reduce((path, ext) => (_.endsWith(path, ext) ? path.replace(ext, "") : path), path); - - getTemplateFullPath = (path, fileName) => { - const raw = resolve(path, "./", this.cropExtension(fileName)); - const pathVariants = this.config.templateExtensions.map((extension) => `${raw}${extension}`); - - return pathVariants.find((variant) => !!this.fileSystem.pathIsExist(variant)); - }; - - requireFnFromTemplate = (packageOrPath) => { - const isPath = _.startsWith(packageOrPath, "./") || _.startsWith(packageOrPath, "../"); - - if (isPath) { - return require(path.resolve(this.config.templates, packageOrPath)); - } - - return require(packageOrPath); - }; - - getTemplate = ({ fileName, name, path }) => { - const { templatePaths } = this.config; - - if (path) { - return this.fileSystem.getFileContent(path); - } - - if (!fileName) return ""; - - const customFullPath = this.getTemplateFullPath(templatePaths.custom, fileName); - let fileContent = customFullPath && this.fileSystem.getFileContent(customFullPath); - - if (fileContent) { - this.logger.log(`"${_.lowerCase(name)}" template found in "${templatePaths.custom}"`); - return fileContent; - } - - const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName); - - if (baseFullPath) { - fileContent = this.fileSystem.getFileContent(baseFullPath); - } else { - this.logger.warn( - `"${_.lowerCase(name)}" template not found in "${templatePaths.custom}"`, - `\nCode generator will use the default template`, - ); - } - - const originalFullPath = this.getTemplateFullPath(templatePaths.original, fileName); - - if (originalFullPath) { - fileContent = this.fileSystem.getFileContent(originalFullPath); - } - - return fileContent; - }; - - getTemplates = ({ templatePaths }) => { - this.logger.log(`try to read templates from directory "${templatePaths.custom}"`); - - return _.reduce( - this.config.templateInfos, - (acc, { fileName, name }) => ({ - ...acc, - [name]: this.getTemplate({ fileName, name }), - }), - {}, - ); - }; - - findTemplateWithExt = (path) => { - const raw = this.cropExtension(path); - const pathVariants = this.config.templateExtensions.map((extension) => `${raw}${extension}`); - return pathVariants.find((variant) => this.fileSystem.pathIsExist(variant)); - }; - - getTemplateContent = (path) => { - const foundTemplatePathKey = _.keys(this.config.templatePaths).find((key) => _.startsWith(path, `@${key}`)); - - const rawPath = resolve( - _.replace(path, `@${foundTemplatePathKey}`, this.config.templatePaths[foundTemplatePathKey]), - ); - const fixedPath = this.findTemplateWithExt(rawPath); - - if (fixedPath) { - return this.fileSystem.getFileContent(fixedPath); - } - - const customPath = this.findTemplateWithExt(resolve(this.config.templatePaths.custom, path)); - - if (customPath) { - return this.fileSystem.getFileContent(customPath); - } - - const originalPath = this.findTemplateWithExt(resolve(this.config.templatePaths.original, path)); - - if (originalPath) { - return this.fileSystem.getFileContent(originalPath); - } - - return ""; - }; - - renderTemplate = (template, configuration, options) => { - if (!template) return ""; - - return Eta.render( - template, - { - ...this.getRenderTemplateData(), - ...configuration, - }, - { - async: false, - ...(options || {}), - includeFile: (path, configuration, options) => { - return this.renderTemplate(this.getTemplateContent(path), configuration, options); - }, - }, - ); - }; -} - -module.exports = { - Templates, -}; diff --git a/src/translators/JavaScript.js b/src/translators/JavaScript.js deleted file mode 100644 index 97e113f7..00000000 --- a/src/translators/JavaScript.js +++ /dev/null @@ -1,60 +0,0 @@ -const ts = require("typescript"); - -function translate(fileName, content, options) { - const output = {}; - const host = ts.createCompilerHost(options, true); - const fileNames = [fileName]; - const originalSourceFileGet = host.getSourceFile.bind(host); - host.getSourceFile = (sourceFileName, languageVersion, onError, shouldCreateNewSourceFile) => { - if (sourceFileName !== fileName) - return originalSourceFileGet(sourceFileName, languageVersion, onError, shouldCreateNewSourceFile); - - return ts.createSourceFile(sourceFileName, content, languageVersion, true, ts.ScriptKind.External); - }; - - host.writeFile = (fileName, contents) => { - output[fileName] = contents; - }; - - ts.createProgram(fileNames, options, host).emit(); - - return output; -} - -module.exports = { - translate: (fileName, sourceTypeScript) => { - const translated = translate(fileName, sourceTypeScript, { - module: "ESNext", - noImplicitReturns: true, - alwaysStrict: true, - target: ts.ScriptTarget.ESNext, - declaration: true, - noImplicitAny: false, - sourceMap: false, - removeComments: false, - disableSizeLimit: true, - esModuleInterop: true, - emitDecoratorMetadata: true, - skipLibCheck: true, - }); - - const sourceFileName = fileName.replace(ts.Extension.Ts, ts.Extension.Js); - const declarationFileName = fileName.replace(ts.Extension.Ts, ts.Extension.Dts); - const sourceContent = translated[sourceFileName]; - const tsImportRows = sourceTypeScript.split("\n").filter((line) => line.startsWith("import ")); - const declarationContent = translated[declarationFileName] - .split("\n") - .map((line) => { - if (line.startsWith("import ")) { - return tsImportRows.shift(); - } - return line; - }) - .join("\n"); - - return { - sourceContent: sourceContent, - declarationContent: declarationContent, - }; - }, -}; diff --git a/src/translators/javascript.js b/src/translators/javascript.js new file mode 100644 index 00000000..75e4959a --- /dev/null +++ b/src/translators/javascript.js @@ -0,0 +1,83 @@ +const ts = require('typescript'); +const { Translator } = require('./translator'); + +class JavascriptTranslator extends Translator { + /** + * @param {TranslatorIO} input + * @returns {Record} + */ + compileTSCode = (input) => { + const fileNameFull = `${input.fileName}${input.fileExtension}`; + const output = {}; + const host = ts.createCompilerHost(this.config.compilerTsConfig, true); + const fileNames = [fileNameFull]; + const originalSourceFileGet = host.getSourceFile.bind(host); + host.getSourceFile = ( + sourceFileName, + languageVersion, + onError, + shouldCreateNewSourceFile, + ) => { + if (sourceFileName !== fileNameFull) + return originalSourceFileGet( + sourceFileName, + languageVersion, + onError, + shouldCreateNewSourceFile, + ); + + return ts.createSourceFile( + sourceFileName, + input.fileContent, + languageVersion, + true, + ts.ScriptKind.TS, + ); + }; + + host.writeFile = (fileName, contents) => { + output[fileName] = contents; + }; + + ts.createProgram(fileNames, this.config.compilerTsConfig, host).emit(); + + return output; + }; + + translate = async (input) => { + const compiled = this.compileTSCode(input); + + const jsFileName = `${input.fileName}${ts.Extension.Js}`; + const dtsFileName = `${input.fileName}${ts.Extension.Dts}`; + const sourceContent = compiled[jsFileName]; + const tsImportRows = input.fileContent + .split('\n') + .filter((line) => line.startsWith('import ')); + const declarationContent = compiled[dtsFileName] + .split('\n') + .map((line) => { + if (line.startsWith('import ')) { + return tsImportRows.shift(); + } + return line; + }) + .join('\n'); + + return [ + { + fileName: input.fileName, + fileExtension: ts.Extension.Js, + fileContent: await this.codeFormatter.formatCode(sourceContent), + }, + { + fileName: input.fileName, + fileExtension: ts.Extension.Dts, + fileContent: await this.codeFormatter.formatCode(declarationContent), + }, + ]; + }; +} + +module.exports = { + JavascriptTranslator, +}; diff --git a/src/translators/translator.js b/src/translators/translator.js new file mode 100644 index 00000000..e6b2d72e --- /dev/null +++ b/src/translators/translator.js @@ -0,0 +1,35 @@ +/** + * @typedef {{ fileName: string, fileExtension: string, fileContent: string }} TranslatorIO + */ + +class Translator { + /** @type {Logger} */ + logger; + /** @type {CodeGenConfig} */ + config; + /** @type {CodeFormatter} */ + codeFormatter; + + /** + * @param codeGenProcess + */ + constructor(codeGenProcess) { + this.logger = codeGenProcess.logger; + this.config = codeGenProcess.config; + this.codeFormatter = codeGenProcess.codeFormatter; + } + + /** + * + * @param input {TranslatorIO} + * @return {Promise} + */ + // eslint-disable-next-line no-unused-vars + translate(input) { + throw new Error('not implemented'); + } +} + +module.exports = { + Translator, +}; diff --git a/src/type-name.js b/src/type-name-formatter.js similarity index 53% rename from src/type-name.js rename to src/type-name-formatter.js index 373e33b4..49bc1aee 100644 --- a/src/type-name.js +++ b/src/type-name-formatter.js @@ -1,10 +1,10 @@ -const _ = require("lodash"); +const _ = require('lodash'); /** * @typedef {"enum-key" | "type-name"} FormattingSchemaType */ -class TypeName { +class TypeNameFormatter { /** @type {Map} */ formattedModelNamesMap = new Map(); @@ -14,7 +14,7 @@ class TypeName { /** @type {Logger} */ logger; - constructor(config, logger) { + constructor({ config, logger }) { this.config = config; this.logger = logger; } @@ -30,20 +30,27 @@ class TypeName { /** * @type {FormattingSchemaType} */ - const schemaType = options.type || "type-name"; + const schemaType = options.type || 'type-name'; - const typePrefix = schemaType === "enum-key" ? this.config.enumKeyPrefix : this.config.typePrefix; - const typeSuffix = schemaType === "enum-key" ? this.config.enumKeySuffix : this.config.typeSuffix; + const typePrefix = + schemaType === 'enum-key' + ? this.config.enumKeyPrefix + : this.config.typePrefix; + const typeSuffix = + schemaType === 'enum-key' + ? this.config.enumKeySuffix + : this.config.typeSuffix; const hashKey = `${typePrefix}_${name}_${typeSuffix}`; - if (typeof name !== "string") { - this.logger.warn("wrong name of the model name", name); + if (typeof name !== 'string') { + this.logger.warn('wrong name of the model name', name); return name; } + // constant names like LEFT_ARROW, RIGHT_FORWARD, ETC_KEY, _KEY_NUM_ if (/^([A-Z_]{1,})$/g.test(name)) { - return _.compact([typePrefix, name, typeSuffix]).join("_"); + return _.compact([typePrefix, name, typeSuffix]).join('_'); } if (this.formattedModelNamesMap.has(hashKey)) { @@ -52,8 +59,14 @@ class TypeName { const fixedModelName = this.fixModelName(name, { type: schemaType }); - const formattedName = _.replace(_.startCase(`${typePrefix}_${fixedModelName}_${typeSuffix}`), /\s/g, ""); - const formattedResultName = this.config.hooks.onFormatTypeName(formattedName, name, schemaType) || formattedName; + const formattedName = _.replace( + _.startCase(`${typePrefix}_${fixedModelName}_${typeSuffix}`), + /\s/g, + '', + ); + const formattedResultName = + this.config.hooks.onFormatTypeName(formattedName, name, schemaType) || + formattedName; this.formattedModelNamesMap.set(hashKey, formattedResultName); @@ -68,25 +81,27 @@ class TypeName { * @return {string} */ fixModelName = (name, options) => { + const { type } = options || {}; + if (!this.isValidName(name)) { if (!/^[a-zA-Z_$]/g.test(name)) { const fixPrefix = - options && options.type === "enum-key" + type === 'enum-key' ? this.config.fixInvalidEnumKeyPrefix : this.config.fixInvalidTypeNamePrefix; name = `${fixPrefix} ${name}`; } // specific replaces for TSOA 3.x - if (name.includes(".")) + if (name.includes('.')) name = name - .replace(/Exclude_keyof[A-Za-z]{1,}/g, (match) => "ExcludeKeys") - .replace(/%22\~AND\~%22/g, "And") - .replace(/%22\~OR\~%22/g, "Or") - .replace(/(\.?%22)|\./g, "_") - .replace(/__+$/, ""); + .replace(/Exclude_keyof[A-Za-z]+/g, () => 'ExcludeKeys') + .replace(/%22~AND~%22/g, 'And') + .replace(/%22~OR~%22/g, 'Or') + .replace(/(\.?%22)|\./g, '_') + .replace(/__+$/, ''); - if (name.includes("-")) name = _.startCase(name).replace(/ /g, ""); + if (name.includes('-')) name = _.startCase(name).replace(/ /g, ''); } return name; @@ -94,5 +109,5 @@ class TypeName { } module.exports = { - TypeName, + TypeNameFormatter, }; diff --git a/src/util/file-system.js b/src/util/file-system.js index d4e5a337..e99ba03d 100644 --- a/src/util/file-system.js +++ b/src/util/file-system.js @@ -1,7 +1,8 @@ -const fs = require("fs"); -const makeDir = require("make-dir"); -const { resolve } = require("path"); -const _ = require("lodash"); +const fs = require('fs'); +const makeDir = require('make-dir'); +const { resolve } = require('path'); +const _ = require('lodash'); +const { Logger } = require('./logger'); const FILE_PREFIX = `/* eslint-disable */ /* tslint:disable */ @@ -17,10 +18,15 @@ const FILE_PREFIX = `/* eslint-disable */ `; class FileSystem { - constructor() {} + /** @type {Logger} */ + logger; + + constructor({ logger = new Logger('file-system') } = {}) { + this.logger = logger; + } getFileContent = (path) => { - return fs.readFileSync(path, { encoding: "UTF-8" }); + return fs.readFileSync(path, { encoding: 'UTF-8' }); }; readDir = (path) => { @@ -39,29 +45,33 @@ class FileSystem { }; cropExtension = (fileName) => { - const fileNameParts = _.split(fileName, "."); + const fileNameParts = _.split(fileName, '.'); if (fileNameParts.length > 1) { fileNameParts.pop(); } - return fileNameParts.join("."); + return fileNameParts.join('.'); }; removeDir = (path) => { try { - if (typeof fs.rmSync === "function") { + if (typeof fs.rmSync === 'function') { fs.rmSync(path, { recursive: true }); } else { fs.rmdirSync(path, { recursive: true }); } - } catch (e) {} + } catch (e) { + this.logger.debug('failed to remove dir', e); + } }; createDir = (path) => { try { makeDir.sync(path); - } catch (e) {} + } catch (e) { + this.logger.debug('failed to create dir', e); + } }; cleanDir = (path) => { @@ -69,10 +79,16 @@ class FileSystem { this.createDir(path); }; - pathIsExist = (path) => path && fs.existsSync(path); + pathIsExist = (path) => { + return !!path && fs.existsSync(path); + }; + + createFile = ({ path, fileName, content, withPrefix }) => { + const absolutePath = resolve(__dirname, path, `./${fileName}`); + const fileContent = `${withPrefix ? FILE_PREFIX : ''}${content}`; - createFile = ({ path, fileName, content, withPrefix }) => - fs.writeFileSync(resolve(__dirname, path, `./${fileName}`), `${withPrefix ? FILE_PREFIX : ""}${content}`, _.noop); + return fs.writeFileSync(absolutePath, fileContent, _.noop); + }; } module.exports = { diff --git a/src/util/id.js b/src/util/id.js index d4c6b30e..95847a64 100644 --- a/src/util/id.js +++ b/src/util/id.js @@ -1,6 +1,6 @@ -const { customAlphabet } = require("nanoid"); +const { customAlphabet } = require('nanoid'); -const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"; +const ALPHABET = 'abcdefghijklmnopqrstuvwxyz0123456789'; const generateId = customAlphabet(ALPHABET, 12); diff --git a/src/util/internal-case.js b/src/util/internal-case.js index 81ae2b60..bc6727f5 100644 --- a/src/util/internal-case.js +++ b/src/util/internal-case.js @@ -1,4 +1,4 @@ -const _ = require("lodash"); +const _ = require('lodash'); module.exports = { internalCase: (value) => _.camelCase(_.lowerCase(value)), diff --git a/src/util/logger.js b/src/util/logger.js index 5dbb0bb1..141fce11 100644 --- a/src/util/logger.js +++ b/src/util/logger.js @@ -1,5 +1,5 @@ -const { emojify } = require("node-emoji"); -const _ = require("lodash"); +const { emojify } = require('node-emoji'); +const _ = require('lodash'); class Logger { firstLog = true; @@ -8,11 +8,11 @@ class Logger { */ config; - constructor(config) { + constructor({ config }) { this.config = config; } - createLogMessage = ({ type, emojiName, messages, raw }) => { + createLogMessage = ({ type, emojiName, messages }) => { if (this.config.silent) return; const emoji = emojify(emojiName); @@ -22,20 +22,44 @@ class Logger { this.log( `swagger-typescript-api(${this.config.version}),${ process.env.npm_config_user_agent || `nodejs(${process.version})` - }`, + },debug mode ${this.config.debug ? 'ENABLED' : 'DISABLED'}`, ); } - if (raw) { - console.log(...raw); + if (type === 'debug' || this.config.debug) { + const trace = new Error().stack + .split('\n') + .splice(3) + .filter( + (line) => + !line.includes('swagger-typescript-api\\node_modules') && + !line.includes('swagger-typescript-api/node_modules'), + ) + .slice(0, 10); + const logFn = console[type] || console.log; + logFn(`${emoji} [${type}]`, new Date().toISOString()); + if (this.config.debugExtras && Array.isArray(this.config.debugExtras)) { + logFn(`[${this.config.debugExtras.join(' ')}]`); + } + logFn( + '[message]', + ..._.map(messages, (message) => + _.startsWith(message, '\n') + ? `\n ${message.replace(/\n/, '')}` + : message, + ), + ); + logFn(trace.join('\n') + '\n---'); return; } console[type]( emoji, - " ", + ' ', ..._.map(messages, (message) => - _.startsWith(message, "\n") ? `\n${emoji} ${message.replace(/\n/, "")}` : message, + _.startsWith(message, '\n') + ? `\n${emoji} ${message.replace(/\n/, '')}` + : message, ), ); }; @@ -46,8 +70,8 @@ class Logger { */ log = (...messages) => this.createLogMessage({ - type: "log", - emojiName: ":sparkles:", + type: 'log', + emojiName: ':sparkles:', messages, }); @@ -58,8 +82,8 @@ class Logger { */ event = (...messages) => this.createLogMessage({ - type: "log", - emojiName: ":comet: ", + type: 'log', + emojiName: ':star:', messages, }); @@ -70,8 +94,8 @@ class Logger { */ success = (...messages) => this.createLogMessage({ - type: "log", - emojiName: ":white_check_mark:", + type: 'log', + emojiName: ':white_check_mark:', messages, }); @@ -82,8 +106,8 @@ class Logger { */ warn = (...messages) => this.createLogMessage({ - type: "warn", - emojiName: ":warning: ", + type: 'warn', + emojiName: ':exclamation:', messages, }); @@ -94,8 +118,8 @@ class Logger { */ error = (...messages) => this.createLogMessage({ - type: "error", - emojiName: ":exclamation:", + type: 'error', + emojiName: ':no_entry:', messages, }); @@ -108,7 +132,9 @@ class Logger { if (!this.config.debug) return; this.createLogMessage({ - raw: messages, + type: 'debug', + emojiName: ':black_large_square:', + messages, }); }; } diff --git a/src/util/name-resolver.js b/src/util/name-resolver.js index 064881d5..4671c560 100644 --- a/src/util/name-resolver.js +++ b/src/util/name-resolver.js @@ -1,20 +1,21 @@ -const _ = require("lodash"); -const { getRandomInt } = require("./random.js"); +const _ = require('lodash'); class NameResolver { reservedNames = []; getFallbackName = null; - /** - * @type {Logger} - */ + /** @type {CodeGenConfig} */ + config; + /** @type {Logger} */ logger; /** + * @param {CodeGenConfig} config; * @param {Logger} logger; * @param {string[]} reservedNames */ - constructor(logger, reservedNames, getFallbackName) { + constructor(config, logger, reservedNames, getFallbackName) { + this.config = config; this.logger = logger; this.getFallbackName = getFallbackName; this.reserve(reservedNames); @@ -24,11 +25,18 @@ class NameResolver { * @param {string[]} names */ reserve(names) { - this.reservedNames.push(..._.uniq(_.compact(names))); + const fixedNames = _.uniq(_.compact(names)); + for (const name of fixedNames) { + if (this.reservedNames.indexOf(name) === -1) { + this.reservedNames.push(name); + } + } } unreserve(names) { - this.reservedNames.filter((reservedName) => !names.some((name) => name === reservedName)); + this.reservedNames.filter( + (reservedName) => !names.some((name) => name === reservedName), + ); } isReserved(name) { @@ -37,13 +45,32 @@ class NameResolver { /** * - * @param {(string[]) | ((reserved: string[]) => string)} variantsOrResolver + * @param {(string[])} variants + * @param {(reserved: string[]) => string)} [resolver] + * @param {any} [extras] * @returns {string | null} */ - resolve(variantsOrResolver, shouldReserve = true) { - this.logger.debug("resolving name with using", variantsOrResolver); - if (Array.isArray(variantsOrResolver)) { - const variants = variantsOrResolver; + resolve(variants, resolver, extras, shouldReserve = true) { + if (typeof resolver === 'function') { + let usageName = null; + while (usageName === null) { + const variant = resolver(variants, extras); + + if (variant === undefined) { + this.logger.warn( + 'unable to resolve name. current reserved names: ', + this.reservedNames, + ); + return null; + } + if (!shouldReserve || !this.isReserved(variant)) { + usageName = variant; + } + } + + shouldReserve && this.reserve([usageName]); + return usageName; + } else if (Array.isArray(variants)) { let usageName = null; const uniqVariants = _.uniq(_.compact(variants)); @@ -58,56 +85,21 @@ class NameResolver { return usageName; } - this.logger.debug("trying to resolve name with using fallback name generator"); - return this.resolve(this.getFallbackName); - } else if (typeof variantsOrResolver === "function") { - let usageName = null; - while (usageName === null) { - const variant = variantsOrResolver(this.reservedNames); - - if (variant === undefined) { - this.logger.warn("unable to resolve name. current reserved names: ", this.reservedNames); - return null; - } - if (!this.isReserved(variant)) { - usageName = variant; - } - } - - shouldReserve && this.reserve([usageName]); - return usageName; + this.logger.debug( + 'trying to resolve name with using fallback name generator using variants', + variants, + ); + return this.resolve(variants, this.getFallbackName, extras); } - this.logger.debug("problem with reserving names. current reserved names: ", this.reservedNames); + this.logger.debug( + 'problem with reserving names. current reserved names: ', + this.reservedNames, + ); return null; } } -class SpecificArgNameResolver extends NameResolver { - /** - * @param {Logger} logger; - * @param {string[]} reservedNames - */ - constructor(logger, reservedNames) { - super(logger, reservedNames, (variants) => { - return (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) || `arg${getRandomInt(1, 10)}`; - }); - } -} - -class ComponentTypeNameResolver extends NameResolver { - /** - * @param {Logger} logger; - * @param {string[]} reservedNames - */ - constructor(logger, reservedNames) { - super(logger, reservedNames, (variants) => { - return (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) || `ComponentType${getRandomInt(1, 10)}`; - }); - } -} - module.exports = { - SpecificArgNameResolver, - ComponentTypeNameResolver, + NameResolver, }; diff --git a/src/util/object-assign.js b/src/util/object-assign.js index 7552bc4d..8dde53c9 100644 --- a/src/util/object-assign.js +++ b/src/util/object-assign.js @@ -1,9 +1,13 @@ -const _ = require("lodash"); +const _ = require('lodash'); const objectAssign = (target, updaterFn) => { if (!updaterFn) return; - const update = typeof updaterFn === "function" ? updaterFn(target) : updaterFn; - const undefinedKeys = _.map(update, (value, key) => value === undefined && key).filter(Boolean); + const update = + typeof updaterFn === 'function' ? updaterFn(target) : updaterFn; + const undefinedKeys = _.map( + update, + (value, key) => value === undefined && key, + ).filter(Boolean); Object.assign(target, _.merge(target, update)); undefinedKeys.forEach((key) => { target[key] = undefined; diff --git a/src/util/pascal-case.js b/src/util/pascal-case.js index 1bb41c49..a78aed50 100644 --- a/src/util/pascal-case.js +++ b/src/util/pascal-case.js @@ -1,4 +1,4 @@ -const _ = require("lodash"); +const _ = require('lodash'); module.exports = { pascalCase: (value) => _.upperFirst(_.camelCase(value)), diff --git a/src/util/request.js b/src/util/request.js index 30a748b7..bf22a16b 100644 --- a/src/util/request.js +++ b/src/util/request.js @@ -1,6 +1,6 @@ -const _ = require("lodash"); -const https = require("https"); -const fetch = require("node-fetch-h2"); +const _ = require('lodash'); +const https = require('https'); +const fetch = require('node-fetch-h2'); class Request { /** @@ -31,7 +31,7 @@ class Request { */ const requestOptions = {}; - if (disableStrictSSL && !_.startsWith(url, "http://")) { + if (disableStrictSSL && !_.startsWith(url, 'http://')) { requestOptions.agent = new https.Agent({ rejectUnauthorized: false, }); @@ -49,7 +49,7 @@ class Request { return await response.text(); } catch (error) { const message = `error while fetching data from URL "${url}"`; - this.logger.error(message, "response" in error ? error.response : error); + this.logger.error(message, 'response' in error ? error.response : error); return message; } } diff --git a/src/util/sort-by-property.js b/src/util/sort-by-property.js new file mode 100644 index 00000000..69def8e9 --- /dev/null +++ b/src/util/sort-by-property.js @@ -0,0 +1,17 @@ +/** + * @param propertyName {string} + * @returns {(o1: Record, o2: Record) => 1 | -1 | 0} + */ +const sortByProperty = (propertyName) => (o1, o2) => { + if (o1[propertyName] > o2[propertyName]) { + return 1; + } + if (o1[propertyName] < o2[propertyName]) { + return -1; + } + return 0; +}; + +module.exports = { + sortByProperty, +}; diff --git a/templates/base/data-contracts.ejs b/templates/base/data-contracts.ejs index 43361a36..166908da 100644 --- a/templates/base/data-contracts.ejs +++ b/templates/base/data-contracts.ejs @@ -3,15 +3,27 @@ const { modelTypes, utils, config } = it; const { formatDescription, require, _, Ts } = utils; +const buildGenerics = (contract) => { + if (!contract.genericArgs || !contract.genericArgs.length) return ''; + + return '<' + contract.genericArgs.map(({ name, default: defaultType, extends: extendsType }) => { + return [ + name, + extendsType && `extends ${extendsType}`, + defaultType && `= ${defaultType}`, + ].join('') + }).join(',') + '>' +} + const dataContractTemplates = { enum: (contract) => { return `enum ${contract.name} {\r\n${contract.content} \r\n }`; }, interface: (contract) => { - return `interface ${contract.name} {\r\n${contract.content}}`; + return `interface ${contract.name}${buildGenerics(contract)} {\r\n${contract.content}}`; }, type: (contract) => { - return `type ${contract.name} = ${contract.content}`; + return `type ${contract.name}${buildGenerics(contract)} = ${contract.content}`; }, } %> @@ -20,9 +32,9 @@ const dataContractTemplates = { type <%~ config.Ts.CodeGenKeyword.UtilRequiredKeys %> = Omit & Required> <% } %> -<% modelTypes.forEach((contract) => { %> +<% for (const contract of modelTypes) { %> <%~ includeFile('@base/data-contract-jsdoc.ejs', { ...it, data: { ...contract, ...contract.typeData } }) %> - export <%~ (dataContractTemplates[contract.typeIdentifier] || dataContractTemplates.type)(contract) %> + <%~ contract.internal ? '' : 'export'%> <%~ (dataContractTemplates[contract.typeIdentifier] || dataContractTemplates.type)(contract) %> -<% }) %> +<% } %> diff --git a/templates/base/http-clients/axios-http-client.ejs b/templates/base/http-clients/axios-http-client.ejs index 74ba6d42..d0acff01 100644 --- a/templates/base/http-clients/axios-http-client.ejs +++ b/templates/base/http-clients/axios-http-client.ejs @@ -2,7 +2,8 @@ const { apiConfig, generateResponses, config } = it; %> -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType, HeadersDefaults } from "axios"; +import type { AxiosInstance, AxiosRequestConfig, HeadersDefaults, ResponseType, AxiosResponse } from "axios"; +import axios from "axios"; export type QueryParamsType = Record; diff --git a/templates/base/http-clients/fetch-http-client.ejs b/templates/base/http-clients/fetch-http-client.ejs index 3acd03c2..708937fc 100644 --- a/templates/base/http-clients/fetch-http-client.ejs +++ b/templates/base/http-clients/fetch-http-client.ejs @@ -185,7 +185,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), } ).then(async (response) => { diff --git a/templates/base/interface-data-contract.ejs b/templates/base/interface-data-contract.ejs index 29bbed5f..4123d798 100644 --- a/templates/base/interface-data-contract.ejs +++ b/templates/base/interface-data-contract.ejs @@ -3,8 +3,8 @@ const { contract, utils } = it; const { formatDescription, require, _ } = utils; %> export interface <%~ contract.name %> { - <% _.forEach(contract.$content, (field) => { %> + <% for (const field of contract.$content) { %> <%~ includeFile('@base/object-field-jsdoc.ejs', { ...it, field }) %> <%~ field.name %><%~ field.isRequired ? '' : '?' %>: <%~ field.value %><%~ field.isNullable ? ' | null' : ''%>; - <% }) %> + <% } %> } diff --git a/templates/base/route-type.ejs b/templates/base/route-type.ejs index bdad929f..c8aa46a6 100644 --- a/templates/base/route-type.ejs +++ b/templates/base/route-type.ejs @@ -7,6 +7,7 @@ const routeDocs = includeFile("@base/route-docs", { config, route, utils }); const routeNamespace = pascalCase(route.routeName.usage); %> + /** <%~ routeDocs.description %> diff --git a/templates/base/type-data-contract.ejs b/templates/base/type-data-contract.ejs index fb43ce22..3a5ecb62 100644 --- a/templates/base/type-data-contract.ejs +++ b/templates/base/type-data-contract.ejs @@ -5,10 +5,10 @@ const { formatDescription, require, _ } = utils; %> <% if (contract.$content.length) { %> export type <%~ contract.name %> = { - <% _.forEach(contract.$content, (field) => { %> + <% for (const field of contract.$content) { %> <%~ includeFile('@base/object-field-jsdoc.ejs', { ...it, field }) %> <%~ field.field %>; - <% }) %> + <% } %> }<%~ utils.isNeedToAddNull(contract) ? ' | null' : ''%> <% } else { %> export type <%~ contract.name %> = Record; diff --git a/templates/default/api.ejs b/templates/default/api.ejs index 5aee183b..a393c917 100644 --- a/templates/default/api.ejs +++ b/templates/default/api.ejs @@ -26,7 +26,7 @@ const descriptionLines = _.compact([ %> -<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %> +<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import type { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %> <% if (descriptionLines.length) { %> /** @@ -47,19 +47,23 @@ export class <%~ config.apiClassName %><% if ( <% } %> -<% routes.outOfModule && routes.outOfModule.forEach((route) => { %> +<% if (routes.outOfModule) { %> + <% for (const route of routes.outOfModule) { %> - <%~ includeFile('./procedure-call.ejs', { ...it, route }) %> + <%~ includeFile('./procedure-call.ejs', { ...it, route }) %> -<% }) %> + <% } %> +<% } %> -<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %> - <%~ moduleName %> = { - <% routes.forEach((route) => { %> +<% if (routes.combined) { %> + <% for (const { routes: combinedRoutes = [], moduleName } of routes.combined) { %> + <%~ moduleName %> = { + <% for (const route of combinedRoutes) { %> - <%~ includeFile('./procedure-call.ejs', { ...it, route }) %> + <%~ includeFile('./procedure-call.ejs', { ...it, route }) %> - <% }) %> - } -<% }) %> + <% } %> + } + <% } %> +<% } %> } diff --git a/templates/default/route-types.ejs b/templates/default/route-types.ejs index 5c9ff567..6590a64f 100644 --- a/templates/default/route-types.ejs +++ b/templates/default/route-types.ejs @@ -12,17 +12,21 @@ import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataCont /* TODO: outOfModule, combined should be attributes of route, which will allow to avoid duplication of code */ %> -<% routes.outOfModule && routes.outOfModule.forEach(({ routes = [] }) => { %> - <% routes.forEach((route) => { %> - <%~ includeFile('@base/route-type.ejs', { ...it, route }) %> - <% }) %> -<% }) %> +<% if (routes.outOfModule) { %> + <% for (const { routes: outOfModuleRoutes = [] } of routes.outOfModule) { %> + <% for (const route of outOfModuleRoutes) { %> + <%~ includeFile('@base/route-type.ejs', { ...it, route }) %> + <% } %> + <% } %> +<% } %> -<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %> - export namespace <%~ pascalCase(moduleName) %> { - <% routes.forEach((route) => { %> - <%~ includeFile('@base/route-type.ejs', { ...it, route }) %> - <% }) %> - } +<% if (routes.combined) { %> + <% for (const { routes: combinedRoutes = [], moduleName } of routes.combined) { %> + export namespace <%~ pascalCase(moduleName) %> { + <% for (const route of combinedRoutes) { %> + <%~ includeFile('@base/route-type.ejs', { ...it, route }) %> + <% } %> + } -<% }) %> + <% } %> +<% } %> diff --git a/templates/modular/api.ejs b/templates/modular/api.ejs index ab371e31..25bfa182 100644 --- a/templates/modular/api.ejs +++ b/templates/modular/api.ejs @@ -6,7 +6,7 @@ const routes = route.routes; const dataContracts = _.map(modelTypes, "name"); %> -<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %> +<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import type { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %> import { HttpClient, RequestParams, ContentType, HttpResponse } from "./<%~ config.fileNames.httpClient %>"; <% if (dataContracts.length) { %> @@ -22,7 +22,7 @@ export class <%= apiClassName %><% if (!config.singl } <% } %> - <% routes.forEach((route) => { %> + <% for (const route of routes) { %> <%~ includeFile('./procedure-call.ejs', { ...it, route }) %> - <% }) %> + <% } %> } diff --git a/templates/modular/route-types.ejs b/templates/modular/route-types.ejs index d1f52eea..16ec9dcb 100644 --- a/templates/modular/route-types.ejs +++ b/templates/modular/route-types.ejs @@ -10,9 +10,9 @@ import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataCont <% } %> export namespace <%~ pascalCase(moduleName) %> { - <% _.forEach(routes, (route) => { %> + <% for (const route of routes) { %> <%~ includeFile('@base/route-type.ejs', { ...it, route }) %> - <% }) %> + <% } %> } diff --git a/tests/allSchemas.js b/tests/allSchemas.js index 62894659..52229edc 100644 --- a/tests/allSchemas.js +++ b/tests/allSchemas.js @@ -1,7 +1,10 @@ const { resolve } = require("path"); +const dotenv = require("dotenv"); const createSchemaInfos = require("./helpers/createSchemaInfos"); -module.exports = [ +dotenv.config(); + +let allSchemas = [ ...createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./schemas/v2.0"), absoluteOutputPath: resolve(__dirname, "./generated/v2.0"), @@ -11,3 +14,15 @@ module.exports = [ absoluteOutputPath: resolve(__dirname, "./generated/v3.0"), }), ]; + +if (process.env.TEST_FILE_NAME) { + console.warn("TEST ONLY", process.env.TEST_FILE_NAME); + allSchemas = allSchemas.filter((schema) => schema.apiFileName === process.env.TEST_FILE_NAME); +} + +if (process.env.TEST_SCHEMA_VERSION) { + console.warn("TEST ONLY", process.env.TEST_SCHEMA_VERSION); + allSchemas = allSchemas.filter((schema) => schema.outputPath.endsWith(process.env.TEST_SCHEMA_VERSION)); +} + +module.exports = allSchemas; diff --git a/tests/generate-extended.js b/tests/generate-extended.js index 1c070e7a..b6b9a774 100644 --- a/tests/generate-extended.js +++ b/tests/generate-extended.js @@ -1,8 +1,11 @@ const _ = require("lodash"); const { resolve } = require("path"); +const dotenv = require("dotenv"); const allSchemas = require("./allSchemas"); const { generateApiForTest } = require("./helpers/generateApiForTest"); +dotenv.config(); + class GenerateExtendedError extends Error { constructor(message, outputPath, fileName) { super(message); @@ -26,20 +29,33 @@ allSchemas.forEach(async ({ absolutePath, apiFileName, outputPath }) => { output: output, generateClient: true, generateRouteTypes: false, - silent: true, + silent: !process.env.TEST_WITH_DEBUG, + debug: process.env.TEST_WITH_DEBUG, extractRequestBody: true, + extractResponseBody: true, + extractEnums: true, extractRequestParams: true, + extractResponseError: true, typePrefix: "IMySuperPrefix", typeSuffix: "MySuperSuffix", sortTypes: true, + debugExtras: ["generate-extended", apiFileName], }).then((result) => { result.configuration.modelTypes.forEach((modelType) => { if (modelType.name) { if (modelType.name.startsWith("IMySuperPrefixIMySuperPrefix")) { - throw new GenerateExtendedError(`modelType has prefix/suffix duplicates - ${modelType.name}`, output, name); + throw new GenerateExtendedError( + `[${outputPath}][${apiFileName}] modelType has prefix/suffix duplicates - ${modelType.name}`, + output, + name, + ); } if (!modelType.name.startsWith("IMySuperPrefix")) { - throw new GenerateExtendedError(`modelType has not prefix/suffix - ${modelType.name}`, output, name); + throw new GenerateExtendedError( + `[${outputPath}][${apiFileName}] modelType has not prefix/suffix - ${modelType.name}`, + output, + name, + ); } } }); diff --git a/tests/generate.js b/tests/generate.js index 1c0a0d82..89309b11 100644 --- a/tests/generate.js +++ b/tests/generate.js @@ -1,6 +1,9 @@ const allSchemas = require("./allSchemas"); +const dotenv = require("dotenv"); const { generateApiForTest } = require("./helpers/generateApiForTest"); +dotenv.config(); + allSchemas.forEach(({ absolutePath, apiFileName, outputPath }) => { generateApiForTest({ testName: "generate script", @@ -9,7 +12,9 @@ allSchemas.forEach(({ absolutePath, apiFileName, outputPath }) => { output: outputPath, generateClient: true, generateRouteTypes: false, - silent: true, + silent: !process.env.TEST_WITH_DEBUG, + debug: process.env.TEST_WITH_DEBUG, sortTypes: true, + debugExtras: ["generate", apiFileName], }); }); diff --git a/tests/generated/v2.0/adafruit.ts b/tests/generated/v2.0/adafruit.ts index 2cc5ce4d..632679cb 100644 --- a/tests/generated/v2.0/adafruit.ts +++ b/tests/generated/v2.0/adafruit.ts @@ -343,7 +343,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -599,11 +599,6 @@ export class Api extends HttpClient extends HttpClient @@ -636,11 +636,6 @@ export class Api extends HttpClient extends HttpClient @@ -1102,20 +1102,20 @@ export class Api extends HttpClient @@ -1194,26 +1194,26 @@ export class Api extends HttpClient @@ -1761,11 +1761,6 @@ export class Api extends HttpClient extends HttpClient diff --git a/tests/generated/v2.0/another-example.ts b/tests/generated/v2.0/another-example.ts index e68edcd1..37e356f6 100644 --- a/tests/generated/v2.0/another-example.ts +++ b/tests/generated/v2.0/another-example.ts @@ -319,7 +319,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -750,10 +750,10 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/another-schema.ts b/tests/generated/v2.0/another-schema.ts index d336b24e..15e6f4a8 100644 --- a/tests/generated/v2.0/another-schema.ts +++ b/tests/generated/v2.0/another-schema.ts @@ -207,7 +207,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/api-with-examples.ts b/tests/generated/v2.0/api-with-examples.ts index c57736d7..5688a6b2 100644 --- a/tests/generated/v2.0/api-with-examples.ts +++ b/tests/generated/v2.0/api-with-examples.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/authentiq.ts b/tests/generated/v2.0/authentiq.ts index 7fe19e9e..ed73d84e 100644 --- a/tests/generated/v2.0/authentiq.ts +++ b/tests/generated/v2.0/authentiq.ts @@ -226,7 +226,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -316,12 +316,12 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/enums.ts b/tests/generated/v2.0/enums.ts index 8095fea2..a0a2b101 100644 --- a/tests/generated/v2.0/enums.ts +++ b/tests/generated/v2.0/enums.ts @@ -245,7 +245,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/example1.ts b/tests/generated/v2.0/example1.ts index 5fbe9b93..2128f3d1 100644 --- a/tests/generated/v2.0/example1.ts +++ b/tests/generated/v2.0/example1.ts @@ -223,7 +223,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/file-formdata-example.ts b/tests/generated/v2.0/file-formdata-example.ts index 023d994a..04a5eb3d 100644 --- a/tests/generated/v2.0/file-formdata-example.ts +++ b/tests/generated/v2.0/file-formdata-example.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/furkot-example.ts b/tests/generated/v2.0/furkot-example.ts index 96ba02b6..005b5f83 100644 --- a/tests/generated/v2.0/furkot-example.ts +++ b/tests/generated/v2.0/furkot-example.ts @@ -259,7 +259,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/giphy.ts b/tests/generated/v2.0/giphy.ts index 358dd58a..6e6dfa41 100644 --- a/tests/generated/v2.0/giphy.ts +++ b/tests/generated/v2.0/giphy.ts @@ -443,7 +443,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -533,10 +533,10 @@ export class Api extends HttpClient @@ -567,8 +567,8 @@ export class Api extends HttpClient extends HttpClient @@ -721,10 +721,10 @@ export class Api extends HttpClient @@ -755,8 +755,8 @@ export class Api extends HttpClient extends HttpClient diff --git a/tests/generated/v2.0/github-swagger.ts b/tests/generated/v2.0/github-swagger.ts index a81c8234..10507d17 100644 --- a/tests/generated/v2.0/github-swagger.ts +++ b/tests/generated/v2.0/github-swagger.ts @@ -1544,19 +1544,6 @@ export interface Repo { watchers_count?: number; } -export type RepoDeployments = { - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -}[]; - export type RepoComments = { body?: string; commit_id?: string; @@ -1611,6 +1598,19 @@ export interface RepoCommitBody { tree: string; } +export type RepoDeployments = { + created_at?: string; + /** A GitHub user */ + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +}[]; + export interface RepoEdit { description?: string; has_downloads?: boolean; @@ -2084,7 +2084,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -2150,6 +2150,16 @@ export class Api extends HttpClient @@ -2531,25 +2541,25 @@ export class Api extends HttpClient @@ -2593,17 +2603,17 @@ export class Api extends HttpClient @@ -2645,10 +2655,10 @@ export class Api extends HttpClient @@ -2890,25 +2900,25 @@ export class Api extends HttpClient @@ -3331,17 +3341,17 @@ export class Api extends HttpClient extends HttpClient @@ -4038,12 +4048,12 @@ export class Api extends HttpClient @@ -4462,15 +4472,15 @@ export class Api extends HttpClient @@ -4618,18 +4628,18 @@ export class Api extends HttpClient @@ -4669,12 +4679,12 @@ export class Api extends HttpClient @@ -5787,25 +5797,25 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/path-args.ts b/tests/generated/v2.0/path-args.ts index 0d1a861b..4749296d 100644 --- a/tests/generated/v2.0/path-args.ts +++ b/tests/generated/v2.0/path-args.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/petstore-expanded.ts b/tests/generated/v2.0/petstore-expanded.ts index 2158c9d3..ce1eabef 100644 --- a/tests/generated/v2.0/petstore-expanded.ts +++ b/tests/generated/v2.0/petstore-expanded.ts @@ -222,7 +222,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -289,13 +289,13 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/petstore-minimal.ts b/tests/generated/v2.0/petstore-minimal.ts index 478d3348..43c4a04d 100644 --- a/tests/generated/v2.0/petstore-minimal.ts +++ b/tests/generated/v2.0/petstore-minimal.ts @@ -194,7 +194,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/petstore-simple.ts b/tests/generated/v2.0/petstore-simple.ts index 7950a2df..e155b077 100644 --- a/tests/generated/v2.0/petstore-simple.ts +++ b/tests/generated/v2.0/petstore-simple.ts @@ -210,7 +210,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -263,13 +263,13 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/petstore-swagger-io.ts b/tests/generated/v2.0/petstore-swagger-io.ts index cadbd75e..dd7810b0 100644 --- a/tests/generated/v2.0/petstore-swagger-io.ts +++ b/tests/generated/v2.0/petstore-swagger-io.ts @@ -247,7 +247,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -601,10 +601,10 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/petstore-with-external-docs.ts b/tests/generated/v2.0/petstore-with-external-docs.ts index 3e901f9c..fbc1a740 100644 --- a/tests/generated/v2.0/petstore-with-external-docs.ts +++ b/tests/generated/v2.0/petstore-with-external-docs.ts @@ -202,7 +202,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -256,13 +256,13 @@ export class Api extends HttpClient diff --git a/tests/generated/v2.0/petstore.ts b/tests/generated/v2.0/petstore.ts index 88d19bd3..6b2c621f 100644 --- a/tests/generated/v2.0/petstore.ts +++ b/tests/generated/v2.0/petstore.ts @@ -201,7 +201,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/query-path-param.ts b/tests/generated/v2.0/query-path-param.ts index 6495af64..f238377b 100644 --- a/tests/generated/v2.0/query-path-param.ts +++ b/tests/generated/v2.0/query-path-param.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v2.0/uber.ts b/tests/generated/v2.0/uber.ts index b2762c2a..ead4c756 100644 --- a/tests/generated/v2.0/uber.ts +++ b/tests/generated/v2.0/uber.ts @@ -265,7 +265,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -352,25 +352,25 @@ export class Api extends HttpClient @@ -392,6 +392,13 @@ export class Api extends HttpClient extends HttpClient @@ -449,15 +449,15 @@ export class Api extends HttpClient diff --git a/tests/generated/v3.0/additional-properties.ts b/tests/generated/v3.0/additional-properties.ts index d98fdf05..af6e77a8 100644 --- a/tests/generated/v3.0/additional-properties.ts +++ b/tests/generated/v3.0/additional-properties.ts @@ -193,7 +193,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/additional-properties2.ts b/tests/generated/v3.0/additional-properties2.ts index 9f596ef6..ad285a96 100644 --- a/tests/generated/v3.0/additional-properties2.ts +++ b/tests/generated/v3.0/additional-properties2.ts @@ -9,7 +9,7 @@ * --------------------------------------------------------------- */ -export type Primitive = null; +export type Primitive = string | number | boolean | null | (string & number & boolean & null); export type PrimitiveMap = Record; @@ -190,7 +190,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/allof-example.ts b/tests/generated/v3.0/allof-example.ts index ed5ab192..84fc00bb 100644 --- a/tests/generated/v3.0/allof-example.ts +++ b/tests/generated/v3.0/allof-example.ts @@ -10,8 +10,8 @@ */ export type Cat = Pet & { - hunts?: boolean; age?: number; + hunts?: boolean; }; export type Dog = Pet & { @@ -200,7 +200,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/anyof-example.ts b/tests/generated/v3.0/anyof-example.ts index d999e9c7..5bb06a41 100644 --- a/tests/generated/v3.0/anyof-example.ts +++ b/tests/generated/v3.0/anyof-example.ts @@ -196,7 +196,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/api-with-examples.ts b/tests/generated/v3.0/api-with-examples.ts index 707d61b5..726096d0 100644 --- a/tests/generated/v3.0/api-with-examples.ts +++ b/tests/generated/v3.0/api-with-examples.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/callback-example.ts b/tests/generated/v3.0/callback-example.ts index 89875f35..1de713ed 100644 --- a/tests/generated/v3.0/callback-example.ts +++ b/tests/generated/v3.0/callback-example.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/components-responses.ts b/tests/generated/v3.0/components-responses.ts index cecc7fd2..17a6ada7 100644 --- a/tests/generated/v3.0/components-responses.ts +++ b/tests/generated/v3.0/components-responses.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/explode-param-3.0.1.ts b/tests/generated/v3.0/explode-param-3.0.1.ts index 5b48d4b3..aeb8f32a 100644 --- a/tests/generated/v3.0/explode-param-3.0.1.ts +++ b/tests/generated/v3.0/explode-param-3.0.1.ts @@ -205,7 +205,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/full-swagger-scheme.ts b/tests/generated/v3.0/full-swagger-scheme.ts index 5e48e5c9..ae1543fd 100644 --- a/tests/generated/v3.0/full-swagger-scheme.ts +++ b/tests/generated/v3.0/full-swagger-scheme.ts @@ -13,10 +13,10 @@ export interface ActionsBillingUsage { /** The amount of free GitHub Actions minutes available. */ included_minutes: number; minutes_used_breakdown: { - /** Total minutes used on Ubuntu runner machines. */ - UBUNTU?: number; /** Total minutes used on macOS runner machines. */ MACOS?: number; + /** Total minutes used on Ubuntu runner machines. */ + UBUNTU?: number; /** Total minutes used on Windows runner machines. */ WINDOWS?: number; }; @@ -162,8 +162,8 @@ export interface ApiOverview { /** @example ["192.30.252.153/32","192.30.252.154/32"] */ pages?: string[]; ssh_key_fingerprints?: { - SHA256_RSA?: string; SHA256_DSA?: string; + SHA256_RSA?: string; }; /** @example true */ verifiable_password_authentication: boolean; @@ -459,10 +459,10 @@ export interface BaseGist { string, { filename?: string; - type?: string; language?: string; raw_url?: string; size?: number; + type?: string; } >; forks?: any[]; @@ -535,10 +535,10 @@ export interface BranchProtection { /** Protected Branch Pull Request Review */ required_pull_request_reviews?: ProtectedBranchPullRequestReview; required_status_checks: { - url?: string; - enforcement_level: string; contexts: string[]; contexts_url?: string; + enforcement_level: string; + url?: string; }; /** Branch Restriction Policy */ restrictions?: BranchRestrictionPolicy; @@ -551,96 +551,96 @@ export interface BranchProtection { */ export interface BranchRestrictionPolicy { apps: { + created_at?: string; + description?: string; + events?: string[]; + external_url?: string; + html_url?: string; id?: number; - slug?: string; + name?: string; node_id?: string; owner?: { - login?: string; - id?: number; - node_id?: string; - url?: string; - repos_url?: string; - events_url?: string; - hooks_url?: string; - issues_url?: string; - members_url?: string; - public_members_url?: string; avatar_url?: string; description?: string; - /** @example """" */ - gravatar_id?: string; - /** @example ""https://github.com/testorg-ea8ec76d71c3af4b"" */ - html_url?: string; + events_url?: string; /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/followers"" */ followers_url?: string; /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/following{/other_user}"" */ following_url?: string; /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/gists{/gist_id}"" */ gists_url?: string; - /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/starred{/owner}{/repo}"" */ - starred_url?: string; - /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/subscriptions"" */ - subscriptions_url?: string; + /** @example """" */ + gravatar_id?: string; + hooks_url?: string; + /** @example ""https://github.com/testorg-ea8ec76d71c3af4b"" */ + html_url?: string; + id?: number; + issues_url?: string; + login?: string; + members_url?: string; + node_id?: string; /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/orgs"" */ organizations_url?: string; + public_members_url?: string; /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/received_events"" */ received_events_url?: string; + repos_url?: string; + /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/starred{/owner}{/repo}"" */ + starred_url?: string; + /** @example ""https://api.github.com/users/testorg-ea8ec76d71c3af4b/subscriptions"" */ + subscriptions_url?: string; /** @example ""Organization"" */ type?: string; + url?: string; }; - name?: string; - description?: string; - external_url?: string; - html_url?: string; - created_at?: string; - updated_at?: string; permissions?: { - metadata?: string; contents?: string; issues?: string; + metadata?: string; single_file?: string; }; - events?: string[]; + slug?: string; + updated_at?: string; }[]; /** @format uri */ apps_url: string; teams: { - id?: number; - node_id?: string; - url?: string; + description?: string | null; html_url?: string; + id?: number; + members_url?: string; name?: string; - slug?: string; - description?: string | null; - privacy?: string; + node_id?: string; + parent?: string | null; permission?: string; - members_url?: string; + privacy?: string; repositories_url?: string; - parent?: string | null; + slug?: string; + url?: string; }[]; /** @format uri */ teams_url: string; /** @format uri */ url: string; users: { - login?: string; - id?: number; - node_id?: string; avatar_url?: string; - gravatar_id?: string; - url?: string; - html_url?: string; + events_url?: string; followers_url?: string; following_url?: string; gists_url?: string; - starred_url?: string; - subscriptions_url?: string; + gravatar_id?: string; + html_url?: string; + id?: number; + login?: string; + node_id?: string; organizations_url?: string; - repos_url?: string; - events_url?: string; received_events_url?: string; - type?: string; + repos_url?: string; site_admin?: boolean; + starred_url?: string; + subscriptions_url?: string; + type?: string; + url?: string; }[]; /** @format uri */ users_url: string; @@ -749,12 +749,12 @@ export interface CheckRun { /** @example "MDg6Q2hlY2tSdW40" */ node_id: string; output: { - title: string | null; - summary: string | null; - text: string | null; annotations_count: number; /** @format uri */ annotations_url: string; + summary: string | null; + text: string | null; + title: string | null; }; pull_requests: PullRequestMinimal[]; /** @@ -988,13 +988,13 @@ export type CodeScanningAlertDismissedReason = "false positive" | "won't fix" | export type CodeScanningAlertEnvironment = string; export type CodeScanningAlertInstances = { - /** The full Git reference, formatted as `refs/heads/`. */ - ref?: CodeScanningAlertRef; /** Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. */ analysis_key?: CodeScanningAnalysisAnalysisKey; /** Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed. */ environment?: CodeScanningAlertEnvironment; matrix_vars?: string | null; + /** The full Git reference, formatted as `refs/heads/`. */ + ref?: CodeScanningAlertRef; /** State of a code scanning alert. */ state?: CodeScanningAlertState; }[]; @@ -1143,9 +1143,9 @@ export interface Collaborator { */ organizations_url: string; permissions?: { + admin: boolean; pull: boolean; push: boolean; - admin: boolean; }; /** * @format uri @@ -1212,17 +1212,12 @@ export interface Commit { */ comments_url: string; commit: { - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - url: string; author: GitUser | null; + /** @example 0 */ + comment_count: number; committer: GitUser | null; /** @example "Fix all the bugs" */ message: string; - /** @example 0 */ - comment_count: number; tree: { /** @example "827efc6d56897b048c772eb4087f854f46256132" */ sha: string; @@ -1232,24 +1227,29 @@ export interface Commit { */ url: string; }; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + url: string; verification?: Verification; }; committer: SimpleUser | null; files?: { - filename?: string; additions?: number; - deletions?: number; - changes?: number; - status?: string; - raw_url?: string; blob_url?: string; - patch?: string; - /** @example ""1e8e60ce9733d5283f7836fa602b6365a66b2567"" */ - sha?: string; + changes?: number; /** @example ""https://api.github.com/repos/owner-3d68404b07d25daeb2d4a6bf/AAA_Public_Repo/contents/geometry.js?ref=c3956841a7cb7e8ba4a6fd923568d86958f01573"" */ contents_url?: string; + deletions?: number; + filename?: string; + patch?: string; /** @example ""subdir/before_name.txt"" */ previous_filename?: string; + raw_url?: string; + /** @example ""1e8e60ce9733d5283f7836fa602b6365a66b2567"" */ + sha?: string; + status?: string; }[]; /** * @format uri @@ -1259,6 +1259,11 @@ export interface Commit { /** @example "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==" */ node_id: string; parents: { + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd" + */ + html_url?: string; /** @example "7638417db6d59f3c431d3e1f261cc637155684cd" */ sha: string; /** @@ -1266,11 +1271,6 @@ export interface Commit { * @example "https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd" */ url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd" - */ - html_url?: string; }[]; /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ sha: string; @@ -1381,13 +1381,13 @@ export interface CommitSearchResultItem { comments_url: string; commit: { author: { - name: string; - email: string; /** @format date-time */ date: string; + email: string; + name: string; }; - committer: GitUser | null; comment_count: number; + committer: GitUser | null; message: string; tree: { sha: string; @@ -1403,9 +1403,9 @@ export interface CommitSearchResultItem { html_url: string; node_id: string; parents: { - url?: string; html_url?: string; sha?: string; + url?: string; }[]; /** Minimal Repository */ repository: MinimalRepository; @@ -1437,11 +1437,11 @@ export interface CommunityProfile { documentation: string | null; files: { code_of_conduct: CodeOfConductSimple | null; - license: LicenseSimple | null; contributing: CommunityHealthFile | null; - readme: CommunityHealthFile | null; issue_template: CommunityHealthFile | null; + license: LicenseSimple | null; pull_request_template: CommunityHealthFile | null; + readme: CommunityHealthFile | null; }; /** @example 100 */ health_percentage: number; @@ -1457,20 +1457,6 @@ export interface CommunityProfile { * A list of directory items */ export type ContentDirectory = { - type: string; - size: number; - name: string; - path: string; - content?: string; - sha: string; - /** @format uri */ - url: string; - /** @format uri */ - git_url: string | null; - /** @format uri */ - html_url: string | null; - /** @format uri */ - download_url: string | null; _links: { /** @format uri */ git: string | null; @@ -1479,6 +1465,20 @@ export type ContentDirectory = { /** @format uri */ self: string; }; + content?: string; + /** @format uri */ + download_url: string | null; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; }[]; /** @@ -1634,20 +1634,6 @@ export interface ContentTree { /** @format uri */ download_url: string | null; entries?: { - type: string; - size: number; - name: string; - path: string; - content?: string; - sha: string; - /** @format uri */ - url: string; - /** @format uri */ - git_url: string | null; - /** @format uri */ - html_url: string | null; - /** @format uri */ - download_url: string | null; _links: { /** @format uri */ git: string | null; @@ -1656,6 +1642,20 @@ export interface ContentTree { /** @format uri */ self: string; }; + content?: string; + /** @format uri */ + download_url: string | null; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; }[]; /** @format uri */ git_url: string | null; @@ -1716,10 +1716,10 @@ export interface ContributorActivity { total: number; /** @example [{"w":"1367712000","a":6898,"d":77,"c":10}] */ weeks: { - w?: string; a?: number; - d?: number; c?: number; + d?: number; + w?: string; }[]; } @@ -2080,17 +2080,17 @@ export interface Event { org?: Actor; payload: { action: string; - /** Issue Simple */ - issue?: IssueSimple; /** Comments provide a way for people to collaborate on an issue. */ comment?: IssueComment; + /** Issue Simple */ + issue?: IssueSimple; pages?: { - page_name?: string; - title?: string; - summary?: string | null; action?: string; - sha?: string; html_url?: string; + page_name?: string; + sha?: string; + summary?: string | null; + title?: string; }[]; }; public: boolean; @@ -2109,21 +2109,21 @@ export interface Event { */ export interface Feed { _links: { - /** Hypermedia Link with Type */ - timeline: LinkWithType; - /** Hypermedia Link with Type */ - user: LinkWithType; - /** Hypermedia Link with Type */ - security_advisories?: LinkWithType; /** Hypermedia Link with Type */ current_user?: LinkWithType; /** Hypermedia Link with Type */ - current_user_public?: LinkWithType; - /** Hypermedia Link with Type */ current_user_actor?: LinkWithType; /** Hypermedia Link with Type */ current_user_organization?: LinkWithType; current_user_organizations?: LinkWithType[]; + /** Hypermedia Link with Type */ + current_user_public?: LinkWithType; + /** Hypermedia Link with Type */ + security_advisories?: LinkWithType; + /** Hypermedia Link with Type */ + timeline: LinkWithType; + /** Hypermedia Link with Type */ + user: LinkWithType; }; /** @example "https://github.com/octocat.private.actor?token=abc123" */ current_user_actor_url?: string; @@ -2149,52 +2149,52 @@ export interface Feed { */ export interface FileCommit { commit: { - sha?: string; - node_id?: string; - url?: string; - html_url?: string; author?: { date?: string; - name?: string; email?: string; + name?: string; }; committer?: { date?: string; - name?: string; email?: string; + name?: string; }; + html_url?: string; message?: string; - tree?: { - url?: string; - sha?: string; - }; + node_id?: string; parents?: { - url?: string; html_url?: string; sha?: string; + url?: string; }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; verification?: { - verified?: boolean; + payload?: string | null; reason?: string; signature?: string | null; - payload?: string | null; + verified?: boolean; }; }; content: { + _links?: { + git?: string; + html?: string; + self?: string; + }; + download_url?: string; + git_url?: string; + html_url?: string; name?: string; path?: string; sha?: string; size?: number; - url?: string; - html_url?: string; - git_url?: string; - download_url?: string; type?: string; - _links?: { - self?: string; - git?: string; - html?: string; - }; + url?: string; } | null; } @@ -2484,9 +2484,9 @@ export interface GistComment { */ export interface GistCommit { change_status: { - total?: number; additions?: number; deletions?: number; + total?: number; }; /** * @format date-time @@ -2516,13 +2516,13 @@ export interface GistSimple { files?: Record< string, { + content?: string; filename?: string; - type?: string; language?: string; raw_url?: string; size?: number; truncated?: boolean; - content?: string; + type?: string; } | null >; forks_url?: string; @@ -2592,6 +2592,8 @@ export interface GitCommit { message: string; node_id: string; parents: { + /** @format uri */ + html_url: string; /** * SHA for the commit * @example "7638417db6d59f3c431d3e1f261cc637155684cd" @@ -2599,8 +2601,6 @@ export interface GitCommit { sha: string; /** @format uri */ url: string; - /** @format uri */ - html_url: string; }[]; /** * SHA for the commit @@ -2619,10 +2619,10 @@ export interface GitCommit { /** @format uri */ url: string; verification: { - verified: boolean; + payload: string | null; reason: string; signature: string | null; - payload: string | null; + verified: boolean; }; } @@ -2633,7 +2633,6 @@ export interface GitCommit { export interface GitRef { node_id: string; object: { - type: string; /** * SHA for the reference * @minLength 40 @@ -2641,6 +2640,7 @@ export interface GitRef { * @example "7638417db6d59f3c431d3e1f261cc637155684cd" */ sha: string; + type: string; /** @format uri */ url: string; }; @@ -2699,16 +2699,16 @@ export interface GitTree { * @example [{"path":"file.rb","mode":"100644","type":"blob","size":30,"sha":"44b4fc6d56897b048c772eb4087f854f46256132","url":"https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132","properties":{"path":{"type":"string"},"mode":{"type":"string"},"type":{"type":"string"},"size":{"type":"integer"},"sha":{"type":"string"},"url":{"type":"string"}},"required":["path","mode","type","sha","url","size"]}] */ tree: { - /** @example "test/file.rb" */ - path?: string; /** @example "040000" */ mode?: string; - /** @example "tree" */ - type?: string; + /** @example "test/file.rb" */ + path?: string; /** @example "23f6827669e43831def8a7ad935069c8bd418261" */ sha?: string; /** @example 12 */ size?: number; + /** @example "tree" */ + type?: string; /** @example "https://api.github.com/repos/owner-482f3203ecf01f67e9deb18e/BBB_Private_Repo/git/blobs/23f6827669e43831def8a7ad935069c8bd418261" */ url?: string; }[]; @@ -2793,19 +2793,19 @@ export interface GpgKey { raw_key: string | null; /** @example [{"id":4,"primary_key_id":3,"key_id":"4A595D4C72EE49C7","public_key":"zsBNBFayYZ...","emails":[],"subkeys":[],"can_sign":false,"can_encrypt_comms":true,"can_encrypt_storage":true,"can_certify":false,"created_at":"2016-03-24T11:31:04-06:00","expires_at":null}] */ subkeys: { - id?: number; - primary_key_id?: number; - key_id?: string; - public_key?: string; - emails?: any[]; - subkeys?: any[]; - can_sign?: boolean; + can_certify?: boolean; can_encrypt_comms?: boolean; can_encrypt_storage?: boolean; - can_certify?: boolean; + can_sign?: boolean; created_at?: string; + emails?: any[]; expires_at?: string | null; + id?: number; + key_id?: string; + primary_key_id?: number; + public_key?: string; raw_key?: string | null; + subkeys?: any[]; }[]; } @@ -2834,6 +2834,11 @@ export interface GroupMapping { * @example [{"group_id":"111a1a11-aaa1-1aaa-11a1-a1a1a1a1a1aa","group_name":"saml-azuread-test","group_description":"A group of Developers working on AzureAD SAML SSO"},{"group_id":"2bb2bb2b-bb22-22bb-2bb2-bb2bbb2bb2b2","group_name":"saml-azuread-test2","group_description":"Another group of Developers working on AzureAD SAML SSO"}] */ groups?: { + /** + * a description of the group + * @example "A group of Developers working on AzureAD SAML SSO" + */ + group_description: string; /** * The ID of the group * @example "111a1a11-aaa1-1aaa-11a1-a1a1a1a1a1aa" @@ -2844,11 +2849,6 @@ export interface GroupMapping { * @example "saml-azuread-test" */ group_name: string; - /** - * a description of the group - * @example "A group of Developers working on AzureAD SAML SSO" - */ - group_description: string; }[]; /** * synchronization status for this group mapping @@ -2873,26 +2873,26 @@ export interface Hook { */ active: boolean; config: { + /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ + content_type?: WebhookConfigContentType; + /** @example ""sha256"" */ + digest?: string; /** @example ""foo@bar.com"" */ email?: string; + /** Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.** */ + insecure_ssl?: WebhookConfigInsecureSsl; /** @example ""foo"" */ password?: string; /** @example ""roomer"" */ room?: string; - /** @example ""foo"" */ - subdomain?: string; - /** The URL to which the payloads will be delivered. */ - url?: WebhookConfigUrl; - /** Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.** */ - insecure_ssl?: WebhookConfigInsecureSsl; - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ - content_type?: WebhookConfigContentType; - /** @example ""sha256"" */ - digest?: string; /** If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers). */ secret?: WebhookConfigSecret; + /** @example ""foo"" */ + subdomain?: string; /** @example ""abc"" */ token?: string; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; }; /** * @format date-time @@ -2975,9 +2975,9 @@ export interface Import { large_files_size?: number; message?: string; project_choices?: { - vcs?: string; - tfvc_project?: string; human_name?: string; + tfvc_project?: string; + vcs?: string; }[]; push_percent?: number | null; /** @format uri */ @@ -3045,16 +3045,16 @@ export interface Installation { id: number; /** @example {"issues":"read","deployments":"write"} */ permissions: { - deployments?: string; checks?: string; - metadata?: string; contents?: string; - pull_requests?: string; - statuses?: string; + deployments?: string; /** @example ""read"" */ issues?: string; + metadata?: string; /** @example ""read"" */ organization_administration?: string; + pull_requests?: string; + statuses?: string; }; /** * @format uri @@ -3087,8 +3087,8 @@ export interface InstallationToken { /** @example true */ has_multiple_single_files?: boolean; permissions?: { - issues?: string; contents?: string; + issues?: string; /** @example "read" */ metadata?: string; /** @example "read" */ @@ -3159,11 +3159,11 @@ export interface Integration { * @example {"issues":"read","deployments":"write"} */ permissions: { - issues?: string; checks?: string; - metadata?: string; contents?: string; deployments?: string; + issues?: string; + metadata?: string; [key: string]: any; }; /** @@ -3267,14 +3267,14 @@ export interface Issue { labels: ( | string | { + color?: string | null; + default?: boolean; + description?: string | null; id?: number; + name?: string; node_id?: string; /** @format uri */ url?: string; - name?: string; - description?: string | null; - color?: string | null; - default?: boolean; } )[]; labels_url: string; @@ -3288,12 +3288,12 @@ export interface Issue { number: number; performed_via_github_app?: Integration | null; pull_request?: { - /** @format date-time */ - merged_at?: string | null; /** @format uri */ diff_url: string | null; /** @format uri */ html_url: string | null; + /** @format date-time */ + merged_at?: string | null; /** @format uri */ patch_url: string | null; /** @format uri */ @@ -3538,13 +3538,13 @@ export interface IssueSearchResultItem { html_url: string; id: number; labels: { - id?: number; - node_id?: string; - url?: string; - name?: string; color?: string; default?: boolean; description?: string | null; + id?: number; + name?: string; + node_id?: string; + url?: string; }[]; labels_url: string; locked: boolean; @@ -3553,12 +3553,12 @@ export interface IssueSearchResultItem { number: number; performed_via_github_app?: Integration | null; pull_request?: { - /** @format date-time */ - merged_at?: string | null; /** @format uri */ diff_url: string | null; /** @format uri */ html_url: string | null; + /** @format date-time */ + merged_at?: string | null; /** @format uri */ patch_url: string | null; /** @format uri */ @@ -3634,12 +3634,12 @@ export interface IssueSimple { number: number; performed_via_github_app?: Integration | null; pull_request?: { - /** @format date-time */ - merged_at?: string | null; /** @format uri */ diff_url: string | null; /** @format uri */ html_url: string | null; + /** @format date-time */ + merged_at?: string | null; /** @format uri */ patch_url: string | null; /** @format uri */ @@ -3729,10 +3729,11 @@ export interface Job { /** Steps in this job. */ steps?: { /** - * The phase of the lifecycle that the job is currently in. - * @example "queued" + * The time that the job finished, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" */ - status: "queued" | "in_progress" | "completed"; + completed_at?: string | null; /** * The outcome of the job. * @example "success" @@ -3752,11 +3753,10 @@ export interface Job { */ started_at?: string | null; /** - * The time that the job finished, in ISO 8601 format. - * @format date-time - * @example "2019-08-08T08:00:00-07:00" + * The phase of the lifecycle that the job is currently in. + * @example "queued" */ - completed_at?: string | null; + status: "queued" | "in_progress" | "completed"; }[]; /** @example "https://api.github.com/repos/github/hello-world/actions/jobs/21" */ url: string; @@ -4035,23 +4035,23 @@ export interface MarketplacePurchase { id: number; login: string; marketplace_pending_change?: { - is_installed?: boolean; effective_date?: string; - unit_count?: number | null; id?: number; + is_installed?: boolean; /** Marketplace Listing Plan */ plan?: MarketplaceListingPlan; + unit_count?: number | null; }; marketplace_purchase: { billing_cycle?: string; - next_billing_date?: string | null; + free_trial_ends_on?: string | null; is_installed?: boolean; - unit_count?: number | null; + next_billing_date?: string | null; on_free_trial?: boolean; - free_trial_ends_on?: string | null; - updated_at?: string; /** Marketplace Listing Plan */ plan?: MarketplaceListingPlan; + unit_count?: number | null; + updated_at?: string; }; organization_billing_email?: string; type: string; @@ -4275,9 +4275,9 @@ export interface MinimalRepository { license?: { key?: string; name?: string; + node_id?: string; spdx_id?: string; url?: string; - node_id?: string; } | null; /** * @format uri @@ -4300,8 +4300,8 @@ export interface MinimalRepository { owner: SimpleUser | null; permissions?: { admin?: boolean; - push?: boolean; pull?: boolean; + push?: boolean; }; private: boolean; /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ @@ -4374,14 +4374,14 @@ export interface OrgHook { /** @example true */ active: boolean; config: { - /** @example ""http://example.com/2"" */ - url?: string; - /** @example ""0"" */ - insecure_ssl?: string; /** @example ""form"" */ content_type?: string; + /** @example ""0"" */ + insecure_ssl?: string; /** @example ""********"" */ secret?: string; + /** @example ""http://example.com/2"" */ + url?: string; }; /** * @format date-time @@ -4549,11 +4549,11 @@ export interface OrganizationFull { /** @example 100 */ owned_private_repos?: number; plan?: { + filled_seats?: number; name: string; - space: number; private_repos: number; - filled_seats?: number; seats?: number; + space: number; }; /** @example 81 */ private_gists?: number | null; @@ -4845,8 +4845,8 @@ export interface PrivateUser { plan?: { collaborators: number; name: string; - space: number; private_repos: number; + space: number; }; /** @example 81 */ private_gists: number; @@ -5065,38 +5065,38 @@ export interface ProtectedBranch { enabled: boolean; }; enforce_admins?: { + enabled: boolean; /** @format uri */ url: string; - enabled: boolean; }; required_linear_history?: { enabled: boolean; }; required_pull_request_reviews?: { - /** @format uri */ - url: string; dismiss_stale_reviews?: boolean; - require_code_owner_reviews?: boolean; - required_approving_review_count?: number; dismissal_restrictions?: { + teams: Team[]; + /** @format uri */ + teams_url: string; /** @format uri */ url: string; + users: SimpleUser[]; /** @format uri */ users_url: string; - /** @format uri */ - teams_url: string; - users: SimpleUser[]; - teams: Team[]; }; + require_code_owner_reviews?: boolean; + required_approving_review_count?: number; + /** @format uri */ + url: string; }; required_signatures?: { + /** @example true */ + enabled: boolean; /** * @format uri * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_signatures" */ url: string; - /** @example true */ - enabled: boolean; }; /** Status Check Policy */ required_status_checks?: StatusCheckPolicy; @@ -5128,16 +5128,16 @@ export interface ProtectedBranchPullRequestReview { /** @example true */ dismiss_stale_reviews: boolean; dismissal_restrictions?: { - /** The list of users with review dismissal access. */ - users?: SimpleUser[]; /** The list of teams with review dismissal access. */ teams?: Team[]; + /** @example ""https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/teams"" */ + teams_url?: string; /** @example ""https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions"" */ url?: string; + /** The list of users with review dismissal access. */ + users?: SimpleUser[]; /** @example ""https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/users"" */ users_url?: string; - /** @example ""https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/teams"" */ - teams_url?: string; }; /** @example true */ require_code_owner_reviews: boolean; @@ -5195,8 +5195,8 @@ export interface PublicUser { plan?: { collaborators: number; name: string; - space: number; private_repos: number; + space: number; }; /** @example 1 */ private_gists?: number; @@ -5233,17 +5233,17 @@ export interface PullRequest { /** Hypermedia Link */ commits: Link; /** Hypermedia Link */ - statuses: Link; - /** Hypermedia Link */ html: Link; /** Hypermedia Link */ issue: Link; /** Hypermedia Link */ - review_comments: Link; - /** Hypermedia Link */ review_comment: Link; /** Hypermedia Link */ + review_comments: Link; + /** Hypermedia Link */ self: Link; + /** Hypermedia Link */ + statuses: Link; }; /** @example "too heated" */ active_lock_reason?: string | null; @@ -5259,10 +5259,15 @@ export interface PullRequest { label: string; ref: string; repo: { + allow_merge_commit?: boolean; + allow_rebase_merge?: boolean; + allow_squash_merge?: boolean; archive_url: string; + archived: boolean; assignees_url: string; blobs_url: string; branches_url: string; + clone_url: string; collaborators_url: string; comments_url: string; commits_url: string; @@ -5270,38 +5275,59 @@ export interface PullRequest { contents_url: string; /** @format uri */ contributors_url: string; + /** @format date-time */ + created_at: string; + default_branch: string; /** @format uri */ deployments_url: string; description: string | null; + disabled: boolean; /** @format uri */ downloads_url: string; /** @format uri */ events_url: string; fork: boolean; + forks: number; + forks_count: number; /** @format uri */ forks_url: string; full_name: string; git_commits_url: string; git_refs_url: string; git_tags_url: string; - /** @format uri */ + git_url: string; + has_downloads: boolean; + has_issues: boolean; + has_pages: boolean; + has_projects: boolean; + has_wiki: boolean; + /** @format uri */ + homepage: string | null; + /** @format uri */ hooks_url: string; /** @format uri */ html_url: string; id: number; - node_id: string; issue_comment_url: string; issue_events_url: string; issues_url: string; keys_url: string; labels_url: string; + language: string | null; /** @format uri */ languages_url: string; + license: LicenseSimple | null; + master_branch?: string; /** @format uri */ merges_url: string; milestones_url: string; + /** @format uri */ + mirror_url: string | null; name: string; + node_id: string; notifications_url: string; + open_issues: number; + open_issues_count: number; owner: { /** @format uri */ avatar_url: string; @@ -5314,8 +5340,8 @@ export interface PullRequest { /** @format uri */ html_url: string; id: number; - node_id: string; login: string; + node_id: string; /** @format uri */ organizations_url: string; /** @format uri */ @@ -5330,9 +5356,19 @@ export interface PullRequest { /** @format uri */ url: string; }; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; private: boolean; pulls_url: string; + /** @format date-time */ + pushed_at: string; releases_url: string; + size: number; + ssh_url: string; + stargazers_count: number; /** @format uri */ stargazers_url: string; statuses_url: string; @@ -5341,56 +5377,20 @@ export interface PullRequest { /** @format uri */ subscription_url: string; /** @format uri */ + svn_url: string; + /** @format uri */ tags_url: string; /** @format uri */ teams_url: string; - trees_url: string; - /** @format uri */ - url: string; - clone_url: string; - default_branch: string; - forks: number; - forks_count: number; - git_url: string; - has_downloads: boolean; - has_issues: boolean; - has_projects: boolean; - has_wiki: boolean; - has_pages: boolean; - /** @format uri */ - homepage: string | null; - language: string | null; - master_branch?: string; - archived: boolean; - disabled: boolean; - /** @format uri */ - mirror_url: string | null; - open_issues: number; - open_issues_count: number; - permissions?: { - admin: boolean; - pull: boolean; - push: boolean; - }; temp_clone_token?: string; - allow_merge_commit?: boolean; - allow_squash_merge?: boolean; - allow_rebase_merge?: boolean; - license: LicenseSimple | null; + topics?: string[]; + trees_url: string; /** @format date-time */ - pushed_at: string; - size: number; - ssh_url: string; - stargazers_count: number; + updated_at: string; /** @format uri */ - svn_url: string; - topics?: string[]; + url: string; watchers: number; watchers_count: number; - /** @format date-time */ - created_at: string; - /** @format date-time */ - updated_at: string; }; sha: string; user: { @@ -5405,8 +5405,8 @@ export interface PullRequest { /** @format uri */ html_url: string; id: number; - node_id: string; login: string; + node_id: string; /** @format uri */ organizations_url: string; /** @format uri */ @@ -5466,10 +5466,15 @@ export interface PullRequest { label: string; ref: string; repo: { + allow_merge_commit?: boolean; + allow_rebase_merge?: boolean; + allow_squash_merge?: boolean; archive_url: string; + archived: boolean; assignees_url: string; blobs_url: string; branches_url: string; + clone_url: string; collaborators_url: string; comments_url: string; commits_url: string; @@ -5477,38 +5482,66 @@ export interface PullRequest { contents_url: string; /** @format uri */ contributors_url: string; + /** @format date-time */ + created_at: string; + default_branch: string; /** @format uri */ deployments_url: string; description: string | null; + disabled: boolean; /** @format uri */ downloads_url: string; /** @format uri */ events_url: string; fork: boolean; + forks: number; + forks_count: number; /** @format uri */ forks_url: string; full_name: string; git_commits_url: string; git_refs_url: string; git_tags_url: string; + git_url: string; + has_downloads: boolean; + has_issues: boolean; + has_pages: boolean; + has_projects: boolean; + has_wiki: boolean; + /** @format uri */ + homepage: string | null; /** @format uri */ hooks_url: string; /** @format uri */ html_url: string; id: number; - node_id: string; issue_comment_url: string; issue_events_url: string; issues_url: string; keys_url: string; labels_url: string; + language: string | null; /** @format uri */ languages_url: string; + license: { + key: string; + name: string; + node_id: string; + spdx_id: string | null; + /** @format uri */ + url: string | null; + }; + master_branch?: string; /** @format uri */ merges_url: string; milestones_url: string; + /** @format uri */ + mirror_url: string | null; name: string; + node_id: string; notifications_url: string; + open_issues: number; + open_issues_count: number; owner: { /** @format uri */ avatar_url: string; @@ -5521,8 +5554,8 @@ export interface PullRequest { /** @format uri */ html_url: string; id: number; - node_id: string; login: string; + node_id: string; /** @format uri */ organizations_url: string; /** @format uri */ @@ -5537,9 +5570,19 @@ export interface PullRequest { /** @format uri */ url: string; }; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; private: boolean; pulls_url: string; + /** @format date-time */ + pushed_at: string; releases_url: string; + size: number; + ssh_url: string; + stargazers_count: number; /** @format uri */ stargazers_url: string; statuses_url: string; @@ -5548,63 +5591,20 @@ export interface PullRequest { /** @format uri */ subscription_url: string; /** @format uri */ + svn_url: string; + /** @format uri */ tags_url: string; /** @format uri */ teams_url: string; - trees_url: string; - /** @format uri */ - url: string; - clone_url: string; - default_branch: string; - forks: number; - forks_count: number; - git_url: string; - has_downloads: boolean; - has_issues: boolean; - has_projects: boolean; - has_wiki: boolean; - has_pages: boolean; - /** @format uri */ - homepage: string | null; - language: string | null; - master_branch?: string; - archived: boolean; - disabled: boolean; - /** @format uri */ - mirror_url: string | null; - open_issues: number; - open_issues_count: number; - permissions?: { - admin: boolean; - pull: boolean; - push: boolean; - }; temp_clone_token?: string; - allow_merge_commit?: boolean; - allow_squash_merge?: boolean; - allow_rebase_merge?: boolean; - license: { - key: string; - name: string; - /** @format uri */ - url: string | null; - spdx_id: string | null; - node_id: string; - }; + topics?: string[]; + trees_url: string; /** @format date-time */ - pushed_at: string; - size: number; - ssh_url: string; - stargazers_count: number; + updated_at: string; /** @format uri */ - svn_url: string; - topics?: string[]; + url: string; watchers: number; watchers_count: number; - /** @format date-time */ - created_at: string; - /** @format date-time */ - updated_at: string; }; sha: string; user: { @@ -5619,8 +5619,8 @@ export interface PullRequest { /** @format uri */ html_url: string; id: number; - node_id: string; login: string; + node_id: string; /** @format uri */ organizations_url: string; /** @format uri */ @@ -5649,13 +5649,13 @@ export interface PullRequest { */ issue_url: string; labels: { + color?: string; + default?: boolean; + description?: string | null; id?: number; + name?: string; node_id?: string; url?: string; - name?: string; - description?: string | null; - color?: string; - default?: boolean; }[]; /** @example true */ locked: boolean; @@ -5745,21 +5745,21 @@ export interface PullRequestMergeResult { export interface PullRequestMinimal { base: { ref: string; - sha: string; repo: { id: number; - url: string; name: string; + url: string; }; + sha: string; }; head: { ref: string; - sha: string; repo: { id: number; - url: string; name: string; + url: string; }; + sha: string; }; id: number; number: number; @@ -5823,24 +5823,24 @@ export interface PullRequestReview { */ export interface PullRequestReviewComment { _links: { - self: { + html: { /** * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" */ href: string; }; - html: { + pull_request: { /** * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" */ href: string; }; - pull_request: { + self: { /** * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" */ href: string; }; @@ -5988,17 +5988,17 @@ export interface PullRequestSimple { /** Hypermedia Link */ commits: Link; /** Hypermedia Link */ - statuses: Link; - /** Hypermedia Link */ html: Link; /** Hypermedia Link */ issue: Link; /** Hypermedia Link */ - review_comments: Link; - /** Hypermedia Link */ review_comment: Link; /** Hypermedia Link */ + review_comments: Link; + /** Hypermedia Link */ self: Link; + /** Hypermedia Link */ + statuses: Link; }; /** @example "too heated" */ active_lock_reason?: string | null; @@ -6069,13 +6069,13 @@ export interface PullRequestSimple { */ issue_url: string; labels: { + color?: string; + default?: boolean; + description?: string; id?: number; + name?: string; node_id?: string; url?: string; - name?: string; - description?: string; - color?: string; - default?: boolean; }[]; /** @example true */ locked: boolean; @@ -6141,12 +6141,12 @@ export interface RateLimit { export interface RateLimitOverview { rate: RateLimit; resources: { + code_scanning_upload?: RateLimit; core: RateLimit; graphql?: RateLimit; + integration_manifest?: RateLimit; search: RateLimit; source_import?: RateLimit; - integration_manifest?: RateLimit; - code_scanning_upload?: RateLimit; }; } @@ -6600,10 +6600,10 @@ export interface Repository { owner: SimpleUser | null; permissions?: { admin: boolean; + maintain?: boolean; pull: boolean; - triage?: boolean; push: boolean; - maintain?: boolean; + triage?: boolean; }; /** * Whether the repository is private or public. @@ -6662,109 +6662,109 @@ export interface Repository { teams_url: string; temp_clone_token?: string; template_repository?: { - id?: number; - node_id?: string; - name?: string; - full_name?: string; - owner?: { - login?: string; - id?: number; - node_id?: string; - avatar_url?: string; - gravatar_id?: string; - url?: string; - html_url?: string; - followers_url?: string; - following_url?: string; - gists_url?: string; - starred_url?: string; - subscriptions_url?: string; - organizations_url?: string; - repos_url?: string; - events_url?: string; - received_events_url?: string; - type?: string; - site_admin?: boolean; - }; - private?: boolean; - html_url?: string; - description?: string; - fork?: boolean; - url?: string; + allow_merge_commit?: boolean; + allow_rebase_merge?: boolean; + allow_squash_merge?: boolean; archive_url?: string; + archived?: boolean; assignees_url?: string; blobs_url?: string; branches_url?: string; + clone_url?: string; collaborators_url?: string; comments_url?: string; commits_url?: string; compare_url?: string; contents_url?: string; contributors_url?: string; + created_at?: string; + default_branch?: string; + delete_branch_on_merge?: boolean; deployments_url?: string; + description?: string; + disabled?: boolean; downloads_url?: string; events_url?: string; + fork?: boolean; + forks_count?: number; forks_url?: string; + full_name?: string; git_commits_url?: string; git_refs_url?: string; git_tags_url?: string; git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_pages?: boolean; + has_projects?: boolean; + has_wiki?: boolean; + homepage?: string; + hooks_url?: string; + html_url?: string; + id?: number; + is_template?: boolean; issue_comment_url?: string; issue_events_url?: string; issues_url?: string; keys_url?: string; labels_url?: string; + language?: string; languages_url?: string; merges_url?: string; milestones_url?: string; + mirror_url?: string; + name?: string; + network_count?: number; + node_id?: string; notifications_url?: string; + open_issues_count?: number; + owner?: { + avatar_url?: string; + events_url?: string; + followers_url?: string; + following_url?: string; + gists_url?: string; + gravatar_id?: string; + html_url?: string; + id?: number; + login?: string; + node_id?: string; + organizations_url?: string; + received_events_url?: string; + repos_url?: string; + site_admin?: boolean; + starred_url?: string; + subscriptions_url?: string; + type?: string; + url?: string; + }; + permissions?: { + admin?: boolean; + pull?: boolean; + push?: boolean; + }; + private?: boolean; pulls_url?: string; + pushed_at?: string; releases_url?: string; + size?: number; ssh_url?: string; + stargazers_count?: number; stargazers_url?: string; statuses_url?: string; + subscribers_count?: number; subscribers_url?: string; subscription_url?: string; + svn_url?: string; tags_url?: string; teams_url?: string; - trees_url?: string; - clone_url?: string; - mirror_url?: string; - hooks_url?: string; - svn_url?: string; - homepage?: string; - language?: string; - forks_count?: number; - stargazers_count?: number; - watchers_count?: number; - size?: number; - default_branch?: string; - open_issues_count?: number; - is_template?: boolean; + temp_clone_token?: string; topics?: string[]; - has_issues?: boolean; - has_projects?: boolean; - has_wiki?: boolean; - has_pages?: boolean; - has_downloads?: boolean; - archived?: boolean; - disabled?: boolean; - visibility?: string; - pushed_at?: string; - created_at?: string; + trees_url?: string; updated_at?: string; - permissions?: { - admin?: boolean; - push?: boolean; - pull?: boolean; - }; - allow_rebase_merge?: boolean; - temp_clone_token?: string; - allow_squash_merge?: boolean; - delete_branch_on_merge?: boolean; - allow_merge_commit?: boolean; - subscribers_count?: number; - network_count?: number; + url?: string; + visibility?: string; + watchers_count?: number; } | null; topics?: string[]; /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ @@ -6870,12 +6870,12 @@ export interface RepositorySubscription { */ export interface ReviewComment { _links: { - /** Hypermedia Link */ - self: Link; /** Hypermedia Link */ html: Link; /** Hypermedia Link */ pull_request: Link; + /** Hypermedia Link */ + self: Link; }; /** How the author is associated with the repository. */ author_association: AuthorAssociation; @@ -7036,15 +7036,15 @@ export interface ScimEnterpriseGroup { externalId?: string | null; id: string; members?: { - value?: string; $ref?: string; display?: string; + value?: string; }[]; meta?: { - resourceType?: string; created?: string; lastModified?: string; location?: string; + resourceType?: string; }; schemas: string[]; } @@ -7052,9 +7052,9 @@ export interface ScimEnterpriseGroup { export interface ScimEnterpriseUser { active?: boolean; emails?: { - value?: string; - type?: string; primary?: boolean; + type?: string; + value?: string; }[]; externalId?: string; groups?: { @@ -7062,14 +7062,14 @@ export interface ScimEnterpriseUser { }[]; id: string; meta?: { - resourceType?: string; created?: string; lastModified?: string; location?: string; + resourceType?: string; }; name?: { - givenName?: string; familyName?: string; + givenName?: string; }; schemas: string[]; userName?: string; @@ -7090,21 +7090,21 @@ export interface ScimError { export interface ScimGroupListEnterprise { Resources: { - schemas: string[]; - id: string; - externalId?: string | null; displayName?: string; + externalId?: string | null; + id: string; members?: { - value?: string; $ref?: string; display?: string; + value?: string; }[]; meta?: { - resourceType?: string; created?: string; lastModified?: string; location?: string; + resourceType?: string; }; + schemas: string[]; }[]; itemsPerPage: number; schemas: string[]; @@ -7133,8 +7133,8 @@ export interface ScimUser { * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] */ emails: { - value: string; primary?: boolean; + value: string; }[]; /** * The ID of the User. @@ -7143,8 +7143,8 @@ export interface ScimUser { externalId: string | null; /** associated groups */ groups?: { - value?: string; display?: string; + value?: string; }[]; /** * Unique identifier of an external identity @@ -7152,8 +7152,6 @@ export interface ScimUser { */ id: string; meta: { - /** @example "User" */ - resourceType?: string; /** * @format date-time * @example "2019-01-24T22:45:36.000Z" @@ -7169,12 +7167,14 @@ export interface ScimUser { * @example "https://api.github.com/scim/v2/organizations/myorg-123abc55141bfd8f/Users/c42772b5-2029-11e9-8543-9264a97dec8d" */ location?: string; + /** @example "User" */ + resourceType?: string; }; /** @example {"givenName":"Jane","familyName":"User"} */ name: { - givenName: string | null; familyName: string | null; formatted?: string | null; + givenName: string | null; }; /** * Set of operations to be performed @@ -7221,29 +7221,29 @@ export interface ScimUserList { export interface ScimUserListEnterprise { Resources: { - schemas: string[]; - id: string; - externalId?: string; - userName?: string; - name?: { - givenName?: string; - familyName?: string; - }; + active?: boolean; emails?: { - value?: string; primary?: boolean; type?: string; + value?: string; }[]; + externalId?: string; groups?: { value?: string; }[]; - active?: boolean; + id: string; meta?: { - resourceType?: string; created?: string; lastModified?: string; location?: string; + resourceType?: string; + }; + name?: { + familyName?: string; + givenName?: string; }; + schemas: string[]; + userName?: string; }[]; itemsPerPage: number; schemas: string[]; @@ -7274,14 +7274,14 @@ export interface ScopedInstallation { /** Search Result Text Matches */ export type SearchResultTextMatches = { - object_url?: string; - object_type?: string | null; - property?: string; fragment?: string; matches?: { - text?: string; indices?: number[]; + text?: string; }[]; + object_type?: string | null; + object_url?: string; + property?: string; }[]; export interface SecretScanningAlert { @@ -7364,12 +7364,12 @@ export interface ShortBranch { */ export interface SimpleCommit { author: { - name: string; email: string; + name: string; } | null; committer: { - name: string; email: string; + name: string; } | null; id: string; message: string; @@ -7817,9 +7817,9 @@ export interface TeamProject { organization_permission?: string; owner_url: string; permissions: { + admin: boolean; read: boolean; write: boolean; - admin: boolean; }; /** Whether the project is private or not. Only present when owner is an organization. */ private?: boolean; @@ -8032,10 +8032,10 @@ export interface TeamRepository { owner: SimpleUser | null; permissions?: { admin: boolean; + maintain?: boolean; pull: boolean; - triage?: boolean; push: boolean; - maintain?: boolean; + triage?: boolean; }; /** * Whether the repository is private or public. @@ -8185,10 +8185,10 @@ export interface Thread { /** Minimal Repository */ repository: MinimalRepository; subject: { - title: string; - url: string; latest_comment_url: string; + title: string; type: string; + url: string; }; /** @example "https://api.github.com/notifications/threads/2/subscription" */ subscription_url: string; @@ -8246,8 +8246,8 @@ export interface TopicSearchResultItem { topic_relation?: { id?: number; name?: string; - topic_id?: number; relation_type?: string; + topic_id?: number; }; }[] | null; @@ -8266,8 +8266,8 @@ export interface TopicSearchResultItem { topic_relation?: { id?: number; name?: string; - topic_id?: number; relation_type?: string; + topic_id?: number; }; }[] | null; @@ -8378,11 +8378,11 @@ export interface UserSearchResultItem { export interface ValidationError { documentation_url: string; errors?: { - resource?: string; - field?: string; - message?: string; code: string; + field?: string; index?: number; + message?: string; + resource?: string; value?: string | null | number | null | string[] | null; }[]; message: string; @@ -8599,17 +8599,17 @@ export interface WorkflowRun { */ export interface WorkflowRunUsage { billable: { - UBUNTU?: { - total_ms: number; - jobs: number; - }; MACOS?: { + jobs: number; total_ms: number; + }; + UBUNTU?: { jobs: number; + total_ms: number; }; WINDOWS?: { - total_ms: number; jobs: number; + total_ms: number; }; }; run_duration_ms: number; @@ -8621,10 +8621,10 @@ export interface WorkflowRunUsage { */ export interface WorkflowUsage { billable: { - UBUNTU?: { + MACOS?: { total_ms?: number; }; - MACOS?: { + UBUNTU?: { total_ms?: number; }; WINDOWS?: { @@ -8810,7 +8810,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -8866,10 +8866,6 @@ export class Api extends HttpClient this.request< { - /** @format uri */ - current_user_url: string; - /** @format uri */ - current_user_authorizations_html_url: string; /** @format uri */ authorizations_url: string; /** @format uri */ @@ -8877,6 +8873,12 @@ export class Api extends HttpClient extends HttpClient({ @@ -8984,14 +8984,14 @@ export class Api extends HttpClient @@ -9014,19 +9014,19 @@ export class Api extends HttpClient @@ -9051,8 +9051,8 @@ export class Api extends HttpClient({ path: `/app/installations/${installationId}`, @@ -9087,6 +9087,8 @@ export class Api extends HttpClient extends HttpClient @@ -9103,8 +9103,8 @@ export class Api extends HttpClient({ @@ -9160,8 +9160,8 @@ export class Api extends HttpClient extends HttpClient @@ -9368,6 +9368,15 @@ export class Api extends HttpClient extends HttpClient @@ -9463,8 +9463,8 @@ export class Api extends HttpClient({ path: `/apps/${appSlug}`, @@ -9485,16 +9485,16 @@ export class Api extends HttpClient @@ -9517,18 +9517,6 @@ export class Api extends HttpClient extends HttpClient @@ -9570,11 +9570,8 @@ export class Api extends HttpClient extends HttpClient @@ -9614,11 +9614,6 @@ export class Api extends HttpClient extends HttpClient @@ -9667,15 +9667,10 @@ export class Api extends HttpClient extends HttpClient @@ -9726,8 +9726,8 @@ export class Api extends HttpClient({ path: `/codes_of_conduct`, @@ -9749,8 +9749,8 @@ export class Api extends HttpClient({ path: `/codes_of_conduct/${key}`, @@ -9771,18 +9771,18 @@ export class Api extends HttpClient @@ -9790,8 +9790,8 @@ export class Api extends HttpClient({ @@ -9848,10 +9848,10 @@ export class Api extends HttpClient @@ -9874,23 +9874,23 @@ export class Api extends HttpClient this.request< { - total_count: number; organizations: OrganizationSimple[]; + total_count: number; }, any >({ @@ -10011,23 +10011,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runner_groups: RunnerGroupsEnterprise[]; + total_count: number; }, any >({ @@ -10051,12 +10051,12 @@ export class Api extends HttpClient @@ -10151,23 +10151,23 @@ export class Api extends HttpClient this.request< { - total_count: number; organizations: OrganizationSimple[]; + total_count: number; }, any >({ @@ -10255,23 +10255,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runners: Runner[]; + total_count: number; }, any >({ @@ -10358,23 +10358,23 @@ export class Api extends HttpClient this.request< { - total_count?: number; runners?: Runner[]; + total_count?: number; }, any >({ @@ -10483,8 +10483,10 @@ export class Api extends HttpClient extends HttpClient extends HttpClient @@ -10580,16 +10580,16 @@ export class Api extends HttpClient @@ -10598,8 +10598,8 @@ export class Api extends HttpClient({ path: `/events`, @@ -10637,18 +10637,18 @@ export class Api extends HttpClient @@ -10710,18 +10710,18 @@ export class Api extends HttpClient @@ -10743,18 +10743,18 @@ export class Api extends HttpClient @@ -10779,12 +10779,12 @@ export class Api extends HttpClient({ @@ -10861,16 +10861,16 @@ export class Api extends HttpClient @@ -10924,12 +10924,12 @@ export class Api extends HttpClient({ @@ -10995,16 +10995,16 @@ export class Api extends HttpClient @@ -11027,16 +11027,16 @@ export class Api extends HttpClient @@ -11169,25 +11169,25 @@ export class Api extends HttpClient this.request< { - total_count: number; repositories: Repository[]; /** @example "selected" */ repository_selection?: string; + total_count: number; }, BasicError >({ @@ -11224,6 +11224,12 @@ export class Api extends HttpClient extends HttpClient @@ -11333,16 +11333,16 @@ export class Api extends HttpClient @@ -11398,16 +11398,16 @@ export class Api extends HttpClient @@ -11430,23 +11430,23 @@ export class Api extends HttpClient @@ -11484,16 +11484,16 @@ export class Api extends HttpClient @@ -11516,23 +11516,23 @@ export class Api extends HttpClient @@ -11574,16 +11574,16 @@ export class Api extends HttpClient @@ -11611,25 +11611,25 @@ export class Api extends HttpClient @@ -11799,13 +11799,13 @@ export class Api extends HttpClient @@ -11847,22 +11847,10 @@ export class Api extends HttpClient extends HttpClient extends HttpClient extends HttpClient @@ -11940,8 +11940,8 @@ export class Api extends HttpClient({ @@ -11980,10 +11980,10 @@ export class Api extends HttpClient @@ -12006,23 +12006,23 @@ export class Api extends HttpClient this.request< { - total_count: number; repositories: Repository[]; + total_count: number; }, any >({ @@ -12139,23 +12139,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runner_groups: RunnerGroupsOrg[]; + total_count: number; }, any >({ @@ -12179,15 +12179,15 @@ export class Api extends HttpClient @@ -12274,8 +12274,8 @@ export class Api extends HttpClient this.request< { - total_count: number; repositories: Repository[]; + total_count: number; }, any >({ @@ -12362,23 +12362,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runners: Runner[]; + total_count: number; }, any >({ @@ -12465,23 +12465,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runners: Runner[]; + total_count: number; }, any >({ @@ -12582,23 +12582,23 @@ export class Api extends HttpClient this.request< { - total_count: number; secrets: OrganizationActionsSecret[]; + total_count: number; }, any >({ @@ -12657,6 +12657,8 @@ export class Api extends HttpClient extends HttpClient @@ -12703,8 +12703,8 @@ export class Api extends HttpClient this.request< { - total_count: number; repositories: MinimalRepository[]; + total_count: number; }, any >({ @@ -12790,8 +12790,10 @@ export class Api extends HttpClient extends HttpClient extends HttpClient @@ -12840,8 +12840,8 @@ export class Api extends HttpClient({ path: `/orgs/${org}/blocks`, @@ -12937,16 +12937,16 @@ export class Api extends HttpClient @@ -12969,16 +12969,16 @@ export class Api extends HttpClient @@ -13001,16 +13001,16 @@ export class Api extends HttpClient @@ -13033,33 +13033,33 @@ export class Api extends HttpClient @@ -13100,27 +13100,27 @@ export class Api extends HttpClient extends HttpClient @@ -13240,23 +13240,23 @@ export class Api extends HttpClient this.request< { - total_count: number; installations: Installation[]; + total_count: number; }, any >({ @@ -13327,16 +13327,16 @@ export class Api extends HttpClient @@ -13359,10 +13359,10 @@ export class Api extends HttpClient extends HttpClient @@ -13444,6 +13444,11 @@ export class Api extends HttpClient extends HttpClient @@ -13513,23 +13513,23 @@ export class Api extends HttpClient @@ -13644,16 +13644,16 @@ export class Api extends HttpClient @@ -13676,19 +13676,19 @@ export class Api extends HttpClient @@ -13774,16 +13774,16 @@ export class Api extends HttpClient @@ -13813,16 +13813,16 @@ export class Api extends HttpClient @@ -13846,8 +13846,8 @@ export class Api extends HttpClient({ @@ -13868,8 +13868,8 @@ export class Api extends HttpClient({ path: `/orgs/${org}/outside_collaborators/${username}`, @@ -13889,20 +13889,20 @@ export class Api extends HttpClient @@ -13925,10 +13925,10 @@ export class Api extends HttpClient @@ -13952,16 +13952,16 @@ export class Api extends HttpClient @@ -14029,25 +14029,25 @@ export class Api extends HttpClient @@ -14070,22 +14070,35 @@ export class Api extends HttpClient extends HttpClient @@ -14208,16 +14208,16 @@ export class Api extends HttpClient @@ -14240,16 +14240,16 @@ export class Api extends HttpClient @@ -14272,14 +14272,22 @@ export class Api extends HttpClient extends HttpClient @@ -14341,10 +14341,20 @@ export class Api extends HttpClient extends HttpClient @@ -14408,16 +14408,16 @@ export class Api extends HttpClient @@ -14441,8 +14441,6 @@ export class Api extends HttpClient extends HttpClient @@ -14491,10 +14491,10 @@ export class Api extends HttpClient @@ -14540,16 +14540,16 @@ export class Api extends HttpClient @@ -14675,16 +14675,16 @@ export class Api extends HttpClient @@ -14761,16 +14761,16 @@ export class Api extends HttpClient @@ -14842,16 +14842,16 @@ export class Api extends HttpClient @@ -14876,23 +14876,23 @@ export class Api extends HttpClient @@ -14946,12 +14946,12 @@ export class Api extends HttpClient({ path: `/orgs/${org}/teams/${teamSlug}/memberships/${username}`, @@ -14989,16 +14989,16 @@ export class Api extends HttpClient @@ -15058,8 +15058,8 @@ export class Api extends HttpClient({ path: `/orgs/${org}/teams/${teamSlug}/projects/${projectId}`, @@ -15096,16 +15096,16 @@ export class Api extends HttpClient @@ -15220,12 +15220,12 @@ export class Api extends HttpClient extends HttpClient @@ -15300,16 +15300,16 @@ export class Api extends HttpClient @@ -15335,9 +15335,9 @@ export class Api extends HttpClient({ path: `/projects/columns/cards/${cardId}`, @@ -15356,17 +15356,17 @@ export class Api extends HttpClient @@ -15374,24 +15374,24 @@ export class Api extends HttpClient({ path: `/projects/columns/cards/${cardId}/moves`, @@ -15477,16 +15477,16 @@ export class Api extends HttpClient @@ -15536,12 +15536,12 @@ export class Api extends HttpClient({ path: `/projects/columns/${columnId}/cards`, @@ -15608,25 +15608,25 @@ export class Api extends HttpClient @@ -15634,9 +15634,9 @@ export class Api extends HttpClient extends HttpClient({ path: `/projects/${projectId}`, @@ -15691,16 +15691,16 @@ export class Api extends HttpClient @@ -15708,8 +15708,8 @@ export class Api extends HttpClient({ @@ -15745,8 +15745,8 @@ export class Api extends HttpClient({ @@ -15770,8 +15770,8 @@ export class Api extends HttpClient({ @@ -15793,8 +15793,8 @@ export class Api extends HttpClient({ @@ -15815,16 +15815,16 @@ export class Api extends HttpClient @@ -15896,8 +15896,8 @@ export class Api extends HttpClient({ path: `/reactions/${reactionId}`, @@ -15934,67 +15934,67 @@ export class Api extends HttpClient @@ -16019,8 +16019,8 @@ export class Api extends HttpClient({ @@ -16041,23 +16041,23 @@ export class Api extends HttpClient this.request< { - total_count: number; artifacts: Artifact[]; + total_count: number; }, any >({ @@ -16179,10 +16179,10 @@ export class Api extends HttpClient @@ -16244,23 +16244,23 @@ export class Api extends HttpClient this.request< { - total_count: number; runners: Runner[]; + total_count: number; }, any >({ @@ -16373,18 +16373,18 @@ export class Api extends HttpClient @@ -16446,23 +16446,23 @@ export class Api extends HttpClient this.request< { - total_count: number; artifacts: Artifact[]; + total_count: number; }, any >({ @@ -16508,23 +16508,23 @@ export class Api extends HttpClient this.request< { - total_count: number; jobs: Job[]; + total_count: number; }, any >({ @@ -16608,23 +16608,23 @@ export class Api extends HttpClient this.request< { - total_count: number; secrets: ActionsSecret[]; + total_count: number; }, any >({ @@ -16722,16 +16722,16 @@ export class Api extends HttpClient @@ -16793,10 +16793,10 @@ export class Api extends HttpClient; + /** The git reference for the workflow. The reference can be a branch or tag name. */ + ref: string; }, params: RequestParams = {}, ) => @@ -16842,18 +16842,18 @@ export class Api extends HttpClient @@ -16899,16 +16899,16 @@ export class Api extends HttpClient @@ -16977,18 +16977,18 @@ export class Api extends HttpClient @@ -17013,8 +17013,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/branches/${branch}`, @@ -17052,46 +17052,46 @@ export class Api extends HttpClient @@ -17099,8 +17099,8 @@ export class Api extends HttpClient({ @@ -17203,15 +17203,15 @@ export class Api extends HttpClient extends HttpClient @@ -17839,97 +17839,97 @@ export class Api extends HttpClient @@ -17987,92 +17987,92 @@ export class Api extends HttpClient @@ -18098,16 +18098,16 @@ export class Api extends HttpClient @@ -18210,30 +18210,30 @@ export class Api extends HttpClient this.request< { - total_count: number; check_runs: CheckRun[]; + total_count: number; }, any >({ @@ -18271,10 +18271,10 @@ export class Api extends HttpClient`. */ ref?: CodeScanningAlertRef; + /** Set to `open`, `fixed`, or `dismissed` to list code scanning alerts in a specific state. */ + state?: CodeScanningAlertState; }, params: RequestParams = {}, ) => @@ -18282,8 +18282,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/code-scanning/alerts`, @@ -18308,8 +18308,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/code-scanning/alerts/${alertNumber}`, @@ -18331,10 +18331,10 @@ export class Api extends HttpClient @@ -18386,12 +18386,6 @@ export class Api extends HttpClient`. */ - ref: CodeScanningAnalysisRef; - /** A Base64 string representing the SARIF file to upload. You must first compress your SARIF file using [`gzip`](http://www.gnu.org/software/gzip/manual/gzip.html) and then translate the contents of the file into a Base64 encoding string. */ - sarif: CodeScanningAnalysisSarifFile; /** * The base directory used in the analysis, as it appears in the SARIF file. * This property is used to convert file paths from absolute to relative, so that alerts can be mapped to their correct location in the repository. @@ -18399,6 +18393,12 @@ export class Api extends HttpClient`. */ + ref: CodeScanningAnalysisRef; + /** A Base64 string representing the SARIF file to upload. You must first compress your SARIF file using [`gzip`](http://www.gnu.org/software/gzip/manual/gzip.html) and then translate the contents of the file into a Base64 encoding string. */ + sarif: CodeScanningAnalysisSarifFile; /** * The time that the analysis run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. * @format date @@ -18437,16 +18437,16 @@ export class Api extends HttpClient @@ -18553,16 +18553,16 @@ export class Api extends HttpClient @@ -18647,16 +18647,16 @@ export class Api extends HttpClient @@ -18664,8 +18664,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/comments/${commentId}/reactions`, @@ -18696,8 +18696,8 @@ export class Api extends HttpClient({ @@ -18742,26 +18742,26 @@ export class Api extends HttpClient @@ -18785,8 +18785,8 @@ export class Api extends HttpClient({ @@ -18809,16 +18809,16 @@ export class Api extends HttpClient @@ -18845,12 +18845,12 @@ export class Api extends HttpClient @@ -18876,24 +18876,24 @@ export class Api extends HttpClient this.request< PullRequestSimple[], { - message: string; documentation_url: string; + message: string; } >({ path: `/repos/${owner}/${repo}/commits/${commitSha}/pulls`, @@ -18934,30 +18934,30 @@ export class Api extends HttpClient this.request< { - total_count: number; check_runs: CheckRun[]; + total_count: number; }, any >({ @@ -18988,23 +18988,23 @@ export class Api extends HttpClient this.request< { - total_count: number; check_suites: CheckSuite[]; + total_count: number; }, any >({ @@ -19044,16 +19044,16 @@ export class Api extends HttpClient @@ -19152,32 +19152,32 @@ export class Api extends HttpClient @@ -19203,26 +19203,26 @@ export class Api extends HttpClient @@ -19232,8 +19232,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/contents/${path}`, @@ -19258,16 +19258,16 @@ export class Api extends HttpClient @@ -19292,35 +19292,35 @@ export class Api extends HttpClient @@ -19344,54 +19344,54 @@ export class Api extends HttpClient | string; + auto_merge?: boolean; + /** @example ""1776-07-04T00:00:00.000-07:52"" */ + created_at?: string; + /** + * Short description of the deployment. + * @default "" + */ + description?: string | null; /** * Name for the target deployment environment (e.g., `production`, `staging`, `qa`). * @default "production" */ environment?: string; + /** JSON payload with extra information about the deployment. */ + payload?: Record | string; /** - * Short description of the deployment. - * @default "" + * Specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `production` and `false` otherwise. + * **Note:** This parameter requires you to use the [`application/vnd.github.ant-man-preview+json`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. */ - description?: string | null; + production_environment?: boolean; + /** The ref to deploy. This can be a branch, tag, or SHA. */ + ref: string; + /** The [status](https://docs.github.com/rest/reference/repos#statuses) contexts to verify against commit status checks. If you omit this parameter, GitHub verifies all unique contexts before creating a deployment. To bypass checking entirely, pass an empty array. Defaults to all unique contexts. */ + required_contexts?: string[]; + /** + * Specifies a task to execute (e.g., `deploy` or `deploy:migrations`). + * @default "deploy" + */ + task?: string; /** * Specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: `false` * **Note:** This parameter requires you to use the [`application/vnd.github.ant-man-preview+json`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. **Note:** This parameter requires you to use the [`application/vnd.github.ant-man-preview+json`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. * @default false */ transient_environment?: boolean; - /** - * Specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `production` and `false` otherwise. - * **Note:** This parameter requires you to use the [`application/vnd.github.ant-man-preview+json`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. - */ - production_environment?: boolean; - /** @example ""1776-07-04T00:00:00.000-07:52"" */ - created_at?: string; }, params: RequestParams = {}, ) => this.request< Deployment, | { - message?: string; /** @example ""https://docs.github.com/rest/reference/repos#create-a-deployment"" */ documentation_url?: string; + message?: string; } | ValidationError >({ @@ -19447,16 +19447,16 @@ export class Api extends HttpClient @@ -19481,19 +19481,12 @@ export class Api extends HttpClient extends HttpClient @@ -19544,8 +19544,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/deployments/${deploymentId}/statuses/${statusId}`, @@ -19566,10 +19566,10 @@ export class Api extends HttpClient; + /** A custom webhook event name. */ + event_type: string; }, params: RequestParams = {}, ) => @@ -19593,16 +19593,16 @@ export class Api extends HttpClient @@ -19627,20 +19627,20 @@ export class Api extends HttpClient @@ -19737,32 +19737,32 @@ export class Api extends HttpClient @@ -19804,16 +19804,16 @@ export class Api extends HttpClient @@ -19853,12 +19853,12 @@ export class Api extends HttpClient @@ -19884,13 +19884,13 @@ export class Api extends HttpClient @@ -19930,23 +19930,23 @@ export class Api extends HttpClient @@ -19987,32 +19987,32 @@ export class Api extends HttpClient @@ -20063,16 +20063,16 @@ export class Api extends HttpClient @@ -20096,33 +20096,33 @@ export class Api extends HttpClient @@ -20164,35 +20164,35 @@ export class Api extends HttpClient @@ -20249,14 +20249,14 @@ export class Api extends HttpClient @@ -20327,16 +20327,16 @@ export class Api extends HttpClient @@ -20361,14 +20361,14 @@ export class Api extends HttpClient @@ -20576,16 +20576,16 @@ export class Api extends HttpClient @@ -20651,43 +20651,43 @@ export class Api extends HttpClient @@ -20711,26 +20711,26 @@ export class Api extends HttpClient @@ -20740,8 +20740,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/issues`, @@ -20764,25 +20764,25 @@ export class Api extends HttpClient @@ -20867,16 +20867,16 @@ export class Api extends HttpClient @@ -20884,8 +20884,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/issues/comments/${commentId}/reactions`, @@ -20916,8 +20916,8 @@ export class Api extends HttpClient({ @@ -20962,16 +20962,16 @@ export class Api extends HttpClient @@ -21028,28 +21028,28 @@ export class Api extends HttpClient @@ -21059,8 +21059,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/issues/${issueNumber}`, @@ -21138,18 +21138,18 @@ export class Api extends HttpClient @@ -21201,16 +21201,16 @@ export class Api extends HttpClient @@ -21235,16 +21235,16 @@ export class Api extends HttpClient @@ -21403,16 +21403,16 @@ export class Api extends HttpClient @@ -21420,8 +21420,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/issues/${issueNumber}/reactions`, @@ -21452,8 +21452,8 @@ export class Api extends HttpClient({ @@ -21499,16 +21499,16 @@ export class Api extends HttpClient @@ -21516,8 +21516,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/issues/${issueNumber}/timeline`, @@ -21539,16 +21539,16 @@ export class Api extends HttpClient @@ -21572,8 +21572,6 @@ export class Api extends HttpClient extends HttpClient @@ -21634,19 +21634,19 @@ export class Api extends HttpClient @@ -21670,12 +21670,12 @@ export class Api extends HttpClient @@ -21717,12 +21717,12 @@ export class Api extends HttpClient @@ -21796,10 +21796,10 @@ export class Api extends HttpClient @@ -21807,9 +21807,9 @@ export class Api extends HttpClient({ @@ -21833,31 +21833,31 @@ export class Api extends HttpClient @@ -21881,17 +21881,17 @@ export class Api extends HttpClient @@ -21933,17 +21933,17 @@ export class Api extends HttpClient @@ -21984,16 +21984,16 @@ export class Api extends HttpClient @@ -22022,25 +22022,25 @@ export class Api extends HttpClient @@ -22122,8 +22122,8 @@ export class Api extends HttpClient({ @@ -22196,8 +22196,8 @@ export class Api extends HttpClient({ @@ -22218,16 +22218,16 @@ export class Api extends HttpClient @@ -22300,20 +22300,20 @@ export class Api extends HttpClient @@ -22337,10 +22337,10 @@ export class Api extends HttpClient @@ -22365,32 +22365,32 @@ export class Api extends HttpClient @@ -22414,20 +22414,20 @@ export class Api extends HttpClient @@ -22452,25 +22452,25 @@ export class Api extends HttpClient @@ -22555,16 +22555,16 @@ export class Api extends HttpClient @@ -22572,8 +22572,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/pulls/comments/${commentId}/reactions`, @@ -22604,8 +22604,8 @@ export class Api extends HttpClient({ @@ -22667,16 +22667,16 @@ export class Api extends HttpClient @@ -22702,25 +22702,25 @@ export class Api extends HttpClient @@ -22749,20 +22749,20 @@ export class Api extends HttpClient @@ -22816,16 +22816,16 @@ export class Api extends HttpClient @@ -22850,16 +22850,16 @@ export class Api extends HttpClient @@ -22899,14 +22899,14 @@ export class Api extends HttpClient @@ -22914,8 +22914,8 @@ export class Api extends HttpClient({ @@ -22940,16 +22940,16 @@ export class Api extends HttpClient @@ -23031,16 +23031,16 @@ export class Api extends HttpClient @@ -23065,22 +23065,18 @@ export class Api extends HttpClient extends HttpClient @@ -23180,16 +23180,16 @@ export class Api extends HttpClient @@ -23215,10 +23215,10 @@ export class Api extends HttpClient @@ -23286,8 +23286,8 @@ export class Api extends HttpClient({ @@ -23336,16 +23336,16 @@ export class Api extends HttpClient @@ -23369,12 +23369,6 @@ export class Api extends HttpClient extends HttpClient @@ -23412,8 +23412,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/releases/assets/${assetId}`, @@ -23435,10 +23435,10 @@ export class Api extends HttpClient extends HttpClient @@ -23581,16 +23581,16 @@ export class Api extends HttpClient @@ -23616,8 +23616,8 @@ export class Api extends HttpClient @@ -23642,8 +23642,6 @@ export class Api extends HttpClient extends HttpClient @@ -23661,8 +23661,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/secret-scanning/alerts`, @@ -23685,8 +23685,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/secret-scanning/alerts/${alertNumber}`, @@ -23708,10 +23708,10 @@ export class Api extends HttpClient @@ -23719,8 +23719,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/secret-scanning/alerts/${alertNumber}`, @@ -23743,16 +23743,16 @@ export class Api extends HttpClient @@ -23857,6 +23857,13 @@ export class Api extends HttpClient extends HttpClient @@ -23896,16 +23896,16 @@ export class Api extends HttpClient @@ -23945,10 +23945,10 @@ export class Api extends HttpClient @@ -23988,16 +23988,16 @@ export class Api extends HttpClient @@ -24036,16 +24036,16 @@ export class Api extends HttpClient @@ -24070,8 +24070,8 @@ export class Api extends HttpClient({ path: `/repos/${owner}/${repo}/topics`, @@ -24101,8 +24101,8 @@ export class Api extends HttpClient({ @@ -24302,10 +24302,6 @@ export class Api extends HttpClient extends HttpClient extends HttpClient @@ -24392,14 +24392,14 @@ export class Api extends HttpClient @@ -24444,14 +24444,14 @@ export class Api extends HttpClient @@ -24476,10 +24476,10 @@ export class Api extends HttpClient @@ -24522,10 +24522,10 @@ export class Api extends HttpClient @@ -24548,29 +24548,29 @@ export class Api extends HttpClient @@ -24615,29 +24615,29 @@ export class Api extends HttpClient @@ -24662,10 +24662,10 @@ export class Api extends HttpClient @@ -24704,8 +24704,6 @@ export class Api extends HttpClient extends HttpClient @@ -24740,36 +24740,36 @@ export class Api extends HttpClient @@ -24810,36 +24810,36 @@ export class Api extends HttpClient @@ -24864,7 +24864,6 @@ export class Api extends HttpClient extends HttpClient @@ -24925,40 +24925,40 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: CodeSearchResultItem[]; + total_count: number; }, | BasicError | ValidationError | { code?: string; - message?: string; documentation_url?: string; + message?: string; } >({ path: `/search/code`, @@ -24978,37 +24978,37 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: CommitSearchResultItem[]; + total_count: number; }, { - message: string; documentation_url: string; + message: string; } >({ path: `/search/commits`, @@ -25028,6 +25028,21 @@ export class Api extends HttpClient extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: IssueSearchResultItem[]; + total_count: number; }, | BasicError | ValidationError | { code?: string; - message?: string; documentation_url?: string; + message?: string; } >({ path: `/search/issues`, @@ -25092,25 +25092,25 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: LabelSearchResultItem[]; + total_count: number; }, BasicError | ValidationError >({ @@ -25131,39 +25131,39 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: RepoSearchResultItem[]; + total_count: number; }, | ValidationError | { code?: string; - message?: string; documentation_url?: string; + message?: string; } >({ path: `/search/repositories`, @@ -25190,13 +25190,13 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: TopicSearchResultItem[]; + total_count: number; }, { - message: string; documentation_url: string; + message: string; } >({ path: `/search/topics`, @@ -25216,39 +25216,39 @@ export class Api extends HttpClient this.request< { - total_count: number; incomplete_results: boolean; items: UserSearchResultItem[]; + total_count: number; }, | ValidationError | { code?: string; - message?: string; documentation_url?: string; + message?: string; } >({ path: `/search/users`, @@ -25288,10 +25288,20 @@ export class Api extends HttpClient extends HttpClient @@ -25356,16 +25356,16 @@ export class Api extends HttpClient @@ -25389,8 +25389,6 @@ export class Api extends HttpClient extends HttpClient @@ -25440,10 +25440,10 @@ export class Api extends HttpClient @@ -25490,16 +25490,16 @@ export class Api extends HttpClient @@ -25625,16 +25625,16 @@ export class Api extends HttpClient @@ -25689,16 +25689,16 @@ export class Api extends HttpClient @@ -25749,16 +25749,16 @@ export class Api extends HttpClient @@ -25783,23 +25783,23 @@ export class Api extends HttpClient @@ -25842,14 +25842,14 @@ export class Api extends HttpClient({ path: `/teams/${teamId}/members/${username}`, @@ -25918,14 +25918,14 @@ export class Api extends HttpClient({ path: `/teams/${teamId}/memberships/${username}`, @@ -25964,16 +25964,16 @@ export class Api extends HttpClient @@ -25981,8 +25981,8 @@ export class Api extends HttpClient({ path: `/teams/${teamId}/projects`, @@ -26005,8 +26005,8 @@ export class Api extends HttpClient({ path: `/teams/${teamId}/projects/${projectId}`, @@ -26042,13 +26042,13 @@ export class Api extends HttpClient({ @@ -26073,8 +26073,8 @@ export class Api extends HttpClient({ @@ -26095,16 +26095,16 @@ export class Api extends HttpClient @@ -26214,18 +26214,18 @@ export class Api extends HttpClient extends HttpClient @@ -26301,40 +26301,40 @@ export class Api extends HttpClient @@ -26360,8 +26360,8 @@ export class Api extends HttpClient({ path: `/user/blocks`, @@ -26454,16 +26454,16 @@ export class Api extends HttpClient @@ -26541,16 +26541,16 @@ export class Api extends HttpClient @@ -26572,16 +26572,16 @@ export class Api extends HttpClient @@ -26648,16 +26648,16 @@ export class Api extends HttpClient @@ -26734,28 +26734,28 @@ export class Api extends HttpClient this.request< { - total_count: number; installations: Installation[]; + total_count: number; }, | BasicError | { - message: string; documentation_url: string; + message: string; } >({ path: `/user/installations`, @@ -26776,24 +26776,24 @@ export class Api extends HttpClient this.request< { - total_count: number; - repository_selection?: string; repositories: Repository[]; + repository_selection?: string; + total_count: number; }, BasicError >({ @@ -26893,6 +26893,11 @@ export class Api extends HttpClient extends HttpClient @@ -26953,16 +26953,16 @@ export class Api extends HttpClient @@ -26984,16 +26984,16 @@ export class Api extends HttpClient @@ -27047,16 +27047,16 @@ export class Api extends HttpClient @@ -27078,16 +27078,16 @@ export class Api extends HttpClient @@ -27109,18 +27109,18 @@ export class Api extends HttpClient @@ -27183,16 +27183,16 @@ export class Api extends HttpClient @@ -27215,20 +27215,20 @@ export class Api extends HttpClient extends HttpClient @@ -27352,16 +27352,16 @@ export class Api extends HttpClient @@ -27383,16 +27383,16 @@ export class Api extends HttpClient @@ -27400,8 +27400,8 @@ export class Api extends HttpClient({ @@ -27423,16 +27423,16 @@ export class Api extends HttpClient @@ -27454,11 +27454,6 @@ export class Api extends HttpClient extends HttpClient @@ -27517,90 +27517,90 @@ export class Api extends HttpClient @@ -27623,16 +27623,16 @@ export class Api extends HttpClient @@ -27684,26 +27684,26 @@ export class Api extends HttpClient @@ -27770,16 +27770,16 @@ export class Api extends HttpClient @@ -27801,16 +27801,16 @@ export class Api extends HttpClient @@ -27833,13 +27833,13 @@ export class Api extends HttpClient @@ -27878,16 +27878,16 @@ export class Api extends HttpClient @@ -27911,16 +27911,16 @@ export class Api extends HttpClient @@ -27943,16 +27943,16 @@ export class Api extends HttpClient @@ -27975,16 +27975,16 @@ export class Api extends HttpClient @@ -28007,16 +28007,16 @@ export class Api extends HttpClient @@ -28054,18 +28054,18 @@ export class Api extends HttpClient @@ -28088,16 +28088,16 @@ export class Api extends HttpClient @@ -28120,10 +28120,10 @@ export class Api extends HttpClient @@ -28162,16 +28162,16 @@ export class Api extends HttpClient @@ -28194,16 +28194,16 @@ export class Api extends HttpClient @@ -28227,28 +28227,28 @@ export class Api extends HttpClient this.request< Project[], | { - message: string; documentation_url: string; + message: string; } | ValidationError >({ @@ -28270,16 +28270,16 @@ export class Api extends HttpClient @@ -28302,16 +28302,16 @@ export class Api extends HttpClient @@ -28334,28 +28334,28 @@ export class Api extends HttpClient @@ -28426,26 +28426,26 @@ export class Api extends HttpClient @@ -28468,16 +28468,16 @@ export class Api extends HttpClient diff --git a/tests/generated/v3.0/link-example.ts b/tests/generated/v3.0/link-example.ts index 0444a117..2a76ef6e 100644 --- a/tests/generated/v3.0/link-example.ts +++ b/tests/generated/v3.0/link-example.ts @@ -203,7 +203,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/no-definitions-schema.ts b/tests/generated/v3.0/no-definitions-schema.ts index 469443a1..3a1e1c51 100644 --- a/tests/generated/v3.0/no-definitions-schema.ts +++ b/tests/generated/v3.0/no-definitions-schema.ts @@ -200,7 +200,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/oneof-example.ts b/tests/generated/v3.0/oneof-example.ts index c87ba1ab..c4e9962f 100644 --- a/tests/generated/v3.0/oneof-example.ts +++ b/tests/generated/v3.0/oneof-example.ts @@ -196,7 +196,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/personal-api-example.ts b/tests/generated/v3.0/personal-api-example.ts index 0b231244..b570ce9e 100644 --- a/tests/generated/v3.0/personal-api-example.ts +++ b/tests/generated/v3.0/personal-api-example.ts @@ -371,7 +371,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/petstore-expanded.ts b/tests/generated/v3.0/petstore-expanded.ts index 32e92c76..3b3ebaac 100644 --- a/tests/generated/v3.0/petstore-expanded.ts +++ b/tests/generated/v3.0/petstore-expanded.ts @@ -202,7 +202,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -255,13 +255,13 @@ export class Api extends HttpClient diff --git a/tests/generated/v3.0/petstore.ts b/tests/generated/v3.0/petstore.ts index 15d2e6e4..0af6c796 100644 --- a/tests/generated/v3.0/petstore.ts +++ b/tests/generated/v3.0/petstore.ts @@ -203,7 +203,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/recursive-schema.ts b/tests/generated/v3.0/recursive-schema.ts index 921f0bd1..68a7165e 100644 --- a/tests/generated/v3.0/recursive-schema.ts +++ b/tests/generated/v3.0/recursive-schema.ts @@ -197,7 +197,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/responses.ts b/tests/generated/v3.0/responses.ts index 45beb861..3a8f3a0d 100644 --- a/tests/generated/v3.0/responses.ts +++ b/tests/generated/v3.0/responses.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/swaggerhub-template.ts b/tests/generated/v3.0/swaggerhub-template.ts index d8c96951..a44509bb 100644 --- a/tests/generated/v3.0/swaggerhub-template.ts +++ b/tests/generated/v3.0/swaggerhub-template.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts index 08deff15..a8621375 100644 --- a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts +++ b/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts @@ -42,11 +42,6 @@ export enum Kind { export type OmitJobId = PickJobExcludeKeysId; -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickJobGithub { - github?: string; -} - /** From T, pick a set of properties whose keys are in the union K */ export interface PickJobExcludeKeysId { address?: string; @@ -58,6 +53,11 @@ export interface PickJobExcludeKeysId { npm?: string; } +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickJobGithub { + github?: string; +} + /** From T, pick a set of properties whose keys are in the union K */ export interface PickProjectExcludeKeysIdOrjob { description: string; @@ -297,7 +297,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/up-banking.ts b/tests/generated/v3.0/up-banking.ts index 4c6f59af..70ce95fd 100644 --- a/tests/generated/v3.0/up-banking.ts +++ b/tests/generated/v3.0/up-banking.ts @@ -12,8 +12,6 @@ /** Provides information about an Up bank account. */ export interface AccountResource { attributes: { - /** The name associated with the account in the Up application. */ - displayName: string; /** The bank account type of this account. */ accountType: AccountTypeEnum; /** @@ -26,6 +24,8 @@ export interface AccountResource { * @format date-time */ createdAt: string; + /** The name associated with the account in the Up application. */ + displayName: string; }; /** The unique identifier for this account. */ id: string; @@ -81,25 +81,25 @@ export interface CategoryResource { self: string; }; relationships: { - parent: { + children: { data: { - /** The type of this resource: `categories` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; - } | null; + /** The type of this resource: `categories` */ + type: string; + }[]; links?: { /** The link to retrieve the related resource(s) in this relationship. */ related: string; }; }; - children: { + parent: { data: { - /** The type of this resource: `categories` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; - }[]; + /** The type of this resource: `categories` */ + type: string; + } | null; links?: { /** The link to retrieve the related resource(s) in this relationship. */ related: string; @@ -221,16 +221,16 @@ export interface ListAccountsResponse { /** The list of accounts returned in this response. */ data: AccountResource[]; links: { - /** - * The link to the previous page in the results. If this value is `null` - * there is no previous page. - */ - prev: string | null; /** * The link to the next page in the results. If this value is `null` * there is no next page. */ next: string | null; + /** + * The link to the previous page in the results. If this value is `null` + * there is no previous page. + */ + prev: string | null; }; } @@ -252,16 +252,16 @@ export interface ListTagsResponse { /** The list of tags returned in this response. */ data: TagResource[]; links: { - /** - * The link to the previous page in the results. If this value is `null` - * there is no previous page. - */ - prev: string | null; /** * The link to the next page in the results. If this value is `null` * there is no next page. */ next: string | null; + /** + * The link to the previous page in the results. If this value is `null` + * there is no previous page. + */ + prev: string | null; }; } @@ -274,16 +274,16 @@ export interface ListTransactionsResponse { /** The list of transactions returned in this response. */ data: TransactionResource[]; links: { - /** - * The link to the previous page in the results. If this value is `null` - * there is no previous page. - */ - prev: string | null; /** * The link to the next page in the results. If this value is `null` * there is no next page. */ next: string | null; + /** + * The link to the previous page in the results. If this value is `null` + * there is no previous page. + */ + prev: string | null; }; } @@ -296,16 +296,16 @@ export interface ListWebhookDeliveryLogsResponse { /** The list of delivery logs returned in this response. */ data: WebhookDeliveryLogResource[]; links: { - /** - * The link to the previous page in the results. If this value is `null` - * there is no previous page. - */ - prev: string | null; /** * The link to the next page in the results. If this value is `null` * there is no next page. */ next: string | null; + /** + * The link to the previous page in the results. If this value is `null` + * there is no previous page. + */ + prev: string | null; }; } @@ -318,16 +318,16 @@ export interface ListWebhooksResponse { /** The list of webhooks returned in this response. */ data: WebhookResource[]; links: { - /** - * The link to the previous page in the results. If this value is `null` - * there is no previous page. - */ - prev: string | null; /** * The link to the next page in the results. If this value is `null` * there is no next page. */ next: string | null; + /** + * The link to the previous page in the results. If this value is `null` + * there is no previous page. + */ + prev: string | null; }; } @@ -412,26 +412,35 @@ export interface TagResource { export interface TransactionResource { attributes: { /** - * The current processing status of this transaction, according to - * whether or not this transaction has settled or is still held. + * The amount of this transaction in Australian dollars. For + * transactions that were once `HELD` but are now `SETTLED`, refer to + * the `holdInfo` field for the original `amount` the transaction was + * `HELD` at. */ - status: TransactionStatusEnum; + amount: MoneyObject; /** - * The original, unprocessed text of the transaction. This is often not - * a perfect indicator of the actual merchant, but it is useful for - * reconciliation purposes in some cases. + * If all or part of this transaction was instantly reimbursed in the + * form of cashback, details of the reimbursement. */ - rawText: string | null; + cashback: CashbackObject | null; + /** + * The date-time at which this transaction was first encountered. + * @format date-time + */ + createdAt: string; /** * A short description for this transaction. Usually the merchant name * for purchases. */ description: string; /** - * Attached message for this transaction, such as a payment message, or a - * transfer note. + * The foreign currency amount of this transaction. This field will be + * `null` for domestic transactions. The amount was converted to the AUD + * amount reflected in the `amount` of this transaction. Refer to the + * `holdInfo` field for the original `foreignAmount` the transaction was + * `HELD` at. */ - message: string | null; + foreignAmount: MoneyObject | null; /** * If this transaction is currently in the `HELD` status, or was ever in * the `HELD` status, the `amount` and `foreignAmount` of the @@ -439,30 +448,21 @@ export interface TransactionResource { */ holdInfo: HoldInfoObject | null; /** - * Details of how this transaction was rounded-up. If no Round Up was - * applied this field will be `null`. - */ - roundUp: RoundUpObject | null; - /** - * If all or part of this transaction was instantly reimbursed in the - * form of cashback, details of the reimbursement. + * Attached message for this transaction, such as a payment message, or a + * transfer note. */ - cashback: CashbackObject | null; + message: string | null; /** - * The amount of this transaction in Australian dollars. For - * transactions that were once `HELD` but are now `SETTLED`, refer to - * the `holdInfo` field for the original `amount` the transaction was - * `HELD` at. + * The original, unprocessed text of the transaction. This is often not + * a perfect indicator of the actual merchant, but it is useful for + * reconciliation purposes in some cases. */ - amount: MoneyObject; + rawText: string | null; /** - * The foreign currency amount of this transaction. This field will be - * `null` for domestic transactions. The amount was converted to the AUD - * amount reflected in the `amount` of this transaction. Refer to the - * `holdInfo` field for the original `foreignAmount` the transaction was - * `HELD` at. + * Details of how this transaction was rounded-up. If no Round Up was + * applied this field will be `null`. */ - foreignAmount: MoneyObject | null; + roundUp: RoundUpObject | null; /** * The date-time at which this transaction settled. This field will be * `null` for transactions that are currently in the `HELD` status. @@ -470,10 +470,10 @@ export interface TransactionResource { */ settledAt: string | null; /** - * The date-time at which this transaction was first encountered. - * @format date-time + * The current processing status of this transaction, according to + * whether or not this transaction has settled or is still held. */ - createdAt: string; + status: TransactionStatusEnum; }; /** The unique identifier for this transaction. */ id: string; @@ -484,10 +484,10 @@ export interface TransactionResource { relationships: { account: { data: { - /** The type of this resource: `accounts` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `accounts` */ + type: string; }; links?: { /** The link to retrieve the related resource(s) in this relationship. */ @@ -496,10 +496,10 @@ export interface TransactionResource { }; category: { data: { - /** The type of this resource: `categories` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `categories` */ + type: string; } | null; links?: { /** The link to retrieve the related resource(s) in this relationship. */ @@ -508,10 +508,10 @@ export interface TransactionResource { }; parentCategory: { data: { - /** The type of this resource: `categories` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `categories` */ + type: string; } | null; links?: { /** The link to retrieve the related resource(s) in this relationship. */ @@ -520,10 +520,10 @@ export interface TransactionResource { }; tags: { data: { - /** The type of this resource: `tags` */ - type: string; /** The label of the tag, which also acts as the tag’s unique identifier. */ id: string; + /** The type of this resource: `tags` */ + type: string; }[]; links?: { /** @@ -561,6 +561,13 @@ export interface UpdateTransactionTagsRequest { */ export interface WebhookDeliveryLogResource { attributes: { + /** + * The date-time at which this log entry was created. + * @format date-time + */ + createdAt: string; + /** The success or failure status of this delivery attempt. */ + deliveryStatus: WebhookDeliveryStatusEnum; /** Information about the request that was sent to the webhook URL. */ request: { /** The payload that was sent in the request body. */ @@ -568,28 +575,21 @@ export interface WebhookDeliveryLogResource { }; /** Information about the response that was received from the webhook URL. */ response: { - /** The HTTP status code received in the response. */ - statusCode: number; /** The payload that was received in the response body. */ body: string; + /** The HTTP status code received in the response. */ + statusCode: number; } | null; - /** The success or failure status of this delivery attempt. */ - deliveryStatus: WebhookDeliveryStatusEnum; - /** - * The date-time at which this log entry was created. - * @format date-time - */ - createdAt: string; }; /** The unique identifier for this log entry. */ id: string; relationships: { webhookEvent: { data: { - /** The type of this resource: `webhook-events` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `webhook-events` */ + type: string; }; }; }; @@ -627,16 +627,16 @@ export interface WebhookEventCallback { */ export interface WebhookEventResource { attributes: { - /** - * The type of this event. This can be used to determine what action to - * take in response to the event. - */ - eventType: WebhookEventTypeEnum; /** * The date-time at which this event was generated. * @format date-time */ createdAt: string; + /** + * The type of this event. This can be used to determine what action to + * take in response to the event. + */ + eventType: WebhookEventTypeEnum; }; /** * The unique identifier for this event. This will remain constant across @@ -644,24 +644,24 @@ export interface WebhookEventResource { */ id: string; relationships: { - webhook: { + transaction?: { data: { - /** The type of this resource: `webhooks` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `transactions` */ + type: string; }; links?: { /** The link to retrieve the related resource(s) in this relationship. */ related: string; }; }; - transaction?: { + webhook: { data: { - /** The type of this resource: `transactions` */ - type: string; /** The unique identifier of the resource within its type. */ id: string; + /** The type of this resource: `webhooks` */ + type: string; }; links?: { /** The link to retrieve the related resource(s) in this relationship. */ @@ -688,25 +688,28 @@ export enum WebhookEventTypeEnum { /** Represents a webhook specified as request input. */ export interface WebhookInputResource { attributes: { + /** + * An optional description for this webhook, up to 64 characters in + * length. + */ + description?: string | null; /** * The URL that this webhook should post events to. This must be a valid * HTTP or HTTPS URL that does not exceed 300 characters in length. * @format uri */ url: string; - /** - * An optional description for this webhook, up to 64 characters in - * length. - */ - description?: string | null; }; } /** Provides information about a webhook. */ export interface WebhookResource { attributes: { - /** The URL that this webhook is configured to `POST` events to. */ - url: string; + /** + * The date-time at which this webhook was created. + * @format date-time + */ + createdAt: string; /** * An optional description that was provided at the time the webhook was * created. @@ -727,11 +730,8 @@ export interface WebhookResource { * details. */ secretKey?: string; - /** - * The date-time at which this webhook was created. - * @format date-time - */ - createdAt: string; + /** The URL that this webhook is configured to `POST` events to. */ + url: string; }; /** The unique identifier for this webhook. */ id: string; @@ -928,7 +928,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -1033,10 +1033,21 @@ export class Api extends HttpClient extends HttpClient extends HttpClient @@ -1235,10 +1235,21 @@ export class Api extends HttpClient extends HttpClient extends HttpClient diff --git a/tests/generated/v3.0/uspto.ts b/tests/generated/v3.0/uspto.ts index 11642234..7315e34d 100644 --- a/tests/generated/v3.0/uspto.ts +++ b/tests/generated/v3.0/uspto.ts @@ -11,20 +11,20 @@ export interface DataSetList { apis?: { + /** + * A URL to the API console for each API + * @format uriref + */ + apiDocumentationUrl?: string; /** To be used as a dataset parameter value */ apiKey?: string; - /** To be used as a version parameter value */ - apiVersionNumber?: string; /** * The URL describing the dataset's fields * @format uriref */ apiUrl?: string; - /** - * A URL to the API console for each API - * @format uriref - */ - apiDocumentationUrl?: string; + /** To be used as a version parameter value */ + apiVersionNumber?: string; }[]; total?: number; } @@ -218,7 +218,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -310,16 +310,16 @@ export class Api extends HttpClient diff --git a/tests/generated/v3.0/wrong-enum-subtypes.ts b/tests/generated/v3.0/wrong-enum-subtypes.ts index 17311f1c..09f6607b 100644 --- a/tests/generated/v3.0/wrong-enum-subtypes.ts +++ b/tests/generated/v3.0/wrong-enum-subtypes.ts @@ -192,7 +192,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/generated/v3.0/wrong-schema-names.ts b/tests/generated/v3.0/wrong-schema-names.ts index 1454e15f..ffcb13eb 100644 --- a/tests/generated/v3.0/wrong-schema-names.ts +++ b/tests/generated/v3.0/wrong-schema-names.ts @@ -19,7 +19,7 @@ export type DF = string; * Not found response * @example "Not found" */ -export type TypeFF = string; +export type Type404 = string; /** * Not found response @@ -31,7 +31,7 @@ export type Type405 = string; * Not found response * @example "Not found" */ -export type Type404 = string; +export type TypeFF = string; export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; @@ -210,7 +210,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/helpers/assertGeneratedModule.js b/tests/helpers/assertGeneratedModule.js index 2ac17389..94b5dd3b 100644 --- a/tests/helpers/assertGeneratedModule.js +++ b/tests/helpers/assertGeneratedModule.js @@ -1,5 +1,6 @@ const fs = require("fs"); const gitDiff = require("git-diff"); +const _ = require("lodash"); const assertGeneratedModule = (pathToModule1, pathToModule2) => { if (process.env.UPDATE_SNAPSHOTS) { @@ -9,14 +10,88 @@ const assertGeneratedModule = (pathToModule1, pathToModule2) => { const output = fs.readFileSync(pathToModule1).toString("utf8"); const expected = fs.readFileSync(pathToModule2).toString("utf8"); - const diff = gitDiff(output, expected, { + const diff = gitDiff(expected, output, { color: true, flags: "--diff-algorithm=default --ignore-space-at-eol --ignore-cr-at-eol --ignore-space-change --ignore-all-space", }); if (diff && diff.length) { - console.log("\n" + diff); + const minusLinePrefix1 = "-"; + const minusLinePrefix2 = "-"; + const plusLinePrefix1 = "+"; + const plusLinePrefix2 = "+"; + const plusLinePrefix3 = "+"; + const lines = diff.split("\n"); + const lineStructs = []; + let deletedLines = 0; + let addedLines = 0; + const printPos = (pos) => { + const fills = lines.length.toString().length; + return `${pos + 1}`.padStart(fills, "0") + ": "; + }; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (line.startsWith(minusLinePrefix1) || line.startsWith(minusLinePrefix2)) { + lineStructs.push({ + pos: i, + id: Math.random().toString() + i, + deleted: true, + line: `${printPos(i + addedLines)}${line}`, + }); + ++deletedLines; + } else if ( + line.startsWith(plusLinePrefix1) || + line.startsWith(plusLinePrefix2) || + line.startsWith(plusLinePrefix3) + ) { + lineStructs.push({ + pos: i, + id: Math.random().toString() + i, + added: true, + line: `${printPos(i - deletedLines)}${line}`, + }); + ++addedLines; + } else { + lineStructs.push({ + pos: i, + id: Math.random().toString() + i, + line: `${printPos(i - deletedLines)}${line}`, + }); + addedLines = 0; + deletedLines = 0; + } + } + + const computedLines = []; + for (let i = 0; i < lineStructs.length; i++) { + const lineStruct = lineStructs[i]; + if (lineStruct.deleted) { + const sliced = lineStructs.slice(i - 5, i + 5); + computedLines.push(...sliced); + } else if (lineStruct.added) { + const sliced = lineStructs.slice(i, i + 5 + 5); + computedLines.push(...sliced); + } + } + + const sortedLines = _.sortBy(_.uniqBy(computedLines, "id"), "pos"); + const maxLine = (sortedLines.map((v) => v.line).sort((a, b) => b.length - a.length)[0] || "").length; + const fixedLines = sortedLines.reduce((acc, computedLine, i, arr) => { + const prev = arr[i - 1]; + if ((prev && computedLine.pos - prev.pos > 10) || !i) { + acc.push("".padEnd(maxLine, "-")); + } + acc.push(computedLine.line); + if (arr.length - 1 === i) { + acc.push("".padEnd(maxLine, "-")); + } + return acc; + }, []); + console.log("\n"); + fixedLines.forEach((line) => { + console.log(line); + }); console.error(new Error("expected another output").stack); process.exit(1); } diff --git a/tests/helpers/generateApiForTest.js b/tests/helpers/generateApiForTest.js index 6dd57921..6109df3f 100644 --- a/tests/helpers/generateApiForTest.js +++ b/tests/helpers/generateApiForTest.js @@ -1,11 +1,20 @@ const { generateApi } = require("../../src"); +const dotenv = require("dotenv"); + +dotenv.config(); /** * * @param options {import("../../index").GenerateApiParams & { testName?: string }} * @returns {Promise} */ -const generateApiForTest = (options) => generateApi(options); +const generateApiForTest = (options) => + generateApi({ + ...options, + silent: !process.env.TEST_WITH_DEBUG, + debug: process.env.TEST_WITH_DEBUG, + debugExtras: options.debugExtras || ["spec", options.testName], + }); module.exports = { generateApiForTest: generateApiForTest, diff --git a/tests/schemas/v2.0/github-swagger.json b/tests/schemas/v2.0/github-swagger.json index 4ffb198a..a31a3b89 100644 --- a/tests/schemas/v2.0/github-swagger.json +++ b/tests/schemas/v2.0/github-swagger.json @@ -74,6 +74,15 @@ "default": 0 } }, + { + "name": "foo.bar.baz", + "in": "query", + "description": "description", + "schema": { + "type": "integer", + "default": 0 + } + }, { "name": "queryParam2", "in": "query", @@ -83,6 +92,15 @@ "default": 20 } }, + { + "name": "query.param.bar.3", + "in": "query", + "description": "description", + "schema": { + "type": "integer", + "default": 0 + } + }, { "name": "queryParam3", "in": "query", diff --git a/tests/spec/another-query-params/expected.ts b/tests/spec/another-query-params/expected.ts index dcba39b2..9fb24e6b 100644 --- a/tests/spec/another-query-params/expected.ts +++ b/tests/spec/another-query-params/expected.ts @@ -214,7 +214,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/another-query-params/schema.ts b/tests/spec/another-query-params/schema.ts index dcba39b2..9fb24e6b 100644 --- a/tests/spec/another-query-params/schema.ts +++ b/tests/spec/another-query-params/schema.ts @@ -214,7 +214,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/axios/expected.ts b/tests/spec/axios/expected.ts index 6d2fe7b1..3be81f8e 100644 --- a/tests/spec/axios/expected.ts +++ b/tests/spec/axios/expected.ts @@ -1907,7 +1907,8 @@ export interface UserUpdate { export type Users = User[]; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import axios from "axios"; export type QueryParamsType = Record; diff --git a/tests/spec/axios/schema.ts b/tests/spec/axios/schema.ts index 6d2fe7b1..3be81f8e 100644 --- a/tests/spec/axios/schema.ts +++ b/tests/spec/axios/schema.ts @@ -1907,7 +1907,8 @@ export interface UserUpdate { export type Users = User[]; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import axios from "axios"; export type QueryParamsType = Record; diff --git a/tests/spec/axiosSingleHttpClient/expected.ts b/tests/spec/axiosSingleHttpClient/expected.ts index 22e65b57..882da26b 100644 --- a/tests/spec/axiosSingleHttpClient/expected.ts +++ b/tests/spec/axiosSingleHttpClient/expected.ts @@ -1907,7 +1907,8 @@ export interface UserUpdate { export type Users = User[]; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import axios from "axios"; export type QueryParamsType = Record; diff --git a/tests/spec/axiosSingleHttpClient/schema.ts b/tests/spec/axiosSingleHttpClient/schema.ts index 22e65b57..882da26b 100644 --- a/tests/spec/axiosSingleHttpClient/schema.ts +++ b/tests/spec/axiosSingleHttpClient/schema.ts @@ -1907,7 +1907,8 @@ export interface UserUpdate { export type Users = User[]; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; +import axios from "axios"; export type QueryParamsType = Record; diff --git a/tests/spec/cli/expected.ts b/tests/spec/cli/expected.ts index 802349b9..c36899ae 100644 --- a/tests/spec/cli/expected.ts +++ b/tests/spec/cli/expected.ts @@ -331,7 +331,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/cli/schema.ts b/tests/spec/cli/schema.ts index 802349b9..c36899ae 100644 --- a/tests/spec/cli/schema.ts +++ b/tests/spec/cli/schema.ts @@ -331,7 +331,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/custom-extensions/expected.ts b/tests/spec/custom-extensions/expected.ts new file mode 100644 index 00000000..068638bb --- /dev/null +++ b/tests/spec/custom-extensions/expected.ts @@ -0,0 +1,241 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = "https://example.com"; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title No title + * @baseUrl https://example.com + */ +export class Api extends HttpClient { + test = { + /** + * @description Test + * + * @name Test + * @request GET:/test + */ + test: (params: RequestParams = {}) => + this.request({ + path: `/test`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/custom-extensions/schema.json b/tests/spec/custom-extensions/schema.json new file mode 100644 index 00000000..3835ac83 --- /dev/null +++ b/tests/spec/custom-extensions/schema.json @@ -0,0 +1,31 @@ +{ + "swagger": "2.0", + "schemes": [ + "https" + ], + "host": "example.com", + "basePath": "/", + "paths": { + "/test": { + "x-my-extension": true, + "x-my-extension-2": { + "dynamic": {} + }, + "get": { + "description": "Test", + "operationId": "test", + "responses": { + "200": { + "description": "Success.", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } +} diff --git a/tests/spec/custom-extensions/schema.ts b/tests/spec/custom-extensions/schema.ts new file mode 100644 index 00000000..068638bb --- /dev/null +++ b/tests/spec/custom-extensions/schema.ts @@ -0,0 +1,241 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = "https://example.com"; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title No title + * @baseUrl https://example.com + */ +export class Api extends HttpClient { + test = { + /** + * @description Test + * + * @name Test + * @request GET:/test + */ + test: (params: RequestParams = {}) => + this.request({ + path: `/test`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/custom-extensions/test.js b/tests/spec/custom-extensions/test.js new file mode 100644 index 00000000..877d7a26 --- /dev/null +++ b/tests/spec/custom-extensions/test.js @@ -0,0 +1,20 @@ +const createSchemaInfos = require("../../helpers/createSchemaInfos"); +const { resolve } = require("path"); +const { generateApiForTest } = require("../../helpers/generateApiForTest"); +const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); +const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); + +const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") }); + +schemas.forEach(({ absolutePath, apiFileName }) => { + generateApiForTest({ + testName: "custom extensions", + silent: true, + name: apiFileName, + input: absolutePath, + output: resolve(__dirname, "./"), + }).then(() => { + validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); + assertGeneratedModule(resolve(__dirname, `./${apiFileName}`), resolve(__dirname, "./expected.ts")); + }); +}); diff --git a/tests/spec/defaultAsSuccess/expected.ts b/tests/spec/defaultAsSuccess/expected.ts index 5fcdd435..1ffc602c 100644 --- a/tests/spec/defaultAsSuccess/expected.ts +++ b/tests/spec/defaultAsSuccess/expected.ts @@ -226,7 +226,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/defaultAsSuccess/schema.ts b/tests/spec/defaultAsSuccess/schema.ts index 5fcdd435..1ffc602c 100644 --- a/tests/spec/defaultAsSuccess/schema.ts +++ b/tests/spec/defaultAsSuccess/schema.ts @@ -226,7 +226,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/defaultResponse/expected.ts b/tests/spec/defaultResponse/expected.ts index c1a696fc..364e7f15 100644 --- a/tests/spec/defaultResponse/expected.ts +++ b/tests/spec/defaultResponse/expected.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/defaultResponse/schema.ts b/tests/spec/defaultResponse/schema.ts index c1a696fc..364e7f15 100644 --- a/tests/spec/defaultResponse/schema.ts +++ b/tests/spec/defaultResponse/schema.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/deprecated/expected.ts b/tests/spec/deprecated/expected.ts index 55ce422e..76789d9b 100644 --- a/tests/spec/deprecated/expected.ts +++ b/tests/spec/deprecated/expected.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/deprecated/schema.ts b/tests/spec/deprecated/schema.ts index 55ce422e..76789d9b 100644 --- a/tests/spec/deprecated/schema.ts +++ b/tests/spec/deprecated/schema.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/discriminator/expected.ts b/tests/spec/discriminator/expected.ts new file mode 100644 index 00000000..4d63f0ad --- /dev/null +++ b/tests/spec/discriminator/expected.ts @@ -0,0 +1,141 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type SimpleDiscriminator = SimpleObject | ComplexObject; + +export interface SimpleObject { + objectType: string; +} + +export interface ComplexObject { + objectType: string; +} + +export enum BlockDTOEnum { + Csv = "csv", + File = "file", + Kek = "kek", +} + +export type BlockDTOWithEnum = BaseBlockDtoWithEnum & + ( + | BaseBlockDtoWithEnumTypeMapping + | BaseBlockDtoWithEnumTypeMapping + ); + +export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { + type: BlockDTOEnum.Csv; + text: string; +}; + +export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { + type: BlockDTOEnum.File; + fileId: string; +}; + +export type BlockDTO = BaseBlockDto & + (BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> | BaseBlockDtoTypeMapping<"file", FileBlockDTO>); + +export type CsvBlockDTO = BaseBlockDto & { + /** @default "csv" */ + type: "csv"; + text: string; +}; + +export type FileBlockDTO = BaseBlockDto & { + /** @default "file" */ + type: "file"; + fileId: string; +}; + +export type Pet = BasePet & + (BasePetPetTypeMapping<"dog", Dog> | BasePetPetTypeMapping<"cat", Cat> | BasePetPetTypeMapping<"lizard", Lizard>); + +export type PetOnlyDiscriminator = + | ({ + pet_type: "dog"; + } & Dog) + | ({ + pet_type: "cat"; + } & Cat) + | ({ + pet_type: "lizard"; + } & Lizard); + +export type Cat = BasePet & { + name?: string; +}; + +export type Dog = BasePet & { + bark?: string; +}; + +export type Lizard = BasePet & { + lovesRocks?: boolean; +}; + +export enum PetEnum { + Dog = "dog", + Lizard = "lizard", + Cat = "cat", +} + +export type PetWithEnum = BasePetWithEnum & + ( + | BasePetWithEnumPetTypeMapping + | BasePetWithEnumPetTypeMapping + | BasePetWithEnumPetTypeMapping + ); + +export type CatWithEnum = BasePetWithEnum & { + name?: string; +}; + +export type DogWithEnum = BasePetWithEnum & { + bark?: string; +}; + +export type LizardWithEnum = BasePetWithEnum & { + lovesRocks?: boolean; +}; + +interface BaseBlockDtoWithEnum { + title: string; + type: BlockDTOEnum; +} + +type BaseBlockDtoWithEnumTypeMapping = { + type: Key; +} & Type; + +interface BaseBlockDto { + title: string; +} + +type BaseBlockDtoTypeMapping = { + type: Key; +} & Type; + +interface BasePet { + pet_type: string; +} + +type BasePetPetTypeMapping = { + pet_type: Key; +} & Type; + +interface BasePetWithEnum { + pet_type: PetEnum; +} + +type BasePetWithEnumPetTypeMapping = { + pet_type: Key; +} & Type; diff --git a/tests/spec/discriminator/schema.json b/tests/spec/discriminator/schema.json new file mode 100644 index 00000000..3de9823b --- /dev/null +++ b/tests/spec/discriminator/schema.json @@ -0,0 +1,368 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "Swagger API Team" + }, + "license": { + "name": "MIT" + } + }, + "host": "petstore.swagger.io", + "basePath": "/api", + "schemes": ["http"], + "consumes": ["application/json"], + "produces": ["application/json"], + "paths": {}, + "definitions": { + "SimpleDiscriminator": { + "discriminator": { + "propertyName": "objectType" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/simpleObject" + }, + { + "$ref": "#/components/schemas/complexObject" + } + ] + }, + "simpleObject": { + "type": "object", + "required": [ + "objectType" + ], + "properties": { + "objectType": { + "type": "string" + } + } + }, + "complexObject": { + "type": "object", + "required": [ + "objectType" + ], + "properties": { + "objectType": { + "type": "string" + } + } + }, + "BlockDTOEnum": { + "enum": ["csv", "file", "kek"] + }, + "BlockDTOWithEnum": { + "required": [ + "title", + "type" + ], + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": false + }, + "type": { + "$ref": "#/components/schemas/BlockDTOEnum" + } + }, + "discriminator": { + "propertyName": "type", + "mapping": { + "csv": "#/components/schemas/CsvBlockWithEnumDTO", + "file": "#/components/schemas/FileBlockWithEnumDTO" + } + }, + "oneOf": [ + { + "$ref": "#/components/schemas/CsvBlockWithEnumDTO" + }, + { + "$ref": "#/components/schemas/FileBlockWithEnumDTO" + } + ] + }, + "CsvBlockWithEnumDTO": { + "allOf": [ + { + "$ref": "#/components/schemas/BlockDTOWithEnum" + }, + { + "required": [ + "text", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "csv", + "enum": [ + "csv" + ] + }, + "text": { + "type": "string", + "nullable": false + } + } + } + ] + }, + "FileBlockWithEnumDTO": { + "allOf": [ + { + "$ref": "#/components/schemas/BlockDTOWithEnum" + }, + { + "required": [ + "fileId", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "file", + "enum": [ + "file" + ] + }, + "fileId": { + "type": "string", + "nullable": false + } + } + } + ] + }, + "BlockDTO": { + "required": [ + "title" + ], + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": false + } + }, + "discriminator": { + "propertyName": "type", + "mapping": { + "csv": "#/components/schemas/CsvBlockDTO", + "file": "#/components/schemas/FileBlockDTO" + } + }, + "oneOf": [ + { + "$ref": "#/components/schemas/CsvBlockDTO" + }, + { + "$ref": "#/components/schemas/FileBlockDTO" + } + ] + }, + "CsvBlockDTO": { + "allOf": [ + { + "$ref": "#/components/schemas/BlockDTO" + }, + { + "required": [ + "text", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "csv", + "enum": [ + "csv" + ] + }, + "text": { + "type": "string", + "nullable": false + } + } + } + ] + }, + "FileBlockDTO": { + "allOf": [ + { + "$ref": "#/components/schemas/BlockDTO" + }, + { + "required": [ + "fileId", + "type" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "file", + "enum": [ + "file" + ] + }, + "fileId": { + "type": "string", + "nullable": false + } + } + } + ] + }, + "Pet": { + "type": "object", + "required": [ + "pet_type" + ], + "properties": { + "pet_type": { + "type": "string" + } + }, + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "cat": "#/components/schemas/Cat", + "lizard": "#/components/schemas/Lizard" + } + } + }, + "PetOnlyDiscriminator": { + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/Dog", + "cat": "#/components/schemas/Cat", + "lizard": "#/components/schemas/Lizard" + } + } + }, + "Cat": { + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + } + ] + }, + "Dog": { + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "bark": { + "type": "string" + } + } + } + ] + }, + "Lizard": { + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "lovesRocks": { + "type": "boolean" + } + } + } + ] + }, + "PetEnum": { + "enum": ["dog", "lizard", "cat"] + }, + "PetWithEnum": { + "type": "object", + "required": [ + "pet_type" + ], + "properties": { + "pet_type": { + "$ref": "#/components/schemas/PetEnum" + } + }, + "discriminator": { + "propertyName": "pet_type", + "mapping": { + "dog": "#/components/schemas/DogWithEnum", + "cat": "#/components/schemas/CatWithEnum", + "lizard": "#/components/schemas/LizardWithEnum" + } + } + }, + "CatWithEnum": { + "allOf": [ + { + "$ref": "#/components/schemas/PetWithEnum" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + } + ] + }, + "DogWithEnum": { + "allOf": [ + { + "$ref": "#/components/schemas/PetWithEnum" + }, + { + "type": "object", + "properties": { + "bark": { + "type": "string" + } + } + } + ] + }, + "LizardWithEnum": { + "allOf": [ + { + "$ref": "#/components/schemas/PetWithEnum" + }, + { + "type": "object", + "properties": { + "lovesRocks": { + "type": "boolean" + } + } + } + ] + } + } +} diff --git a/tests/spec/discriminator/schema.ts b/tests/spec/discriminator/schema.ts new file mode 100644 index 00000000..4d63f0ad --- /dev/null +++ b/tests/spec/discriminator/schema.ts @@ -0,0 +1,141 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type SimpleDiscriminator = SimpleObject | ComplexObject; + +export interface SimpleObject { + objectType: string; +} + +export interface ComplexObject { + objectType: string; +} + +export enum BlockDTOEnum { + Csv = "csv", + File = "file", + Kek = "kek", +} + +export type BlockDTOWithEnum = BaseBlockDtoWithEnum & + ( + | BaseBlockDtoWithEnumTypeMapping + | BaseBlockDtoWithEnumTypeMapping + ); + +export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { + type: BlockDTOEnum.Csv; + text: string; +}; + +export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { + type: BlockDTOEnum.File; + fileId: string; +}; + +export type BlockDTO = BaseBlockDto & + (BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> | BaseBlockDtoTypeMapping<"file", FileBlockDTO>); + +export type CsvBlockDTO = BaseBlockDto & { + /** @default "csv" */ + type: "csv"; + text: string; +}; + +export type FileBlockDTO = BaseBlockDto & { + /** @default "file" */ + type: "file"; + fileId: string; +}; + +export type Pet = BasePet & + (BasePetPetTypeMapping<"dog", Dog> | BasePetPetTypeMapping<"cat", Cat> | BasePetPetTypeMapping<"lizard", Lizard>); + +export type PetOnlyDiscriminator = + | ({ + pet_type: "dog"; + } & Dog) + | ({ + pet_type: "cat"; + } & Cat) + | ({ + pet_type: "lizard"; + } & Lizard); + +export type Cat = BasePet & { + name?: string; +}; + +export type Dog = BasePet & { + bark?: string; +}; + +export type Lizard = BasePet & { + lovesRocks?: boolean; +}; + +export enum PetEnum { + Dog = "dog", + Lizard = "lizard", + Cat = "cat", +} + +export type PetWithEnum = BasePetWithEnum & + ( + | BasePetWithEnumPetTypeMapping + | BasePetWithEnumPetTypeMapping + | BasePetWithEnumPetTypeMapping + ); + +export type CatWithEnum = BasePetWithEnum & { + name?: string; +}; + +export type DogWithEnum = BasePetWithEnum & { + bark?: string; +}; + +export type LizardWithEnum = BasePetWithEnum & { + lovesRocks?: boolean; +}; + +interface BaseBlockDtoWithEnum { + title: string; + type: BlockDTOEnum; +} + +type BaseBlockDtoWithEnumTypeMapping = { + type: Key; +} & Type; + +interface BaseBlockDto { + title: string; +} + +type BaseBlockDtoTypeMapping = { + type: Key; +} & Type; + +interface BasePet { + pet_type: string; +} + +type BasePetPetTypeMapping = { + pet_type: Key; +} & Type; + +interface BasePetWithEnum { + pet_type: PetEnum; +} + +type BasePetWithEnumPetTypeMapping = { + pet_type: Key; +} & Type; diff --git a/tests/spec/discriminator/test.js b/tests/spec/discriminator/test.js new file mode 100644 index 00000000..67870298 --- /dev/null +++ b/tests/spec/discriminator/test.js @@ -0,0 +1,22 @@ +const { generateApiForTest } = require("../../helpers/generateApiForTest"); +const { resolve } = require("path"); +const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); +const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); +const createSchemaInfos = require("../../helpers/createSchemaInfos"); + +const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") }); + +schemas.forEach(({ absolutePath, apiFileName }) => { + generateApiForTest({ + testName: "discriminator test", + silent: true, + name: apiFileName, + input: absolutePath, + output: resolve(__dirname, "./"), + addReadonly: true, + generateClient: false, + }).then(() => { + validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); + assertGeneratedModule(resolve(__dirname, `./${apiFileName}`), resolve(__dirname, `./expected.ts`)); + }); +}); diff --git a/tests/spec/dot-path-params/expected.ts b/tests/spec/dot-path-params/expected.ts index 7d92c52f..ee03aac9 100644 --- a/tests/spec/dot-path-params/expected.ts +++ b/tests/spec/dot-path-params/expected.ts @@ -188,7 +188,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -234,10 +234,17 @@ export class Api extends HttpClient + reproFunc: ( + truckId: string, + query: { + queryId: string; + }, + params: RequestParams = {}, + ) => this.request({ path: `/foobar/${truckId}/item`, method: "POST", + query: query, ...params, }), }; diff --git a/tests/spec/dot-path-params/schema.json b/tests/spec/dot-path-params/schema.json index 51879183..a4889935 100644 --- a/tests/spec/dot-path-params/schema.json +++ b/tests/spec/dot-path-params/schema.json @@ -25,6 +25,12 @@ "in": "path", "required": true, "type": "string" + }, + { + "name": "query.id", + "in": "query", + "required": true, + "type": "string" } ] } diff --git a/tests/spec/dot-path-params/schema.ts b/tests/spec/dot-path-params/schema.ts index 7d92c52f..ee03aac9 100644 --- a/tests/spec/dot-path-params/schema.ts +++ b/tests/spec/dot-path-params/schema.ts @@ -188,7 +188,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; @@ -234,10 +234,17 @@ export class Api extends HttpClient + reproFunc: ( + truckId: string, + query: { + queryId: string; + }, + params: RequestParams = {}, + ) => this.request({ path: `/foobar/${truckId}/item`, method: "POST", + query: query, ...params, }), }; diff --git a/tests/spec/enumNamesAsValues/expected.ts b/tests/spec/enumNamesAsValues/expected.ts index 1a5ebef8..8e5dcb1b 100644 --- a/tests/spec/enumNamesAsValues/expected.ts +++ b/tests/spec/enumNamesAsValues/expected.ts @@ -378,7 +378,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/enumNamesAsValues/schema.ts b/tests/spec/enumNamesAsValues/schema.ts index 1a5ebef8..8e5dcb1b 100644 --- a/tests/spec/enumNamesAsValues/schema.ts +++ b/tests/spec/enumNamesAsValues/schema.ts @@ -378,7 +378,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/enums-2.0/expected.ts b/tests/spec/enums-2.0/expected.ts index 355c7471..4fa5c9ad 100644 --- a/tests/spec/enums-2.0/expected.ts +++ b/tests/spec/enums-2.0/expected.ts @@ -9,6 +9,29 @@ * --------------------------------------------------------------- */ +export interface ObjWithEnum { + "prop-enum-nullable"?: 0 | 1 | 2 | 3 | 4 | 5 | null; + "prop-enum"?: 0 | 1 | 2 | 3 | 4 | 5; +} + +export enum XNullableEnum { + Value0 = 0, + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4, + Value5 = 5, +} + +export enum SimpleEnumNonNullable { + Value0 = 0, + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4, + Value5 = 5, +} + export enum OnlyEnumNames { Bla = "Bla", Blabla = "Blabla", @@ -67,3 +90,11 @@ export enum SomeInterestEnum { ASDds = "ASDds", HSDFDS = "HSDFDS", } + +export interface PostFooPayload { + someTypeId?: 1 | 2 | 3 | 4 | 5; +} + +export interface PostFooParams { + testKek: 1 | 2 | 3 | 4 | 5; +} diff --git a/tests/spec/enums-2.0/schema.json b/tests/spec/enums-2.0/schema.json index f551f550..2b10d2bf 100644 --- a/tests/spec/enums-2.0/schema.json +++ b/tests/spec/enums-2.0/schema.json @@ -5,6 +5,29 @@ "basePath": "/", "info": {}, "definitions": { + "objWithEnum": { + "type": "object", + "properties": { + "prop-enum-nullable": { + "type": "integer", + "x-nullable": true, + "enum": [ 0, 1, 2, 3, 4, 5 ] + }, + "prop-enum": { + "type": "integer", + "enum": [ 0, 1, 2, 3, 4, 5 ] + } + } + }, + "x-nullable-enum": { + "type": "integer", + "x-nullable": true, + "enum": [ 0, 1, 2, 3, 4, 5 ] + }, + "simple-enum-non-nullable": { + "type": "integer", + "enum": [ 0, 1, 2, 3, 4, 5 ] + }, "OnlyEnumNames": { "x-enumNames": ["Bla", "Blabla", "Boiler"] }, @@ -57,5 +80,37 @@ "HSDFDS" ] } + }, + "paths": { + "/foo": { + "post": { + "operationId": "postFoo", + "parameters": [ + { + "in": "query", + "name": "testKek", + "required": true, + "type": "integer", + "enum": [1,2,3,4,5] + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "someTypeId": { + "type":"integer", + "enum":[1,2,3,4,5] + } + } + } + } + } + }, + "responses": {} + } + } } } diff --git a/tests/spec/enums-2.0/schema.ts b/tests/spec/enums-2.0/schema.ts index 355c7471..4fa5c9ad 100644 --- a/tests/spec/enums-2.0/schema.ts +++ b/tests/spec/enums-2.0/schema.ts @@ -9,6 +9,29 @@ * --------------------------------------------------------------- */ +export interface ObjWithEnum { + "prop-enum-nullable"?: 0 | 1 | 2 | 3 | 4 | 5 | null; + "prop-enum"?: 0 | 1 | 2 | 3 | 4 | 5; +} + +export enum XNullableEnum { + Value0 = 0, + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4, + Value5 = 5, +} + +export enum SimpleEnumNonNullable { + Value0 = 0, + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4, + Value5 = 5, +} + export enum OnlyEnumNames { Bla = "Bla", Blabla = "Blabla", @@ -67,3 +90,11 @@ export enum SomeInterestEnum { ASDds = "ASDds", HSDFDS = "HSDFDS", } + +export interface PostFooPayload { + someTypeId?: 1 | 2 | 3 | 4 | 5; +} + +export interface PostFooParams { + testKek: 1 | 2 | 3 | 4 | 5; +} diff --git a/tests/spec/enums-2.0/test.js b/tests/spec/enums-2.0/test.js index 89afae54..ebc7be6e 100644 --- a/tests/spec/enums-2.0/test.js +++ b/tests/spec/enums-2.0/test.js @@ -13,6 +13,10 @@ schemas.forEach(({ absolutePath, apiFileName }) => { name: apiFileName, input: absolutePath, output: resolve(__dirname, "./"), + extractRequestParams: true, + extractRequestBody: true, + extractResponseBody: true, + extractResponseError: true, generateClient: false, }).then(() => { validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); diff --git a/tests/spec/extract-enums/v2.0/expected.ts b/tests/spec/extract-enums/v2.0/expected.ts index 7338168b..7d56cc7a 100644 --- a/tests/spec/extract-enums/v2.0/expected.ts +++ b/tests/spec/extract-enums/v2.0/expected.ts @@ -21,10 +21,10 @@ export enum TypeNamePrefixEnumRootTypeNameSuffix { export interface TypeNamePrefixTreeTypeNameSuffix { tree?: { - mode?: TypeNamePrefixTreeModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeTypeNameSuffix; + mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; }[]; } @@ -87,7 +87,20 @@ export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", } -export enum TypeNamePrefixTreeModeTypeNameSuffix { +export interface TypeNamePrefixSuperDuperStructDTOTypeNameSuffix { + /** @example "100" */ + id: number; + /** @example "APPROVED" */ + state: TypeNamePrefixSuperDuperStructDtoStateEnumTypeNameSuffix; +} + +export type TypeNamePrefixNullableEnumTypeNameSuffix = null; + +/** **Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`. */ +export type TypeNamePrefixCodeScanningAlertDismissedReasonTypeNameSuffix = + TypeNamePrefixCodeScanningAlertDismissedReasonEnumTypeNameSuffix | null; + +export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -95,7 +108,7 @@ export enum TypeNamePrefixTreeModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixTreeModeNumTypeNameSuffix { +export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -103,14 +116,123 @@ export enum TypeNamePrefixTreeModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixTreeTypeTypeNameSuffix { +export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixTreeBerekeTypeNameSuffix { +export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", } + +/** @example "APPROVED" */ +export enum TypeNamePrefixSuperDuperStructDtoStateEnumTypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export enum TypeNamePrefixCodeScanningAlertDismissedReasonEnumTypeNameSuffix { + EnumKeyPrefixFalsePositiveEnumKeySuffix = "false positive", + EnumKeyPrefixWontFixEnumKeySuffix = "won't fix", + EnumKeyPrefixUsedInTestsEnumKeySuffix = "used in tests", +} + +/** @example "APPROVED" */ +export enum TypeNamePrefixNameSpaceAddSuperDuperEnumTypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export type TypeNamePrefixNameSpaceAddSuperDuperDataTypeNameSuffix = + TypeNamePrefixNameSpaceAddSuperDuperEnum1TypeNameSuffix; + +/** @example "APPROVED" */ +export enum TypeNamePrefixNameSpaceAddSuperDuperEnum1TypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export interface TypeNamePrefixIssuesDetailParamsTypeNameSuffix { + /** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ + filter: TypeNamePrefixFilterEnumTypeNameSuffix; + /** @default "open" */ + state: TypeNamePrefixStateEnumTypeNameSuffix; + /** @default "created" */ + sort: TypeNamePrefixSortEnumTypeNameSuffix; + /** @default "desc" */ + direction: TypeNamePrefixDirectionEnumTypeNameSuffix; + org: string; +} + +/** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ +export enum TypeNamePrefixFilterEnumTypeNameSuffix { + EnumKeyPrefixAssignedEnumKeySuffix = "assigned", + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixMentionedEnumKeySuffix = "mentioned", + EnumKeyPrefixSubscribedEnumKeySuffix = "subscribed", + EnumKeyPrefixAllEnumKeySuffix = "all", +} + +/** @default "open" */ +export enum TypeNamePrefixStateEnumTypeNameSuffix { + EnumKeyPrefixOpenEnumKeySuffix = "open", + EnumKeyPrefixClosedEnumKeySuffix = "closed", +} + +/** @default "created" */ +export enum TypeNamePrefixSortEnumTypeNameSuffix { + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixUpdatedEnumKeySuffix = "updated", + EnumKeyPrefixCommentsEnumKeySuffix = "comments", +} + +/** @default "desc" */ +export enum TypeNamePrefixDirectionEnumTypeNameSuffix { + EnumKeyPrefixAscEnumKeySuffix = "asc", + EnumKeyPrefixDescEnumKeySuffix = "desc", +} + +export type TypeNamePrefixIssuesDetailDataTypeNameSuffix = any; + +/** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ +export enum TypeNamePrefixIssuesDetailParams1FilterEnumTypeNameSuffix { + EnumKeyPrefixAssignedEnumKeySuffix = "assigned", + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixMentionedEnumKeySuffix = "mentioned", + EnumKeyPrefixSubscribedEnumKeySuffix = "subscribed", + EnumKeyPrefixAllEnumKeySuffix = "all", +} + +/** @default "open" */ +export enum TypeNamePrefixIssuesDetailParams1StateEnumTypeNameSuffix { + EnumKeyPrefixOpenEnumKeySuffix = "open", + EnumKeyPrefixClosedEnumKeySuffix = "closed", +} + +/** @default "created" */ +export enum TypeNamePrefixIssuesDetailParams1SortEnumTypeNameSuffix { + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixUpdatedEnumKeySuffix = "updated", + EnumKeyPrefixCommentsEnumKeySuffix = "comments", +} + +/** @default "desc" */ +export enum TypeNamePrefixIssuesDetailParams1DirectionEnumTypeNameSuffix { + EnumKeyPrefixAscEnumKeySuffix = "asc", + EnumKeyPrefixDescEnumKeySuffix = "desc", +} diff --git a/tests/spec/extract-enums/v2.0/schema.json b/tests/spec/extract-enums/v2.0/schema.json index 7b23d439..64c3f8e8 100644 --- a/tests/spec/extract-enums/v2.0/schema.json +++ b/tests/spec/extract-enums/v2.0/schema.json @@ -4,7 +4,122 @@ "basePath": "/v2", "tags": [], "schemes": ["http"], - "paths": {}, + "paths": { + "/api/v1/super-duper": { + "post": { + "tags": [""], + "summary": "", + "parameters": [ + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "string", + "enum": [ + "NEW", + "PENDING" + ], + "example": "APPROVED" + } + } + } + }, + "404": { "description": "" } + }, + "operationId": "NameSpace_AddSuperDuper" + } + }, + "/orgs/{org}/issues": { + "get": { + "description": "List issues.\nList all issues for a given organization for the authenticated user.\n", + "parameters": [ + { + "default": "all", + "description": "Issues assigned to you / created by you / mentioning you / you're\nsubscribed to updates for / All issues the authenticated user can see\n", + "enum": ["assigned", "created", "mentioned", "subscribed", "all"], + "in": "query", + "name": "filter", + "required": true, + "type": "string" + }, + { + "default": "open", + "enum": ["open", "closed"], + "in": "query", + "name": "state", + "required": true, + "type": "string" + }, + { + "default": "created", + "enum": ["created", "updated", "comments"], + "in": "query", + "name": "sort", + "required": true, + "type": "string" + }, + { + "default": "desc", + "enum": ["asc", "desc"], + "in": "query", + "name": "direction", + "required": true, + "type": "string" + }, + ], + "responses": { + "200": { + "description": "OK", + "headers": { + "X-GitHub-Media-Type": { + "description": "You can check the current version of media type in responses.\n", + "type": "string" + }, + "X-GitHub-Request-Id": { + "type": "integer" + }, + "X-RateLimit-Limit": { + "type": "integer" + }, + "X-RateLimit-Remaining": { + "type": "integer" + }, + "X-RateLimit-Reset": { + "type": "integer" + } + }, + "schema": { + "$ref": "#/definitions/issues" + } + }, + "403": { + "description": "API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting\nfor details.\n", + "headers": { + "X-GitHub-Media-Type": { + "description": "You can check the current version of media type in responses.\n", + "type": "string" + }, + "X-GitHub-Request-Id": { + "type": "integer" + }, + "X-RateLimit-Limit": { + "type": "integer" + }, + "X-RateLimit-Remaining": { + "type": "integer" + }, + "X-RateLimit-Reset": { + "type": "integer" + } + } + } + } + } + } + }, "definitions": { "enum-root": { "enum": ["100644", "100755", "040000", "160000", "120000", "test1", "test2"], @@ -89,6 +204,42 @@ "ASDds", "HSDFDS" ] + }, + "SuperDuperStructDTO": { + "properties": { + "id": { "type": "number", "example": "100" }, + "state": { + "type": "string", + "enum": [ + "NEW", + "PENDING" + ], + "example": "APPROVED" + } + }, + "type": "object", + "required": [ + "id", + "state" + ] + }, + "nullableEnum": { + "type": "number", + "enum": [null], + "nullable": true + }, + "code-scanning-alert-dismissed-reason": { + "type": "string", + "description": "**Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`.", + "nullable": true, + "oneOf": [ + { + "enum": ["false positive", "won't fix", "used in tests"] + }, + { + "enum": [null] + } + ] } }, "externalDocs": { diff --git a/tests/spec/extract-enums/v2.0/schema.ts b/tests/spec/extract-enums/v2.0/schema.ts index 7338168b..7d56cc7a 100644 --- a/tests/spec/extract-enums/v2.0/schema.ts +++ b/tests/spec/extract-enums/v2.0/schema.ts @@ -21,10 +21,10 @@ export enum TypeNamePrefixEnumRootTypeNameSuffix { export interface TypeNamePrefixTreeTypeNameSuffix { tree?: { - mode?: TypeNamePrefixTreeModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeTypeNameSuffix; + mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; }[]; } @@ -87,7 +87,20 @@ export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", } -export enum TypeNamePrefixTreeModeTypeNameSuffix { +export interface TypeNamePrefixSuperDuperStructDTOTypeNameSuffix { + /** @example "100" */ + id: number; + /** @example "APPROVED" */ + state: TypeNamePrefixSuperDuperStructDtoStateEnumTypeNameSuffix; +} + +export type TypeNamePrefixNullableEnumTypeNameSuffix = null; + +/** **Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`. */ +export type TypeNamePrefixCodeScanningAlertDismissedReasonTypeNameSuffix = + TypeNamePrefixCodeScanningAlertDismissedReasonEnumTypeNameSuffix | null; + +export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -95,7 +108,7 @@ export enum TypeNamePrefixTreeModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixTreeModeNumTypeNameSuffix { +export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -103,14 +116,123 @@ export enum TypeNamePrefixTreeModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixTreeTypeTypeNameSuffix { +export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixTreeBerekeTypeNameSuffix { +export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", } + +/** @example "APPROVED" */ +export enum TypeNamePrefixSuperDuperStructDtoStateEnumTypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export enum TypeNamePrefixCodeScanningAlertDismissedReasonEnumTypeNameSuffix { + EnumKeyPrefixFalsePositiveEnumKeySuffix = "false positive", + EnumKeyPrefixWontFixEnumKeySuffix = "won't fix", + EnumKeyPrefixUsedInTestsEnumKeySuffix = "used in tests", +} + +/** @example "APPROVED" */ +export enum TypeNamePrefixNameSpaceAddSuperDuperEnumTypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export type TypeNamePrefixNameSpaceAddSuperDuperDataTypeNameSuffix = + TypeNamePrefixNameSpaceAddSuperDuperEnum1TypeNameSuffix; + +/** @example "APPROVED" */ +export enum TypeNamePrefixNameSpaceAddSuperDuperEnum1TypeNameSuffix { + EnumKeyPrefix_NEW_EnumKeySuffix = "NEW", + EnumKeyPrefix_PENDING_EnumKeySuffix = "PENDING", +} + +export interface TypeNamePrefixIssuesDetailParamsTypeNameSuffix { + /** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ + filter: TypeNamePrefixFilterEnumTypeNameSuffix; + /** @default "open" */ + state: TypeNamePrefixStateEnumTypeNameSuffix; + /** @default "created" */ + sort: TypeNamePrefixSortEnumTypeNameSuffix; + /** @default "desc" */ + direction: TypeNamePrefixDirectionEnumTypeNameSuffix; + org: string; +} + +/** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ +export enum TypeNamePrefixFilterEnumTypeNameSuffix { + EnumKeyPrefixAssignedEnumKeySuffix = "assigned", + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixMentionedEnumKeySuffix = "mentioned", + EnumKeyPrefixSubscribedEnumKeySuffix = "subscribed", + EnumKeyPrefixAllEnumKeySuffix = "all", +} + +/** @default "open" */ +export enum TypeNamePrefixStateEnumTypeNameSuffix { + EnumKeyPrefixOpenEnumKeySuffix = "open", + EnumKeyPrefixClosedEnumKeySuffix = "closed", +} + +/** @default "created" */ +export enum TypeNamePrefixSortEnumTypeNameSuffix { + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixUpdatedEnumKeySuffix = "updated", + EnumKeyPrefixCommentsEnumKeySuffix = "comments", +} + +/** @default "desc" */ +export enum TypeNamePrefixDirectionEnumTypeNameSuffix { + EnumKeyPrefixAscEnumKeySuffix = "asc", + EnumKeyPrefixDescEnumKeySuffix = "desc", +} + +export type TypeNamePrefixIssuesDetailDataTypeNameSuffix = any; + +/** + * Issues assigned to you / created by you / mentioning you / you're + * subscribed to updates for / All issues the authenticated user can see + * @default "all" + */ +export enum TypeNamePrefixIssuesDetailParams1FilterEnumTypeNameSuffix { + EnumKeyPrefixAssignedEnumKeySuffix = "assigned", + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixMentionedEnumKeySuffix = "mentioned", + EnumKeyPrefixSubscribedEnumKeySuffix = "subscribed", + EnumKeyPrefixAllEnumKeySuffix = "all", +} + +/** @default "open" */ +export enum TypeNamePrefixIssuesDetailParams1StateEnumTypeNameSuffix { + EnumKeyPrefixOpenEnumKeySuffix = "open", + EnumKeyPrefixClosedEnumKeySuffix = "closed", +} + +/** @default "created" */ +export enum TypeNamePrefixIssuesDetailParams1SortEnumTypeNameSuffix { + EnumKeyPrefixCreatedEnumKeySuffix = "created", + EnumKeyPrefixUpdatedEnumKeySuffix = "updated", + EnumKeyPrefixCommentsEnumKeySuffix = "comments", +} + +/** @default "desc" */ +export enum TypeNamePrefixIssuesDetailParams1DirectionEnumTypeNameSuffix { + EnumKeyPrefixAscEnumKeySuffix = "asc", + EnumKeyPrefixDescEnumKeySuffix = "desc", +} diff --git a/tests/spec/extract-enums/v3.0/expected.ts b/tests/spec/extract-enums/v3.0/expected.ts index 201def92..95414617 100644 --- a/tests/spec/extract-enums/v3.0/expected.ts +++ b/tests/spec/extract-enums/v3.0/expected.ts @@ -21,10 +21,10 @@ export enum TypeNamePrefixEnumRootTypeNameSuffix { export interface TypeNamePrefixTreeTypeNameSuffix { tree?: { - mode?: TypeNamePrefixTreeModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeTypeNameSuffix; + mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; }[]; } @@ -87,7 +87,7 @@ export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", } -export enum TypeNamePrefixTreeModeTypeNameSuffix { +export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -95,7 +95,7 @@ export enum TypeNamePrefixTreeModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixTreeModeNumTypeNameSuffix { +export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -103,13 +103,13 @@ export enum TypeNamePrefixTreeModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixTreeTypeTypeNameSuffix { +export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixTreeBerekeTypeNameSuffix { +export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", @@ -121,13 +121,13 @@ export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { * Order By * @default "created_time" */ - order_by?: TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix; + order_by?: TypeNamePrefixOrderByEnumTypeNameSuffix; statusesPath?: any[]; /** * Order By * @default "created_time" */ - orderPathBy?: TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix; + orderPathBy?: TypeNamePrefixOrderPathByEnumTypeNameSuffix; /** Tag Ids */ tagPathIds?: string[]; } @@ -136,7 +136,7 @@ export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix { +export enum TypeNamePrefixOrderByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -144,7 +144,7 @@ export enum TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix { +export enum TypeNamePrefixOrderPathByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -152,7 +152,31 @@ export enum TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderHeaderByTypeNameSuffix { +export enum TypeNamePrefixGetAbcGetParams1OrderByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1OrderPathByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1OrderHeaderByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1EnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -161,33 +185,105 @@ export interface TypeNamePrefixGetCdeGetParamsTypeNameSuffix { tag_ids?: string[]; SHOULD_NOT_BE_ANY?: { tree?: { - mode?: TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix; - type?: TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix; - bereke?: TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix; + mode?: TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix; }[]; }; /** * Order By * @default "created_time" */ - order_by?: TypeNamePrefixGetCdeGetParamsOrderByTypeNameSuffix; + order_by?: TypeNamePrefixOrderByEnum1TypeNameSuffix; shouldNotBeAnyPath?: { tree?: { - mode?: TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix; - type?: TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix; - bereke?: TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix; + mode?: TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix; }[]; }; /** * Order By * @default "created_time" */ - orderByPath?: TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix; + orderByPath?: TypeNamePrefixOrderByPathEnumTypeNameSuffix; +} + +export enum TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixOrderByEnum1TypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +export enum TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixOrderByPathEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } -export enum TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1ModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -195,7 +291,7 @@ export enum TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -203,13 +299,13 @@ export enum TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1TypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1BerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", @@ -219,15 +315,79 @@ export enum TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1OrderByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } +export enum TypeNamePrefixGetCdeGetParams1ModeEnum1TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnum1TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixGetCdeGetParams1TypeEnum1TypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixGetCdeGetParams1BerekeEnum1TypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetCdeGetParams1OrderByPathEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeEnum2TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnum2TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixGetCdeGetParams1TypeEnum2TypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixGetCdeGetParams1BerekeEnum2TypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + /** * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1OrderByHeaderEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -235,6 +395,6 @@ export enum TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByHeaderTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1EnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } diff --git a/tests/spec/extract-enums/v3.0/schema.ts b/tests/spec/extract-enums/v3.0/schema.ts index 201def92..95414617 100644 --- a/tests/spec/extract-enums/v3.0/schema.ts +++ b/tests/spec/extract-enums/v3.0/schema.ts @@ -21,10 +21,10 @@ export enum TypeNamePrefixEnumRootTypeNameSuffix { export interface TypeNamePrefixTreeTypeNameSuffix { tree?: { - mode?: TypeNamePrefixTreeModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeTypeNameSuffix; + mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; }[]; } @@ -87,7 +87,7 @@ export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", } -export enum TypeNamePrefixTreeModeTypeNameSuffix { +export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -95,7 +95,7 @@ export enum TypeNamePrefixTreeModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixTreeModeNumTypeNameSuffix { +export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -103,13 +103,13 @@ export enum TypeNamePrefixTreeModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixTreeTypeTypeNameSuffix { +export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixTreeBerekeTypeNameSuffix { +export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", @@ -121,13 +121,13 @@ export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { * Order By * @default "created_time" */ - order_by?: TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix; + order_by?: TypeNamePrefixOrderByEnumTypeNameSuffix; statusesPath?: any[]; /** * Order By * @default "created_time" */ - orderPathBy?: TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix; + orderPathBy?: TypeNamePrefixOrderPathByEnumTypeNameSuffix; /** Tag Ids */ tagPathIds?: string[]; } @@ -136,7 +136,7 @@ export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix { +export enum TypeNamePrefixOrderByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -144,7 +144,7 @@ export enum TypeNamePrefixGetAbcGetParamsOrderByTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix { +export enum TypeNamePrefixOrderPathByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -152,7 +152,31 @@ export enum TypeNamePrefixGetAbcGetParamsOrderPathByTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetAbcGetParamsOrderHeaderByTypeNameSuffix { +export enum TypeNamePrefixGetAbcGetParams1OrderByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1OrderPathByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1OrderHeaderByEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetAbcGetParams1EnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -161,33 +185,105 @@ export interface TypeNamePrefixGetCdeGetParamsTypeNameSuffix { tag_ids?: string[]; SHOULD_NOT_BE_ANY?: { tree?: { - mode?: TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix; - type?: TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix; - bereke?: TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix; + mode?: TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix; }[]; }; /** * Order By * @default "created_time" */ - order_by?: TypeNamePrefixGetCdeGetParamsOrderByTypeNameSuffix; + order_by?: TypeNamePrefixOrderByEnum1TypeNameSuffix; shouldNotBeAnyPath?: { tree?: { - mode?: TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix; - "mode-num"?: TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix; - type?: TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix; - bereke?: TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix; + mode?: TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix; + "mode-num"?: TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix; + type?: TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix; + bereke?: TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix; }[]; }; /** * Order By * @default "created_time" */ - orderByPath?: TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix; + orderByPath?: TypeNamePrefixOrderByPathEnumTypeNameSuffix; +} + +export enum TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixOrderByEnum1TypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +export enum TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixOrderByPathEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } -export enum TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1ModeEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", @@ -195,7 +291,7 @@ export enum TypeNamePrefixGetCdeGetParamsModeTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", } -export enum TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnumTypeNameSuffix { EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, @@ -203,13 +299,13 @@ export enum TypeNamePrefixGetCdeGetParamsModeNumTypeNameSuffix { EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, } -export enum TypeNamePrefixGetCdeGetParamsTypeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1TypeEnumTypeNameSuffix { EnumKeyPrefixBlobEnumKeySuffix = "blob", EnumKeyPrefixTreeEnumKeySuffix = "tree", EnumKeyPrefixCommitEnumKeySuffix = "commit", } -export enum TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1BerekeEnumTypeNameSuffix { EnumKeyPrefixBlaEnumKeySuffix = "Bla", EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", @@ -219,15 +315,79 @@ export enum TypeNamePrefixGetCdeGetParamsBerekeTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1OrderByEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } +export enum TypeNamePrefixGetCdeGetParams1ModeEnum1TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnum1TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixGetCdeGetParams1TypeEnum1TypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixGetCdeGetParams1BerekeEnum1TypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + +/** + * Order By + * @default "created_time" + */ +export enum TypeNamePrefixGetCdeGetParams1OrderByPathEnumTypeNameSuffix { + EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeEnum2TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", + EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", + EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", + EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", + EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", +} + +export enum TypeNamePrefixGetCdeGetParams1ModeNumEnum2TypeNameSuffix { + EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, + EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, + EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, + EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, + EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, +} + +export enum TypeNamePrefixGetCdeGetParams1TypeEnum2TypeNameSuffix { + EnumKeyPrefixBlobEnumKeySuffix = "blob", + EnumKeyPrefixTreeEnumKeySuffix = "tree", + EnumKeyPrefixCommitEnumKeySuffix = "commit", +} + +export enum TypeNamePrefixGetCdeGetParams1BerekeEnum2TypeNameSuffix { + EnumKeyPrefixBlaEnumKeySuffix = "Bla", + EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", + EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", +} + /** * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1OrderByHeaderEnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } @@ -235,6 +395,6 @@ export enum TypeNamePrefixGetCdeGetParamsOrderByPathTypeNameSuffix { * Order By * @default "created_time" */ -export enum TypeNamePrefixGetCdeGetParamsOrderByHeaderTypeNameSuffix { +export enum TypeNamePrefixGetCdeGetParams1EnumTypeNameSuffix { EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", } diff --git a/tests/spec/extractRequestBody/expected.ts b/tests/spec/extractRequestBody/expected.ts index 8f4a9af1..3a729a87 100644 --- a/tests/spec/extractRequestBody/expected.ts +++ b/tests/spec/extractRequestBody/expected.ts @@ -339,7 +339,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractRequestBody/schema.ts b/tests/spec/extractRequestBody/schema.ts index 8f4a9af1..3a729a87 100644 --- a/tests/spec/extractRequestBody/schema.ts +++ b/tests/spec/extractRequestBody/schema.ts @@ -339,7 +339,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractRequestParams/expected.ts b/tests/spec/extractRequestParams/expected.ts index a2e217b8..c091f21d 100644 --- a/tests/spec/extractRequestParams/expected.ts +++ b/tests/spec/extractRequestParams/expected.ts @@ -261,7 +261,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractRequestParams/schema.ts b/tests/spec/extractRequestParams/schema.ts index a2e217b8..c091f21d 100644 --- a/tests/spec/extractRequestParams/schema.ts +++ b/tests/spec/extractRequestParams/schema.ts @@ -261,7 +261,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractResponseBody/expected.ts b/tests/spec/extractResponseBody/expected.ts index 2dd9c39f..8ff1f152 100644 --- a/tests/spec/extractResponseBody/expected.ts +++ b/tests/spec/extractResponseBody/expected.ts @@ -341,7 +341,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractResponseBody/schema.ts b/tests/spec/extractResponseBody/schema.ts index 2dd9c39f..8ff1f152 100644 --- a/tests/spec/extractResponseBody/schema.ts +++ b/tests/spec/extractResponseBody/schema.ts @@ -341,7 +341,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractResponseError/expected.ts b/tests/spec/extractResponseError/expected.ts index 7072ae4b..0d4de091 100644 --- a/tests/spec/extractResponseError/expected.ts +++ b/tests/spec/extractResponseError/expected.ts @@ -336,7 +336,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/extractResponseError/schema.ts b/tests/spec/extractResponseError/schema.ts index 7072ae4b..0d4de091 100644 --- a/tests/spec/extractResponseError/schema.ts +++ b/tests/spec/extractResponseError/schema.ts @@ -336,7 +336,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/js/schema.d.ts b/tests/spec/js/schema.d.ts index 070dc9aa..42997921 100644 --- a/tests/spec/js/schema.d.ts +++ b/tests/spec/js/schema.d.ts @@ -73,8 +73,8 @@ export interface AssetPatch { label?: string; name: string; } -export declare type Assets = Asset[]; -export declare type Assignees = User[]; +export type Assets = Asset[]; +export type Assignees = User[]; export interface Blob { content?: string; encoding?: "utf-8" | "base64"; @@ -123,21 +123,21 @@ export interface Branch { }; name?: string; } -export declare type Branches = { +export type Branches = { commit?: { sha?: string; url?: string; }; name?: string; }[]; -export declare type CodeFrequencyStats = number[]; +export type CodeFrequencyStats = number[]; export interface Comment { body?: string; } export interface CommentBody { body: string; } -export declare type Comments = { +export type Comments = { body?: string; /** ISO 8601. */ created_at?: string; @@ -193,7 +193,7 @@ export interface Commit { }; url?: string; } -export declare type CommitActivityStats = { +export type CommitActivityStats = { days?: number[]; total?: number; week?: number; @@ -227,7 +227,7 @@ export interface CommitCommentBody { /** SHA of the commit to comment on. */ sha: string; } -export declare type Commits = { +export type Commits = { /** A GitHub user */ author?: User; commit?: { @@ -359,7 +359,7 @@ export interface ContentsPath { type?: string; url?: string; } -export declare type ContributorsStats = { +export type ContributorsStats = { author?: { avatar_url?: string; gravatar_id?: string; @@ -487,7 +487,7 @@ export interface DeploymentResp { updated_at?: string; url?: string; } -export declare type DeploymentStatuses = { +export type DeploymentStatuses = { created_at?: string; /** A GitHub user */ creator?: User; @@ -514,13 +514,13 @@ export interface Download { size?: number; url?: string; } -export declare type Downloads = Download[]; +export type Downloads = Download[]; export interface EditTeam { name: string; permission?: "pull" | "push" | "admin"; } -export declare type EmailsPost = string[]; -export declare type Emojis = Record; +export type EmailsPost = string[]; +export type Emojis = Record; export interface Event { /** A user or organization */ actor?: Actor; @@ -537,7 +537,7 @@ export interface Event { }; type?: string; } -export declare type Events = Event[]; +export type Events = Event[]; export interface Feeds { _links?: { current_user?: { @@ -575,7 +575,7 @@ export interface Feeds { export interface ForkBody { organization?: string; } -export declare type Forks = Repos; +export type Forks = Repos; export interface Gist { comments?: number; comments_url?: string; @@ -618,7 +618,7 @@ export interface Gist { /** A GitHub user */ user?: User; } -export declare type Gists = { +export type Gists = { comments?: number; comments_url?: string; created_at?: string; @@ -653,7 +653,7 @@ export interface GitRefPatch { force?: boolean; sha?: string; } -export declare type Gitignore = any[]; +export type Gitignore = any[]; export interface GitignoreLang { name?: string; source?: string; @@ -667,7 +667,7 @@ export interface HeadBranch { ref?: string; url?: string; } -export declare type Hook = { +export type Hook = { active?: boolean; config?: { content_type?: string; @@ -762,8 +762,8 @@ export interface IssueEvent { }; url?: string; } -export declare type IssueEvents = IssueEvent[]; -export declare type Issues = { +export type IssueEvents = IssueEvent[]; +export type Issues = { /** A GitHub user */ assignee?: User; body?: string; @@ -819,7 +819,7 @@ export interface IssuesComment { /** A GitHub user */ user?: User; } -export declare type IssuesComments = { +export type IssuesComments = { _links?: { html?: { href?: string; @@ -844,7 +844,7 @@ export declare type IssuesComments = { /** A GitHub user */ user?: User; }[]; -export declare type Keys = { +export type Keys = { id?: number; key?: string; title?: string; @@ -859,7 +859,7 @@ export interface Label { name?: string; url?: string; } -export declare type Labels = { +export type Labels = { /** * @minLength 6 * @maxLength 6 @@ -868,7 +868,7 @@ export declare type Labels = { name?: string; url?: string; }[]; -export declare type Languages = Record; +export type Languages = Record; export interface Markdown { context?: string; mode?: string; @@ -985,7 +985,7 @@ export interface OrgTeamsPost { repo_names?: string[]; } /** A GitHub organization */ -export declare type Organization = Actor; +export type Organization = Actor; export interface OrganizationAsTeamMember { errors?: { code?: string; @@ -1133,7 +1133,7 @@ export interface PullUpdate { state?: string; title?: string; } -export declare type Pulls = { +export type Pulls = { _links?: { comments?: { href?: string; @@ -1235,7 +1235,7 @@ export interface PullsCommentPost { path?: string; position?: number; } -export declare type PullsComments = { +export type PullsComments = { _links?: { html?: { href?: string; @@ -1286,7 +1286,7 @@ export interface RateLimit { reset?: number; }; } -export declare type Ref = { +export type Ref = { /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ created_at?: string; creator?: { @@ -1304,7 +1304,7 @@ export declare type Ref = { updated_at?: string; url?: string; }[]; -export declare type RefStatus = { +export type RefStatus = { commit_url?: string; name?: string; repository_url?: string; @@ -1321,7 +1321,7 @@ export declare type RefStatus = { url?: string; }[]; }[]; -export declare type Refs = { +export type Refs = { object?: { sha?: string; type?: string; @@ -1375,7 +1375,7 @@ export interface ReleaseCreate { tag_name?: string; target_commitish?: string; } -export declare type Releases = { +export type Releases = { assets?: { content_type?: string; created_at?: string; @@ -1450,7 +1450,7 @@ export interface Repo { watchers?: number; watchers_count?: number; } -export declare type RepoDeployments = { +export type RepoDeployments = { created_at?: string; /** A GitHub user */ creator?: User; @@ -1462,7 +1462,7 @@ export declare type RepoDeployments = { updated_at?: string; url?: string; }[]; -export declare type RepoComments = { +export type RepoComments = { body?: string; commit_id?: string; /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ @@ -1522,7 +1522,7 @@ export interface RepoEdit { name?: string; private?: boolean; } -export declare type Repos = Repo[]; +export type Repos = Repo[]; export interface SearchCode { items?: { git_url?: string; @@ -1704,7 +1704,7 @@ export interface TagBody { /** String of the type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob. */ type: "commit" | "tree" | "blob"; } -export declare type Tags = Tag[]; +export type Tags = Tag[]; export interface Team { id?: number; members_count?: number; @@ -1717,13 +1717,13 @@ export interface TeamMembership { state?: string; url?: string; } -export declare type TeamRepos = Repos; -export declare type Teams = { +export type TeamRepos = Repos; +export type Teams = { id?: number; name?: string; url?: string; }[]; -export declare type TeamsList = { +export type TeamsList = { id?: number; members_count?: number; name?: string; @@ -1759,8 +1759,8 @@ export interface Trees { url?: string; } /** A GitHub user */ -export declare type User = Actor; -export declare type UserEmails = string[]; +export type User = Actor; +export type UserEmails = string[]; export interface UserKeysKeyId { id?: number; key?: string; @@ -1780,9 +1780,9 @@ export interface UserUpdate { location?: string; name?: string; } -export declare type Users = User[]; -export declare type QueryParamsType = Record; -export declare type ResponseFormat = keyof Omit; +export type Users = User[]; +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; @@ -1801,7 +1801,7 @@ export interface FullRequestParams extends Omit { /** request cancellation token */ cancelToken?: CancelToken; } -export declare type RequestParams = Omit; +export type RequestParams = Omit; export interface ApiConfig { baseUrl?: string; baseApiParams?: Omit; @@ -1812,7 +1812,7 @@ export interface HttpResponse ex data: D; error: E; } -declare type CancelToken = Symbol | string | number; +type CancelToken = Symbol | string | number; export declare enum ContentType { Json = "application/json", FormData = "multipart/form-data", diff --git a/tests/spec/js/schema.js b/tests/spec/js/schema.js index cdc16511..bb353961 100644 --- a/tests/spec/js/schema.js +++ b/tests/spec/js/schema.js @@ -122,7 +122,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response; diff --git a/tests/spec/jsAxios/schema.d.ts b/tests/spec/jsAxios/schema.d.ts index b24f0b46..1c46ab41 100644 --- a/tests/spec/jsAxios/schema.d.ts +++ b/tests/spec/jsAxios/schema.d.ts @@ -73,8 +73,8 @@ export interface AssetPatch { label?: string; name: string; } -export declare type Assets = Asset[]; -export declare type Assignees = User[]; +export type Assets = Asset[]; +export type Assignees = User[]; export interface Blob { content?: string; encoding?: "utf-8" | "base64"; @@ -123,21 +123,21 @@ export interface Branch { }; name?: string; } -export declare type Branches = { +export type Branches = { commit?: { sha?: string; url?: string; }; name?: string; }[]; -export declare type CodeFrequencyStats = number[]; +export type CodeFrequencyStats = number[]; export interface Comment { body?: string; } export interface CommentBody { body: string; } -export declare type Comments = { +export type Comments = { body?: string; /** ISO 8601. */ created_at?: string; @@ -193,7 +193,7 @@ export interface Commit { }; url?: string; } -export declare type CommitActivityStats = { +export type CommitActivityStats = { days?: number[]; total?: number; week?: number; @@ -227,7 +227,7 @@ export interface CommitCommentBody { /** SHA of the commit to comment on. */ sha: string; } -export declare type Commits = { +export type Commits = { /** A GitHub user */ author?: User; commit?: { @@ -359,7 +359,7 @@ export interface ContentsPath { type?: string; url?: string; } -export declare type ContributorsStats = { +export type ContributorsStats = { author?: { avatar_url?: string; gravatar_id?: string; @@ -487,7 +487,7 @@ export interface DeploymentResp { updated_at?: string; url?: string; } -export declare type DeploymentStatuses = { +export type DeploymentStatuses = { created_at?: string; /** A GitHub user */ creator?: User; @@ -514,13 +514,13 @@ export interface Download { size?: number; url?: string; } -export declare type Downloads = Download[]; +export type Downloads = Download[]; export interface EditTeam { name: string; permission?: "pull" | "push" | "admin"; } -export declare type EmailsPost = string[]; -export declare type Emojis = Record; +export type EmailsPost = string[]; +export type Emojis = Record; export interface Event { /** A user or organization */ actor?: Actor; @@ -537,7 +537,7 @@ export interface Event { }; type?: string; } -export declare type Events = Event[]; +export type Events = Event[]; export interface Feeds { _links?: { current_user?: { @@ -575,7 +575,7 @@ export interface Feeds { export interface ForkBody { organization?: string; } -export declare type Forks = Repos; +export type Forks = Repos; export interface Gist { comments?: number; comments_url?: string; @@ -618,7 +618,7 @@ export interface Gist { /** A GitHub user */ user?: User; } -export declare type Gists = { +export type Gists = { comments?: number; comments_url?: string; created_at?: string; @@ -653,7 +653,7 @@ export interface GitRefPatch { force?: boolean; sha?: string; } -export declare type Gitignore = any[]; +export type Gitignore = any[]; export interface GitignoreLang { name?: string; source?: string; @@ -667,7 +667,7 @@ export interface HeadBranch { ref?: string; url?: string; } -export declare type Hook = { +export type Hook = { active?: boolean; config?: { content_type?: string; @@ -762,8 +762,8 @@ export interface IssueEvent { }; url?: string; } -export declare type IssueEvents = IssueEvent[]; -export declare type Issues = { +export type IssueEvents = IssueEvent[]; +export type Issues = { /** A GitHub user */ assignee?: User; body?: string; @@ -819,7 +819,7 @@ export interface IssuesComment { /** A GitHub user */ user?: User; } -export declare type IssuesComments = { +export type IssuesComments = { _links?: { html?: { href?: string; @@ -844,7 +844,7 @@ export declare type IssuesComments = { /** A GitHub user */ user?: User; }[]; -export declare type Keys = { +export type Keys = { id?: number; key?: string; title?: string; @@ -859,7 +859,7 @@ export interface Label { name?: string; url?: string; } -export declare type Labels = { +export type Labels = { /** * @minLength 6 * @maxLength 6 @@ -868,7 +868,7 @@ export declare type Labels = { name?: string; url?: string; }[]; -export declare type Languages = Record; +export type Languages = Record; export interface Markdown { context?: string; mode?: string; @@ -985,7 +985,7 @@ export interface OrgTeamsPost { repo_names?: string[]; } /** A GitHub organization */ -export declare type Organization = Actor; +export type Organization = Actor; export interface OrganizationAsTeamMember { errors?: { code?: string; @@ -1133,7 +1133,7 @@ export interface PullUpdate { state?: string; title?: string; } -export declare type Pulls = { +export type Pulls = { _links?: { comments?: { href?: string; @@ -1235,7 +1235,7 @@ export interface PullsCommentPost { path?: string; position?: number; } -export declare type PullsComments = { +export type PullsComments = { _links?: { html?: { href?: string; @@ -1286,7 +1286,7 @@ export interface RateLimit { reset?: number; }; } -export declare type Ref = { +export type Ref = { /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ created_at?: string; creator?: { @@ -1304,7 +1304,7 @@ export declare type Ref = { updated_at?: string; url?: string; }[]; -export declare type RefStatus = { +export type RefStatus = { commit_url?: string; name?: string; repository_url?: string; @@ -1321,7 +1321,7 @@ export declare type RefStatus = { url?: string; }[]; }[]; -export declare type Refs = { +export type Refs = { object?: { sha?: string; type?: string; @@ -1375,7 +1375,7 @@ export interface ReleaseCreate { tag_name?: string; target_commitish?: string; } -export declare type Releases = { +export type Releases = { assets?: { content_type?: string; created_at?: string; @@ -1450,7 +1450,7 @@ export interface Repo { watchers?: number; watchers_count?: number; } -export declare type RepoDeployments = { +export type RepoDeployments = { created_at?: string; /** A GitHub user */ creator?: User; @@ -1462,7 +1462,7 @@ export declare type RepoDeployments = { updated_at?: string; url?: string; }[]; -export declare type RepoComments = { +export type RepoComments = { body?: string; commit_id?: string; /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ @@ -1522,7 +1522,7 @@ export interface RepoEdit { name?: string; private?: boolean; } -export declare type Repos = Repo[]; +export type Repos = Repo[]; export interface SearchCode { items?: { git_url?: string; @@ -1704,7 +1704,7 @@ export interface TagBody { /** String of the type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob. */ type: "commit" | "tree" | "blob"; } -export declare type Tags = Tag[]; +export type Tags = Tag[]; export interface Team { id?: number; members_count?: number; @@ -1717,13 +1717,13 @@ export interface TeamMembership { state?: string; url?: string; } -export declare type TeamRepos = Repos; -export declare type Teams = { +export type TeamRepos = Repos; +export type Teams = { id?: number; name?: string; url?: string; }[]; -export declare type TeamsList = { +export type TeamsList = { id?: number; members_count?: number; name?: string; @@ -1759,8 +1759,8 @@ export interface Trees { url?: string; } /** A GitHub user */ -export declare type User = Actor; -export declare type UserEmails = string[]; +export type User = Actor; +export type UserEmails = string[]; export interface UserKeysKeyId { id?: number; key?: string; @@ -1780,9 +1780,9 @@ export interface UserUpdate { location?: string; name?: string; } -export declare type Users = User[]; -import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios"; -export declare type QueryParamsType = Record; +export type Users = User[]; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios"; +export type QueryParamsType = Record; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; @@ -1797,7 +1797,7 @@ export interface FullRequestParams extends Omit; +export type RequestParams = Omit; export interface ApiConfig extends Omit { securityWorker?: ( securityData: SecurityDataType | null, diff --git a/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts b/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts index c1b5600e..395b6542 100644 --- a/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts +++ b/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts @@ -9,8 +9,8 @@ * --------------------------------------------------------------- */ -export declare type QueryParamsType = Record; -export declare type ResponseFormat = keyof Omit; +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; @@ -29,7 +29,7 @@ export interface FullRequestParams extends Omit { /** request cancellation token */ cancelToken?: CancelToken; } -export declare type RequestParams = Omit; +export type RequestParams = Omit; export interface ApiConfig { baseUrl?: string; baseApiParams?: Omit; @@ -40,7 +40,7 @@ export interface HttpResponse ex data: D; error: E; } -declare type CancelToken = Symbol | string | number; +type CancelToken = Symbol | string | number; export declare enum ContentType { Json = "application/json", FormData = "multipart/form-data", diff --git a/tests/spec/jsSingleHttpClientModular/expected/http-client.js b/tests/spec/jsSingleHttpClientModular/expected/http-client.js index 81c9aab3..e087da55 100644 --- a/tests/spec/jsSingleHttpClientModular/expected/http-client.js +++ b/tests/spec/jsSingleHttpClientModular/expected/http-client.js @@ -122,7 +122,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response; diff --git a/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts b/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts index c1b5600e..395b6542 100644 --- a/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts +++ b/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts @@ -9,8 +9,8 @@ * --------------------------------------------------------------- */ -export declare type QueryParamsType = Record; -export declare type ResponseFormat = keyof Omit; +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; @@ -29,7 +29,7 @@ export interface FullRequestParams extends Omit { /** request cancellation token */ cancelToken?: CancelToken; } -export declare type RequestParams = Omit; +export type RequestParams = Omit; export interface ApiConfig { baseUrl?: string; baseApiParams?: Omit; @@ -40,7 +40,7 @@ export interface HttpResponse ex data: D; error: E; } -declare type CancelToken = Symbol | string | number; +type CancelToken = Symbol | string | number; export declare enum ContentType { Json = "application/json", FormData = "multipart/form-data", diff --git a/tests/spec/jsSingleHttpClientModular/generated/http-client.js b/tests/spec/jsSingleHttpClientModular/generated/http-client.js index 81c9aab3..e087da55 100644 --- a/tests/spec/jsSingleHttpClientModular/generated/http-client.js +++ b/tests/spec/jsSingleHttpClientModular/generated/http-client.js @@ -122,7 +122,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response; diff --git a/tests/spec/modular/expected/http-client.ts b/tests/spec/modular/expected/http-client.ts index d7e44561..80f88c47 100644 --- a/tests/spec/modular/expected/http-client.ts +++ b/tests/spec/modular/expected/http-client.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/modular/generated/http-client.ts b/tests/spec/modular/generated/http-client.ts index d7e44561..80f88c47 100644 --- a/tests/spec/modular/generated/http-client.ts +++ b/tests/spec/modular/generated/http-client.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/moduleNameFirstTag/expected.ts b/tests/spec/moduleNameFirstTag/expected.ts index 83991655..16fffab1 100644 --- a/tests/spec/moduleNameFirstTag/expected.ts +++ b/tests/spec/moduleNameFirstTag/expected.ts @@ -311,7 +311,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/moduleNameFirstTag/schema.ts b/tests/spec/moduleNameFirstTag/schema.ts index 83991655..16fffab1 100644 --- a/tests/spec/moduleNameFirstTag/schema.ts +++ b/tests/spec/moduleNameFirstTag/schema.ts @@ -311,7 +311,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/moduleNameIndex/expected.ts b/tests/spec/moduleNameIndex/expected.ts index b6c53c3c..85459b18 100644 --- a/tests/spec/moduleNameIndex/expected.ts +++ b/tests/spec/moduleNameIndex/expected.ts @@ -311,7 +311,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/moduleNameIndex/schema.ts b/tests/spec/moduleNameIndex/schema.ts index b6c53c3c..85459b18 100644 --- a/tests/spec/moduleNameIndex/schema.ts +++ b/tests/spec/moduleNameIndex/schema.ts @@ -311,7 +311,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/nullable-2.0/expected.ts b/tests/spec/nullable-2.0/expected.ts index 906fdd27..0790cf12 100644 --- a/tests/spec/nullable-2.0/expected.ts +++ b/tests/spec/nullable-2.0/expected.ts @@ -17,8 +17,8 @@ export type MyObject = { export interface TestObject { stringMaybeUndefined?: string; stringMaybeNullA?: string | null; - stringMaybeNullB?: null; - stringMaybeNullAndUndefined?: null; + stringMaybeNullB?: string | null; + stringMaybeNullAndUndefined?: string | null; otherObjectMaybeUndefined?: OtherObject; otherObjectMaybeNullA?: OtherObject | null; otherObjectMaybeNullB?: OtherObject | null; diff --git a/tests/spec/nullable-2.0/schema.ts b/tests/spec/nullable-2.0/schema.ts index 906fdd27..0790cf12 100644 --- a/tests/spec/nullable-2.0/schema.ts +++ b/tests/spec/nullable-2.0/schema.ts @@ -17,8 +17,8 @@ export type MyObject = { export interface TestObject { stringMaybeUndefined?: string; stringMaybeNullA?: string | null; - stringMaybeNullB?: null; - stringMaybeNullAndUndefined?: null; + stringMaybeNullB?: string | null; + stringMaybeNullAndUndefined?: string | null; otherObjectMaybeUndefined?: OtherObject; otherObjectMaybeNullA?: OtherObject | null; otherObjectMaybeNullB?: OtherObject | null; diff --git a/tests/spec/nullable-3.0/expected.ts b/tests/spec/nullable-3.0/expected.ts index f124f699..53b5543f 100644 --- a/tests/spec/nullable-3.0/expected.ts +++ b/tests/spec/nullable-3.0/expected.ts @@ -17,8 +17,8 @@ export type MyObject = { export interface TestObject { stringMaybeUndefined?: string; stringMaybeNullA: string | null; - stringMaybeNullB: null; - stringMaybeNullAndUndefined?: null; + stringMaybeNullB: string | null; + stringMaybeNullAndUndefined?: string | null; otherObjectMaybeUndefined?: OtherObject; otherObjectMaybeNullA: OtherObject | null; otherObjectMaybeNullB: OtherObject | null; diff --git a/tests/spec/nullable-3.0/schema.ts b/tests/spec/nullable-3.0/schema.ts index f124f699..53b5543f 100644 --- a/tests/spec/nullable-3.0/schema.ts +++ b/tests/spec/nullable-3.0/schema.ts @@ -17,8 +17,8 @@ export type MyObject = { export interface TestObject { stringMaybeUndefined?: string; stringMaybeNullA: string | null; - stringMaybeNullB: null; - stringMaybeNullAndUndefined?: null; + stringMaybeNullB: string | null; + stringMaybeNullAndUndefined?: string | null; otherObjectMaybeUndefined?: OtherObject; otherObjectMaybeNullA: OtherObject | null; otherObjectMaybeNullB: OtherObject | null; diff --git a/tests/spec/on-insert-path-param/expected.ts b/tests/spec/on-insert-path-param/expected.ts index 37034dad..bfc93cc6 100644 --- a/tests/spec/on-insert-path-param/expected.ts +++ b/tests/spec/on-insert-path-param/expected.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/on-insert-path-param/schema.ts b/tests/spec/on-insert-path-param/schema.ts index 37034dad..bfc93cc6 100644 --- a/tests/spec/on-insert-path-param/schema.ts +++ b/tests/spec/on-insert-path-param/schema.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/partialBaseTemplate/expected.ts b/tests/spec/partialBaseTemplate/expected.ts index 4d26244e..77f81d4b 100644 --- a/tests/spec/partialBaseTemplate/expected.ts +++ b/tests/spec/partialBaseTemplate/expected.ts @@ -198,7 +198,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/partialBaseTemplate/schema.ts b/tests/spec/partialBaseTemplate/schema.ts index 4d26244e..77f81d4b 100644 --- a/tests/spec/partialBaseTemplate/schema.ts +++ b/tests/spec/partialBaseTemplate/schema.ts @@ -198,7 +198,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/partialBaseTemplate/test.js b/tests/spec/partialBaseTemplate/test.js index 9721cb18..47e3bdd2 100644 --- a/tests/spec/partialBaseTemplate/test.js +++ b/tests/spec/partialBaseTemplate/test.js @@ -17,7 +17,7 @@ schemas.forEach(({ absolutePath, apiFileName, Exception }) => { // because this script was called from package.json folder templates: "./tests/spec/partialBaseTemplate/spec_templates", }).then((output) => { - if (!_.includes(_.get(output.files, "[0].content"), "/** PARTIAL TEMPLATES */")) { + if (!_.includes(_.get(output.files, "[0].fileContent"), "/** PARTIAL TEMPLATES */")) { throw new Exception("Failed, spec templates are not applied"); } diff --git a/tests/spec/partialDefaultTemplate/expected.ts b/tests/spec/partialDefaultTemplate/expected.ts index 8f180614..a6473b66 100644 --- a/tests/spec/partialDefaultTemplate/expected.ts +++ b/tests/spec/partialDefaultTemplate/expected.ts @@ -194,7 +194,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/partialDefaultTemplate/schema.ts b/tests/spec/partialDefaultTemplate/schema.ts index 8f180614..a6473b66 100644 --- a/tests/spec/partialDefaultTemplate/schema.ts +++ b/tests/spec/partialDefaultTemplate/schema.ts @@ -194,7 +194,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/partialDefaultTemplate/test.js b/tests/spec/partialDefaultTemplate/test.js index 4f5b99c6..db301bb7 100644 --- a/tests/spec/partialDefaultTemplate/test.js +++ b/tests/spec/partialDefaultTemplate/test.js @@ -17,7 +17,7 @@ schemas.forEach(({ absolutePath, apiFileName, Exception }) => { // because this script was called from package.json folder templates: "./tests/spec/partialDefaultTemplate/spec_templates", }).then((output) => { - if (!_.includes(_.get(output.files, "[0].content"), "/** PARTIAL TEMPLATES */")) { + if (!_.includes(_.get(output.files, "[0].fileContent"), "/** PARTIAL TEMPLATES */")) { throw new Exception("Failed, spec templates are not applied"); } diff --git a/tests/spec/patch/expected.ts b/tests/spec/patch/expected.ts index 74c9ba7f..e189578d 100644 --- a/tests/spec/patch/expected.ts +++ b/tests/spec/patch/expected.ts @@ -1943,7 +1943,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/patch/schema.ts b/tests/spec/patch/schema.ts index 74c9ba7f..e189578d 100644 --- a/tests/spec/patch/schema.ts +++ b/tests/spec/patch/schema.ts @@ -1943,7 +1943,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/responses/expected.ts b/tests/spec/responses/expected.ts index ef40dd90..ddb8feb4 100644 --- a/tests/spec/responses/expected.ts +++ b/tests/spec/responses/expected.ts @@ -226,7 +226,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/responses/schema.ts b/tests/spec/responses/schema.ts index ef40dd90..ddb8feb4 100644 --- a/tests/spec/responses/schema.ts +++ b/tests/spec/responses/schema.ts @@ -226,7 +226,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/singleHttpClient/expected.ts b/tests/spec/singleHttpClient/expected.ts index 7900e0f2..a25ee0ba 100644 --- a/tests/spec/singleHttpClient/expected.ts +++ b/tests/spec/singleHttpClient/expected.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/singleHttpClient/schema.ts b/tests/spec/singleHttpClient/schema.ts index 7900e0f2..a25ee0ba 100644 --- a/tests/spec/singleHttpClient/schema.ts +++ b/tests/spec/singleHttpClient/schema.ts @@ -186,7 +186,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/sortTypes-false/expected.ts b/tests/spec/sortTypes-false/expected.ts new file mode 100644 index 00000000..17f43d62 --- /dev/null +++ b/tests/spec/sortTypes-false/expected.ts @@ -0,0 +1,5889 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Actor { + created_at?: string; + gravatar_id?: string; + email?: string; + blog?: string; + collaborators?: number; + disk_usage?: number; + followers?: number; + avatar_url?: string; + followers_url?: string; + following?: number; + following_url?: string; + bio?: string; + gists_url?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + login?: string; + name?: string; + organizations_url?: string; + owned_private_repos?: number; + company?: string; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + updated_at?: string; + url?: string; +} + +export interface Asset { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; +} + +export interface AssetPatch { + label?: string; + name: string; +} + +export type Assets = Asset[]; + +export type Assignees = User[]; + +export interface Blob { + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; +} + +export interface Blobs { + sha?: string; +} + +export interface Branch { + _links?: { + html?: string; + self?: string; + }; + commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + name?: string; +} + +export type Branches = { + commit?: { + sha?: string; + url?: string; + }; + name?: string; +}[]; + +export type CodeFrequencyStats = number[]; + +export interface Comment { + body?: string; +} + +export interface CommentBody { + body: string; +} + +export type Comments = { + body?: string; + created_at?: string; + id?: number; + url?: string; + user?: User; +}[]; + +export interface Commit { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + status?: string; + }[]; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + url?: string; +} + +export type CommitActivityStats = { + days?: number[]; + total?: number; + week?: number; +}[]; + +export interface CommitComment { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export interface CommitCommentBody { + body: string; + line?: string; + number?: string; + path?: string; + position?: number; + sha: string; +} + +export type Commits = { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +}[]; + +export interface CompareCommits { + ahead_by?: number; + base_commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + behind_by?: number; + commits?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }[]; + diff_url?: string; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + contents_url?: string; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + sha?: string; + status?: string; + }[]; + html_url?: string; + patch_url?: string; + permalink_url?: string; + status?: string; + total_commits?: number; + url?: string; +} + +export interface ContentsPath { + _links?: { + git?: string; + html?: string; + self?: string; + }; + content?: string; + encoding?: string; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; +} + +export type ContributorsStats = { + author?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + total?: number; + weeks?: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +}[]; + +export interface CreateFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: { + _links?: { + git?: string; + html?: string; + self?: string; + }; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; + }; +} + +export interface CreateFileBody { + committer?: { + email?: string; + name?: string; + }; + content?: string; + message?: string; +} + +export interface DeleteFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: string; +} + +export interface DeleteFileBody { + committer?: { + email?: string; + name?: string; + }; + message?: string; + sha?: string; +} + +export interface Deployment { + description?: string; + payload?: { + deploy_user?: string; + environment?: string; + room_id?: number; + }; + ref?: string; +} + +export interface DeploymentResp { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +} + +export type DeploymentStatuses = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface DeploymentStatusesCreate { + description?: string; + state?: string; + target_url?: string; +} + +export interface Download { + content_type?: string; + description?: string; + download_count?: number; + html_url?: string; + id?: number; + name?: string; + size?: number; + url?: string; +} + +export type Downloads = Download[]; + +export interface EditTeam { + name: string; + permission?: "pull" | "push" | "admin"; +} + +export type EmailsPost = string[]; + +export type Emojis = Record; + +export interface Event { + actor?: Actor; + created_at?: object; + id?: number; + org?: Organization; + payload?: object; + public?: boolean; + repo?: { + id?: number; + name?: string; + url?: string; + }; + type?: string; +} + +export type Events = Event[]; + +export interface Feeds { + _links?: { + current_user?: { + href?: string; + type?: string; + }; + current_user_actor?: { + href?: string; + type?: string; + }; + current_user_organization?: { + href?: string; + type?: string; + }; + current_user_public?: { + href?: string; + type?: string; + }; + timeline?: { + href?: string; + type?: string; + }; + user?: { + href?: string; + type?: string; + }; + }; + current_user_actor_url?: string; + current_user_organization_url?: string; + current_user_public?: string; + current_user_url?: string; + timeline_url?: string; + user_url?: string; +} + +export interface ForkBody { + organization?: string; +} + +export type Forks = Repos; + +export interface Gist { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + forks?: { + created_at?: string; + url?: string; + user?: User; + }[]; + git_pull_url?: string; + git_push_url?: string; + history?: { + change_status?: { + additions?: number; + deletions?: number; + total?: number; + }; + committed_at?: string; + url?: string; + user?: User; + version?: string; + }[]; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +} + +export type Gists = { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +}[]; + +export interface GitCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: string; + tree?: string; +} + +export interface GitRefPatch { + force?: boolean; + sha?: string; +} + +export type Gitignore = any[]; + +export interface GitignoreLang { + name?: string; + source?: string; +} + +export interface HeadBranch { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +} + +export type Hook = { + active?: boolean; + config?: { + content_type?: string; + url?: string; + }; + created_at?: string; + events?: ( + | "push" + | "issues" + | "issue_comment" + | "commit_comment" + | "pull_request" + | "pull_request_review_comment" + | "gollum" + | "watch" + | "download" + | "fork" + | "fork_apply" + | "member" + | "public" + | "team_add" + | "status" + )[]; + id?: number; + name?: string; + updated_at?: string; + url?: string; +}[]; + +export interface HookBody { + active?: boolean; + add_events?: string[]; +} + +export interface Issue { + assignee?: string; + body?: string; + labels?: string[]; + milestone?: number; + title?: string; +} + +export interface IssueEvent { + actor?: Actor; + commit_id?: string; + created_at?: string; + event?: string; + issue?: { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }; + url?: string; +} + +export type IssueEvents = IssueEvent[]; + +export type Issues = { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface IssuesComment { + body?: string; + created_at?: string; + html_url?: string; + id?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export type IssuesComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export type Keys = { + id?: number; + key?: string; + title?: string; + url?: string; +}[]; + +export interface Label { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +} + +export type Labels = { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +}[]; + +export type Languages = Record; + +export interface Markdown { + context?: string; + mode?: string; + text?: string; +} + +export interface Merge { + merged?: boolean; + message?: string; + sha?: string; +} + +export interface MergePullBody { + commit_message?: string; +} + +export interface MergesBody { + base?: string; + commit_message?: string; + head?: string; +} + +export interface MergesConflict { + message?: string; +} + +export interface MergesSuccessful { + author?: User; + comments_url?: string; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + comment_count?: number; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + merged?: boolean; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Meta { + git?: string[]; + hooks?: string[]; +} + +export interface Milestone { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; +} + +export interface MilestoneUpdate { + description?: string; + due_on?: string; + state?: string; + title?: string; +} + +export interface NotificationMarkRead { + last_read_at?: string; +} + +export interface Notifications { + id?: number; + last_read_at?: string; + reason?: string; + repository?: { + description?: string; + fork?: boolean; + full_name?: string; + html_url?: string; + id?: number; + name?: string; + owner?: Actor; + private?: boolean; + url?: string; + }; + subject?: { + latest_comment_url?: string; + title?: string; + type?: string; + url?: string; + }; + unread?: boolean; + updated_at?: string; + url?: string; +} + +export interface OrgTeamsPost { + name: string; + permission?: "pull" | "push" | "admin"; + repo_names?: string[]; +} + +export type Organization = Actor; + +export interface OrganizationAsTeamMember { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +} + +export interface ParticipationStats { + all?: number[]; + owner?: number[]; +} + +export interface PatchGist { + description?: string; + files?: { + "delete_this_file.txt"?: string; + "file1.txt"?: { + content?: string; + }; + "new_file.txt"?: { + content?: string; + }; + "old_name.txt"?: { + content?: string; + filename?: string; + }; + }; +} + +export interface PatchOrg { + billing_email?: string; + company?: string; + email?: string; + location?: string; + name?: string; +} + +export interface PostGist { + description?: string; + files?: { + "file1.txt"?: { + content?: string; + }; + }; + public?: boolean; +} + +export interface PostRepo { + auto_init?: boolean; + description?: string; + gitignore_template?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name: string; + private?: boolean; + team_id?: number; +} + +export interface PullRequest { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + additions?: number; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + changed_files?: number; + closed_at?: string; + comments?: number; + commits?: number; + created_at?: string; + deletions?: number; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merge_commit_sha?: string; + mergeable?: boolean; + merged?: boolean; + merged_at?: string; + merged_by?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + number?: number; + patch_url?: string; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullUpdate { + body?: string; + state?: string; + title?: string; +} + +export type Pulls = { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + closed_at?: string; + created_at?: string; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merged_at?: string; + number?: number; + patch_url?: string; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsComment { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullsCommentPost { + body?: string; + commit_id?: string; + path?: string; + position?: number; +} + +export type PullsComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsPost { + base?: string; + body?: string; + head?: string; + title?: string; +} + +export interface PutSubscription { + created_at?: string; + ignored?: boolean; + reason?: object; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface RateLimit { + rate?: { + remaining?: number; + limit?: number; + reset?: number; + }; +} + +export type Ref = { + state?: string; + target_url?: string; + updated_at?: string; + created_at?: string; + creator?: { + id?: number; + login?: string; + avatar_url?: string; + gravatar_id?: string; + url?: string; + }; + description?: string; + id?: number; + url?: string; +}[]; + +export type RefStatus = { + sha?: string; + state?: string; + commit_url?: string; + name?: string; + repository_url?: string; + statuses?: { + id?: number; + state?: string; + context?: string; + created_at?: string; + description?: string; + target_url?: string; + updated_at?: string; + url?: string; + }[]; +}[]; + +export type Refs = { + ref?: string; + object?: { + type?: string; + sha?: string; + url?: string; + }; + url?: string; +}[]; + +export interface RefsBody { + ref?: string; + sha?: string; +} + +export interface Release { + tarball_url?: string; + target_commitish?: string; + assets?: { + id?: number; + label?: string; + content_type?: string; + created_at?: string; + download_count?: number; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +} + +export interface ReleaseCreate { + prerelease?: boolean; + body?: string; + draft?: boolean; + name?: string; + tag_name?: string; + target_commitish?: string; +} + +export type Releases = { + created_at?: string; + assets?: { + id?: number; + content_type?: string; + created_at?: string; + download_count?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +}[]; + +export interface Repo { + forks?: number; + organization?: Organization; + clone_url?: string; + created_at?: string; + description?: string; + fork?: boolean; + forks_count?: number; + full_name?: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + html_url?: string; + id?: number; + language?: string; + master_branch?: string; + mirror_url?: string; + name?: string; + open_issues?: number; + open_issues_count?: number; + owner?: Actor; + parent?: Repo; + private?: boolean; + pushed_at?: string; + size?: number; + source?: Repo; + ssh_url?: string; + svn_url?: string; + updated_at?: string; + url?: string; + watchers?: number; + watchers_count?: number; +} + +export type RepoDeployments = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +}[]; + +export type RepoComments = { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface RepoCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: { + url?: string; + sha?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; +} + +export interface RepoCommitBody { + author?: { + name?: string; + date?: string; + email?: string; + }; + message: string; + parents: string[]; + tree: string; +} + +export interface RepoEdit { + has_downloads?: boolean; + description?: string; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name?: string; + private?: boolean; +} + +export type Repos = Repo[]; + +export interface SearchCode { + items?: { + html_url?: string; + git_url?: string; + name?: string; + path?: string; + repository?: { + comments_url?: string; + assignees_url?: string; + archive_url?: string; + blobs_url?: string; + branches_url?: string; + collaborators_url?: string; + commits_url?: string; + compare_url?: string; + contents_url?: string; + contributors_url?: string; + description?: string; + downloads_url?: string; + events_url?: string; + fork?: boolean; + forks_url?: string; + full_name?: string; + git_commits_url?: string; + git_refs_url?: string; + git_tags_url?: string; + hooks_url?: string; + html_url?: string; + id?: number; + issue_comment_url?: string; + issue_events_url?: string; + issues_url?: string; + keys_url?: string; + labels_url?: string; + languages_url?: string; + merges_url?: string; + milestones_url?: string; + name?: string; + notifications_url?: string; + owner?: Actor; + private?: boolean; + pulls_url?: string; + stargazers_url?: string; + statuses_url?: string; + subscribers_url?: string; + subscription_url?: string; + tags_url?: string; + teams_url?: string; + trees_url?: string; + url?: string; + }; + score?: number; + sha?: string; + url?: string; + }[]; + total_count?: number; +} + +export interface SearchIssues { + total_count?: number; + items?: { + closed_at?: any; + body?: string; + assignee?: any; + comments?: number; + comments_url?: string; + created_at?: string; + events_url?: string; + html_url?: string; + id?: number; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + labels_url?: string; + milestone?: any; + number?: number; + pull_request?: { + diff_url?: any; + html_url?: any; + patch_url?: any; + }; + score?: number; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }[]; +} + +export interface SearchIssuesByKeyword { + issues?: { + gravatar_id?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: string[]; + number?: number; + position?: number; + body?: string; + state?: string; + title?: string; + updated_at?: string; + user?: string; + votes?: number; + }[]; +} + +export interface SearchRepositories { + items?: Repo[]; + total_count?: number; +} + +export interface SearchRepositoriesByKeyword { + repositories?: Repo[]; +} + +export interface SearchUserByEmail { + user?: User; +} + +export interface SearchUsers { + total_count?: number; + items?: Users; +} + +export interface SearchUsersByKeyword { + users?: Users; +} + +export interface Subscription { + thread_url?: string; + ignored?: boolean; + reason?: string; + created_at?: string; + repository_url?: string; + subscribed?: boolean; + url?: string; +} + +export interface SubscriptionBody { + subscribed?: boolean; + ignored?: boolean; +} + +export interface Tag { + url?: string; + message?: string; + object?: { + sha?: string; + type?: "commit" | "tree" | "blob"; + url?: string; + }; + sha?: string; + tag?: string; + tagger?: { + email?: string; + name?: string; + date?: string; + }; +} + +export interface TagBody { + tag: string; + message: string; + object: string; + tagger: { + email?: string; + date?: string; + name?: string; + }; + type: "commit" | "tree" | "blob"; +} + +export type Tags = Tag[]; + +export interface Team { + name?: string; + url?: string; + id?: number; + members_count?: number; + permission?: string; + repos_count?: number; +} + +export interface TeamMembership { + url?: string; + state?: string; +} + +export type TeamRepos = Repos; + +export type Teams = { + url?: string; + name?: string; + id?: number; +}[]; + +export type TeamsList = { + repos_count?: number; + members_count?: number; + name?: string; + id?: number; + organization?: { + avatar_url?: string; + id?: number; + login?: string; + url?: string; + }; + permission?: string; + url?: string; +}[]; + +export interface Tree { + tree?: { + mode?: "100644" | "100755" | "040000" | "160000" | "120000"; + path?: string; + sha?: string; + size?: number; + type?: "blob" | "tree" | "commit"; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Trees { + sha?: string; + url?: string; + tree?: Tree[]; + base_tree?: string; +} + +export type User = Actor; + +export type UserEmails = string[]; + +export interface UserKeysKeyId { + title?: string; + key?: string; + id?: number; + url?: string; +} + +export interface UserKeysPost { + title?: string; + key?: string; +} + +export interface UserUpdate { + company?: string; + blog?: string; + email?: string; + location?: string; + hireable?: boolean; + name?: string; + bio?: string; +} + +export type Users = User[]; + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title GitHub + * @version v3 + */ +export class Api extends HttpClient { + someop = { + /** + * No description + * + * @tags someop + * @name SomeOp1 + * @request POST:/someop + */ + someOp1: ( + data: Events, + query?: { + queryParam1?: number; + fooBarBaz?: number; + queryParam2?: number; + queryParamBar3?: number; + queryParam3?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags someop + * @name SomeOp + * @request POST:/someop/{fooId}/bars/bar-bar + */ + someOp: ( + fooId: string, + data: Events, + query?: { + page?: number; + size?: number; + sort?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop/${fooId}/bars/bar-bar`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + }; + emojis = { + /** + * No description + * + * @name EmojisList + * @request GET:/emojis + */ + emojisList: (params: RequestParams = {}) => + this.request({ + path: `/emojis`, + method: "GET", + format: "json", + ...params, + }), + }; + events = { + /** + * No description + * + * @name EventsList + * @request GET:/events + */ + eventsList: (params: RequestParams = {}) => + this.request({ + path: `/events`, + method: "GET", + format: "json", + ...params, + }), + }; + feeds = { + /** + * No description + * + * @name FeedsList + * @request GET:/feeds + */ + feedsList: (params: RequestParams = {}) => + this.request({ + path: `/feeds`, + method: "GET", + format: "json", + ...params, + }), + }; + gists = { + /** + * No description + * + * @name GistsList + * @request GET:/gists + */ + gistsList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsCreate + * @request POST:/gists + */ + gistsCreate: (body: PostGist, params: RequestParams = {}) => + this.request({ + path: `/gists`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicList + * @request GET:/gists/public + */ + publicList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/public`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/gists/starred + */ + starredList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsDelete + * @request DELETE:/gists/{id} + */ + gistsDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/gists/{id} + */ + gistsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsPartialUpdate + * @request PATCH:/gists/{id} + */ + gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/gists/{id}/comments + */ + commentsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsCreate + * @request POST:/gists/{id}/comments + */ + commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/gists/{id}/comments/{commentId} + */ + commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/gists/{id}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/gists/{id}/comments/{commentId} + */ + commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/gists/{id}/forks + */ + forksCreate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/forks`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name StarDelete + * @request DELETE:/gists/{id}/star + */ + starDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarDetail + * @request GET:/gists/{id}/star + */ + starDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarUpdate + * @request PUT:/gists/{id}/star + */ + starUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "PUT", + ...params, + }), + }; + gitignore = { + /** + * No description + * + * @name TemplatesList + * @request GET:/gitignore/templates + */ + templatesList: (params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TemplatesDetail + * @request GET:/gitignore/templates/{language} + */ + templatesDetail: (language: string, params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates/${language}`, + method: "GET", + format: "json", + ...params, + }), + }; + issues = { + /** + * No description + * + * @name IssuesList + * @request GET:/issues + */ + issuesList: ( + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + legacy = { + /** + * No description + * + * @name IssuesSearchDetail + * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} + */ + issuesSearchDetail: ( + keyword: string, + state: "open" | "closed", + owner: string, + repository: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposSearchDetail + * @request GET:/legacy/repos/search/{keyword} + */ + reposSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + language?: string; + start_page?: string; + sort?: "updated" | "stars" | "forks"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/repos/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserEmailDetail + * @request GET:/legacy/user/email/{email} + */ + userEmailDetail: (email: string, params: RequestParams = {}) => + this.request({ + path: `/legacy/user/email/${email}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserSearchDetail + * @request GET:/legacy/user/search/{keyword} + */ + userSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + start_page?: string; + sort?: "updated" | "stars" | "forks"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/user/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + markdown = { + /** + * No description + * + * @name MarkdownCreate + * @request POST:/markdown + */ + markdownCreate: (body: Markdown, params: RequestParams = {}) => + this.request({ + path: `/markdown`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name PostMarkdown + * @request POST:/markdown/raw + */ + postMarkdown: (params: RequestParams = {}) => + this.request({ + path: `/markdown/raw`, + method: "POST", + type: ContentType.Text, + ...params, + }), + }; + meta = { + /** + * No description + * + * @name MetaList + * @request GET:/meta + */ + metaList: (params: RequestParams = {}) => + this.request({ + path: `/meta`, + method: "GET", + format: "json", + ...params, + }), + }; + networks = { + /** + * No description + * + * @name EventsDetail + * @request GET:/networks/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/networks/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + }; + notifications = { + /** + * No description + * + * @name NotificationsList + * @request GET:/notifications + */ + notificationsList: ( + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/notifications + */ + notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name ThreadsDetail + * @request GET:/notifications/threads/{id} + */ + threadsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsPartialUpdate + * @request PATCH:/notifications/threads/{id} + */ + threadsPartialUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "PATCH", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDelete + * @request DELETE:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDetail + * @request GET:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionUpdate + * @request PUT:/notifications/threads/{id}/subscription + */ + threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + orgs = { + /** + * No description + * + * @name OrgsDetail + * @request GET:/orgs/{org} + */ + orgsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsPartialUpdate + * @request PATCH:/orgs/{org} + */ + orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/orgs/{org}/events + */ + eventsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/orgs/{org}/issues + */ + issuesDetail: ( + org: string, + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/orgs/{org}/members + */ + membersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/orgs/{org}/members/{username} + */ + membersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/orgs/{org}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail + * @request GET:/orgs/{org}/public_members + */ + publicMembersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDelete + * @request DELETE:/orgs/{org}/public_members/{username} + */ + publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail2 + * @request GET:/orgs/{org}/public_members/{username} + * @originalName publicMembersDetail + * @duplicate + */ + publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersUpdate + * @request PUT:/orgs/{org}/public_members/{username} + */ + publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/orgs/{org}/repos + */ + reposDetail: ( + org: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/orgs/{org}/repos + */ + reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/orgs/{org}/teams + */ + teamsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsCreate + * @request POST:/orgs/{org}/teams + */ + teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + rateLimit = { + /** + * No description + * + * @name RateLimitList + * @request GET:/rate_limit + */ + rateLimitList: (params: RequestParams = {}) => + this.request({ + path: `/rate_limit`, + method: "GET", + format: "json", + ...params, + }), + }; + repos = { + /** + * No description + * + * @name ReposDelete + * @request DELETE:/repos/{owner}/{repo} + */ + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/repos/{owner}/{repo} + */ + reposDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposPartialUpdate + * @request PATCH:/repos/{owner}/{repo} + */ + reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail + * @request GET:/repos/{owner}/{repo}/assignees + */ + assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail2 + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + * @originalName assigneesDetail + * @duplicate + */ + assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees/${assignee}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail + * @request GET:/repos/{owner}/{repo}/branches + */ + branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail2 + * @request GET:/repos/{owner}/{repo}/branches/{branch} + * @originalName branchesDetail + * @duplicate + */ + branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches/${branch}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail + * @request GET:/repos/{owner}/{repo}/collaborators + */ + collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDelete + * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail2 + * @request GET:/repos/{owner}/{repo}/collaborators/{user} + * @originalName collaboratorsDetail + * @duplicate + */ + collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsUpdate + * @request PUT:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/repos/{owner}/{repo}/comments + */ + commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/repos/{owner}/{repo}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail + * @request GET:/repos/{owner}/{repo}/commits + */ + commitsDetail: ( + owner: string, + repo: string, + query?: { + since?: string; + sha?: string; + path?: string; + author?: string; + until?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsStatusDetail + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${ref}/status`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail2 + * @request GET:/repos/{owner}/{repo}/commits/{shaCode} + * @originalName commitsDetail + * @duplicate + */ + commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsDetail + * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsCreate + * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsCreate: ( + owner: string, + repo: string, + shaCode: string, + body: CommitCommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CompareDetail + * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} + */ + compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDelete + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "DELETE", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDetail + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + contentsDetail: ( + owner: string, + repo: string, + path: string, + query?: { + path?: string; + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsUpdate + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContributorsDetail + * @request GET:/repos/{owner}/{repo}/contributors + */ + contributorsDetail: ( + owner: string, + repo: string, + query: { + anon: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contributors`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsDetail + * @request GET:/repos/{owner}/{repo}/deployments + */ + deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsCreate + * @request POST:/repos/{owner}/{repo}/deployments + */ + deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesDetail + * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesCreate + * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesCreate: ( + owner: string, + repo: string, + id: number, + body: DeploymentStatusesCreate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail + * @request GET:/repos/{owner}/{repo}/downloads + */ + downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DownloadsDelete + * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} + */ + downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail2 + * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} + * @originalName downloadsDetail + * @duplicate + */ + downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/repos/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksDetail + * @request GET:/repos/{owner}/{repo}/forks + */ + forksDetail: ( + owner: string, + repo: string, + query?: { + sort?: "newes" | "oldes" | "watchers"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/repos/{owner}/{repo}/forks + */ + forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsCreate + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsDetail + * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} + */ + gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsCreate + * @request POST:/repos/{owner}/{repo}/git/commits + */ + gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsDetail + * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} + */ + gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail + * @request GET:/repos/{owner}/{repo}/git/refs + */ + gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsCreate + * @request POST:/repos/{owner}/{repo}/git/refs + */ + gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDelete + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail2 + * @request GET:/repos/{owner}/{repo}/git/refs/{ref} + * @originalName gitRefsDetail + * @duplicate + */ + gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsCreate + * @request POST:/repos/{owner}/{repo}/git/tags + */ + gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsDetail + * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} + */ + gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesCreate + * @request POST:/repos/{owner}/{repo}/git/trees + */ + gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesDetail + * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} + */ + gitTreesDetail: ( + owner: string, + repo: string, + shaCode: string, + query?: { + recursive?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDetail + * @request GET:/repos/{owner}/{repo}/hooks + */ + hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksCreate + * @request POST:/repos/{owner}/{repo}/hooks + */ + hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDelete + * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name HooksDetail2 + * @request GET:/repos/{owner}/{repo}/hooks/{hookId} + * @originalName hooksDetail + * @duplicate + */ + hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksTestsCreate + * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests + */ + hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/repos/{owner}/{repo}/issues + */ + issuesDetail: ( + owner: string, + repo: string, + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCreate + * @request POST:/repos/{owner}/{repo}/issues + */ + issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + issuesCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "created" | "updated"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail2 + * @request GET:/repos/{owner}/{repo}/issues/{number} + * @originalName issuesDetail + * @duplicate + */ + issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/{number} + */ + issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/comments + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/comments + */ + issuesCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/events + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDetail + * @request GET:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsUpdate + * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "PUT", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete2 + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels/{name} + * @originalName issuesLabelsDelete + * @duplicate + */ + issuesLabelsDelete2: (owner: string, repo: string, number: number, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/repos/{owner}/{repo}/keys + */ + keysDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/repos/{owner}/{repo}/keys + */ + keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} + */ + keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail2 + * @request GET:/repos/{owner}/{repo}/keys/{keyId} + * @originalName keysDetail + * @duplicate + */ + keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail + * @request GET:/repos/{owner}/{repo}/labels + */ + labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsCreate + * @request POST:/repos/{owner}/{repo}/labels + */ + labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDelete + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail2 + * @request GET:/repos/{owner}/{repo}/labels/{name} + * @originalName labelsDetail + * @duplicate + */ + labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LanguagesDetail + * @request GET:/repos/{owner}/{repo}/languages + */ + languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/languages`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MergesCreate + * @request POST:/repos/{owner}/{repo}/merges + */ + mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/merges`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail + * @request GET:/repos/{owner}/{repo}/milestones + */ + milestonesDetail: ( + owner: string, + repo: string, + query?: { + state?: "open" | "closed"; + direction?: string; + sort?: "due_date" | "completeness"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesCreate + * @request POST:/repos/{owner}/{repo}/milestones + */ + milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDelete + * @request DELETE:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail2 + * @request GET:/repos/{owner}/{repo}/milestones/{number} + * @originalName milestonesDetail + * @duplicate + */ + milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesPartialUpdate: ( + owner: string, + repo: string, + number: number, + body: MilestoneUpdate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesLabelsDetail + * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels + */ + milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsDetail + * @request GET:/repos/{owner}/{repo}/notifications + */ + notificationsDetail: ( + owner: string, + repo: string, + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/repos/{owner}/{repo}/notifications + */ + notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name PullsDetail + * @request GET:/repos/{owner}/{repo}/pulls + */ + pullsDetail: ( + owner: string, + repo: string, + query?: { + state?: "open" | "closed"; + head?: string; + base?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCreate + * @request POST:/repos/{owner}/{repo}/pulls + */ + pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + pullsCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "created" | "updated"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/{number} + * @originalName pullsDetail + * @duplicate + */ + pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/{number} + */ + pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsCreate + * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments + */ + pullsCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: PullsCommentPost, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommitsDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits + */ + pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsFilesDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/files + */ + pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/files`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsMergeDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PullsMergeUpdate + * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReadmeDetail + * @request GET:/repos/{owner}/{repo}/readme + */ + readmeDetail: ( + owner: string, + repo: string, + query?: { + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/readme`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail + * @request GET:/repos/{owner}/{repo}/releases + */ + releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesCreate + * @request POST:/repos/{owner}/{repo}/releases + */ + releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDelete + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail + * @request GET:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsPartialUpdate: ( + owner: string, + repo: string, + id: string, + body: AssetPatch, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDelete + * @request DELETE:/repos/{owner}/{repo}/releases/{id} + */ + releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id} + * @originalName releasesDetail + * @duplicate + */ + releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/{id} + */ + releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id}/assets + * @originalName releasesAssetsDetail + * @duplicate + */ + releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}/assets`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StargazersDetail + * @request GET:/repos/{owner}/{repo}/stargazers + */ + stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stargazers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCodeFrequencyDetail + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/code_frequency`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCommitActivityDetail + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/commit_activity`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsContributorsDetail + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/contributors`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsParticipationDetail + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/participation`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsPunchCardDetail + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/punch_card`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesDetail + * @request GET:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesCreate + * @request POST:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscribersDetail + * @request GET:/repos/{owner}/{repo}/subscribers + */ + subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscribers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDelete + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDetail + * @request GET:/repos/{owner}/{repo}/subscription + */ + subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionUpdate + * @request PUT:/repos/{owner}/{repo}/subscription + */ + subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TagsDetail + * @request GET:/repos/{owner}/{repo}/tags + */ + tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/tags`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/repos/{owner}/{repo}/teams + */ + teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name WatchersDetail + * @request GET:/repos/{owner}/{repo}/watchers + */ + watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/watchers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/repos/{owner}/{repo}/{archive_format}/{path} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: ( + owner: string, + repo: string, + archiveFormat: "tarball" | "zipball", + path: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + method: "GET", + ...params, + }), + }; + repositories = { + /** + * No description + * + * @name RepositoriesList + * @request GET:/repositories + */ + repositoriesList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + search = { + /** + * No description + * + * @name CodeList + * @request GET:/search/code + */ + codeList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "indexed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/code`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/search/issues + */ + issuesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "updated" | "created" | "comments"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name RepositoriesList + * @request GET:/search/repositories + */ + repositoriesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "stars" | "forks" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersList + * @request GET:/search/users + */ + usersList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "followers" | "repositories" | "joined"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + teams = { + /** + * No description + * + * @name TeamsDelete + * @request DELETE:/teams/{teamId} + */ + teamsDelete: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/teams/{teamId} + */ + teamsDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsPartialUpdate + * @request PATCH:/teams/{teamId} + */ + teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/teams/{teamId}/members + */ + membersDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/teams/{teamId}/members/{username} + */ + membersDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/teams/{teamId}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MembersUpdate + * @request PUT:/teams/{teamId}/members/{username} + */ + membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name MembershipsDelete + * @request DELETE:/teams/{teamId}/memberships/{username} + */ + membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembershipsDetail + * @request GET:/teams/{teamId}/memberships/{username} + */ + membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembershipsUpdate + * @request PUT:/teams/{teamId}/memberships/{username} + */ + membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "PUT", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/teams/{teamId}/repos + */ + reposDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDelete + * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} + */ + reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/teams/{teamId}/repos/{owner}/{repo} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposUpdate + * @request PUT:/teams/{teamId}/repos/{owner}/{repo} + */ + reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "PUT", + ...params, + }), + }; + user = { + /** + * No description + * + * @name UserList + * @request GET:/user + */ + userList: (params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserPartialUpdate + * @request PATCH:/user + */ + userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EmailsDelete + * @request DELETE:/user/emails + */ + emailsDelete: (body: UserEmails, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "DELETE", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name EmailsList + * @request GET:/user/emails + */ + emailsList: (params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EmailsCreate + * @request POST:/user/emails + */ + emailsCreate: (body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "POST", + body: body, + ...params, + }), + + /** + * No description + * + * @name FollowersList + * @request GET:/user/followers + */ + followersList: (params: RequestParams = {}) => + this.request({ + path: `/user/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingList + * @request GET:/user/following + */ + followingList: (params: RequestParams = {}) => + this.request({ + path: `/user/following`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDelete + * @request DELETE:/user/following/{username} + */ + followingDelete: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/user/following/{username} + */ + followingDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowingUpdate + * @request PUT:/user/following/{username} + */ + followingUpdate: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/user/issues + */ + issuesList: ( + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysList + * @request GET:/user/keys + */ + keysList: (params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/user/keys + */ + keysCreate: (body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/user/keys/{keyId} + */ + keysDelete: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/user/keys/{keyId} + */ + keysDetail: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsList + * @request GET:/user/orgs + */ + orgsList: (params: RequestParams = {}) => + this.request({ + path: `/user/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposList + * @request GET:/user/repos + */ + reposList: ( + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/user/repos + */ + reposCreate: (body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/user/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/user/starred + */ + starredList: ( + query?: { + direction?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDelete + * @request DELETE:/user/starred/{owner}/{repo} + */ + starredDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/user/starred/{owner}/{repo} + */ + starredDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarredUpdate + * @request PUT:/user/starred/{owner}/{repo} + */ + starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsList + * @request GET:/user/subscriptions + */ + subscriptionsList: (params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDelete + * @request DELETE:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsUpdate + * @request PUT:/user/subscriptions/{owner}/{repo} + */ + subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name TeamsList + * @request GET:/user/teams + */ + teamsList: (params: RequestParams = {}) => + this.request({ + path: `/user/teams`, + method: "GET", + format: "json", + ...params, + }), + }; + users = { + /** + * No description + * + * @name UsersList + * @request GET:/users + */ + usersList: ( + query?: { + since?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersDetail + * @request GET:/users/{username} + */ + usersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/users/{username}/events + */ + eventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EventsOrgsDetail + * @request GET:/users/{username}/events/orgs/{org} + */ + eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events/orgs/${org}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowersDetail + * @request GET:/users/{username}/followers + */ + followersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/users/{username}/following/{targetUser} + */ + followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/following/${targetUser}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/users/{username}/gists + */ + gistsDetail: ( + username: string, + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/users/{username}/keys + */ + keysDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsDetail + * @request GET:/users/{username}/orgs + */ + orgsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsDetail + * @request GET:/users/{username}/received_events + */ + receivedEventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsPublicDetail + * @request GET:/users/{username}/received_events/public + */ + receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events/public`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/users/{username}/repos + */ + reposDetail: ( + username: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/users/{username}/starred + */ + starredDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/starred`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/users/{username}/subscriptions + */ + subscriptionsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/subscriptions`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/sortTypes-false/schema.json b/tests/spec/sortTypes-false/schema.json new file mode 100644 index 00000000..9a67b567 --- /dev/null +++ b/tests/spec/sortTypes-false/schema.json @@ -0,0 +1,13703 @@ +{ + "swagger":"2.0", + "schemes":[ + "https" + ], + "info":{ + "title":"GitHub", + "version":"v3" + }, + "consumes":[ + "application/json" + ], + "produces":[ + "application/json" + ], + "paths":{ + "/someop":{ + "post":{ + "tags":[ + "someop" + ], + "operationId":"someOp_1", + "parameters":[ + { + "name":"queryParam1", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"foo.bar.baz", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"queryParam2", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"query.param.bar.3", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"queryParam3", + "in":"query", + "schema":{ + "type":"array", + "items":{ + "type":"string" + } + } + } + ], + "requestBody":{ + "content":{ + "application/json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + }, + "required":true + }, + "responses":{ + "200":{ + "content":{ + "application/hal+json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + } + }, + "400":{ + + } + } + } + }, + "/emojis":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/emojis" + } + }, + "403":{ + + } + } + } + }, + "/someop/{fooId}/bars/bar-bar":{ + "post":{ + "tags":[ + "someop" + ], + "operationId":"someOp", + "parameters":[ + { + "name":"page", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"size", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"sort", + "in":"query", + "schema":{ + "type":"array", + "items":{ + "type":"string" + } + } + } + ], + "requestBody":{ + "content":{ + "application/json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + }, + "required":true + }, + "responses":{ + "200":{ + "content":{ + "application/hal+json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + } + }, + "400":{ + + } + } + } + }, + "/events":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/feeds":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/feeds" + } + }, + "403":{ + + } + } + } + }, + "/gists":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postGist" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + } + }, + "/gists/public":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/gists/starred":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/patchGist" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/comment" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/forks":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/gists/{id}/star":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/gitignore/templates":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/gitignore/templates/{language}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"language", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore-lang" + } + }, + "403":{ + + } + } + } + }, + "/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/legacy/issues/search/{owner}/{repository}/{state}/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"path", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repository", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-issues-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/legacy/repos/search/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"language", + "type":"string" + }, + { + "in":"query", + "name":"start_page", + "type":"string" + }, + { + "enum":[ + "updated", + "stars", + "forks" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-repositories-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/legacy/user/email/{email}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"email", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-user-by-email" + } + }, + "403":{ + + } + } + } + }, + "/legacy/user/search/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"start_page", + "type":"string" + }, + { + "enum":[ + "updated", + "stars", + "forks" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-users-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/markdown":{ + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/markdown" + } + } + ], + "produces":[ + "text/html" + ], + "responses":{ + "200":{ + + }, + "403":{ + + } + } + } + }, + "/markdown/raw":{ + "post":{ + "consumes":[ + "text/plain" + ], + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "produces":[ + "text/html" + ], + "responses":{ + "200":{ + + }, + "403":{ + + } + } + } + }, + "/meta":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/meta" + } + }, + "403":{ + + } + } + } + }, + "/networks/{owner}/{repo}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/notifications":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"all", + "type":"boolean" + }, + { + "in":"query", + "name":"participating", + "type":"boolean" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/notificationMarkRead" + } + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/notifications/threads/{id}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/notifications/threads/{id}/subscription":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/putSubscription" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/organization" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/patchOrg" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/organization" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/issues":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "302":{ + + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "302":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/orgs/{org}/public_members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/public_members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postRepo" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/teams":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/orgTeamsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + } + }, + "/rate_limit":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/rate_limit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/repoEdit" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/assignees":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/assignees" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/assignees/{assignee}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"assignee", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/repos/{owner}/{repo}/branches":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/branches" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/branches/{branch}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"branch", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/branch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/collaborators":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/collaborators/{user}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"query", + "name":"sha", + "type":"string" + }, + { + "in":"query", + "name":"path", + "type":"string" + }, + { + "in":"query", + "name":"author", + "type":"string" + }, + { + "in":"query", + "name":"until", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{ref}/status":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/refStatus" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{shaCode}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoComments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commitCommentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/compare/{baseId}...{headId}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"baseId", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"headId", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/compare-commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/contents/{path}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deleteFileBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/deleteFile" + } + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"path", + "type":"string" + }, + { + "in":"query", + "name":"ref", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contents-path" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/createFileBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/createFile" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/contributors":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"anon", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/deployments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo-deployments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deployment" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/deployment-resp" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/deployments/{id}/statuses":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/deployment-statuses" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deployment-statuses-create" + } + } + ], + "responses":{ + "201":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/downloads":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/downloads" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/downloads/{downloadId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"downloadId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"downloadId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/download" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/forks":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "newes", + "oldes", + "watchers" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/forks" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/forkBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/blobs":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/blob" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/blobs" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/blobs/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/blob" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/commits":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/repoCommitBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/gitCommit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/commits/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoCommit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/refs":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/refs" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/refsBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/refs/{ref}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/gitRefPatch" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/tags":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/tagBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/tag" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/tags/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tag" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/trees":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/tree" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/trees" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/trees/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"recursive", + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tree" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/hookBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{hookId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/hookBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{hookId}/tests":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/issue" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvents" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/events/{eventId}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"eventId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvent" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/issue" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvents" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/labels":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/labels/{name}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/keys":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/keys" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-keys-post" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/keys/{keyId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/labels":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/labels/{name}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/languages":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/languages" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/merges":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/mergesBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/mergesSuccessful" + } + }, + "204":{ + + }, + "403":{ + + }, + "404":{ + "schema":{ + "$ref":"#/definitions/mergesConflict" + } + }, + "409":{ + "schema":{ + "$ref":"#/definitions/mergesConflict" + } + } + } + } + }, + "/repos/{owner}/{repo}/milestones":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "due_date", + "completeness" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/milestoneUpdate" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/milestones/{number}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/milestoneUpdate" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/milestones/{number}/labels":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/notifications":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"all", + "type":"boolean" + }, + { + "in":"query", + "name":"participating", + "type":"boolean" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/notificationMarkRead" + } + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "type":"string" + }, + { + "in":"query", + "name":"head", + "type":"string" + }, + { + "in":"query", + "name":"base", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullRequest" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullUpdate" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullsCommentPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/commits":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/files":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/merge":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/mergePullBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/merge" + } + }, + "403":{ + + }, + "405":{ + "schema":{ + "$ref":"#/definitions/merge" + } + } + } + } + }, + "/repos/{owner}/{repo}/readme":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"ref", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contents-path" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/releases" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/release-create" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/assets/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/asset" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/assetPatch" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/asset" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/release-create" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}/assets":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/assets" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stargazers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/code_frequency":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/codeFrequencyStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/commit_activity":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitActivityStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/contributors":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contributorsStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/participation":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/participationStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/punch_card":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/codeFrequencyStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/statuses/{ref}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/ref" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/headBranch" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/ref" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/subscribers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/subscription":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/subscriptionBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/tags":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tags" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/teams":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/watchers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/{archive_format}/{path}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "tarball", + "zipball" + ], + "in":"path", + "name":"archive_format", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "302":{ + + }, + "403":{ + + } + } + } + }, + "/repositories":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/search/code":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "indexed" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-code" + } + }, + "403":{ + + } + } + } + }, + "/search/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "updated", + "created", + "comments" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-issues" + } + }, + "403":{ + + } + } + } + }, + "/search/repositories":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "stars", + "forks", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-repositories" + } + }, + "403":{ + + } + } + } + }, + "/search/users":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "followers", + "repositories", + "joined" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-users" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/editTeam" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "422":{ + "schema":{ + "$ref":"#/definitions/organizationAsTeamMember" + } + } + } + } + }, + "/teams/{teamId}/memberships/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamMembership" + } + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamMembership" + } + }, + "403":{ + + }, + "422":{ + "schema":{ + "$ref":"#/definitions/organizationAsTeamMember" + } + } + } + } + }, + "/teams/{teamId}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamRepos" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/repos/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/user":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-update" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + } + }, + "/user/emails":{ + "delete":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-emails" + } + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "produces":[ + "application/vnd.github.v3" + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-emails" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/user/followers":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/user/following":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/user/following/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/user/keys":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-keys-post" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/user/keys/{keyId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/user/orgs":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/user/repos":{ + "get":{ + "parameters":[ + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postRepo" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/user/starred":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/user/starred/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/subscriptions":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/user/subscriptions/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/teams":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams-list" + } + }, + "403":{ + + } + } + } + }, + "/users":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/events/orgs/{org}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/followers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/following/{targetUser}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"targetUser", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/users/{username}/gists":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/keys":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/orgs":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/received_events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/received_events/public":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/starred":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/subscriptions":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + } + }, + "definitions":{ + "actor":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "blog":{ + "type":"string" + }, + "collaborators":{ + "type":"integer" + }, + "disk_usage":{ + "type":"integer" + }, + "followers":{ + "type":"integer" + }, + "avatar_url":{ + "type":"string" + }, + "followers_url":{ + "type":"string" + }, + "following":{ + "type":"integer" + }, + "following_url":{ + "type":"string" + }, + "bio":{ + "type":"string" + }, + "gists_url":{ + "type":"string" + }, + "hireable":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "location":{ + "type":"string" + }, + "login":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "organizations_url":{ + "type":"string" + }, + "owned_private_repos":{ + "type":"integer" + }, + "company":{ + "type":"string" + }, + "plan":{ + "properties":{ + "collaborators":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "private_repos":{ + "type":"integer" + }, + "space":{ + "type":"integer" + } + }, + "type":"object" + }, + "private_gists":{ + "type":"integer" + }, + "public_gists":{ + "type":"integer" + }, + "public_repos":{ + "type":"integer" + }, + "starred_url":{ + "type":"string" + }, + "subscriptions_url":{ + "type":"string" + }, + "total_private_repos":{ + "type":"integer" + }, + "type":{ + "enum":[ + "User", + "Organization" + ] + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "asset":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"number" + }, + "id":{ + "type":"number" + }, + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "assetPatch":{ + "properties":{ + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "assets":{ + "items":{ + "$ref":"#/definitions/asset" + }, + "type":"array" + }, + "assignees":{ + "items":{ + "$ref":"#/definitions/user" + }, + "type":"array" + }, + "blob":{ + "properties":{ + "content":{ + "type":"string" + }, + "encoding":{ + "enum":[ + "utf-8", + "base64" + ] + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + }, + "blobs":{ + "properties":{ + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "branch":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + } + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "branches":{ + "items":{ + "properties":{ + "commit":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "codeFrequencyStats":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "comment":{ + "properties":{ + "body":{ + "type":"string" + } + }, + "type":"object" + }, + "commentBody":{ + "properties":{ + "body":{ + "type":"string" + } + }, + "required":[ + "body" + ], + "type":"object" + }, + "comments":{ + "items":{ + "properties":{ + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "files":{ + "items":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "blob_url":{ + "type":"string" + }, + "changes":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "filename":{ + "type":"string" + }, + "patch":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "status":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "stats":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "total":{ + "type":"integer" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "commitActivityStats":{ + "items":{ + "properties":{ + "days":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "total":{ + "type":"integer" + }, + "week":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + }, + "commitComment":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "line":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "commitCommentBody":{ + "properties":{ + "body":{ + "type":"string" + }, + "line":{ + "type":"string" + }, + "number":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "sha":{ + "type":"string" + } + }, + "required":[ + "sha", + "body" + ], + "type":"object" + }, + "commits":{ + "items":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "compare-commits":{ + "properties":{ + "ahead_by":{ + "type":"integer" + }, + "base_commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "behind_by":{ + "type":"integer" + }, + "commits":{ + "items":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "diff_url":{ + "type":"string" + }, + "files":{ + "items":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "blob_url":{ + "type":"string" + }, + "changes":{ + "type":"integer" + }, + "contents_url":{ + "type":"string" + }, + "deletions":{ + "type":"integer" + }, + "filename":{ + "type":"string" + }, + "patch":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "status":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + }, + "permalink_url":{ + "type":"string" + }, + "status":{ + "type":"string" + }, + "total_commits":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "contents-path":{ + "properties":{ + "_links":{ + "properties":{ + "git":{ + "type":"string" + }, + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + }, + "encoding":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "contributorsStats":{ + "items":{ + "properties":{ + "author":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "total":{ + "type":"integer" + }, + "weeks":{ + "items":{ + "properties":{ + "a":{ + "type":"integer" + }, + "c":{ + "type":"integer" + }, + "d":{ + "type":"integer" + }, + "w":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "type":"array" + }, + "createFile":{ + "properties":{ + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "properties":{ + "_links":{ + "properties":{ + "git":{ + "type":"string" + }, + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "git_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "createFileBody":{ + "properties":{ + "committer":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + }, + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "deleteFile":{ + "properties":{ + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + } + }, + "html_url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "parents":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "deleteFileBody":{ + "properties":{ + "committer":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment":{ + "properties":{ + "description":{ + "type":"string" + }, + "payload":{ + "properties":{ + "deploy_user":{ + "type":"string" + }, + "environment":{ + "type":"string" + }, + "room_id":{ + "type":"number" + } + }, + "type":"object" + }, + "ref":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment-resp":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment-statuses":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "deployment-statuses-create":{ + "properties":{ + "description":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + } + }, + "type":"object" + }, + "download":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "downloads":{ + "items":{ + "$ref":"#/definitions/download" + }, + "type":"array" + }, + "editTeam":{ + "properties":{ + "name":{ + "type":"string" + }, + "permission":{ + "enum":[ + "pull", + "push", + "admin" + ] + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "emailsPost":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "emojis":{ + "additionalProperties":{ + "type":"string" + }, + "type":"object" + }, + "event":{ + "properties":{ + "actor":{ + "$ref":"#/definitions/actor" + }, + "created_at":{ + "type":"object" + }, + "id":{ + "type":"integer" + }, + "org":{ + "$ref":"#/definitions/organization" + }, + "payload":{ + "properties":{ + + }, + "type":"object" + }, + "public":{ + "type":"boolean" + }, + "repo":{ + "properties":{ + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "events":{ + "items":{ + "$ref":"#/definitions/event" + }, + "type":"array" + }, + "feeds":{ + "properties":{ + "_links":{ + "properties":{ + "current_user":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_actor":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_organization":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_public":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "timeline":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "user":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + } + } + }, + "current_user_actor_url":{ + "type":"string" + }, + "current_user_organization_url":{ + "type":"string" + }, + "current_user_public":{ + "type":"string" + }, + "current_user_url":{ + "type":"string" + }, + "timeline_url":{ + "type":"string" + }, + "user_url":{ + "type":"string" + } + }, + "type":"object" + }, + "forkBody":{ + "properties":{ + "organization":{ + "type":"string" + } + }, + "type":"object" + }, + "forks":{ + "$ref":"#/definitions/repos" + }, + "gist":{ + "properties":{ + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "ring.erl":{ + "properties":{ + "filename":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "forks":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "git_pull_url":{ + "type":"string" + }, + "git_push_url":{ + "type":"string" + }, + "history":{ + "items":{ + "properties":{ + "change_status":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "total":{ + "type":"integer" + } + }, + "type":"object" + }, + "committed_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + }, + "version":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"string" + }, + "public":{ + "type":"boolean" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "gists":{ + "items":{ + "properties":{ + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "ring.erl":{ + "properties":{ + "filename":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "git_pull_url":{ + "type":"string" + }, + "git_push_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"string" + }, + "public":{ + "type":"boolean" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "gitCommit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "type":"string" + }, + "tree":{ + "type":"string" + } + }, + "type":"object" + }, + "gitRefPatch":{ + "properties":{ + "force":{ + "type":"boolean" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "gitignore":{ + "items":{ + + }, + "type":"array" + }, + "gitignore-lang":{ + "properties":{ + "name":{ + "type":"string" + }, + "source":{ + "type":"string" + } + }, + "type":"object" + }, + "headBranch":{ + "properties":{ + "object":{ + "properties":{ + "sha":{ + "type":"string" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "ref":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "hook":{ + "items":{ + "properties":{ + "active":{ + "type":"boolean" + }, + "config":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "created_at":{ + "type":"string" + }, + "events":{ + "items":{ + "enum":[ + "push", + "issues", + "issue_comment", + "commit_comment", + "pull_request", + "pull_request_review_comment", + "gollum", + "watch", + "download", + "fork", + "fork_apply", + "member", + "public", + "team_add", + "status" + ] + }, + "type":"array" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "hookBody":{ + "properties":{ + "active":{ + "type":"boolean" + }, + "add_events":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "type":"object" + }, + "issue":{ + "properties":{ + "assignee":{ + "type":"string" + }, + "body":{ + "type":"string" + }, + "labels":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "milestone":{ + "type":"number" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "issueEvent":{ + "properties":{ + "actor":{ + "$ref":"#/definitions/actor" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "event":{ + "type":"string" + }, + "issue":{ + "properties":{ + "assignee":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + } + }, + "type":"object" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "issueEvents":{ + "items":{ + "$ref":"#/definitions/issueEvent" + }, + "type":"array" + }, + "issues":{ + "items":{ + "properties":{ + "assignee":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + } + }, + "type":"object" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "issuesComment":{ + "properties":{ + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "issuesComments":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "keys":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "key":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "label":{ + "properties":{ + "color":{ + "maxLength":6, + "minLength":6, + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "maxLength":6, + "minLength":6, + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "languages":{ + "additionalProperties":{ + "type":"integer" + }, + "type":"object" + }, + "markdown":{ + "properties":{ + "context":{ + "type":"string" + }, + "mode":{ + "type":"string" + }, + "text":{ + "type":"string" + } + }, + "type":"object" + }, + "merge":{ + "properties":{ + "merged":{ + "type":"boolean" + }, + "message":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "mergePullBody":{ + "properties":{ + "commit_message":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesBody":{ + "properties":{ + "base":{ + "type":"string" + }, + "commit_message":{ + "type":"string" + }, + "head":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesConflict":{ + "properties":{ + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesSuccessful":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "comments_url":{ + "type":"string" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "comment_count":{ + "type":"integer" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "merged":{ + "type":"boolean" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "meta":{ + "properties":{ + "git":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "hooks":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "type":"object" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "milestoneUpdate":{ + "properties":{ + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "notificationMarkRead":{ + "properties":{ + "last_read_at":{ + "type":"string" + } + }, + "type":"object" + }, + "notifications":{ + "properties":{ + "id":{ + "type":"integer" + }, + "last_read_at":{ + "type":"string" + }, + "reason":{ + "type":"string" + }, + "repository":{ + "properties":{ + "description":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "full_name":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "private":{ + "type":"boolean" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "subject":{ + "properties":{ + "latest_comment_url":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "unread":{ + "type":"boolean" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "orgTeamsPost":{ + "properties":{ + "name":{ + "type":"string" + }, + "permission":{ + "enum":[ + "pull", + "push", + "admin" + ] + }, + "repo_names":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "organization":{ + "allOf":[ + { + "$ref":"#/definitions/actor" + }, + { + + } + ], + "type":"object" + }, + "organizationAsTeamMember":{ + "properties":{ + "errors":{ + "items":{ + "properties":{ + "code":{ + "type":"string" + }, + "field":{ + "type":"string" + }, + "resource":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "participationStats":{ + "properties":{ + "all":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "owner":{ + "items":{ + "type":"integer" + }, + "type":"array" + } + }, + "type":"object" + }, + "patchGist":{ + "properties":{ + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "delete_this_file.txt":{ + "type":"string" + }, + "file1.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "new_file.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "old_name.txt":{ + "properties":{ + "content":{ + "type":"string" + }, + "filename":{ + "type":"string" + } + }, + "type":"object" + } + } + } + }, + "type":"object" + }, + "patchOrg":{ + "properties":{ + "billing_email":{ + "type":"string" + }, + "company":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "location":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "postGist":{ + "properties":{ + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "file1.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "public":{ + "type":"boolean" + } + }, + "type":"object" + }, + "postRepo":{ + "properties":{ + "auto_init":{ + "type":"boolean" + }, + "description":{ + "type":"string" + }, + "gitignore_template":{ + "type":"string" + }, + "has_downloads":{ + "type":"boolean" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "private":{ + "type":"boolean" + }, + "team_id":{ + "type":"integer" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "pullRequest":{ + "properties":{ + "_links":{ + "properties":{ + "comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "review_comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "additions":{ + "type":"integer" + }, + "base":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "changed_files":{ + "type":"integer" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "commits":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "deletions":{ + "type":"integer" + }, + "diff_url":{ + "type":"string" + }, + "head":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "issue_url":{ + "type":"string" + }, + "merge_commit_sha":{ + "type":"string" + }, + "mergeable":{ + "type":"boolean" + }, + "merged":{ + "type":"boolean" + }, + "merged_at":{ + "type":"string" + }, + "merged_by":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "patch_url":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "pullUpdate":{ + "properties":{ + "body":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "pulls":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "review_comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "base":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "diff_url":{ + "type":"string" + }, + "head":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "issue_url":{ + "type":"string" + }, + "merged_at":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "patch_url":{ + "type":"string" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "type":"array" + }, + "pullsComment":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "pullsCommentPost":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"number" + } + }, + "type":"object" + }, + "pullsComments":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "type":"array" + }, + "pullsPost":{ + "properties":{ + "base":{ + "type":"string" + }, + "body":{ + "type":"string" + }, + "head":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "putSubscription":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "ignored":{ + "type":"boolean" + }, + "reason":{ + "type":"object" + }, + "subscribed":{ + "type":"boolean" + }, + "thread_url":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "rate_limit":{ + "properties":{ + "rate":{ + "properties":{ + "remaining":{ + "type":"integer" + }, + "limit":{ + "type":"integer" + }, + "reset":{ + "type":"integer" + } + } + } + }, + "type":"object" + }, + "ref":{ + "items":{ + "properties":{ + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "properties":{ + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "refStatus":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "commit_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "repository_url":{ + "type":"string" + }, + "statuses":{ + "items":{ + "properties":{ + "id":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "context":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "type":"array" + }, + "refs":{ + "items":{ + "properties":{ + "ref":{ + "type":"string" + }, + "object":{ + "properties":{ + "type":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "refsBody":{ + "properties":{ + "ref":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "release":{ + "properties":{ + "tarball_url":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + }, + "assets":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "label":{ + "type":"string" + }, + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "assets_url":{ + "type":"string" + }, + "author":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "prerelease":{ + "type":"boolean" + }, + "published_at":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "upload_url":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "zipball_url":{ + "type":"string" + } + }, + "type":"object" + }, + "release-create":{ + "properties":{ + "prerelease":{ + "type":"boolean" + }, + "body":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "name":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + } + }, + "type":"object" + }, + "releases":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "assets":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "assets_url":{ + "type":"string" + }, + "author":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "prerelease":{ + "type":"boolean" + }, + "published_at":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "tarball_url":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + }, + "upload_url":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "zipball_url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "repo":{ + "properties":{ + "forks":{ + "type":"integer" + }, + "organization":{ + "$ref":"#/definitions/organization" + }, + "clone_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "forks_count":{ + "type":"integer" + }, + "full_name":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "has_downloads":{ + "type":"boolean" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "language":{ + "type":"string" + }, + "master_branch":{ + "type":"string" + }, + "mirror_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "open_issues":{ + "type":"integer" + }, + "open_issues_count":{ + "type":"integer" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "parent":{ + "allOf":[ + { + "$ref":"#/definitions/repo" + }, + { + + } + ] + }, + "private":{ + "type":"boolean" + }, + "pushed_at":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "source":{ + "allOf":[ + { + "$ref":"#/definitions/repo" + }, + { + } + ] + }, + "ssh_url":{ + "type":"string" + }, + "svn_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "watchers":{ + "type":"integer" + }, + "watchers_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "repo-deployments":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "repoComments":{ + "items":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "line":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "repoCommit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "url":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "repoCommitBody":{ + "properties":{ + "author":{ + "properties":{ + "name":{ + "type":"string" + }, + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "tree":{ + "type":"string" + } + }, + "required":[ + "message", + "parents", + "tree" + ], + "type":"object" + }, + "repoEdit":{ + "properties":{ + "has_downloads":{ + "type":"boolean" + }, + "description":{ + "type":"string" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "private":{ + "type":"boolean" + } + }, + "type":"object" + }, + "repos":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + }, + "search-code":{ + "properties":{ + "items":{ + "items":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "repository":{ + "properties":{ + "comments_url":{ + "type":"string" + }, + "assignees_url":{ + "type":"string" + }, + "archive_url":{ + "type":"string" + }, + "blobs_url":{ + "type":"string" + }, + "branches_url":{ + "type":"string" + }, + "collaborators_url":{ + "type":"string" + }, + "commits_url":{ + "type":"string" + }, + "compare_url":{ + "type":"string" + }, + "contents_url":{ + "type":"string" + }, + "contributors_url":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "downloads_url":{ + "type":"string" + }, + "events_url":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "forks_url":{ + "type":"string" + }, + "full_name":{ + "type":"string" + }, + "git_commits_url":{ + "type":"string" + }, + "git_refs_url":{ + "type":"string" + }, + "git_tags_url":{ + "type":"string" + }, + "hooks_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "issue_comment_url":{ + "type":"string" + }, + "issue_events_url":{ + "type":"string" + }, + "issues_url":{ + "type":"string" + }, + "keys_url":{ + "type":"string" + }, + "labels_url":{ + "type":"string" + }, + "languages_url":{ + "type":"string" + }, + "merges_url":{ + "type":"string" + }, + "milestones_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "notifications_url":{ + "type":"string" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "private":{ + "type":"boolean" + }, + "pulls_url":{ + "type":"string" + }, + "stargazers_url":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "subscribers_url":{ + "type":"string" + }, + "subscription_url":{ + "type":"string" + }, + "tags_url":{ + "type":"string" + }, + "teams_url":{ + "type":"string" + }, + "trees_url":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "score":{ + "type":"number" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "total_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "search-issues":{ + "properties":{ + "total_count":{ + "type":"integer" + }, + "items":{ + "items":{ + "properties":{ + "closed_at":{ + "type":"null" + }, + "body":{ + "type":"string" + }, + "assignee":{ + "type":"null" + }, + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "events_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "labels_url":{ + "type":"string" + }, + "milestone":{ + "type":"null" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"null" + }, + "html_url":{ + "type":"null" + }, + "patch_url":{ + "type":"null" + } + }, + "type":"object" + }, + "score":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-issues-by-keyword":{ + "properties":{ + "issues":{ + "items":{ + "properties":{ + "gravatar_id":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "number":{ + "type":"integer" + }, + "position":{ + "type":"integer" + }, + "body":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "user":{ + "type":"string" + }, + "votes":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-repositories":{ + "properties":{ + "items":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + }, + "total_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "search-repositories-by-keyword":{ + "properties":{ + "repositories":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-user-by-email":{ + "properties":{ + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "search-users":{ + "properties":{ + "total_count":{ + "type":"integer" + }, + "items":{ + "$ref":"#/definitions/users" + } + }, + "type":"object" + }, + "search-users-by-keyword":{ + "properties":{ + "users":{ + "$ref":"#/definitions/users" + } + }, + "type":"object" + }, + "subscription":{ + "properties":{ + "thread_url":{ + "type":"string" + }, + "ignored":{ + "type":"boolean" + }, + "reason":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "repository_url":{ + "type":"string" + }, + "subscribed":{ + "type":"boolean" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "subscriptionBody":{ + "properties":{ + "subscribed":{ + "type":"boolean" + }, + "ignored":{ + "type":"boolean" + } + }, + "type":"object" + }, + "tag":{ + "properties":{ + "url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "object":{ + "properties":{ + "sha":{ + "type":"string" + }, + "type":{ + "enum":[ + "commit", + "tree", + "blob" + ] + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "sha":{ + "type":"string" + }, + "tag":{ + "type":"string" + }, + "tagger":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "date":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "tagBody":{ + "properties":{ + "tag":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "object":{ + "type":"string" + }, + "tagger":{ + "properties":{ + "email":{ + "type":"string" + }, + "date":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "type":{ + "enum":[ + "commit", + "tree", + "blob" + ] + } + }, + "required":[ + "tag", + "message", + "object", + "type", + "tagger" + ], + "type":"object" + }, + "tags":{ + "items":{ + "$ref":"#/definitions/tag" + }, + "type":"array" + }, + "team":{ + "properties":{ + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "members_count":{ + "type":"integer" + }, + "permission":{ + "type":"string" + }, + "repos_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "teamMembership":{ + "properties":{ + "url":{ + "type":"string" + }, + "state":{ + "type":"string" + } + }, + "type":"object" + }, + "teamRepos":{ + "$ref":"#/definitions/repos" + }, + "teams":{ + "items":{ + "properties":{ + "url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "id":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + }, + "teams-list":{ + "items":{ + "properties":{ + "repos_count":{ + "type":"integer" + }, + "members_count":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "organization":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "permission":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "tree":{ + "properties":{ + "tree":{ + "items":{ + "properties":{ + "mode":{ + "enum":[ + "100644", + "100755", + "040000", + "160000", + "120000" + ], + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "enum":[ + "blob", + "tree", + "commit" + ], + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "trees":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "tree":{ + "items":{ + "$ref":"#/definitions/tree" + }, + "type":"array" + }, + "base_tree":{ + "type":"string" + } + }, + "type":"object" + }, + "user":{ + "allOf":[ + { + "$ref":"#/definitions/actor" + }, + { + + } + ], + "type":"object" + }, + "user-emails":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "user-keys-keyId":{ + "properties":{ + "title":{ + "type":"string" + }, + "key":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "user-keys-post":{ + "properties":{ + "title":{ + "type":"string" + }, + "key":{ + "type":"string" + } + }, + "type":"object" + }, + "user-update":{ + "properties":{ + "company":{ + "type":"string" + }, + "blog":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "location":{ + "type":"string" + }, + "hireable":{ + "type":"boolean" + }, + "name":{ + "type":"string" + }, + "bio":{ + "type":"string" + } + }, + "type":"object" + }, + "users":{ + "items":{ + "$ref":"#/definitions/user" + }, + "type":"array" + } + } +} \ No newline at end of file diff --git a/tests/spec/sortTypes-false/schema.ts b/tests/spec/sortTypes-false/schema.ts new file mode 100644 index 00000000..17f43d62 --- /dev/null +++ b/tests/spec/sortTypes-false/schema.ts @@ -0,0 +1,5889 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Actor { + created_at?: string; + gravatar_id?: string; + email?: string; + blog?: string; + collaborators?: number; + disk_usage?: number; + followers?: number; + avatar_url?: string; + followers_url?: string; + following?: number; + following_url?: string; + bio?: string; + gists_url?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + login?: string; + name?: string; + organizations_url?: string; + owned_private_repos?: number; + company?: string; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + updated_at?: string; + url?: string; +} + +export interface Asset { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; +} + +export interface AssetPatch { + label?: string; + name: string; +} + +export type Assets = Asset[]; + +export type Assignees = User[]; + +export interface Blob { + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; +} + +export interface Blobs { + sha?: string; +} + +export interface Branch { + _links?: { + html?: string; + self?: string; + }; + commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + name?: string; +} + +export type Branches = { + commit?: { + sha?: string; + url?: string; + }; + name?: string; +}[]; + +export type CodeFrequencyStats = number[]; + +export interface Comment { + body?: string; +} + +export interface CommentBody { + body: string; +} + +export type Comments = { + body?: string; + created_at?: string; + id?: number; + url?: string; + user?: User; +}[]; + +export interface Commit { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + status?: string; + }[]; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + url?: string; +} + +export type CommitActivityStats = { + days?: number[]; + total?: number; + week?: number; +}[]; + +export interface CommitComment { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export interface CommitCommentBody { + body: string; + line?: string; + number?: string; + path?: string; + position?: number; + sha: string; +} + +export type Commits = { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +}[]; + +export interface CompareCommits { + ahead_by?: number; + base_commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + behind_by?: number; + commits?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }[]; + diff_url?: string; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + contents_url?: string; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + sha?: string; + status?: string; + }[]; + html_url?: string; + patch_url?: string; + permalink_url?: string; + status?: string; + total_commits?: number; + url?: string; +} + +export interface ContentsPath { + _links?: { + git?: string; + html?: string; + self?: string; + }; + content?: string; + encoding?: string; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; +} + +export type ContributorsStats = { + author?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + total?: number; + weeks?: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +}[]; + +export interface CreateFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: { + _links?: { + git?: string; + html?: string; + self?: string; + }; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; + }; +} + +export interface CreateFileBody { + committer?: { + email?: string; + name?: string; + }; + content?: string; + message?: string; +} + +export interface DeleteFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: string; +} + +export interface DeleteFileBody { + committer?: { + email?: string; + name?: string; + }; + message?: string; + sha?: string; +} + +export interface Deployment { + description?: string; + payload?: { + deploy_user?: string; + environment?: string; + room_id?: number; + }; + ref?: string; +} + +export interface DeploymentResp { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +} + +export type DeploymentStatuses = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface DeploymentStatusesCreate { + description?: string; + state?: string; + target_url?: string; +} + +export interface Download { + content_type?: string; + description?: string; + download_count?: number; + html_url?: string; + id?: number; + name?: string; + size?: number; + url?: string; +} + +export type Downloads = Download[]; + +export interface EditTeam { + name: string; + permission?: "pull" | "push" | "admin"; +} + +export type EmailsPost = string[]; + +export type Emojis = Record; + +export interface Event { + actor?: Actor; + created_at?: object; + id?: number; + org?: Organization; + payload?: object; + public?: boolean; + repo?: { + id?: number; + name?: string; + url?: string; + }; + type?: string; +} + +export type Events = Event[]; + +export interface Feeds { + _links?: { + current_user?: { + href?: string; + type?: string; + }; + current_user_actor?: { + href?: string; + type?: string; + }; + current_user_organization?: { + href?: string; + type?: string; + }; + current_user_public?: { + href?: string; + type?: string; + }; + timeline?: { + href?: string; + type?: string; + }; + user?: { + href?: string; + type?: string; + }; + }; + current_user_actor_url?: string; + current_user_organization_url?: string; + current_user_public?: string; + current_user_url?: string; + timeline_url?: string; + user_url?: string; +} + +export interface ForkBody { + organization?: string; +} + +export type Forks = Repos; + +export interface Gist { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + forks?: { + created_at?: string; + url?: string; + user?: User; + }[]; + git_pull_url?: string; + git_push_url?: string; + history?: { + change_status?: { + additions?: number; + deletions?: number; + total?: number; + }; + committed_at?: string; + url?: string; + user?: User; + version?: string; + }[]; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +} + +export type Gists = { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +}[]; + +export interface GitCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: string; + tree?: string; +} + +export interface GitRefPatch { + force?: boolean; + sha?: string; +} + +export type Gitignore = any[]; + +export interface GitignoreLang { + name?: string; + source?: string; +} + +export interface HeadBranch { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +} + +export type Hook = { + active?: boolean; + config?: { + content_type?: string; + url?: string; + }; + created_at?: string; + events?: ( + | "push" + | "issues" + | "issue_comment" + | "commit_comment" + | "pull_request" + | "pull_request_review_comment" + | "gollum" + | "watch" + | "download" + | "fork" + | "fork_apply" + | "member" + | "public" + | "team_add" + | "status" + )[]; + id?: number; + name?: string; + updated_at?: string; + url?: string; +}[]; + +export interface HookBody { + active?: boolean; + add_events?: string[]; +} + +export interface Issue { + assignee?: string; + body?: string; + labels?: string[]; + milestone?: number; + title?: string; +} + +export interface IssueEvent { + actor?: Actor; + commit_id?: string; + created_at?: string; + event?: string; + issue?: { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }; + url?: string; +} + +export type IssueEvents = IssueEvent[]; + +export type Issues = { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface IssuesComment { + body?: string; + created_at?: string; + html_url?: string; + id?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export type IssuesComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export type Keys = { + id?: number; + key?: string; + title?: string; + url?: string; +}[]; + +export interface Label { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +} + +export type Labels = { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +}[]; + +export type Languages = Record; + +export interface Markdown { + context?: string; + mode?: string; + text?: string; +} + +export interface Merge { + merged?: boolean; + message?: string; + sha?: string; +} + +export interface MergePullBody { + commit_message?: string; +} + +export interface MergesBody { + base?: string; + commit_message?: string; + head?: string; +} + +export interface MergesConflict { + message?: string; +} + +export interface MergesSuccessful { + author?: User; + comments_url?: string; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + comment_count?: number; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + merged?: boolean; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Meta { + git?: string[]; + hooks?: string[]; +} + +export interface Milestone { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; +} + +export interface MilestoneUpdate { + description?: string; + due_on?: string; + state?: string; + title?: string; +} + +export interface NotificationMarkRead { + last_read_at?: string; +} + +export interface Notifications { + id?: number; + last_read_at?: string; + reason?: string; + repository?: { + description?: string; + fork?: boolean; + full_name?: string; + html_url?: string; + id?: number; + name?: string; + owner?: Actor; + private?: boolean; + url?: string; + }; + subject?: { + latest_comment_url?: string; + title?: string; + type?: string; + url?: string; + }; + unread?: boolean; + updated_at?: string; + url?: string; +} + +export interface OrgTeamsPost { + name: string; + permission?: "pull" | "push" | "admin"; + repo_names?: string[]; +} + +export type Organization = Actor; + +export interface OrganizationAsTeamMember { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +} + +export interface ParticipationStats { + all?: number[]; + owner?: number[]; +} + +export interface PatchGist { + description?: string; + files?: { + "delete_this_file.txt"?: string; + "file1.txt"?: { + content?: string; + }; + "new_file.txt"?: { + content?: string; + }; + "old_name.txt"?: { + content?: string; + filename?: string; + }; + }; +} + +export interface PatchOrg { + billing_email?: string; + company?: string; + email?: string; + location?: string; + name?: string; +} + +export interface PostGist { + description?: string; + files?: { + "file1.txt"?: { + content?: string; + }; + }; + public?: boolean; +} + +export interface PostRepo { + auto_init?: boolean; + description?: string; + gitignore_template?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name: string; + private?: boolean; + team_id?: number; +} + +export interface PullRequest { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + additions?: number; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + changed_files?: number; + closed_at?: string; + comments?: number; + commits?: number; + created_at?: string; + deletions?: number; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merge_commit_sha?: string; + mergeable?: boolean; + merged?: boolean; + merged_at?: string; + merged_by?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + number?: number; + patch_url?: string; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullUpdate { + body?: string; + state?: string; + title?: string; +} + +export type Pulls = { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + closed_at?: string; + created_at?: string; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merged_at?: string; + number?: number; + patch_url?: string; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsComment { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullsCommentPost { + body?: string; + commit_id?: string; + path?: string; + position?: number; +} + +export type PullsComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsPost { + base?: string; + body?: string; + head?: string; + title?: string; +} + +export interface PutSubscription { + created_at?: string; + ignored?: boolean; + reason?: object; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface RateLimit { + rate?: { + remaining?: number; + limit?: number; + reset?: number; + }; +} + +export type Ref = { + state?: string; + target_url?: string; + updated_at?: string; + created_at?: string; + creator?: { + id?: number; + login?: string; + avatar_url?: string; + gravatar_id?: string; + url?: string; + }; + description?: string; + id?: number; + url?: string; +}[]; + +export type RefStatus = { + sha?: string; + state?: string; + commit_url?: string; + name?: string; + repository_url?: string; + statuses?: { + id?: number; + state?: string; + context?: string; + created_at?: string; + description?: string; + target_url?: string; + updated_at?: string; + url?: string; + }[]; +}[]; + +export type Refs = { + ref?: string; + object?: { + type?: string; + sha?: string; + url?: string; + }; + url?: string; +}[]; + +export interface RefsBody { + ref?: string; + sha?: string; +} + +export interface Release { + tarball_url?: string; + target_commitish?: string; + assets?: { + id?: number; + label?: string; + content_type?: string; + created_at?: string; + download_count?: number; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +} + +export interface ReleaseCreate { + prerelease?: boolean; + body?: string; + draft?: boolean; + name?: string; + tag_name?: string; + target_commitish?: string; +} + +export type Releases = { + created_at?: string; + assets?: { + id?: number; + content_type?: string; + created_at?: string; + download_count?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +}[]; + +export interface Repo { + forks?: number; + organization?: Organization; + clone_url?: string; + created_at?: string; + description?: string; + fork?: boolean; + forks_count?: number; + full_name?: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + html_url?: string; + id?: number; + language?: string; + master_branch?: string; + mirror_url?: string; + name?: string; + open_issues?: number; + open_issues_count?: number; + owner?: Actor; + parent?: Repo; + private?: boolean; + pushed_at?: string; + size?: number; + source?: Repo; + ssh_url?: string; + svn_url?: string; + updated_at?: string; + url?: string; + watchers?: number; + watchers_count?: number; +} + +export type RepoDeployments = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +}[]; + +export type RepoComments = { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface RepoCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: { + url?: string; + sha?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; +} + +export interface RepoCommitBody { + author?: { + name?: string; + date?: string; + email?: string; + }; + message: string; + parents: string[]; + tree: string; +} + +export interface RepoEdit { + has_downloads?: boolean; + description?: string; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name?: string; + private?: boolean; +} + +export type Repos = Repo[]; + +export interface SearchCode { + items?: { + html_url?: string; + git_url?: string; + name?: string; + path?: string; + repository?: { + comments_url?: string; + assignees_url?: string; + archive_url?: string; + blobs_url?: string; + branches_url?: string; + collaborators_url?: string; + commits_url?: string; + compare_url?: string; + contents_url?: string; + contributors_url?: string; + description?: string; + downloads_url?: string; + events_url?: string; + fork?: boolean; + forks_url?: string; + full_name?: string; + git_commits_url?: string; + git_refs_url?: string; + git_tags_url?: string; + hooks_url?: string; + html_url?: string; + id?: number; + issue_comment_url?: string; + issue_events_url?: string; + issues_url?: string; + keys_url?: string; + labels_url?: string; + languages_url?: string; + merges_url?: string; + milestones_url?: string; + name?: string; + notifications_url?: string; + owner?: Actor; + private?: boolean; + pulls_url?: string; + stargazers_url?: string; + statuses_url?: string; + subscribers_url?: string; + subscription_url?: string; + tags_url?: string; + teams_url?: string; + trees_url?: string; + url?: string; + }; + score?: number; + sha?: string; + url?: string; + }[]; + total_count?: number; +} + +export interface SearchIssues { + total_count?: number; + items?: { + closed_at?: any; + body?: string; + assignee?: any; + comments?: number; + comments_url?: string; + created_at?: string; + events_url?: string; + html_url?: string; + id?: number; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + labels_url?: string; + milestone?: any; + number?: number; + pull_request?: { + diff_url?: any; + html_url?: any; + patch_url?: any; + }; + score?: number; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }[]; +} + +export interface SearchIssuesByKeyword { + issues?: { + gravatar_id?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: string[]; + number?: number; + position?: number; + body?: string; + state?: string; + title?: string; + updated_at?: string; + user?: string; + votes?: number; + }[]; +} + +export interface SearchRepositories { + items?: Repo[]; + total_count?: number; +} + +export interface SearchRepositoriesByKeyword { + repositories?: Repo[]; +} + +export interface SearchUserByEmail { + user?: User; +} + +export interface SearchUsers { + total_count?: number; + items?: Users; +} + +export interface SearchUsersByKeyword { + users?: Users; +} + +export interface Subscription { + thread_url?: string; + ignored?: boolean; + reason?: string; + created_at?: string; + repository_url?: string; + subscribed?: boolean; + url?: string; +} + +export interface SubscriptionBody { + subscribed?: boolean; + ignored?: boolean; +} + +export interface Tag { + url?: string; + message?: string; + object?: { + sha?: string; + type?: "commit" | "tree" | "blob"; + url?: string; + }; + sha?: string; + tag?: string; + tagger?: { + email?: string; + name?: string; + date?: string; + }; +} + +export interface TagBody { + tag: string; + message: string; + object: string; + tagger: { + email?: string; + date?: string; + name?: string; + }; + type: "commit" | "tree" | "blob"; +} + +export type Tags = Tag[]; + +export interface Team { + name?: string; + url?: string; + id?: number; + members_count?: number; + permission?: string; + repos_count?: number; +} + +export interface TeamMembership { + url?: string; + state?: string; +} + +export type TeamRepos = Repos; + +export type Teams = { + url?: string; + name?: string; + id?: number; +}[]; + +export type TeamsList = { + repos_count?: number; + members_count?: number; + name?: string; + id?: number; + organization?: { + avatar_url?: string; + id?: number; + login?: string; + url?: string; + }; + permission?: string; + url?: string; +}[]; + +export interface Tree { + tree?: { + mode?: "100644" | "100755" | "040000" | "160000" | "120000"; + path?: string; + sha?: string; + size?: number; + type?: "blob" | "tree" | "commit"; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Trees { + sha?: string; + url?: string; + tree?: Tree[]; + base_tree?: string; +} + +export type User = Actor; + +export type UserEmails = string[]; + +export interface UserKeysKeyId { + title?: string; + key?: string; + id?: number; + url?: string; +} + +export interface UserKeysPost { + title?: string; + key?: string; +} + +export interface UserUpdate { + company?: string; + blog?: string; + email?: string; + location?: string; + hireable?: boolean; + name?: string; + bio?: string; +} + +export type Users = User[]; + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title GitHub + * @version v3 + */ +export class Api extends HttpClient { + someop = { + /** + * No description + * + * @tags someop + * @name SomeOp1 + * @request POST:/someop + */ + someOp1: ( + data: Events, + query?: { + queryParam1?: number; + fooBarBaz?: number; + queryParam2?: number; + queryParamBar3?: number; + queryParam3?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags someop + * @name SomeOp + * @request POST:/someop/{fooId}/bars/bar-bar + */ + someOp: ( + fooId: string, + data: Events, + query?: { + page?: number; + size?: number; + sort?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop/${fooId}/bars/bar-bar`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + }; + emojis = { + /** + * No description + * + * @name EmojisList + * @request GET:/emojis + */ + emojisList: (params: RequestParams = {}) => + this.request({ + path: `/emojis`, + method: "GET", + format: "json", + ...params, + }), + }; + events = { + /** + * No description + * + * @name EventsList + * @request GET:/events + */ + eventsList: (params: RequestParams = {}) => + this.request({ + path: `/events`, + method: "GET", + format: "json", + ...params, + }), + }; + feeds = { + /** + * No description + * + * @name FeedsList + * @request GET:/feeds + */ + feedsList: (params: RequestParams = {}) => + this.request({ + path: `/feeds`, + method: "GET", + format: "json", + ...params, + }), + }; + gists = { + /** + * No description + * + * @name GistsList + * @request GET:/gists + */ + gistsList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsCreate + * @request POST:/gists + */ + gistsCreate: (body: PostGist, params: RequestParams = {}) => + this.request({ + path: `/gists`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicList + * @request GET:/gists/public + */ + publicList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/public`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/gists/starred + */ + starredList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsDelete + * @request DELETE:/gists/{id} + */ + gistsDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/gists/{id} + */ + gistsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsPartialUpdate + * @request PATCH:/gists/{id} + */ + gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/gists/{id}/comments + */ + commentsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsCreate + * @request POST:/gists/{id}/comments + */ + commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/gists/{id}/comments/{commentId} + */ + commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/gists/{id}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/gists/{id}/comments/{commentId} + */ + commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/gists/{id}/forks + */ + forksCreate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/forks`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name StarDelete + * @request DELETE:/gists/{id}/star + */ + starDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarDetail + * @request GET:/gists/{id}/star + */ + starDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarUpdate + * @request PUT:/gists/{id}/star + */ + starUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "PUT", + ...params, + }), + }; + gitignore = { + /** + * No description + * + * @name TemplatesList + * @request GET:/gitignore/templates + */ + templatesList: (params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TemplatesDetail + * @request GET:/gitignore/templates/{language} + */ + templatesDetail: (language: string, params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates/${language}`, + method: "GET", + format: "json", + ...params, + }), + }; + issues = { + /** + * No description + * + * @name IssuesList + * @request GET:/issues + */ + issuesList: ( + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + legacy = { + /** + * No description + * + * @name IssuesSearchDetail + * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} + */ + issuesSearchDetail: ( + keyword: string, + state: "open" | "closed", + owner: string, + repository: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposSearchDetail + * @request GET:/legacy/repos/search/{keyword} + */ + reposSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + language?: string; + start_page?: string; + sort?: "updated" | "stars" | "forks"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/repos/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserEmailDetail + * @request GET:/legacy/user/email/{email} + */ + userEmailDetail: (email: string, params: RequestParams = {}) => + this.request({ + path: `/legacy/user/email/${email}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserSearchDetail + * @request GET:/legacy/user/search/{keyword} + */ + userSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + start_page?: string; + sort?: "updated" | "stars" | "forks"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/user/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + markdown = { + /** + * No description + * + * @name MarkdownCreate + * @request POST:/markdown + */ + markdownCreate: (body: Markdown, params: RequestParams = {}) => + this.request({ + path: `/markdown`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name PostMarkdown + * @request POST:/markdown/raw + */ + postMarkdown: (params: RequestParams = {}) => + this.request({ + path: `/markdown/raw`, + method: "POST", + type: ContentType.Text, + ...params, + }), + }; + meta = { + /** + * No description + * + * @name MetaList + * @request GET:/meta + */ + metaList: (params: RequestParams = {}) => + this.request({ + path: `/meta`, + method: "GET", + format: "json", + ...params, + }), + }; + networks = { + /** + * No description + * + * @name EventsDetail + * @request GET:/networks/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/networks/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + }; + notifications = { + /** + * No description + * + * @name NotificationsList + * @request GET:/notifications + */ + notificationsList: ( + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/notifications + */ + notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name ThreadsDetail + * @request GET:/notifications/threads/{id} + */ + threadsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsPartialUpdate + * @request PATCH:/notifications/threads/{id} + */ + threadsPartialUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "PATCH", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDelete + * @request DELETE:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDetail + * @request GET:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionUpdate + * @request PUT:/notifications/threads/{id}/subscription + */ + threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + orgs = { + /** + * No description + * + * @name OrgsDetail + * @request GET:/orgs/{org} + */ + orgsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsPartialUpdate + * @request PATCH:/orgs/{org} + */ + orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/orgs/{org}/events + */ + eventsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/orgs/{org}/issues + */ + issuesDetail: ( + org: string, + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/orgs/{org}/members + */ + membersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/orgs/{org}/members/{username} + */ + membersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/orgs/{org}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail + * @request GET:/orgs/{org}/public_members + */ + publicMembersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDelete + * @request DELETE:/orgs/{org}/public_members/{username} + */ + publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail2 + * @request GET:/orgs/{org}/public_members/{username} + * @originalName publicMembersDetail + * @duplicate + */ + publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersUpdate + * @request PUT:/orgs/{org}/public_members/{username} + */ + publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/orgs/{org}/repos + */ + reposDetail: ( + org: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/orgs/{org}/repos + */ + reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/orgs/{org}/teams + */ + teamsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsCreate + * @request POST:/orgs/{org}/teams + */ + teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + rateLimit = { + /** + * No description + * + * @name RateLimitList + * @request GET:/rate_limit + */ + rateLimitList: (params: RequestParams = {}) => + this.request({ + path: `/rate_limit`, + method: "GET", + format: "json", + ...params, + }), + }; + repos = { + /** + * No description + * + * @name ReposDelete + * @request DELETE:/repos/{owner}/{repo} + */ + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/repos/{owner}/{repo} + */ + reposDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposPartialUpdate + * @request PATCH:/repos/{owner}/{repo} + */ + reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail + * @request GET:/repos/{owner}/{repo}/assignees + */ + assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail2 + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + * @originalName assigneesDetail + * @duplicate + */ + assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees/${assignee}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail + * @request GET:/repos/{owner}/{repo}/branches + */ + branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail2 + * @request GET:/repos/{owner}/{repo}/branches/{branch} + * @originalName branchesDetail + * @duplicate + */ + branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches/${branch}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail + * @request GET:/repos/{owner}/{repo}/collaborators + */ + collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDelete + * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail2 + * @request GET:/repos/{owner}/{repo}/collaborators/{user} + * @originalName collaboratorsDetail + * @duplicate + */ + collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsUpdate + * @request PUT:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/repos/{owner}/{repo}/comments + */ + commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/repos/{owner}/{repo}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail + * @request GET:/repos/{owner}/{repo}/commits + */ + commitsDetail: ( + owner: string, + repo: string, + query?: { + since?: string; + sha?: string; + path?: string; + author?: string; + until?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsStatusDetail + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${ref}/status`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail2 + * @request GET:/repos/{owner}/{repo}/commits/{shaCode} + * @originalName commitsDetail + * @duplicate + */ + commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsDetail + * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsCreate + * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsCreate: ( + owner: string, + repo: string, + shaCode: string, + body: CommitCommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CompareDetail + * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} + */ + compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDelete + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "DELETE", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDetail + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + contentsDetail: ( + owner: string, + repo: string, + path: string, + query?: { + path?: string; + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsUpdate + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContributorsDetail + * @request GET:/repos/{owner}/{repo}/contributors + */ + contributorsDetail: ( + owner: string, + repo: string, + query: { + anon: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contributors`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsDetail + * @request GET:/repos/{owner}/{repo}/deployments + */ + deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsCreate + * @request POST:/repos/{owner}/{repo}/deployments + */ + deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesDetail + * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesCreate + * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesCreate: ( + owner: string, + repo: string, + id: number, + body: DeploymentStatusesCreate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail + * @request GET:/repos/{owner}/{repo}/downloads + */ + downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DownloadsDelete + * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} + */ + downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail2 + * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} + * @originalName downloadsDetail + * @duplicate + */ + downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/repos/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksDetail + * @request GET:/repos/{owner}/{repo}/forks + */ + forksDetail: ( + owner: string, + repo: string, + query?: { + sort?: "newes" | "oldes" | "watchers"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/repos/{owner}/{repo}/forks + */ + forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsCreate + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsDetail + * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} + */ + gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsCreate + * @request POST:/repos/{owner}/{repo}/git/commits + */ + gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsDetail + * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} + */ + gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail + * @request GET:/repos/{owner}/{repo}/git/refs + */ + gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsCreate + * @request POST:/repos/{owner}/{repo}/git/refs + */ + gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDelete + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail2 + * @request GET:/repos/{owner}/{repo}/git/refs/{ref} + * @originalName gitRefsDetail + * @duplicate + */ + gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsCreate + * @request POST:/repos/{owner}/{repo}/git/tags + */ + gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsDetail + * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} + */ + gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesCreate + * @request POST:/repos/{owner}/{repo}/git/trees + */ + gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesDetail + * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} + */ + gitTreesDetail: ( + owner: string, + repo: string, + shaCode: string, + query?: { + recursive?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDetail + * @request GET:/repos/{owner}/{repo}/hooks + */ + hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksCreate + * @request POST:/repos/{owner}/{repo}/hooks + */ + hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDelete + * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name HooksDetail2 + * @request GET:/repos/{owner}/{repo}/hooks/{hookId} + * @originalName hooksDetail + * @duplicate + */ + hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksTestsCreate + * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests + */ + hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/repos/{owner}/{repo}/issues + */ + issuesDetail: ( + owner: string, + repo: string, + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCreate + * @request POST:/repos/{owner}/{repo}/issues + */ + issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + issuesCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "created" | "updated"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail2 + * @request GET:/repos/{owner}/{repo}/issues/{number} + * @originalName issuesDetail + * @duplicate + */ + issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/{number} + */ + issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/comments + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/comments + */ + issuesCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/events + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDetail + * @request GET:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsUpdate + * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "PUT", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete2 + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels/{name} + * @originalName issuesLabelsDelete + * @duplicate + */ + issuesLabelsDelete2: (owner: string, repo: string, number: number, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/repos/{owner}/{repo}/keys + */ + keysDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/repos/{owner}/{repo}/keys + */ + keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} + */ + keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail2 + * @request GET:/repos/{owner}/{repo}/keys/{keyId} + * @originalName keysDetail + * @duplicate + */ + keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail + * @request GET:/repos/{owner}/{repo}/labels + */ + labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsCreate + * @request POST:/repos/{owner}/{repo}/labels + */ + labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDelete + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail2 + * @request GET:/repos/{owner}/{repo}/labels/{name} + * @originalName labelsDetail + * @duplicate + */ + labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LanguagesDetail + * @request GET:/repos/{owner}/{repo}/languages + */ + languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/languages`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MergesCreate + * @request POST:/repos/{owner}/{repo}/merges + */ + mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/merges`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail + * @request GET:/repos/{owner}/{repo}/milestones + */ + milestonesDetail: ( + owner: string, + repo: string, + query?: { + state?: "open" | "closed"; + direction?: string; + sort?: "due_date" | "completeness"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesCreate + * @request POST:/repos/{owner}/{repo}/milestones + */ + milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDelete + * @request DELETE:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail2 + * @request GET:/repos/{owner}/{repo}/milestones/{number} + * @originalName milestonesDetail + * @duplicate + */ + milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesPartialUpdate: ( + owner: string, + repo: string, + number: number, + body: MilestoneUpdate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesLabelsDetail + * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels + */ + milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsDetail + * @request GET:/repos/{owner}/{repo}/notifications + */ + notificationsDetail: ( + owner: string, + repo: string, + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/repos/{owner}/{repo}/notifications + */ + notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name PullsDetail + * @request GET:/repos/{owner}/{repo}/pulls + */ + pullsDetail: ( + owner: string, + repo: string, + query?: { + state?: "open" | "closed"; + head?: string; + base?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCreate + * @request POST:/repos/{owner}/{repo}/pulls + */ + pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + pullsCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "created" | "updated"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/{number} + * @originalName pullsDetail + * @duplicate + */ + pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/{number} + */ + pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsCreate + * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments + */ + pullsCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: PullsCommentPost, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommitsDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits + */ + pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsFilesDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/files + */ + pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/files`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsMergeDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PullsMergeUpdate + * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReadmeDetail + * @request GET:/repos/{owner}/{repo}/readme + */ + readmeDetail: ( + owner: string, + repo: string, + query?: { + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/readme`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail + * @request GET:/repos/{owner}/{repo}/releases + */ + releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesCreate + * @request POST:/repos/{owner}/{repo}/releases + */ + releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDelete + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail + * @request GET:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsPartialUpdate: ( + owner: string, + repo: string, + id: string, + body: AssetPatch, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDelete + * @request DELETE:/repos/{owner}/{repo}/releases/{id} + */ + releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id} + * @originalName releasesDetail + * @duplicate + */ + releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/{id} + */ + releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id}/assets + * @originalName releasesAssetsDetail + * @duplicate + */ + releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}/assets`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StargazersDetail + * @request GET:/repos/{owner}/{repo}/stargazers + */ + stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stargazers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCodeFrequencyDetail + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/code_frequency`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCommitActivityDetail + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/commit_activity`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsContributorsDetail + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/contributors`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsParticipationDetail + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/participation`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsPunchCardDetail + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/punch_card`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesDetail + * @request GET:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesCreate + * @request POST:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscribersDetail + * @request GET:/repos/{owner}/{repo}/subscribers + */ + subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscribers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDelete + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDetail + * @request GET:/repos/{owner}/{repo}/subscription + */ + subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionUpdate + * @request PUT:/repos/{owner}/{repo}/subscription + */ + subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TagsDetail + * @request GET:/repos/{owner}/{repo}/tags + */ + tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/tags`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/repos/{owner}/{repo}/teams + */ + teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name WatchersDetail + * @request GET:/repos/{owner}/{repo}/watchers + */ + watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/watchers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/repos/{owner}/{repo}/{archive_format}/{path} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: ( + owner: string, + repo: string, + archiveFormat: "tarball" | "zipball", + path: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + method: "GET", + ...params, + }), + }; + repositories = { + /** + * No description + * + * @name RepositoriesList + * @request GET:/repositories + */ + repositoriesList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + search = { + /** + * No description + * + * @name CodeList + * @request GET:/search/code + */ + codeList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "indexed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/code`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/search/issues + */ + issuesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "updated" | "created" | "comments"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name RepositoriesList + * @request GET:/search/repositories + */ + repositoriesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "stars" | "forks" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersList + * @request GET:/search/users + */ + usersList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "followers" | "repositories" | "joined"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + teams = { + /** + * No description + * + * @name TeamsDelete + * @request DELETE:/teams/{teamId} + */ + teamsDelete: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/teams/{teamId} + */ + teamsDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsPartialUpdate + * @request PATCH:/teams/{teamId} + */ + teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/teams/{teamId}/members + */ + membersDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/teams/{teamId}/members/{username} + */ + membersDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/teams/{teamId}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MembersUpdate + * @request PUT:/teams/{teamId}/members/{username} + */ + membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name MembershipsDelete + * @request DELETE:/teams/{teamId}/memberships/{username} + */ + membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembershipsDetail + * @request GET:/teams/{teamId}/memberships/{username} + */ + membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembershipsUpdate + * @request PUT:/teams/{teamId}/memberships/{username} + */ + membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "PUT", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/teams/{teamId}/repos + */ + reposDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDelete + * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} + */ + reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/teams/{teamId}/repos/{owner}/{repo} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposUpdate + * @request PUT:/teams/{teamId}/repos/{owner}/{repo} + */ + reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "PUT", + ...params, + }), + }; + user = { + /** + * No description + * + * @name UserList + * @request GET:/user + */ + userList: (params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserPartialUpdate + * @request PATCH:/user + */ + userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EmailsDelete + * @request DELETE:/user/emails + */ + emailsDelete: (body: UserEmails, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "DELETE", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name EmailsList + * @request GET:/user/emails + */ + emailsList: (params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EmailsCreate + * @request POST:/user/emails + */ + emailsCreate: (body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "POST", + body: body, + ...params, + }), + + /** + * No description + * + * @name FollowersList + * @request GET:/user/followers + */ + followersList: (params: RequestParams = {}) => + this.request({ + path: `/user/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingList + * @request GET:/user/following + */ + followingList: (params: RequestParams = {}) => + this.request({ + path: `/user/following`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDelete + * @request DELETE:/user/following/{username} + */ + followingDelete: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/user/following/{username} + */ + followingDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowingUpdate + * @request PUT:/user/following/{username} + */ + followingUpdate: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/user/issues + */ + issuesList: ( + query: { + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + state: "open" | "closed"; + labels: string; + sort: "created" | "updated" | "comments"; + direction: "asc" | "desc"; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysList + * @request GET:/user/keys + */ + keysList: (params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/user/keys + */ + keysCreate: (body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/user/keys/{keyId} + */ + keysDelete: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/user/keys/{keyId} + */ + keysDetail: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsList + * @request GET:/user/orgs + */ + orgsList: (params: RequestParams = {}) => + this.request({ + path: `/user/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposList + * @request GET:/user/repos + */ + reposList: ( + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/user/repos + */ + reposCreate: (body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/user/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/user/starred + */ + starredList: ( + query?: { + direction?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDelete + * @request DELETE:/user/starred/{owner}/{repo} + */ + starredDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/user/starred/{owner}/{repo} + */ + starredDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarredUpdate + * @request PUT:/user/starred/{owner}/{repo} + */ + starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsList + * @request GET:/user/subscriptions + */ + subscriptionsList: (params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDelete + * @request DELETE:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsUpdate + * @request PUT:/user/subscriptions/{owner}/{repo} + */ + subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name TeamsList + * @request GET:/user/teams + */ + teamsList: (params: RequestParams = {}) => + this.request({ + path: `/user/teams`, + method: "GET", + format: "json", + ...params, + }), + }; + users = { + /** + * No description + * + * @name UsersList + * @request GET:/users + */ + usersList: ( + query?: { + since?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersDetail + * @request GET:/users/{username} + */ + usersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/users/{username}/events + */ + eventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EventsOrgsDetail + * @request GET:/users/{username}/events/orgs/{org} + */ + eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events/orgs/${org}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowersDetail + * @request GET:/users/{username}/followers + */ + followersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/users/{username}/following/{targetUser} + */ + followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/following/${targetUser}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/users/{username}/gists + */ + gistsDetail: ( + username: string, + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/users/{username}/keys + */ + keysDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsDetail + * @request GET:/users/{username}/orgs + */ + orgsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsDetail + * @request GET:/users/{username}/received_events + */ + receivedEventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsPublicDetail + * @request GET:/users/{username}/received_events/public + */ + receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events/public`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/users/{username}/repos + */ + reposDetail: ( + username: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/users/{username}/starred + */ + starredDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/starred`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/users/{username}/subscriptions + */ + subscriptionsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/subscriptions`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/sortTypes-false/test.js b/tests/spec/sortTypes-false/test.js new file mode 100644 index 00000000..c3df414c --- /dev/null +++ b/tests/spec/sortTypes-false/test.js @@ -0,0 +1,22 @@ +const { generateApiForTest } = require("../../helpers/generateApiForTest"); +const { resolve } = require("path"); +const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); +const createSchemaInfos = require("../../helpers/createSchemaInfos"); +const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); + +const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") }); + +schemas.forEach(({ absolutePath, apiFileName }) => { + generateApiForTest({ + testName: "--sort-types-false option test", + silent: true, + name: apiFileName, + input: absolutePath, + output: resolve(__dirname, "./"), + generateClient: true, + sortTypes: false, + }).then(() => { + validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); + assertGeneratedModule(resolve(__dirname, `./${apiFileName}`), resolve(__dirname, `./expected.ts`)); + }); +}); diff --git a/tests/spec/sortTypes/expected.ts b/tests/spec/sortTypes/expected.ts new file mode 100644 index 00000000..10eb562a --- /dev/null +++ b/tests/spec/sortTypes/expected.ts @@ -0,0 +1,5889 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Actor { + avatar_url?: string; + bio?: string; + blog?: string; + collaborators?: number; + company?: string; + created_at?: string; + disk_usage?: number; + email?: string; + followers?: number; + followers_url?: string; + following?: number; + following_url?: string; + gists_url?: string; + gravatar_id?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + login?: string; + name?: string; + organizations_url?: string; + owned_private_repos?: number; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + updated_at?: string; + url?: string; +} + +export interface Asset { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; +} + +export interface AssetPatch { + label?: string; + name: string; +} + +export type Assets = Asset[]; + +export type Assignees = User[]; + +export interface Blob { + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; +} + +export interface Blobs { + sha?: string; +} + +export interface Branch { + _links?: { + html?: string; + self?: string; + }; + commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + name?: string; +} + +export type Branches = { + commit?: { + sha?: string; + url?: string; + }; + name?: string; +}[]; + +export type CodeFrequencyStats = number[]; + +export interface Comment { + body?: string; +} + +export interface CommentBody { + body: string; +} + +export type Comments = { + body?: string; + created_at?: string; + id?: number; + url?: string; + user?: User; +}[]; + +export interface Commit { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + status?: string; + }[]; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + url?: string; +} + +export type CommitActivityStats = { + days?: number[]; + total?: number; + week?: number; +}[]; + +export interface CommitComment { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export interface CommitCommentBody { + body: string; + line?: string; + number?: string; + path?: string; + position?: number; + sha: string; +} + +export type Commits = { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +}[]; + +export interface CompareCommits { + ahead_by?: number; + base_commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + behind_by?: number; + commits?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }[]; + diff_url?: string; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + contents_url?: string; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + sha?: string; + status?: string; + }[]; + html_url?: string; + patch_url?: string; + permalink_url?: string; + status?: string; + total_commits?: number; + url?: string; +} + +export interface ContentsPath { + _links?: { + git?: string; + html?: string; + self?: string; + }; + content?: string; + encoding?: string; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; +} + +export type ContributorsStats = { + author?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + total?: number; + weeks?: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +}[]; + +export interface CreateFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: { + _links?: { + git?: string; + html?: string; + self?: string; + }; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; + }; +} + +export interface CreateFileBody { + committer?: { + email?: string; + name?: string; + }; + content?: string; + message?: string; +} + +export interface DeleteFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: string; +} + +export interface DeleteFileBody { + committer?: { + email?: string; + name?: string; + }; + message?: string; + sha?: string; +} + +export interface Deployment { + description?: string; + payload?: { + deploy_user?: string; + environment?: string; + room_id?: number; + }; + ref?: string; +} + +export interface DeploymentResp { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +} + +export type DeploymentStatuses = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface DeploymentStatusesCreate { + description?: string; + state?: string; + target_url?: string; +} + +export interface Download { + content_type?: string; + description?: string; + download_count?: number; + html_url?: string; + id?: number; + name?: string; + size?: number; + url?: string; +} + +export type Downloads = Download[]; + +export interface EditTeam { + name: string; + permission?: "pull" | "push" | "admin"; +} + +export type EmailsPost = string[]; + +export type Emojis = Record; + +export interface Event { + actor?: Actor; + created_at?: object; + id?: number; + org?: Organization; + payload?: object; + public?: boolean; + repo?: { + id?: number; + name?: string; + url?: string; + }; + type?: string; +} + +export type Events = Event[]; + +export interface Feeds { + _links?: { + current_user?: { + href?: string; + type?: string; + }; + current_user_actor?: { + href?: string; + type?: string; + }; + current_user_organization?: { + href?: string; + type?: string; + }; + current_user_public?: { + href?: string; + type?: string; + }; + timeline?: { + href?: string; + type?: string; + }; + user?: { + href?: string; + type?: string; + }; + }; + current_user_actor_url?: string; + current_user_organization_url?: string; + current_user_public?: string; + current_user_url?: string; + timeline_url?: string; + user_url?: string; +} + +export interface ForkBody { + organization?: string; +} + +export type Forks = Repos; + +export interface Gist { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + forks?: { + created_at?: string; + url?: string; + user?: User; + }[]; + git_pull_url?: string; + git_push_url?: string; + history?: { + change_status?: { + additions?: number; + deletions?: number; + total?: number; + }; + committed_at?: string; + url?: string; + user?: User; + version?: string; + }[]; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +} + +export type Gists = { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +}[]; + +export interface GitCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: string; + tree?: string; +} + +export interface GitRefPatch { + force?: boolean; + sha?: string; +} + +export type Gitignore = any[]; + +export interface GitignoreLang { + name?: string; + source?: string; +} + +export interface HeadBranch { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +} + +export type Hook = { + active?: boolean; + config?: { + content_type?: string; + url?: string; + }; + created_at?: string; + events?: ( + | "push" + | "issues" + | "issue_comment" + | "commit_comment" + | "pull_request" + | "pull_request_review_comment" + | "gollum" + | "watch" + | "download" + | "fork" + | "fork_apply" + | "member" + | "public" + | "team_add" + | "status" + )[]; + id?: number; + name?: string; + updated_at?: string; + url?: string; +}[]; + +export interface HookBody { + active?: boolean; + add_events?: string[]; +} + +export interface Issue { + assignee?: string; + body?: string; + labels?: string[]; + milestone?: number; + title?: string; +} + +export interface IssueEvent { + actor?: Actor; + commit_id?: string; + created_at?: string; + event?: string; + issue?: { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }; + url?: string; +} + +export type IssueEvents = IssueEvent[]; + +export type Issues = { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface IssuesComment { + body?: string; + created_at?: string; + html_url?: string; + id?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export type IssuesComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export type Keys = { + id?: number; + key?: string; + title?: string; + url?: string; +}[]; + +export interface Label { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +} + +export type Labels = { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +}[]; + +export type Languages = Record; + +export interface Markdown { + context?: string; + mode?: string; + text?: string; +} + +export interface Merge { + merged?: boolean; + message?: string; + sha?: string; +} + +export interface MergePullBody { + commit_message?: string; +} + +export interface MergesBody { + base?: string; + commit_message?: string; + head?: string; +} + +export interface MergesConflict { + message?: string; +} + +export interface MergesSuccessful { + author?: User; + comments_url?: string; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + comment_count?: number; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + merged?: boolean; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Meta { + git?: string[]; + hooks?: string[]; +} + +export interface Milestone { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; +} + +export interface MilestoneUpdate { + description?: string; + due_on?: string; + state?: string; + title?: string; +} + +export interface NotificationMarkRead { + last_read_at?: string; +} + +export interface Notifications { + id?: number; + last_read_at?: string; + reason?: string; + repository?: { + description?: string; + fork?: boolean; + full_name?: string; + html_url?: string; + id?: number; + name?: string; + owner?: Actor; + private?: boolean; + url?: string; + }; + subject?: { + latest_comment_url?: string; + title?: string; + type?: string; + url?: string; + }; + unread?: boolean; + updated_at?: string; + url?: string; +} + +export interface OrgTeamsPost { + name: string; + permission?: "pull" | "push" | "admin"; + repo_names?: string[]; +} + +export type Organization = Actor; + +export interface OrganizationAsTeamMember { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +} + +export interface ParticipationStats { + all?: number[]; + owner?: number[]; +} + +export interface PatchGist { + description?: string; + files?: { + "delete_this_file.txt"?: string; + "file1.txt"?: { + content?: string; + }; + "new_file.txt"?: { + content?: string; + }; + "old_name.txt"?: { + content?: string; + filename?: string; + }; + }; +} + +export interface PatchOrg { + billing_email?: string; + company?: string; + email?: string; + location?: string; + name?: string; +} + +export interface PostGist { + description?: string; + files?: { + "file1.txt"?: { + content?: string; + }; + }; + public?: boolean; +} + +export interface PostRepo { + auto_init?: boolean; + description?: string; + gitignore_template?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name: string; + private?: boolean; + team_id?: number; +} + +export interface PullRequest { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + additions?: number; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + changed_files?: number; + closed_at?: string; + comments?: number; + commits?: number; + created_at?: string; + deletions?: number; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merge_commit_sha?: string; + mergeable?: boolean; + merged?: boolean; + merged_at?: string; + merged_by?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + number?: number; + patch_url?: string; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullUpdate { + body?: string; + state?: string; + title?: string; +} + +export type Pulls = { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + closed_at?: string; + created_at?: string; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merged_at?: string; + number?: number; + patch_url?: string; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsComment { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullsCommentPost { + body?: string; + commit_id?: string; + path?: string; + position?: number; +} + +export type PullsComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsPost { + base?: string; + body?: string; + head?: string; + title?: string; +} + +export interface PutSubscription { + created_at?: string; + ignored?: boolean; + reason?: object; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface RateLimit { + rate?: { + limit?: number; + remaining?: number; + reset?: number; + }; +} + +export type Ref = { + created_at?: string; + creator?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + description?: string; + id?: number; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export type RefStatus = { + commit_url?: string; + name?: string; + repository_url?: string; + sha?: string; + state?: string; + statuses?: { + context?: string; + created_at?: string; + description?: string; + id?: number; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; + }[]; +}[]; + +export type Refs = { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +}[]; + +export interface RefsBody { + ref?: string; + sha?: string; +} + +export interface Release { + assets?: { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +} + +export interface ReleaseCreate { + body?: string; + draft?: boolean; + name?: string; + prerelease?: boolean; + tag_name?: string; + target_commitish?: string; +} + +export type Releases = { + assets?: { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +}[]; + +export interface Repo { + clone_url?: string; + created_at?: string; + description?: string; + fork?: boolean; + forks?: number; + forks_count?: number; + full_name?: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + html_url?: string; + id?: number; + language?: string; + master_branch?: string; + mirror_url?: string; + name?: string; + open_issues?: number; + open_issues_count?: number; + organization?: Organization; + owner?: Actor; + parent?: Repo; + private?: boolean; + pushed_at?: string; + size?: number; + source?: Repo; + ssh_url?: string; + svn_url?: string; + updated_at?: string; + url?: string; + watchers?: number; + watchers_count?: number; +} + +export type RepoComments = { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface RepoCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; +} + +export interface RepoCommitBody { + author?: { + date?: string; + email?: string; + name?: string; + }; + message: string; + parents: string[]; + tree: string; +} + +export type RepoDeployments = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface RepoEdit { + description?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name?: string; + private?: boolean; +} + +export type Repos = Repo[]; + +export interface SearchCode { + items?: { + git_url?: string; + html_url?: string; + name?: string; + path?: string; + repository?: { + archive_url?: string; + assignees_url?: string; + blobs_url?: string; + branches_url?: string; + collaborators_url?: string; + comments_url?: string; + commits_url?: string; + compare_url?: string; + contents_url?: string; + contributors_url?: string; + description?: string; + downloads_url?: string; + events_url?: string; + fork?: boolean; + forks_url?: string; + full_name?: string; + git_commits_url?: string; + git_refs_url?: string; + git_tags_url?: string; + hooks_url?: string; + html_url?: string; + id?: number; + issue_comment_url?: string; + issue_events_url?: string; + issues_url?: string; + keys_url?: string; + labels_url?: string; + languages_url?: string; + merges_url?: string; + milestones_url?: string; + name?: string; + notifications_url?: string; + owner?: Actor; + private?: boolean; + pulls_url?: string; + stargazers_url?: string; + statuses_url?: string; + subscribers_url?: string; + subscription_url?: string; + tags_url?: string; + teams_url?: string; + trees_url?: string; + url?: string; + }; + score?: number; + sha?: string; + url?: string; + }[]; + total_count?: number; +} + +export interface SearchIssues { + items?: { + assignee?: any; + body?: string; + closed_at?: any; + comments?: number; + comments_url?: string; + created_at?: string; + events_url?: string; + html_url?: string; + id?: number; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + labels_url?: string; + milestone?: any; + number?: number; + pull_request?: { + diff_url?: any; + html_url?: any; + patch_url?: any; + }; + score?: number; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }[]; + total_count?: number; +} + +export interface SearchIssuesByKeyword { + issues?: { + body?: string; + comments?: number; + created_at?: string; + gravatar_id?: string; + html_url?: string; + labels?: string[]; + number?: number; + position?: number; + state?: string; + title?: string; + updated_at?: string; + user?: string; + votes?: number; + }[]; +} + +export interface SearchRepositories { + items?: Repo[]; + total_count?: number; +} + +export interface SearchRepositoriesByKeyword { + repositories?: Repo[]; +} + +export interface SearchUserByEmail { + user?: User; +} + +export interface SearchUsers { + items?: Users; + total_count?: number; +} + +export interface SearchUsersByKeyword { + users?: Users; +} + +export interface Subscription { + created_at?: string; + ignored?: boolean; + reason?: string; + repository_url?: string; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface SubscriptionBody { + ignored?: boolean; + subscribed?: boolean; +} + +export interface Tag { + message?: string; + object?: { + sha?: string; + type?: "commit" | "tree" | "blob"; + url?: string; + }; + sha?: string; + tag?: string; + tagger?: { + date?: string; + email?: string; + name?: string; + }; + url?: string; +} + +export interface TagBody { + message: string; + object: string; + tag: string; + tagger: { + date?: string; + email?: string; + name?: string; + }; + type: "commit" | "tree" | "blob"; +} + +export type Tags = Tag[]; + +export interface Team { + id?: number; + members_count?: number; + name?: string; + permission?: string; + repos_count?: number; + url?: string; +} + +export interface TeamMembership { + state?: string; + url?: string; +} + +export type TeamRepos = Repos; + +export type Teams = { + id?: number; + name?: string; + url?: string; +}[]; + +export type TeamsList = { + id?: number; + members_count?: number; + name?: string; + organization?: { + avatar_url?: string; + id?: number; + login?: string; + url?: string; + }; + permission?: string; + repos_count?: number; + url?: string; +}[]; + +export interface Tree { + sha?: string; + tree?: { + mode?: "100644" | "100755" | "040000" | "160000" | "120000"; + path?: string; + sha?: string; + size?: number; + type?: "blob" | "tree" | "commit"; + url?: string; + }[]; + url?: string; +} + +export interface Trees { + base_tree?: string; + sha?: string; + tree?: Tree[]; + url?: string; +} + +export type User = Actor; + +export type UserEmails = string[]; + +export interface UserKeysKeyId { + id?: number; + key?: string; + title?: string; + url?: string; +} + +export interface UserKeysPost { + key?: string; + title?: string; +} + +export interface UserUpdate { + bio?: string; + blog?: string; + company?: string; + email?: string; + hireable?: boolean; + location?: string; + name?: string; +} + +export type Users = User[]; + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title GitHub + * @version v3 + */ +export class Api extends HttpClient { + someop = { + /** + * No description + * + * @tags someop + * @name SomeOp1 + * @request POST:/someop + */ + someOp1: ( + data: Events, + query?: { + queryParam1?: number; + queryParam2?: number; + queryParam3?: string[]; + queryParamBar3?: number; + fooBarBaz?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags someop + * @name SomeOp + * @request POST:/someop/{fooId}/bars/bar-bar + */ + someOp: ( + fooId: string, + data: Events, + query?: { + page?: number; + size?: number; + sort?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop/${fooId}/bars/bar-bar`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + }; + emojis = { + /** + * No description + * + * @name EmojisList + * @request GET:/emojis + */ + emojisList: (params: RequestParams = {}) => + this.request({ + path: `/emojis`, + method: "GET", + format: "json", + ...params, + }), + }; + events = { + /** + * No description + * + * @name EventsList + * @request GET:/events + */ + eventsList: (params: RequestParams = {}) => + this.request({ + path: `/events`, + method: "GET", + format: "json", + ...params, + }), + }; + feeds = { + /** + * No description + * + * @name FeedsList + * @request GET:/feeds + */ + feedsList: (params: RequestParams = {}) => + this.request({ + path: `/feeds`, + method: "GET", + format: "json", + ...params, + }), + }; + gists = { + /** + * No description + * + * @name GistsList + * @request GET:/gists + */ + gistsList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsCreate + * @request POST:/gists + */ + gistsCreate: (body: PostGist, params: RequestParams = {}) => + this.request({ + path: `/gists`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicList + * @request GET:/gists/public + */ + publicList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/public`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/gists/starred + */ + starredList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsDelete + * @request DELETE:/gists/{id} + */ + gistsDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/gists/{id} + */ + gistsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsPartialUpdate + * @request PATCH:/gists/{id} + */ + gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/gists/{id}/comments + */ + commentsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsCreate + * @request POST:/gists/{id}/comments + */ + commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/gists/{id}/comments/{commentId} + */ + commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/gists/{id}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/gists/{id}/comments/{commentId} + */ + commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/gists/{id}/forks + */ + forksCreate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/forks`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name StarDelete + * @request DELETE:/gists/{id}/star + */ + starDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarDetail + * @request GET:/gists/{id}/star + */ + starDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarUpdate + * @request PUT:/gists/{id}/star + */ + starUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "PUT", + ...params, + }), + }; + gitignore = { + /** + * No description + * + * @name TemplatesList + * @request GET:/gitignore/templates + */ + templatesList: (params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TemplatesDetail + * @request GET:/gitignore/templates/{language} + */ + templatesDetail: (language: string, params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates/${language}`, + method: "GET", + format: "json", + ...params, + }), + }; + issues = { + /** + * No description + * + * @name IssuesList + * @request GET:/issues + */ + issuesList: ( + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + legacy = { + /** + * No description + * + * @name IssuesSearchDetail + * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} + */ + issuesSearchDetail: ( + keyword: string, + state: "open" | "closed", + owner: string, + repository: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposSearchDetail + * @request GET:/legacy/repos/search/{keyword} + */ + reposSearchDetail: ( + keyword: string, + query?: { + language?: string; + order?: "desc" | "asc"; + sort?: "updated" | "stars" | "forks"; + start_page?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/repos/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserEmailDetail + * @request GET:/legacy/user/email/{email} + */ + userEmailDetail: (email: string, params: RequestParams = {}) => + this.request({ + path: `/legacy/user/email/${email}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserSearchDetail + * @request GET:/legacy/user/search/{keyword} + */ + userSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + sort?: "updated" | "stars" | "forks"; + start_page?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/user/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + markdown = { + /** + * No description + * + * @name MarkdownCreate + * @request POST:/markdown + */ + markdownCreate: (body: Markdown, params: RequestParams = {}) => + this.request({ + path: `/markdown`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name PostMarkdown + * @request POST:/markdown/raw + */ + postMarkdown: (params: RequestParams = {}) => + this.request({ + path: `/markdown/raw`, + method: "POST", + type: ContentType.Text, + ...params, + }), + }; + meta = { + /** + * No description + * + * @name MetaList + * @request GET:/meta + */ + metaList: (params: RequestParams = {}) => + this.request({ + path: `/meta`, + method: "GET", + format: "json", + ...params, + }), + }; + networks = { + /** + * No description + * + * @name EventsDetail + * @request GET:/networks/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/networks/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + }; + notifications = { + /** + * No description + * + * @name NotificationsList + * @request GET:/notifications + */ + notificationsList: ( + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/notifications + */ + notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name ThreadsDetail + * @request GET:/notifications/threads/{id} + */ + threadsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsPartialUpdate + * @request PATCH:/notifications/threads/{id} + */ + threadsPartialUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "PATCH", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDelete + * @request DELETE:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDetail + * @request GET:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionUpdate + * @request PUT:/notifications/threads/{id}/subscription + */ + threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + orgs = { + /** + * No description + * + * @name OrgsDetail + * @request GET:/orgs/{org} + */ + orgsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsPartialUpdate + * @request PATCH:/orgs/{org} + */ + orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/orgs/{org}/events + */ + eventsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/orgs/{org}/issues + */ + issuesDetail: ( + org: string, + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/orgs/{org}/members + */ + membersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/orgs/{org}/members/{username} + */ + membersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/orgs/{org}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail + * @request GET:/orgs/{org}/public_members + */ + publicMembersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDelete + * @request DELETE:/orgs/{org}/public_members/{username} + */ + publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail2 + * @request GET:/orgs/{org}/public_members/{username} + * @originalName publicMembersDetail + * @duplicate + */ + publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersUpdate + * @request PUT:/orgs/{org}/public_members/{username} + */ + publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/orgs/{org}/repos + */ + reposDetail: ( + org: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/orgs/{org}/repos + */ + reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/orgs/{org}/teams + */ + teamsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsCreate + * @request POST:/orgs/{org}/teams + */ + teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + rateLimit = { + /** + * No description + * + * @name RateLimitList + * @request GET:/rate_limit + */ + rateLimitList: (params: RequestParams = {}) => + this.request({ + path: `/rate_limit`, + method: "GET", + format: "json", + ...params, + }), + }; + repos = { + /** + * No description + * + * @name ReposDelete + * @request DELETE:/repos/{owner}/{repo} + */ + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/repos/{owner}/{repo} + */ + reposDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposPartialUpdate + * @request PATCH:/repos/{owner}/{repo} + */ + reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail + * @request GET:/repos/{owner}/{repo}/assignees + */ + assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail2 + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + * @originalName assigneesDetail + * @duplicate + */ + assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees/${assignee}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail + * @request GET:/repos/{owner}/{repo}/branches + */ + branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail2 + * @request GET:/repos/{owner}/{repo}/branches/{branch} + * @originalName branchesDetail + * @duplicate + */ + branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches/${branch}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail + * @request GET:/repos/{owner}/{repo}/collaborators + */ + collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDelete + * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail2 + * @request GET:/repos/{owner}/{repo}/collaborators/{user} + * @originalName collaboratorsDetail + * @duplicate + */ + collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsUpdate + * @request PUT:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/repos/{owner}/{repo}/comments + */ + commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/repos/{owner}/{repo}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail + * @request GET:/repos/{owner}/{repo}/commits + */ + commitsDetail: ( + owner: string, + repo: string, + query?: { + author?: string; + path?: string; + sha?: string; + since?: string; + until?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsStatusDetail + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${ref}/status`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail2 + * @request GET:/repos/{owner}/{repo}/commits/{shaCode} + * @originalName commitsDetail + * @duplicate + */ + commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsDetail + * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsCreate + * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsCreate: ( + owner: string, + repo: string, + shaCode: string, + body: CommitCommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CompareDetail + * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} + */ + compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDelete + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "DELETE", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDetail + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + contentsDetail: ( + owner: string, + repo: string, + path: string, + query?: { + path?: string; + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsUpdate + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContributorsDetail + * @request GET:/repos/{owner}/{repo}/contributors + */ + contributorsDetail: ( + owner: string, + repo: string, + query: { + anon: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contributors`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsDetail + * @request GET:/repos/{owner}/{repo}/deployments + */ + deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsCreate + * @request POST:/repos/{owner}/{repo}/deployments + */ + deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesDetail + * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesCreate + * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesCreate: ( + owner: string, + repo: string, + id: number, + body: DeploymentStatusesCreate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail + * @request GET:/repos/{owner}/{repo}/downloads + */ + downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DownloadsDelete + * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} + */ + downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail2 + * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} + * @originalName downloadsDetail + * @duplicate + */ + downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/repos/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksDetail + * @request GET:/repos/{owner}/{repo}/forks + */ + forksDetail: ( + owner: string, + repo: string, + query?: { + sort?: "newes" | "oldes" | "watchers"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/repos/{owner}/{repo}/forks + */ + forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsCreate + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsDetail + * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} + */ + gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsCreate + * @request POST:/repos/{owner}/{repo}/git/commits + */ + gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsDetail + * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} + */ + gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail + * @request GET:/repos/{owner}/{repo}/git/refs + */ + gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsCreate + * @request POST:/repos/{owner}/{repo}/git/refs + */ + gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDelete + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail2 + * @request GET:/repos/{owner}/{repo}/git/refs/{ref} + * @originalName gitRefsDetail + * @duplicate + */ + gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsCreate + * @request POST:/repos/{owner}/{repo}/git/tags + */ + gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsDetail + * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} + */ + gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesCreate + * @request POST:/repos/{owner}/{repo}/git/trees + */ + gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesDetail + * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} + */ + gitTreesDetail: ( + owner: string, + repo: string, + shaCode: string, + query?: { + recursive?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDetail + * @request GET:/repos/{owner}/{repo}/hooks + */ + hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksCreate + * @request POST:/repos/{owner}/{repo}/hooks + */ + hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDelete + * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name HooksDetail2 + * @request GET:/repos/{owner}/{repo}/hooks/{hookId} + * @originalName hooksDetail + * @duplicate + */ + hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksTestsCreate + * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests + */ + hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/repos/{owner}/{repo}/issues + */ + issuesDetail: ( + owner: string, + repo: string, + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCreate + * @request POST:/repos/{owner}/{repo}/issues + */ + issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + issuesCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + since?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail2 + * @request GET:/repos/{owner}/{repo}/issues/{number} + * @originalName issuesDetail + * @duplicate + */ + issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/{number} + */ + issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/comments + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/comments + */ + issuesCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/events + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDetail + * @request GET:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsUpdate + * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "PUT", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete2 + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels/{name} + * @originalName issuesLabelsDelete + * @duplicate + */ + issuesLabelsDelete2: (owner: string, repo: string, number: number, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/repos/{owner}/{repo}/keys + */ + keysDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/repos/{owner}/{repo}/keys + */ + keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} + */ + keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail2 + * @request GET:/repos/{owner}/{repo}/keys/{keyId} + * @originalName keysDetail + * @duplicate + */ + keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail + * @request GET:/repos/{owner}/{repo}/labels + */ + labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsCreate + * @request POST:/repos/{owner}/{repo}/labels + */ + labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDelete + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail2 + * @request GET:/repos/{owner}/{repo}/labels/{name} + * @originalName labelsDetail + * @duplicate + */ + labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LanguagesDetail + * @request GET:/repos/{owner}/{repo}/languages + */ + languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/languages`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MergesCreate + * @request POST:/repos/{owner}/{repo}/merges + */ + mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/merges`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail + * @request GET:/repos/{owner}/{repo}/milestones + */ + milestonesDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "due_date" | "completeness"; + state?: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesCreate + * @request POST:/repos/{owner}/{repo}/milestones + */ + milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDelete + * @request DELETE:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail2 + * @request GET:/repos/{owner}/{repo}/milestones/{number} + * @originalName milestonesDetail + * @duplicate + */ + milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesPartialUpdate: ( + owner: string, + repo: string, + number: number, + body: MilestoneUpdate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesLabelsDetail + * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels + */ + milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsDetail + * @request GET:/repos/{owner}/{repo}/notifications + */ + notificationsDetail: ( + owner: string, + repo: string, + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/repos/{owner}/{repo}/notifications + */ + notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name PullsDetail + * @request GET:/repos/{owner}/{repo}/pulls + */ + pullsDetail: ( + owner: string, + repo: string, + query?: { + base?: string; + head?: string; + state?: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCreate + * @request POST:/repos/{owner}/{repo}/pulls + */ + pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + pullsCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + since?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/{number} + * @originalName pullsDetail + * @duplicate + */ + pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/{number} + */ + pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsCreate + * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments + */ + pullsCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: PullsCommentPost, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommitsDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits + */ + pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsFilesDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/files + */ + pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/files`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsMergeDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PullsMergeUpdate + * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReadmeDetail + * @request GET:/repos/{owner}/{repo}/readme + */ + readmeDetail: ( + owner: string, + repo: string, + query?: { + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/readme`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail + * @request GET:/repos/{owner}/{repo}/releases + */ + releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesCreate + * @request POST:/repos/{owner}/{repo}/releases + */ + releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDelete + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail + * @request GET:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsPartialUpdate: ( + owner: string, + repo: string, + id: string, + body: AssetPatch, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDelete + * @request DELETE:/repos/{owner}/{repo}/releases/{id} + */ + releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id} + * @originalName releasesDetail + * @duplicate + */ + releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/{id} + */ + releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id}/assets + * @originalName releasesAssetsDetail + * @duplicate + */ + releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}/assets`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StargazersDetail + * @request GET:/repos/{owner}/{repo}/stargazers + */ + stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stargazers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCodeFrequencyDetail + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/code_frequency`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCommitActivityDetail + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/commit_activity`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsContributorsDetail + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/contributors`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsParticipationDetail + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/participation`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsPunchCardDetail + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/punch_card`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesDetail + * @request GET:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesCreate + * @request POST:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscribersDetail + * @request GET:/repos/{owner}/{repo}/subscribers + */ + subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscribers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDelete + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDetail + * @request GET:/repos/{owner}/{repo}/subscription + */ + subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionUpdate + * @request PUT:/repos/{owner}/{repo}/subscription + */ + subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TagsDetail + * @request GET:/repos/{owner}/{repo}/tags + */ + tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/tags`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/repos/{owner}/{repo}/teams + */ + teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name WatchersDetail + * @request GET:/repos/{owner}/{repo}/watchers + */ + watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/watchers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/repos/{owner}/{repo}/{archive_format}/{path} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: ( + owner: string, + repo: string, + archiveFormat: "tarball" | "zipball", + path: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + method: "GET", + ...params, + }), + }; + repositories = { + /** + * No description + * + * @name RepositoriesList + * @request GET:/repositories + */ + repositoriesList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + search = { + /** + * No description + * + * @name CodeList + * @request GET:/search/code + */ + codeList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "indexed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/code`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/search/issues + */ + issuesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "updated" | "created" | "comments"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name RepositoriesList + * @request GET:/search/repositories + */ + repositoriesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "stars" | "forks" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersList + * @request GET:/search/users + */ + usersList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "followers" | "repositories" | "joined"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + teams = { + /** + * No description + * + * @name TeamsDelete + * @request DELETE:/teams/{teamId} + */ + teamsDelete: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/teams/{teamId} + */ + teamsDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsPartialUpdate + * @request PATCH:/teams/{teamId} + */ + teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/teams/{teamId}/members + */ + membersDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/teams/{teamId}/members/{username} + */ + membersDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/teams/{teamId}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MembersUpdate + * @request PUT:/teams/{teamId}/members/{username} + */ + membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name MembershipsDelete + * @request DELETE:/teams/{teamId}/memberships/{username} + */ + membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembershipsDetail + * @request GET:/teams/{teamId}/memberships/{username} + */ + membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembershipsUpdate + * @request PUT:/teams/{teamId}/memberships/{username} + */ + membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "PUT", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/teams/{teamId}/repos + */ + reposDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDelete + * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} + */ + reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/teams/{teamId}/repos/{owner}/{repo} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposUpdate + * @request PUT:/teams/{teamId}/repos/{owner}/{repo} + */ + reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "PUT", + ...params, + }), + }; + user = { + /** + * No description + * + * @name UserList + * @request GET:/user + */ + userList: (params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserPartialUpdate + * @request PATCH:/user + */ + userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EmailsDelete + * @request DELETE:/user/emails + */ + emailsDelete: (body: UserEmails, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "DELETE", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name EmailsList + * @request GET:/user/emails + */ + emailsList: (params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EmailsCreate + * @request POST:/user/emails + */ + emailsCreate: (body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "POST", + body: body, + ...params, + }), + + /** + * No description + * + * @name FollowersList + * @request GET:/user/followers + */ + followersList: (params: RequestParams = {}) => + this.request({ + path: `/user/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingList + * @request GET:/user/following + */ + followingList: (params: RequestParams = {}) => + this.request({ + path: `/user/following`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDelete + * @request DELETE:/user/following/{username} + */ + followingDelete: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/user/following/{username} + */ + followingDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowingUpdate + * @request PUT:/user/following/{username} + */ + followingUpdate: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/user/issues + */ + issuesList: ( + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysList + * @request GET:/user/keys + */ + keysList: (params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/user/keys + */ + keysCreate: (body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/user/keys/{keyId} + */ + keysDelete: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/user/keys/{keyId} + */ + keysDetail: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsList + * @request GET:/user/orgs + */ + orgsList: (params: RequestParams = {}) => + this.request({ + path: `/user/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposList + * @request GET:/user/repos + */ + reposList: ( + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/user/repos + */ + reposCreate: (body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/user/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/user/starred + */ + starredList: ( + query?: { + direction?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDelete + * @request DELETE:/user/starred/{owner}/{repo} + */ + starredDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/user/starred/{owner}/{repo} + */ + starredDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarredUpdate + * @request PUT:/user/starred/{owner}/{repo} + */ + starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsList + * @request GET:/user/subscriptions + */ + subscriptionsList: (params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDelete + * @request DELETE:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsUpdate + * @request PUT:/user/subscriptions/{owner}/{repo} + */ + subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name TeamsList + * @request GET:/user/teams + */ + teamsList: (params: RequestParams = {}) => + this.request({ + path: `/user/teams`, + method: "GET", + format: "json", + ...params, + }), + }; + users = { + /** + * No description + * + * @name UsersList + * @request GET:/users + */ + usersList: ( + query?: { + since?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersDetail + * @request GET:/users/{username} + */ + usersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/users/{username}/events + */ + eventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EventsOrgsDetail + * @request GET:/users/{username}/events/orgs/{org} + */ + eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events/orgs/${org}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowersDetail + * @request GET:/users/{username}/followers + */ + followersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/users/{username}/following/{targetUser} + */ + followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/following/${targetUser}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/users/{username}/gists + */ + gistsDetail: ( + username: string, + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/users/{username}/keys + */ + keysDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsDetail + * @request GET:/users/{username}/orgs + */ + orgsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsDetail + * @request GET:/users/{username}/received_events + */ + receivedEventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsPublicDetail + * @request GET:/users/{username}/received_events/public + */ + receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events/public`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/users/{username}/repos + */ + reposDetail: ( + username: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/users/{username}/starred + */ + starredDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/starred`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/users/{username}/subscriptions + */ + subscriptionsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/subscriptions`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/sortTypes/schema.json b/tests/spec/sortTypes/schema.json new file mode 100644 index 00000000..9a67b567 --- /dev/null +++ b/tests/spec/sortTypes/schema.json @@ -0,0 +1,13703 @@ +{ + "swagger":"2.0", + "schemes":[ + "https" + ], + "info":{ + "title":"GitHub", + "version":"v3" + }, + "consumes":[ + "application/json" + ], + "produces":[ + "application/json" + ], + "paths":{ + "/someop":{ + "post":{ + "tags":[ + "someop" + ], + "operationId":"someOp_1", + "parameters":[ + { + "name":"queryParam1", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"foo.bar.baz", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"queryParam2", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"query.param.bar.3", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"queryParam3", + "in":"query", + "schema":{ + "type":"array", + "items":{ + "type":"string" + } + } + } + ], + "requestBody":{ + "content":{ + "application/json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + }, + "required":true + }, + "responses":{ + "200":{ + "content":{ + "application/hal+json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + } + }, + "400":{ + + } + } + } + }, + "/emojis":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/emojis" + } + }, + "403":{ + + } + } + } + }, + "/someop/{fooId}/bars/bar-bar":{ + "post":{ + "tags":[ + "someop" + ], + "operationId":"someOp", + "parameters":[ + { + "name":"page", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"size", + "in":"query", + "schema":{ + "type":"integer" + } + }, + { + "name":"sort", + "in":"query", + "schema":{ + "type":"array", + "items":{ + "type":"string" + } + } + } + ], + "requestBody":{ + "content":{ + "application/json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + }, + "required":true + }, + "responses":{ + "200":{ + "content":{ + "application/hal+json":{ + "schema":{ + "$ref":"#/definitions/events" + } + } + } + }, + "400":{ + + } + } + } + }, + "/events":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/feeds":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/feeds" + } + }, + "403":{ + + } + } + } + }, + "/gists":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postGist" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + } + }, + "/gists/public":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/gists/starred":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/patchGist" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gist" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/comment" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/comment" + } + }, + "403":{ + + } + } + } + }, + "/gists/{id}/forks":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/gists/{id}/star":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/gitignore/templates":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/gitignore/templates/{language}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"language", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore-lang" + } + }, + "403":{ + + } + } + } + }, + "/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/legacy/issues/search/{owner}/{repository}/{state}/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"path", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repository", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-issues-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/legacy/repos/search/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"language", + "type":"string" + }, + { + "in":"query", + "name":"start_page", + "type":"string" + }, + { + "enum":[ + "updated", + "stars", + "forks" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-repositories-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/legacy/user/email/{email}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"email", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-user-by-email" + } + }, + "403":{ + + } + } + } + }, + "/legacy/user/search/{keyword}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyword", + "required":true, + "type":"string" + }, + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"start_page", + "type":"string" + }, + { + "enum":[ + "updated", + "stars", + "forks" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-users-by-keyword" + } + }, + "403":{ + + } + } + } + }, + "/markdown":{ + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/markdown" + } + } + ], + "produces":[ + "text/html" + ], + "responses":{ + "200":{ + + }, + "403":{ + + } + } + } + }, + "/markdown/raw":{ + "post":{ + "consumes":[ + "text/plain" + ], + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "produces":[ + "text/html" + ], + "responses":{ + "200":{ + + }, + "403":{ + + } + } + } + }, + "/meta":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/meta" + } + }, + "403":{ + + } + } + } + }, + "/networks/{owner}/{repo}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/notifications":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"all", + "type":"boolean" + }, + { + "in":"query", + "name":"participating", + "type":"boolean" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/notificationMarkRead" + } + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/notifications/threads/{id}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/notifications/threads/{id}/subscription":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/putSubscription" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/organization" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/patchOrg" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/organization" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/issues":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "302":{ + + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "302":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/orgs/{org}/public_members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/public_members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postRepo" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/orgs/{org}/teams":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/orgTeamsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + } + }, + "/rate_limit":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/rate_limit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/repoEdit" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/assignees":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/assignees" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/assignees/{assignee}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"assignee", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/repos/{owner}/{repo}/branches":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/branches" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/branches/{branch}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"branch", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/branch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/collaborators":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/collaborators/{user}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"user", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"query", + "name":"sha", + "type":"string" + }, + { + "in":"query", + "name":"path", + "type":"string" + }, + { + "in":"query", + "name":"author", + "type":"string" + }, + { + "in":"query", + "name":"until", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{ref}/status":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/refStatus" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/commits/{shaCode}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoComments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commitCommentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/commitComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/compare/{baseId}...{headId}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"baseId", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"headId", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/compare-commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/contents/{path}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deleteFileBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/deleteFile" + } + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"path", + "type":"string" + }, + { + "in":"query", + "name":"ref", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contents-path" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/createFileBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/createFile" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/contributors":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"anon", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/deployments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo-deployments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deployment" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/deployment-resp" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/deployments/{id}/statuses":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/deployment-statuses" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/deployment-statuses-create" + } + } + ], + "responses":{ + "201":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/downloads":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/downloads" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/downloads/{downloadId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"downloadId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"downloadId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/download" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/events" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/forks":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "newes", + "oldes", + "watchers" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/forks" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/forkBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/blobs":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/blob" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/blobs" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/blobs/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/blob" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/commits":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/repoCommitBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/gitCommit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/commits/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repoCommit" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/refs":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/refs" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/refsBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/refs/{ref}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/gitRefPatch" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/headBranch" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/tags":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/tagBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/tag" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/tags/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tag" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/trees":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/tree" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/trees" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/git/trees/{shaCode}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"shaCode", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"recursive", + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tree" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/hookBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{hookId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/hookBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/hook" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{hookId}/tests":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"hookId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/issue" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvents" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/events/{eventId}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"eventId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvent" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/issue" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issue" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/issuesComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issueEvents" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/labels":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/issues/{number}/labels/{name}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/keys":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/keys" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-keys-post" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/keys/{keyId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/labels":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/labels/{name}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"name", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/label" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/languages":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/languages" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/merges":{ + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/mergesBody" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/mergesSuccessful" + } + }, + "204":{ + + }, + "403":{ + + }, + "404":{ + "schema":{ + "$ref":"#/definitions/mergesConflict" + } + }, + "409":{ + "schema":{ + "$ref":"#/definitions/mergesConflict" + } + } + } + } + }, + "/repos/{owner}/{repo}/milestones":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "due_date", + "completeness" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/milestoneUpdate" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/milestones/{number}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/milestoneUpdate" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/milestone" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/milestones/{number}/labels":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/labels" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/notifications":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"all", + "type":"boolean" + }, + { + "in":"query", + "name":"participating", + "type":"boolean" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/notifications" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/notificationMarkRead" + } + } + ], + "responses":{ + "205":{ + + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "type":"string" + }, + { + "in":"query", + "name":"head", + "type":"string" + }, + { + "in":"query", + "name":"base", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullsPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issuesComments" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/comments/{commentId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"commentId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/commentBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullRequest" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullUpdate" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repo" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/comments":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/pullsCommentPost" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/pullsComment" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/commits":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commits" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/files":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/pulls" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{number}/merge":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"number", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/mergePullBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/merge" + } + }, + "403":{ + + }, + "405":{ + "schema":{ + "$ref":"#/definitions/merge" + } + } + } + } + }, + "/repos/{owner}/{repo}/readme":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"ref", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contents-path" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/releases" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/release-create" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/assets/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/asset" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/assetPatch" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/asset" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/release-create" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/release" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}/assets":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"id", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/assets" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stargazers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/code_frequency":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/codeFrequencyStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/commit_activity":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/commitActivityStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/contributors":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/contributorsStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/participation":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/participationStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/stats/punch_card":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/codeFrequencyStats" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/statuses/{ref}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/ref" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"ref", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/headBranch" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/ref" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/subscribers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/subscription":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/subscriptionBody" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/subscription" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/tags":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/tags" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/teams":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/watchers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/repos/{owner}/{repo}/{archive_format}/{path}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "enum":[ + "tarball", + "zipball" + ], + "in":"path", + "name":"archive_format", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"path", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "302":{ + + }, + "403":{ + + } + } + } + }, + "/repositories":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/search/code":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "indexed" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-code" + } + }, + "403":{ + + } + } + } + }, + "/search/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "updated", + "created", + "comments" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-issues" + } + }, + "403":{ + + } + } + } + }, + "/search/repositories":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "stars", + "forks", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-repositories" + } + }, + "403":{ + + } + } + } + }, + "/search/users":{ + "get":{ + "parameters":[ + { + "enum":[ + "desc", + "asc" + ], + "in":"query", + "name":"order", + "type":"string" + }, + { + "in":"query", + "name":"q", + "required":true, + "type":"string" + }, + { + "enum":[ + "followers", + "repositories", + "joined" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/search-users" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/editTeam" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/team" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/members":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/members/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "422":{ + "schema":{ + "$ref":"#/definitions/organizationAsTeamMember" + } + } + } + } + }, + "/teams/{teamId}/memberships/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamMembership" + } + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamMembership" + } + }, + "403":{ + + }, + "422":{ + "schema":{ + "$ref":"#/definitions/organizationAsTeamMember" + } + } + } + } + }, + "/teams/{teamId}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teamRepos" + } + }, + "403":{ + + } + } + } + }, + "/teams/{teamId}/repos/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"teamId", + "required":true, + "type":"integer" + }, + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/user":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + }, + "patch":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-update" + } + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + } + }, + "/user/emails":{ + "delete":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-emails" + } + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "produces":[ + "application/vnd.github.v3" + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-emails" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/emailsPost" + } + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/user/followers":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/user/following":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/user/following/{username}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/issues":{ + "get":{ + "parameters":[ + { + "enum":[ + "assigned", + "created", + "mentioned", + "subscribed", + "all" + ], + "in":"query", + "name":"filter", + "required":true, + "type":"string" + }, + { + "enum":[ + "open", + "closed" + ], + "in":"query", + "name":"state", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"labels", + "required":true, + "type":"string" + }, + { + "enum":[ + "created", + "updated", + "comments" + ], + "in":"query", + "name":"sort", + "required":true, + "type":"string" + }, + { + "enum":[ + "asc", + "desc" + ], + "in":"query", + "name":"direction", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/issues" + } + }, + "403":{ + + } + } + } + }, + "/user/keys":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/user-keys-post" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/user/keys/{keyId}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"keyId", + "required":true, + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user-keys-keyId" + } + }, + "403":{ + + } + } + } + }, + "/user/orgs":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/user/repos":{ + "get":{ + "parameters":[ + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + }, + "post":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + }, + { + "in":"body", + "name":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/postRepo" + } + } + ], + "responses":{ + "201":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/user/starred":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"direction", + "type":"string" + }, + { + "enum":[ + "created", + "updated" + ], + "in":"query", + "name":"sort", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/user/starred/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/subscriptions":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/user/subscriptions/{owner}/{repo}":{ + "delete":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + }, + "get":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + }, + "put":{ + "parameters":[ + { + "in":"path", + "name":"owner", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"repo", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + } + } + } + }, + "/user/teams":{ + "get":{ + "parameters":[ + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/teams-list" + } + }, + "403":{ + + } + } + } + }, + "/users":{ + "get":{ + "parameters":[ + { + "in":"query", + "name":"since", + "type":"integer" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/user" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/events/orgs/{org}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"org", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/followers":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/users" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/following/{targetUser}":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"path", + "name":"targetUser", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "204":{ + + }, + "403":{ + + }, + "404":{ + + } + } + } + }, + "/users/{username}/gists":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"query", + "name":"since", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gists" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/keys":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/orgs":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/gitignore" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/received_events":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/received_events/public":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/repos":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "enum":[ + "all", + "public", + "private", + "forks", + "sources", + "member" + ], + "in":"query", + "name":"type", + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "200":{ + "schema":{ + "$ref":"#/definitions/repos" + } + }, + "403":{ + + } + } + } + }, + "/users/{username}/starred":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + }, + "/users/{username}/subscriptions":{ + "get":{ + "parameters":[ + { + "in":"path", + "name":"username", + "required":true, + "type":"string" + }, + { + "in":"header", + "name":"Accept", + "type":"string" + } + ], + "responses":{ + "403":{ + + } + } + } + } + }, + "definitions":{ + "actor":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "blog":{ + "type":"string" + }, + "collaborators":{ + "type":"integer" + }, + "disk_usage":{ + "type":"integer" + }, + "followers":{ + "type":"integer" + }, + "avatar_url":{ + "type":"string" + }, + "followers_url":{ + "type":"string" + }, + "following":{ + "type":"integer" + }, + "following_url":{ + "type":"string" + }, + "bio":{ + "type":"string" + }, + "gists_url":{ + "type":"string" + }, + "hireable":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "location":{ + "type":"string" + }, + "login":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "organizations_url":{ + "type":"string" + }, + "owned_private_repos":{ + "type":"integer" + }, + "company":{ + "type":"string" + }, + "plan":{ + "properties":{ + "collaborators":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "private_repos":{ + "type":"integer" + }, + "space":{ + "type":"integer" + } + }, + "type":"object" + }, + "private_gists":{ + "type":"integer" + }, + "public_gists":{ + "type":"integer" + }, + "public_repos":{ + "type":"integer" + }, + "starred_url":{ + "type":"string" + }, + "subscriptions_url":{ + "type":"string" + }, + "total_private_repos":{ + "type":"integer" + }, + "type":{ + "enum":[ + "User", + "Organization" + ] + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "asset":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"number" + }, + "id":{ + "type":"number" + }, + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "assetPatch":{ + "properties":{ + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "assets":{ + "items":{ + "$ref":"#/definitions/asset" + }, + "type":"array" + }, + "assignees":{ + "items":{ + "$ref":"#/definitions/user" + }, + "type":"array" + }, + "blob":{ + "properties":{ + "content":{ + "type":"string" + }, + "encoding":{ + "enum":[ + "utf-8", + "base64" + ] + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + }, + "blobs":{ + "properties":{ + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "branch":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + } + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "branches":{ + "items":{ + "properties":{ + "commit":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "codeFrequencyStats":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "comment":{ + "properties":{ + "body":{ + "type":"string" + } + }, + "type":"object" + }, + "commentBody":{ + "properties":{ + "body":{ + "type":"string" + } + }, + "required":[ + "body" + ], + "type":"object" + }, + "comments":{ + "items":{ + "properties":{ + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "files":{ + "items":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "blob_url":{ + "type":"string" + }, + "changes":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "filename":{ + "type":"string" + }, + "patch":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "status":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "stats":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "total":{ + "type":"integer" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "commitActivityStats":{ + "items":{ + "properties":{ + "days":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "total":{ + "type":"integer" + }, + "week":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + }, + "commitComment":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "line":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "commitCommentBody":{ + "properties":{ + "body":{ + "type":"string" + }, + "line":{ + "type":"string" + }, + "number":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "sha":{ + "type":"string" + } + }, + "required":[ + "sha", + "body" + ], + "type":"object" + }, + "commits":{ + "items":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "compare-commits":{ + "properties":{ + "ahead_by":{ + "type":"integer" + }, + "base_commit":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "behind_by":{ + "type":"integer" + }, + "commits":{ + "items":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "diff_url":{ + "type":"string" + }, + "files":{ + "items":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "blob_url":{ + "type":"string" + }, + "changes":{ + "type":"integer" + }, + "contents_url":{ + "type":"string" + }, + "deletions":{ + "type":"integer" + }, + "filename":{ + "type":"string" + }, + "patch":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "status":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + }, + "permalink_url":{ + "type":"string" + }, + "status":{ + "type":"string" + }, + "total_commits":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "contents-path":{ + "properties":{ + "_links":{ + "properties":{ + "git":{ + "type":"string" + }, + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + }, + "encoding":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "contributorsStats":{ + "items":{ + "properties":{ + "author":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "total":{ + "type":"integer" + }, + "weeks":{ + "items":{ + "properties":{ + "a":{ + "type":"integer" + }, + "c":{ + "type":"integer" + }, + "d":{ + "type":"integer" + }, + "w":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "type":"array" + }, + "createFile":{ + "properties":{ + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "properties":{ + "_links":{ + "properties":{ + "git":{ + "type":"string" + }, + "html":{ + "type":"string" + }, + "self":{ + "type":"string" + } + }, + "type":"object" + }, + "git_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "createFileBody":{ + "properties":{ + "committer":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + }, + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "deleteFile":{ + "properties":{ + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + } + }, + "html_url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "parents":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "deleteFileBody":{ + "properties":{ + "committer":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment":{ + "properties":{ + "description":{ + "type":"string" + }, + "payload":{ + "properties":{ + "deploy_user":{ + "type":"string" + }, + "environment":{ + "type":"string" + }, + "room_id":{ + "type":"number" + } + }, + "type":"object" + }, + "ref":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment-resp":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "deployment-statuses":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "deployment-statuses-create":{ + "properties":{ + "description":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + } + }, + "type":"object" + }, + "download":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "downloads":{ + "items":{ + "$ref":"#/definitions/download" + }, + "type":"array" + }, + "editTeam":{ + "properties":{ + "name":{ + "type":"string" + }, + "permission":{ + "enum":[ + "pull", + "push", + "admin" + ] + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "emailsPost":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "emojis":{ + "additionalProperties":{ + "type":"string" + }, + "type":"object" + }, + "event":{ + "properties":{ + "actor":{ + "$ref":"#/definitions/actor" + }, + "created_at":{ + "type":"object" + }, + "id":{ + "type":"integer" + }, + "org":{ + "$ref":"#/definitions/organization" + }, + "payload":{ + "properties":{ + + }, + "type":"object" + }, + "public":{ + "type":"boolean" + }, + "repo":{ + "properties":{ + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "events":{ + "items":{ + "$ref":"#/definitions/event" + }, + "type":"array" + }, + "feeds":{ + "properties":{ + "_links":{ + "properties":{ + "current_user":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_actor":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_organization":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "current_user_public":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "timeline":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + }, + "user":{ + "properties":{ + "href":{ + "type":"string" + }, + "type":{ + "type":"string" + } + }, + "type":"object" + } + } + }, + "current_user_actor_url":{ + "type":"string" + }, + "current_user_organization_url":{ + "type":"string" + }, + "current_user_public":{ + "type":"string" + }, + "current_user_url":{ + "type":"string" + }, + "timeline_url":{ + "type":"string" + }, + "user_url":{ + "type":"string" + } + }, + "type":"object" + }, + "forkBody":{ + "properties":{ + "organization":{ + "type":"string" + } + }, + "type":"object" + }, + "forks":{ + "$ref":"#/definitions/repos" + }, + "gist":{ + "properties":{ + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "ring.erl":{ + "properties":{ + "filename":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "forks":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "git_pull_url":{ + "type":"string" + }, + "git_push_url":{ + "type":"string" + }, + "history":{ + "items":{ + "properties":{ + "change_status":{ + "properties":{ + "additions":{ + "type":"integer" + }, + "deletions":{ + "type":"integer" + }, + "total":{ + "type":"integer" + } + }, + "type":"object" + }, + "committed_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + }, + "version":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"string" + }, + "public":{ + "type":"boolean" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "gists":{ + "items":{ + "properties":{ + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "ring.erl":{ + "properties":{ + "filename":{ + "type":"string" + }, + "raw_url":{ + "type":"string" + }, + "size":{ + "type":"integer" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "git_pull_url":{ + "type":"string" + }, + "git_push_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"string" + }, + "public":{ + "type":"boolean" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "gitCommit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "type":"string" + }, + "tree":{ + "type":"string" + } + }, + "type":"object" + }, + "gitRefPatch":{ + "properties":{ + "force":{ + "type":"boolean" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "gitignore":{ + "items":{ + + }, + "type":"array" + }, + "gitignore-lang":{ + "properties":{ + "name":{ + "type":"string" + }, + "source":{ + "type":"string" + } + }, + "type":"object" + }, + "headBranch":{ + "properties":{ + "object":{ + "properties":{ + "sha":{ + "type":"string" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "ref":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "hook":{ + "items":{ + "properties":{ + "active":{ + "type":"boolean" + }, + "config":{ + "properties":{ + "content_type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "created_at":{ + "type":"string" + }, + "events":{ + "items":{ + "enum":[ + "push", + "issues", + "issue_comment", + "commit_comment", + "pull_request", + "pull_request_review_comment", + "gollum", + "watch", + "download", + "fork", + "fork_apply", + "member", + "public", + "team_add", + "status" + ] + }, + "type":"array" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "hookBody":{ + "properties":{ + "active":{ + "type":"boolean" + }, + "add_events":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "type":"object" + }, + "issue":{ + "properties":{ + "assignee":{ + "type":"string" + }, + "body":{ + "type":"string" + }, + "labels":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "milestone":{ + "type":"number" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "issueEvent":{ + "properties":{ + "actor":{ + "$ref":"#/definitions/actor" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "event":{ + "type":"string" + }, + "issue":{ + "properties":{ + "assignee":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + } + }, + "type":"object" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "issueEvents":{ + "items":{ + "$ref":"#/definitions/issueEvent" + }, + "type":"array" + }, + "issues":{ + "items":{ + "properties":{ + "assignee":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "patch_url":{ + "type":"string" + } + }, + "type":"object" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "issuesComment":{ + "properties":{ + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "issuesComments":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "keys":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "key":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "label":{ + "properties":{ + "color":{ + "maxLength":6, + "minLength":6, + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "maxLength":6, + "minLength":6, + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "languages":{ + "additionalProperties":{ + "type":"integer" + }, + "type":"object" + }, + "markdown":{ + "properties":{ + "context":{ + "type":"string" + }, + "mode":{ + "type":"string" + }, + "text":{ + "type":"string" + } + }, + "type":"object" + }, + "merge":{ + "properties":{ + "merged":{ + "type":"boolean" + }, + "message":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "mergePullBody":{ + "properties":{ + "commit_message":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesBody":{ + "properties":{ + "base":{ + "type":"string" + }, + "commit_message":{ + "type":"string" + }, + "head":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesConflict":{ + "properties":{ + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "mergesSuccessful":{ + "properties":{ + "author":{ + "$ref":"#/definitions/user" + }, + "comments_url":{ + "type":"string" + }, + "commit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "comment_count":{ + "type":"integer" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "$ref":"#/definitions/user" + }, + "merged":{ + "type":"boolean" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "meta":{ + "properties":{ + "git":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "hooks":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "type":"object" + }, + "milestone":{ + "properties":{ + "closed_issues":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "open_issues":{ + "type":"integer" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "milestoneUpdate":{ + "properties":{ + "description":{ + "type":"string" + }, + "due_on":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "notificationMarkRead":{ + "properties":{ + "last_read_at":{ + "type":"string" + } + }, + "type":"object" + }, + "notifications":{ + "properties":{ + "id":{ + "type":"integer" + }, + "last_read_at":{ + "type":"string" + }, + "reason":{ + "type":"string" + }, + "repository":{ + "properties":{ + "description":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "full_name":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "private":{ + "type":"boolean" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "subject":{ + "properties":{ + "latest_comment_url":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "type":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "unread":{ + "type":"boolean" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "orgTeamsPost":{ + "properties":{ + "name":{ + "type":"string" + }, + "permission":{ + "enum":[ + "pull", + "push", + "admin" + ] + }, + "repo_names":{ + "items":{ + "type":"string" + }, + "type":"array" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "organization":{ + "allOf":[ + { + "$ref":"#/definitions/actor" + }, + { + + } + ], + "type":"object" + }, + "organizationAsTeamMember":{ + "properties":{ + "errors":{ + "items":{ + "properties":{ + "code":{ + "type":"string" + }, + "field":{ + "type":"string" + }, + "resource":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "message":{ + "type":"string" + } + }, + "type":"object" + }, + "participationStats":{ + "properties":{ + "all":{ + "items":{ + "type":"integer" + }, + "type":"array" + }, + "owner":{ + "items":{ + "type":"integer" + }, + "type":"array" + } + }, + "type":"object" + }, + "patchGist":{ + "properties":{ + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "delete_this_file.txt":{ + "type":"string" + }, + "file1.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "new_file.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + }, + "old_name.txt":{ + "properties":{ + "content":{ + "type":"string" + }, + "filename":{ + "type":"string" + } + }, + "type":"object" + } + } + } + }, + "type":"object" + }, + "patchOrg":{ + "properties":{ + "billing_email":{ + "type":"string" + }, + "company":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "location":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "postGist":{ + "properties":{ + "description":{ + "type":"string" + }, + "files":{ + "properties":{ + "file1.txt":{ + "properties":{ + "content":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "public":{ + "type":"boolean" + } + }, + "type":"object" + }, + "postRepo":{ + "properties":{ + "auto_init":{ + "type":"boolean" + }, + "description":{ + "type":"string" + }, + "gitignore_template":{ + "type":"string" + }, + "has_downloads":{ + "type":"boolean" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "private":{ + "type":"boolean" + }, + "team_id":{ + "type":"integer" + } + }, + "required":[ + "name" + ], + "type":"object" + }, + "pullRequest":{ + "properties":{ + "_links":{ + "properties":{ + "comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "review_comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "additions":{ + "type":"integer" + }, + "base":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "changed_files":{ + "type":"integer" + }, + "closed_at":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "commits":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "deletions":{ + "type":"integer" + }, + "diff_url":{ + "type":"string" + }, + "head":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "issue_url":{ + "type":"string" + }, + "merge_commit_sha":{ + "type":"string" + }, + "mergeable":{ + "type":"boolean" + }, + "merged":{ + "type":"boolean" + }, + "merged_at":{ + "type":"string" + }, + "merged_by":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "number":{ + "type":"integer" + }, + "patch_url":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "pullUpdate":{ + "properties":{ + "body":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "pulls":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "review_comments":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "base":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "closed_at":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "diff_url":{ + "type":"string" + }, + "head":{ + "properties":{ + "label":{ + "type":"string" + }, + "ref":{ + "type":"string" + }, + "repo":{ + "$ref":"#/definitions/repo" + }, + "sha":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "html_url":{ + "type":"string" + }, + "issue_url":{ + "type":"string" + }, + "merged_at":{ + "type":"string" + }, + "number":{ + "type":"integer" + }, + "patch_url":{ + "type":"string" + }, + "state":{ + "enum":[ + "open", + "closed" + ] + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "type":"array" + }, + "pullsComment":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "pullsCommentPost":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"number" + } + }, + "type":"object" + }, + "pullsComments":{ + "items":{ + "properties":{ + "_links":{ + "properties":{ + "html":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "pull_request":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + }, + "self":{ + "properties":{ + "href":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "type":"array" + }, + "pullsPost":{ + "properties":{ + "base":{ + "type":"string" + }, + "body":{ + "type":"string" + }, + "head":{ + "type":"string" + }, + "title":{ + "type":"string" + } + }, + "type":"object" + }, + "putSubscription":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "ignored":{ + "type":"boolean" + }, + "reason":{ + "type":"object" + }, + "subscribed":{ + "type":"boolean" + }, + "thread_url":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "rate_limit":{ + "properties":{ + "rate":{ + "properties":{ + "remaining":{ + "type":"integer" + }, + "limit":{ + "type":"integer" + }, + "reset":{ + "type":"integer" + } + } + } + }, + "type":"object" + }, + "ref":{ + "items":{ + "properties":{ + "state":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "creator":{ + "properties":{ + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "avatar_url":{ + "type":"string" + }, + "gravatar_id":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "refStatus":{ + "items":{ + "properties":{ + "sha":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "commit_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "repository_url":{ + "type":"string" + }, + "statuses":{ + "items":{ + "properties":{ + "id":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "context":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "target_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "type":"array" + }, + "refs":{ + "items":{ + "properties":{ + "ref":{ + "type":"string" + }, + "object":{ + "properties":{ + "type":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "refsBody":{ + "properties":{ + "ref":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "release":{ + "properties":{ + "tarball_url":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + }, + "assets":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "label":{ + "type":"string" + }, + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "assets_url":{ + "type":"string" + }, + "author":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "prerelease":{ + "type":"boolean" + }, + "published_at":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "upload_url":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "zipball_url":{ + "type":"string" + } + }, + "type":"object" + }, + "release-create":{ + "properties":{ + "prerelease":{ + "type":"boolean" + }, + "body":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "name":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + } + }, + "type":"object" + }, + "releases":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "assets":{ + "items":{ + "properties":{ + "id":{ + "type":"integer" + }, + "content_type":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "download_count":{ + "type":"integer" + }, + "label":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "state":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "uploader":{ + "$ref":"#/definitions/user" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "assets_url":{ + "type":"string" + }, + "author":{ + "$ref":"#/definitions/user" + }, + "body":{ + "type":"string" + }, + "draft":{ + "type":"boolean" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "prerelease":{ + "type":"boolean" + }, + "published_at":{ + "type":"string" + }, + "tag_name":{ + "type":"string" + }, + "tarball_url":{ + "type":"string" + }, + "target_commitish":{ + "type":"string" + }, + "upload_url":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "zipball_url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "repo":{ + "properties":{ + "forks":{ + "type":"integer" + }, + "organization":{ + "$ref":"#/definitions/organization" + }, + "clone_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "forks_count":{ + "type":"integer" + }, + "full_name":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "has_downloads":{ + "type":"boolean" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "language":{ + "type":"string" + }, + "master_branch":{ + "type":"string" + }, + "mirror_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "open_issues":{ + "type":"integer" + }, + "open_issues_count":{ + "type":"integer" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "parent":{ + "allOf":[ + { + "$ref":"#/definitions/repo" + }, + { + + } + ] + }, + "private":{ + "type":"boolean" + }, + "pushed_at":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "source":{ + "allOf":[ + { + "$ref":"#/definitions/repo" + }, + { + } + ] + }, + "ssh_url":{ + "type":"string" + }, + "svn_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "watchers":{ + "type":"integer" + }, + "watchers_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "repo-deployments":{ + "items":{ + "properties":{ + "created_at":{ + "type":"string" + }, + "creator":{ + "$ref":"#/definitions/user" + }, + "description":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "payload":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "repoComments":{ + "items":{ + "properties":{ + "body":{ + "type":"string" + }, + "commit_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "line":{ + "type":"integer" + }, + "path":{ + "type":"string" + }, + "position":{ + "type":"integer" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + }, + "repoCommit":{ + "properties":{ + "author":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "committer":{ + "properties":{ + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "properties":{ + "url":{ + "type":"string" + }, + "sha":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "tree":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "repoCommitBody":{ + "properties":{ + "author":{ + "properties":{ + "name":{ + "type":"string" + }, + "date":{ + "type":"string" + }, + "email":{ + "type":"string" + } + }, + "type":"object" + }, + "message":{ + "type":"string" + }, + "parents":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "tree":{ + "type":"string" + } + }, + "required":[ + "message", + "parents", + "tree" + ], + "type":"object" + }, + "repoEdit":{ + "properties":{ + "has_downloads":{ + "type":"boolean" + }, + "description":{ + "type":"string" + }, + "has_issues":{ + "type":"boolean" + }, + "has_wiki":{ + "type":"boolean" + }, + "homepage":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "private":{ + "type":"boolean" + } + }, + "type":"object" + }, + "repos":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + }, + "search-code":{ + "properties":{ + "items":{ + "items":{ + "properties":{ + "html_url":{ + "type":"string" + }, + "git_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "path":{ + "type":"string" + }, + "repository":{ + "properties":{ + "comments_url":{ + "type":"string" + }, + "assignees_url":{ + "type":"string" + }, + "archive_url":{ + "type":"string" + }, + "blobs_url":{ + "type":"string" + }, + "branches_url":{ + "type":"string" + }, + "collaborators_url":{ + "type":"string" + }, + "commits_url":{ + "type":"string" + }, + "compare_url":{ + "type":"string" + }, + "contents_url":{ + "type":"string" + }, + "contributors_url":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "downloads_url":{ + "type":"string" + }, + "events_url":{ + "type":"string" + }, + "fork":{ + "type":"boolean" + }, + "forks_url":{ + "type":"string" + }, + "full_name":{ + "type":"string" + }, + "git_commits_url":{ + "type":"string" + }, + "git_refs_url":{ + "type":"string" + }, + "git_tags_url":{ + "type":"string" + }, + "hooks_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "issue_comment_url":{ + "type":"string" + }, + "issue_events_url":{ + "type":"string" + }, + "issues_url":{ + "type":"string" + }, + "keys_url":{ + "type":"string" + }, + "labels_url":{ + "type":"string" + }, + "languages_url":{ + "type":"string" + }, + "merges_url":{ + "type":"string" + }, + "milestones_url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "notifications_url":{ + "type":"string" + }, + "owner":{ + "$ref":"#/definitions/actor" + }, + "private":{ + "type":"boolean" + }, + "pulls_url":{ + "type":"string" + }, + "stargazers_url":{ + "type":"string" + }, + "statuses_url":{ + "type":"string" + }, + "subscribers_url":{ + "type":"string" + }, + "subscription_url":{ + "type":"string" + }, + "tags_url":{ + "type":"string" + }, + "teams_url":{ + "type":"string" + }, + "trees_url":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "score":{ + "type":"number" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "total_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "search-issues":{ + "properties":{ + "total_count":{ + "type":"integer" + }, + "items":{ + "items":{ + "properties":{ + "closed_at":{ + "type":"null" + }, + "body":{ + "type":"string" + }, + "assignee":{ + "type":"null" + }, + "comments":{ + "type":"integer" + }, + "comments_url":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "events_url":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "labels":{ + "items":{ + "properties":{ + "color":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "labels_url":{ + "type":"string" + }, + "milestone":{ + "type":"null" + }, + "number":{ + "type":"integer" + }, + "pull_request":{ + "properties":{ + "diff_url":{ + "type":"null" + }, + "html_url":{ + "type":"null" + }, + "patch_url":{ + "type":"null" + } + }, + "type":"object" + }, + "score":{ + "type":"number" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-issues-by-keyword":{ + "properties":{ + "issues":{ + "items":{ + "properties":{ + "gravatar_id":{ + "type":"string" + }, + "comments":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "html_url":{ + "type":"string" + }, + "labels":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "number":{ + "type":"integer" + }, + "position":{ + "type":"integer" + }, + "body":{ + "type":"string" + }, + "state":{ + "type":"string" + }, + "title":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "user":{ + "type":"string" + }, + "votes":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-repositories":{ + "properties":{ + "items":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + }, + "total_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "search-repositories-by-keyword":{ + "properties":{ + "repositories":{ + "items":{ + "$ref":"#/definitions/repo" + }, + "type":"array" + } + }, + "type":"object" + }, + "search-user-by-email":{ + "properties":{ + "user":{ + "$ref":"#/definitions/user" + } + }, + "type":"object" + }, + "search-users":{ + "properties":{ + "total_count":{ + "type":"integer" + }, + "items":{ + "$ref":"#/definitions/users" + } + }, + "type":"object" + }, + "search-users-by-keyword":{ + "properties":{ + "users":{ + "$ref":"#/definitions/users" + } + }, + "type":"object" + }, + "subscription":{ + "properties":{ + "thread_url":{ + "type":"string" + }, + "ignored":{ + "type":"boolean" + }, + "reason":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "repository_url":{ + "type":"string" + }, + "subscribed":{ + "type":"boolean" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "subscriptionBody":{ + "properties":{ + "subscribed":{ + "type":"boolean" + }, + "ignored":{ + "type":"boolean" + } + }, + "type":"object" + }, + "tag":{ + "properties":{ + "url":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "object":{ + "properties":{ + "sha":{ + "type":"string" + }, + "type":{ + "enum":[ + "commit", + "tree", + "blob" + ] + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "sha":{ + "type":"string" + }, + "tag":{ + "type":"string" + }, + "tagger":{ + "properties":{ + "email":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "date":{ + "type":"string" + } + }, + "type":"object" + } + }, + "type":"object" + }, + "tagBody":{ + "properties":{ + "tag":{ + "type":"string" + }, + "message":{ + "type":"string" + }, + "object":{ + "type":"string" + }, + "tagger":{ + "properties":{ + "email":{ + "type":"string" + }, + "date":{ + "type":"string" + }, + "name":{ + "type":"string" + } + }, + "type":"object" + }, + "type":{ + "enum":[ + "commit", + "tree", + "blob" + ] + } + }, + "required":[ + "tag", + "message", + "object", + "type", + "tagger" + ], + "type":"object" + }, + "tags":{ + "items":{ + "$ref":"#/definitions/tag" + }, + "type":"array" + }, + "team":{ + "properties":{ + "name":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "members_count":{ + "type":"integer" + }, + "permission":{ + "type":"string" + }, + "repos_count":{ + "type":"integer" + } + }, + "type":"object" + }, + "teamMembership":{ + "properties":{ + "url":{ + "type":"string" + }, + "state":{ + "type":"string" + } + }, + "type":"object" + }, + "teamRepos":{ + "$ref":"#/definitions/repos" + }, + "teams":{ + "items":{ + "properties":{ + "url":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "id":{ + "type":"integer" + } + }, + "type":"object" + }, + "type":"array" + }, + "teams-list":{ + "items":{ + "properties":{ + "repos_count":{ + "type":"integer" + }, + "members_count":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "organization":{ + "properties":{ + "avatar_url":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "login":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "permission":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "tree":{ + "properties":{ + "tree":{ + "items":{ + "properties":{ + "mode":{ + "enum":[ + "100644", + "100755", + "040000", + "160000", + "120000" + ], + "type":"string" + }, + "path":{ + "type":"string" + }, + "sha":{ + "type":"string" + }, + "size":{ + "type":"integer" + }, + "type":{ + "enum":[ + "blob", + "tree", + "commit" + ], + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "type":"array" + }, + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "trees":{ + "properties":{ + "sha":{ + "type":"string" + }, + "url":{ + "type":"string" + }, + "tree":{ + "items":{ + "$ref":"#/definitions/tree" + }, + "type":"array" + }, + "base_tree":{ + "type":"string" + } + }, + "type":"object" + }, + "user":{ + "allOf":[ + { + "$ref":"#/definitions/actor" + }, + { + + } + ], + "type":"object" + }, + "user-emails":{ + "items":{ + "type":"string" + }, + "type":"array" + }, + "user-keys-keyId":{ + "properties":{ + "title":{ + "type":"string" + }, + "key":{ + "type":"string" + }, + "id":{ + "type":"integer" + }, + "url":{ + "type":"string" + } + }, + "type":"object" + }, + "user-keys-post":{ + "properties":{ + "title":{ + "type":"string" + }, + "key":{ + "type":"string" + } + }, + "type":"object" + }, + "user-update":{ + "properties":{ + "company":{ + "type":"string" + }, + "blog":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "location":{ + "type":"string" + }, + "hireable":{ + "type":"boolean" + }, + "name":{ + "type":"string" + }, + "bio":{ + "type":"string" + } + }, + "type":"object" + }, + "users":{ + "items":{ + "$ref":"#/definitions/user" + }, + "type":"array" + } + } +} \ No newline at end of file diff --git a/tests/spec/sortTypes/schema.ts b/tests/spec/sortTypes/schema.ts new file mode 100644 index 00000000..10eb562a --- /dev/null +++ b/tests/spec/sortTypes/schema.ts @@ -0,0 +1,5889 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Actor { + avatar_url?: string; + bio?: string; + blog?: string; + collaborators?: number; + company?: string; + created_at?: string; + disk_usage?: number; + email?: string; + followers?: number; + followers_url?: string; + following?: number; + following_url?: string; + gists_url?: string; + gravatar_id?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + login?: string; + name?: string; + organizations_url?: string; + owned_private_repos?: number; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + updated_at?: string; + url?: string; +} + +export interface Asset { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; +} + +export interface AssetPatch { + label?: string; + name: string; +} + +export type Assets = Asset[]; + +export type Assignees = User[]; + +export interface Blob { + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; +} + +export interface Blobs { + sha?: string; +} + +export interface Branch { + _links?: { + html?: string; + self?: string; + }; + commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + name?: string; +} + +export type Branches = { + commit?: { + sha?: string; + url?: string; + }; + name?: string; +}[]; + +export type CodeFrequencyStats = number[]; + +export interface Comment { + body?: string; +} + +export interface CommentBody { + body: string; +} + +export type Comments = { + body?: string; + created_at?: string; + id?: number; + url?: string; + user?: User; +}[]; + +export interface Commit { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + status?: string; + }[]; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + url?: string; +} + +export type CommitActivityStats = { + days?: number[]; + total?: number; + week?: number; +}[]; + +export interface CommitComment { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export interface CommitCommentBody { + body: string; + line?: string; + number?: string; + path?: string; + position?: number; + sha: string; +} + +export type Commits = { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +}[]; + +export interface CompareCommits { + ahead_by?: number; + base_commit?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }; + behind_by?: number; + commits?: { + author?: User; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; + }[]; + diff_url?: string; + files?: { + additions?: number; + blob_url?: string; + changes?: number; + contents_url?: string; + deletions?: number; + filename?: string; + patch?: string; + raw_url?: string; + sha?: string; + status?: string; + }[]; + html_url?: string; + patch_url?: string; + permalink_url?: string; + status?: string; + total_commits?: number; + url?: string; +} + +export interface ContentsPath { + _links?: { + git?: string; + html?: string; + self?: string; + }; + content?: string; + encoding?: string; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; +} + +export type ContributorsStats = { + author?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + total?: number; + weeks?: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +}[]; + +export interface CreateFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: { + _links?: { + git?: string; + html?: string; + self?: string; + }; + git_url?: string; + html_url?: string; + name?: string; + path?: string; + sha?: string; + size?: number; + type?: string; + url?: string; + }; +} + +export interface CreateFileBody { + committer?: { + email?: string; + name?: string; + }; + content?: string; + message?: string; +} + +export interface DeleteFile { + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + content?: string; +} + +export interface DeleteFileBody { + committer?: { + email?: string; + name?: string; + }; + message?: string; + sha?: string; +} + +export interface Deployment { + description?: string; + payload?: { + deploy_user?: string; + environment?: string; + room_id?: number; + }; + ref?: string; +} + +export interface DeploymentResp { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +} + +export type DeploymentStatuses = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface DeploymentStatusesCreate { + description?: string; + state?: string; + target_url?: string; +} + +export interface Download { + content_type?: string; + description?: string; + download_count?: number; + html_url?: string; + id?: number; + name?: string; + size?: number; + url?: string; +} + +export type Downloads = Download[]; + +export interface EditTeam { + name: string; + permission?: "pull" | "push" | "admin"; +} + +export type EmailsPost = string[]; + +export type Emojis = Record; + +export interface Event { + actor?: Actor; + created_at?: object; + id?: number; + org?: Organization; + payload?: object; + public?: boolean; + repo?: { + id?: number; + name?: string; + url?: string; + }; + type?: string; +} + +export type Events = Event[]; + +export interface Feeds { + _links?: { + current_user?: { + href?: string; + type?: string; + }; + current_user_actor?: { + href?: string; + type?: string; + }; + current_user_organization?: { + href?: string; + type?: string; + }; + current_user_public?: { + href?: string; + type?: string; + }; + timeline?: { + href?: string; + type?: string; + }; + user?: { + href?: string; + type?: string; + }; + }; + current_user_actor_url?: string; + current_user_organization_url?: string; + current_user_public?: string; + current_user_url?: string; + timeline_url?: string; + user_url?: string; +} + +export interface ForkBody { + organization?: string; +} + +export type Forks = Repos; + +export interface Gist { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + forks?: { + created_at?: string; + url?: string; + user?: User; + }[]; + git_pull_url?: string; + git_push_url?: string; + history?: { + change_status?: { + additions?: number; + deletions?: number; + total?: number; + }; + committed_at?: string; + url?: string; + user?: User; + version?: string; + }[]; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +} + +export type Gists = { + comments?: number; + comments_url?: string; + created_at?: string; + description?: string; + files?: { + "ring.erl"?: { + filename?: string; + raw_url?: string; + size?: number; + }; + }; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + public?: boolean; + url?: string; + user?: User; +}[]; + +export interface GitCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: string; + tree?: string; +} + +export interface GitRefPatch { + force?: boolean; + sha?: string; +} + +export type Gitignore = any[]; + +export interface GitignoreLang { + name?: string; + source?: string; +} + +export interface HeadBranch { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +} + +export type Hook = { + active?: boolean; + config?: { + content_type?: string; + url?: string; + }; + created_at?: string; + events?: ( + | "push" + | "issues" + | "issue_comment" + | "commit_comment" + | "pull_request" + | "pull_request_review_comment" + | "gollum" + | "watch" + | "download" + | "fork" + | "fork_apply" + | "member" + | "public" + | "team_add" + | "status" + )[]; + id?: number; + name?: string; + updated_at?: string; + url?: string; +}[]; + +export interface HookBody { + active?: boolean; + add_events?: string[]; +} + +export interface Issue { + assignee?: string; + body?: string; + labels?: string[]; + milestone?: number; + title?: string; +} + +export interface IssueEvent { + actor?: Actor; + commit_id?: string; + created_at?: string; + event?: string; + issue?: { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }; + url?: string; +} + +export type IssueEvents = IssueEvent[]; + +export type Issues = { + assignee?: User; + body?: string; + closed_at?: string; + comments?: number; + created_at?: string; + html_url?: string; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + milestone?: { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; + }; + number?: number; + pull_request?: { + diff_url?: string; + html_url?: string; + patch_url?: string; + }; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface IssuesComment { + body?: string; + created_at?: string; + html_url?: string; + id?: number; + updated_at?: string; + url?: string; + user?: User; +} + +export type IssuesComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export type Keys = { + id?: number; + key?: string; + title?: string; + url?: string; +}[]; + +export interface Label { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +} + +export type Labels = { + /** + * @minLength 6 + * @maxLength 6 + */ + color?: string; + name?: string; + url?: string; +}[]; + +export type Languages = Record; + +export interface Markdown { + context?: string; + mode?: string; + text?: string; +} + +export interface Merge { + merged?: boolean; + message?: string; + sha?: string; +} + +export interface MergePullBody { + commit_message?: string; +} + +export interface MergesBody { + base?: string; + commit_message?: string; + head?: string; +} + +export interface MergesConflict { + message?: string; +} + +export interface MergesSuccessful { + author?: User; + comments_url?: string; + commit?: { + author?: { + date?: string; + email?: string; + name?: string; + }; + comment_count?: number; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + }; + committer?: User; + merged?: boolean; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + url?: string; +} + +export interface Meta { + git?: string[]; + hooks?: string[]; +} + +export interface Milestone { + closed_issues?: number; + created_at?: string; + creator?: User; + description?: string; + due_on?: string; + number?: number; + open_issues?: number; + state?: "open" | "closed"; + title?: string; + url?: string; +} + +export interface MilestoneUpdate { + description?: string; + due_on?: string; + state?: string; + title?: string; +} + +export interface NotificationMarkRead { + last_read_at?: string; +} + +export interface Notifications { + id?: number; + last_read_at?: string; + reason?: string; + repository?: { + description?: string; + fork?: boolean; + full_name?: string; + html_url?: string; + id?: number; + name?: string; + owner?: Actor; + private?: boolean; + url?: string; + }; + subject?: { + latest_comment_url?: string; + title?: string; + type?: string; + url?: string; + }; + unread?: boolean; + updated_at?: string; + url?: string; +} + +export interface OrgTeamsPost { + name: string; + permission?: "pull" | "push" | "admin"; + repo_names?: string[]; +} + +export type Organization = Actor; + +export interface OrganizationAsTeamMember { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +} + +export interface ParticipationStats { + all?: number[]; + owner?: number[]; +} + +export interface PatchGist { + description?: string; + files?: { + "delete_this_file.txt"?: string; + "file1.txt"?: { + content?: string; + }; + "new_file.txt"?: { + content?: string; + }; + "old_name.txt"?: { + content?: string; + filename?: string; + }; + }; +} + +export interface PatchOrg { + billing_email?: string; + company?: string; + email?: string; + location?: string; + name?: string; +} + +export interface PostGist { + description?: string; + files?: { + "file1.txt"?: { + content?: string; + }; + }; + public?: boolean; +} + +export interface PostRepo { + auto_init?: boolean; + description?: string; + gitignore_template?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name: string; + private?: boolean; + team_id?: number; +} + +export interface PullRequest { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + additions?: number; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + changed_files?: number; + closed_at?: string; + comments?: number; + commits?: number; + created_at?: string; + deletions?: number; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merge_commit_sha?: string; + mergeable?: boolean; + merged?: boolean; + merged_at?: string; + merged_by?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + number?: number; + patch_url?: string; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullUpdate { + body?: string; + state?: string; + title?: string; +} + +export type Pulls = { + _links?: { + comments?: { + href?: string; + }; + html?: { + href?: string; + }; + review_comments?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + base?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + body?: string; + closed_at?: string; + created_at?: string; + diff_url?: string; + head?: { + label?: string; + ref?: string; + repo?: Repo; + sha?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + }; + html_url?: string; + issue_url?: string; + merged_at?: string; + number?: number; + patch_url?: string; + state?: "open" | "closed"; + title?: string; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsComment { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +} + +export interface PullsCommentPost { + body?: string; + commit_id?: string; + path?: string; + position?: number; +} + +export type PullsComments = { + _links?: { + html?: { + href?: string; + }; + pull_request?: { + href?: string; + }; + self?: { + href?: string; + }; + }; + body?: string; + commit_id?: string; + created_at?: string; + id?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; +}[]; + +export interface PullsPost { + base?: string; + body?: string; + head?: string; + title?: string; +} + +export interface PutSubscription { + created_at?: string; + ignored?: boolean; + reason?: object; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface RateLimit { + rate?: { + limit?: number; + remaining?: number; + reset?: number; + }; +} + +export type Ref = { + created_at?: string; + creator?: { + avatar_url?: string; + gravatar_id?: string; + id?: number; + login?: string; + url?: string; + }; + description?: string; + id?: number; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; +}[]; + +export type RefStatus = { + commit_url?: string; + name?: string; + repository_url?: string; + sha?: string; + state?: string; + statuses?: { + context?: string; + created_at?: string; + description?: string; + id?: number; + state?: string; + target_url?: string; + updated_at?: string; + url?: string; + }[]; +}[]; + +export type Refs = { + object?: { + sha?: string; + type?: string; + url?: string; + }; + ref?: string; + url?: string; +}[]; + +export interface RefsBody { + ref?: string; + sha?: string; +} + +export interface Release { + assets?: { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +} + +export interface ReleaseCreate { + body?: string; + draft?: boolean; + name?: string; + prerelease?: boolean; + tag_name?: string; + target_commitish?: string; +} + +export type Releases = { + assets?: { + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + uploader?: User; + url?: string; + }[]; + assets_url?: string; + author?: User; + body?: string; + created_at?: string; + draft?: boolean; + html_url?: string; + id?: number; + name?: string; + prerelease?: boolean; + published_at?: string; + tag_name?: string; + tarball_url?: string; + target_commitish?: string; + upload_url?: string; + url?: string; + zipball_url?: string; +}[]; + +export interface Repo { + clone_url?: string; + created_at?: string; + description?: string; + fork?: boolean; + forks?: number; + forks_count?: number; + full_name?: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + html_url?: string; + id?: number; + language?: string; + master_branch?: string; + mirror_url?: string; + name?: string; + open_issues?: number; + open_issues_count?: number; + organization?: Organization; + owner?: Actor; + parent?: Repo; + private?: boolean; + pushed_at?: string; + size?: number; + source?: Repo; + ssh_url?: string; + svn_url?: string; + updated_at?: string; + url?: string; + watchers?: number; + watchers_count?: number; +} + +export type RepoComments = { + body?: string; + commit_id?: string; + created_at?: string; + html_url?: string; + id?: number; + line?: number; + path?: string; + position?: number; + updated_at?: string; + url?: string; + user?: User; +}[]; + +export interface RepoCommit { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + message?: string; + parents?: { + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; +} + +export interface RepoCommitBody { + author?: { + date?: string; + email?: string; + name?: string; + }; + message: string; + parents: string[]; + tree: string; +} + +export type RepoDeployments = { + created_at?: string; + creator?: User; + description?: string; + id?: number; + payload?: string; + sha?: string; + statuses_url?: string; + updated_at?: string; + url?: string; +}[]; + +export interface RepoEdit { + description?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_wiki?: boolean; + homepage?: string; + name?: string; + private?: boolean; +} + +export type Repos = Repo[]; + +export interface SearchCode { + items?: { + git_url?: string; + html_url?: string; + name?: string; + path?: string; + repository?: { + archive_url?: string; + assignees_url?: string; + blobs_url?: string; + branches_url?: string; + collaborators_url?: string; + comments_url?: string; + commits_url?: string; + compare_url?: string; + contents_url?: string; + contributors_url?: string; + description?: string; + downloads_url?: string; + events_url?: string; + fork?: boolean; + forks_url?: string; + full_name?: string; + git_commits_url?: string; + git_refs_url?: string; + git_tags_url?: string; + hooks_url?: string; + html_url?: string; + id?: number; + issue_comment_url?: string; + issue_events_url?: string; + issues_url?: string; + keys_url?: string; + labels_url?: string; + languages_url?: string; + merges_url?: string; + milestones_url?: string; + name?: string; + notifications_url?: string; + owner?: Actor; + private?: boolean; + pulls_url?: string; + stargazers_url?: string; + statuses_url?: string; + subscribers_url?: string; + subscription_url?: string; + tags_url?: string; + teams_url?: string; + trees_url?: string; + url?: string; + }; + score?: number; + sha?: string; + url?: string; + }[]; + total_count?: number; +} + +export interface SearchIssues { + items?: { + assignee?: any; + body?: string; + closed_at?: any; + comments?: number; + comments_url?: string; + created_at?: string; + events_url?: string; + html_url?: string; + id?: number; + labels?: { + color?: string; + name?: string; + url?: string; + }[]; + labels_url?: string; + milestone?: any; + number?: number; + pull_request?: { + diff_url?: any; + html_url?: any; + patch_url?: any; + }; + score?: number; + state?: string; + title?: string; + updated_at?: string; + url?: string; + user?: User; + }[]; + total_count?: number; +} + +export interface SearchIssuesByKeyword { + issues?: { + body?: string; + comments?: number; + created_at?: string; + gravatar_id?: string; + html_url?: string; + labels?: string[]; + number?: number; + position?: number; + state?: string; + title?: string; + updated_at?: string; + user?: string; + votes?: number; + }[]; +} + +export interface SearchRepositories { + items?: Repo[]; + total_count?: number; +} + +export interface SearchRepositoriesByKeyword { + repositories?: Repo[]; +} + +export interface SearchUserByEmail { + user?: User; +} + +export interface SearchUsers { + items?: Users; + total_count?: number; +} + +export interface SearchUsersByKeyword { + users?: Users; +} + +export interface Subscription { + created_at?: string; + ignored?: boolean; + reason?: string; + repository_url?: string; + subscribed?: boolean; + thread_url?: string; + url?: string; +} + +export interface SubscriptionBody { + ignored?: boolean; + subscribed?: boolean; +} + +export interface Tag { + message?: string; + object?: { + sha?: string; + type?: "commit" | "tree" | "blob"; + url?: string; + }; + sha?: string; + tag?: string; + tagger?: { + date?: string; + email?: string; + name?: string; + }; + url?: string; +} + +export interface TagBody { + message: string; + object: string; + tag: string; + tagger: { + date?: string; + email?: string; + name?: string; + }; + type: "commit" | "tree" | "blob"; +} + +export type Tags = Tag[]; + +export interface Team { + id?: number; + members_count?: number; + name?: string; + permission?: string; + repos_count?: number; + url?: string; +} + +export interface TeamMembership { + state?: string; + url?: string; +} + +export type TeamRepos = Repos; + +export type Teams = { + id?: number; + name?: string; + url?: string; +}[]; + +export type TeamsList = { + id?: number; + members_count?: number; + name?: string; + organization?: { + avatar_url?: string; + id?: number; + login?: string; + url?: string; + }; + permission?: string; + repos_count?: number; + url?: string; +}[]; + +export interface Tree { + sha?: string; + tree?: { + mode?: "100644" | "100755" | "040000" | "160000" | "120000"; + path?: string; + sha?: string; + size?: number; + type?: "blob" | "tree" | "commit"; + url?: string; + }[]; + url?: string; +} + +export interface Trees { + base_tree?: string; + sha?: string; + tree?: Tree[]; + url?: string; +} + +export type User = Actor; + +export type UserEmails = string[]; + +export interface UserKeysKeyId { + id?: number; + key?: string; + title?: string; + url?: string; +} + +export interface UserKeysPost { + key?: string; + title?: string; +} + +export interface UserUpdate { + bio?: string; + blog?: string; + company?: string; + email?: string; + hireable?: boolean; + location?: string; + name?: string; +} + +export type Users = User[]; + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : `${property}`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + }, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title GitHub + * @version v3 + */ +export class Api extends HttpClient { + someop = { + /** + * No description + * + * @tags someop + * @name SomeOp1 + * @request POST:/someop + */ + someOp1: ( + data: Events, + query?: { + queryParam1?: number; + queryParam2?: number; + queryParam3?: string[]; + queryParamBar3?: number; + fooBarBaz?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags someop + * @name SomeOp + * @request POST:/someop/{fooId}/bars/bar-bar + */ + someOp: ( + fooId: string, + data: Events, + query?: { + page?: number; + size?: number; + sort?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/someop/${fooId}/bars/bar-bar`, + method: "POST", + query: query, + body: data, + format: "json", + ...params, + }), + }; + emojis = { + /** + * No description + * + * @name EmojisList + * @request GET:/emojis + */ + emojisList: (params: RequestParams = {}) => + this.request({ + path: `/emojis`, + method: "GET", + format: "json", + ...params, + }), + }; + events = { + /** + * No description + * + * @name EventsList + * @request GET:/events + */ + eventsList: (params: RequestParams = {}) => + this.request({ + path: `/events`, + method: "GET", + format: "json", + ...params, + }), + }; + feeds = { + /** + * No description + * + * @name FeedsList + * @request GET:/feeds + */ + feedsList: (params: RequestParams = {}) => + this.request({ + path: `/feeds`, + method: "GET", + format: "json", + ...params, + }), + }; + gists = { + /** + * No description + * + * @name GistsList + * @request GET:/gists + */ + gistsList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsCreate + * @request POST:/gists + */ + gistsCreate: (body: PostGist, params: RequestParams = {}) => + this.request({ + path: `/gists`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicList + * @request GET:/gists/public + */ + publicList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/public`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/gists/starred + */ + starredList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/gists/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsDelete + * @request DELETE:/gists/{id} + */ + gistsDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/gists/{id} + */ + gistsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GistsPartialUpdate + * @request PATCH:/gists/{id} + */ + gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/gists/{id}/comments + */ + commentsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsCreate + * @request POST:/gists/{id}/comments + */ + commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/gists/{id}/comments/{commentId} + */ + commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/gists/{id}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/gists/{id}/comments/{commentId} + */ + commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/comments/${commentId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/gists/{id}/forks + */ + forksCreate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/forks`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name StarDelete + * @request DELETE:/gists/{id}/star + */ + starDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarDetail + * @request GET:/gists/{id}/star + */ + starDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarUpdate + * @request PUT:/gists/{id}/star + */ + starUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/gists/${id}/star`, + method: "PUT", + ...params, + }), + }; + gitignore = { + /** + * No description + * + * @name TemplatesList + * @request GET:/gitignore/templates + */ + templatesList: (params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TemplatesDetail + * @request GET:/gitignore/templates/{language} + */ + templatesDetail: (language: string, params: RequestParams = {}) => + this.request({ + path: `/gitignore/templates/${language}`, + method: "GET", + format: "json", + ...params, + }), + }; + issues = { + /** + * No description + * + * @name IssuesList + * @request GET:/issues + */ + issuesList: ( + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + legacy = { + /** + * No description + * + * @name IssuesSearchDetail + * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} + */ + issuesSearchDetail: ( + keyword: string, + state: "open" | "closed", + owner: string, + repository: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposSearchDetail + * @request GET:/legacy/repos/search/{keyword} + */ + reposSearchDetail: ( + keyword: string, + query?: { + language?: string; + order?: "desc" | "asc"; + sort?: "updated" | "stars" | "forks"; + start_page?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/repos/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserEmailDetail + * @request GET:/legacy/user/email/{email} + */ + userEmailDetail: (email: string, params: RequestParams = {}) => + this.request({ + path: `/legacy/user/email/${email}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserSearchDetail + * @request GET:/legacy/user/search/{keyword} + */ + userSearchDetail: ( + keyword: string, + query?: { + order?: "desc" | "asc"; + sort?: "updated" | "stars" | "forks"; + start_page?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/legacy/user/search/${keyword}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + markdown = { + /** + * No description + * + * @name MarkdownCreate + * @request POST:/markdown + */ + markdownCreate: (body: Markdown, params: RequestParams = {}) => + this.request({ + path: `/markdown`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name PostMarkdown + * @request POST:/markdown/raw + */ + postMarkdown: (params: RequestParams = {}) => + this.request({ + path: `/markdown/raw`, + method: "POST", + type: ContentType.Text, + ...params, + }), + }; + meta = { + /** + * No description + * + * @name MetaList + * @request GET:/meta + */ + metaList: (params: RequestParams = {}) => + this.request({ + path: `/meta`, + method: "GET", + format: "json", + ...params, + }), + }; + networks = { + /** + * No description + * + * @name EventsDetail + * @request GET:/networks/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/networks/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + }; + notifications = { + /** + * No description + * + * @name NotificationsList + * @request GET:/notifications + */ + notificationsList: ( + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/notifications + */ + notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name ThreadsDetail + * @request GET:/notifications/threads/{id} + */ + threadsDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsPartialUpdate + * @request PATCH:/notifications/threads/{id} + */ + threadsPartialUpdate: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}`, + method: "PATCH", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDelete + * @request DELETE:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionDetail + * @request GET:/notifications/threads/{id}/subscription + */ + threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ThreadsSubscriptionUpdate + * @request PUT:/notifications/threads/{id}/subscription + */ + threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => + this.request({ + path: `/notifications/threads/${id}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + orgs = { + /** + * No description + * + * @name OrgsDetail + * @request GET:/orgs/{org} + */ + orgsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsPartialUpdate + * @request PATCH:/orgs/{org} + */ + orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/orgs/{org}/events + */ + eventsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/orgs/{org}/issues + */ + issuesDetail: ( + org: string, + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/orgs/{org}/members + */ + membersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/orgs/{org}/members/{username} + */ + membersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/orgs/{org}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail + * @request GET:/orgs/{org}/public_members + */ + publicMembersDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDelete + * @request DELETE:/orgs/{org}/public_members/{username} + */ + publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PublicMembersDetail2 + * @request GET:/orgs/{org}/public_members/{username} + * @originalName publicMembersDetail + * @duplicate + */ + publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PublicMembersUpdate + * @request PUT:/orgs/{org}/public_members/{username} + */ + publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/public_members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/orgs/{org}/repos + */ + reposDetail: ( + org: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/orgs/${org}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/orgs/{org}/repos + */ + reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/orgs/{org}/teams + */ + teamsDetail: (org: string, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsCreate + * @request POST:/orgs/{org}/teams + */ + teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => + this.request({ + path: `/orgs/${org}/teams`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + rateLimit = { + /** + * No description + * + * @name RateLimitList + * @request GET:/rate_limit + */ + rateLimitList: (params: RequestParams = {}) => + this.request({ + path: `/rate_limit`, + method: "GET", + format: "json", + ...params, + }), + }; + repos = { + /** + * No description + * + * @name ReposDelete + * @request DELETE:/repos/{owner}/{repo} + */ + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/repos/{owner}/{repo} + */ + reposDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposPartialUpdate + * @request PATCH:/repos/{owner}/{repo} + */ + reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail + * @request GET:/repos/{owner}/{repo}/assignees + */ + assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name AssigneesDetail2 + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + * @originalName assigneesDetail + * @duplicate + */ + assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/assignees/${assignee}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail + * @request GET:/repos/{owner}/{repo}/branches + */ + branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name BranchesDetail2 + * @request GET:/repos/{owner}/{repo}/branches/{branch} + * @originalName branchesDetail + * @duplicate + */ + branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/branches/${branch}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail + * @request GET:/repos/{owner}/{repo}/collaborators + */ + collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDelete + * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsDetail2 + * @request GET:/repos/{owner}/{repo}/collaborators/{user} + * @originalName collaboratorsDetail + * @duplicate + */ + collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name CollaboratorsUpdate + * @request PUT:/repos/{owner}/{repo}/collaborators/{user} + */ + collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/collaborators/${user}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail + * @request GET:/repos/{owner}/{repo}/comments + */ + commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsDelete + * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name CommentsDetail2 + * @request GET:/repos/{owner}/{repo}/comments/{commentId} + * @originalName commentsDetail + * @duplicate + */ + commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} + */ + commentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail + * @request GET:/repos/{owner}/{repo}/commits + */ + commitsDetail: ( + owner: string, + repo: string, + query?: { + author?: string; + path?: string; + sha?: string; + since?: string; + until?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsStatusDetail + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${ref}/status`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsDetail2 + * @request GET:/repos/{owner}/{repo}/commits/{shaCode} + * @originalName commitsDetail + * @duplicate + */ + commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsDetail + * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name CommitsCommentsCreate + * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments + */ + commitsCommentsCreate: ( + owner: string, + repo: string, + shaCode: string, + body: CommitCommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name CompareDetail + * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} + */ + compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDelete + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "DELETE", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsDetail + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + contentsDetail: ( + owner: string, + repo: string, + path: string, + query?: { + path?: string; + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContentsUpdate + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/contents/${path}`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ContributorsDetail + * @request GET:/repos/{owner}/{repo}/contributors + */ + contributorsDetail: ( + owner: string, + repo: string, + query: { + anon: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/contributors`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsDetail + * @request GET:/repos/{owner}/{repo}/deployments + */ + deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsCreate + * @request POST:/repos/{owner}/{repo}/deployments + */ + deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesDetail + * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DeploymentsStatusesCreate + * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses + */ + deploymentsStatusesCreate: ( + owner: string, + repo: string, + id: number, + body: DeploymentStatusesCreate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail + * @request GET:/repos/{owner}/{repo}/downloads + */ + downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name DownloadsDelete + * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} + */ + downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name DownloadsDetail2 + * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} + * @originalName downloadsDetail + * @duplicate + */ + downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/repos/{owner}/{repo}/events + */ + eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksDetail + * @request GET:/repos/{owner}/{repo}/forks + */ + forksDetail: ( + owner: string, + repo: string, + query?: { + sort?: "newes" | "oldes" | "watchers"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ForksCreate + * @request POST:/repos/{owner}/{repo}/forks + */ + forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/forks`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsCreate + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitBlobsDetail + * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} + */ + gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsCreate + * @request POST:/repos/{owner}/{repo}/git/commits + */ + gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitCommitsDetail + * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} + */ + gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail + * @request GET:/repos/{owner}/{repo}/git/refs + */ + gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsCreate + * @request POST:/repos/{owner}/{repo}/git/refs + */ + gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsDelete + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name GitRefsDetail2 + * @request GET:/repos/{owner}/{repo}/git/refs/{ref} + * @originalName gitRefsDetail + * @duplicate + */ + gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitRefsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/refs/${ref}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsCreate + * @request POST:/repos/{owner}/{repo}/git/tags + */ + gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTagsDetail + * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} + */ + gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesCreate + * @request POST:/repos/{owner}/{repo}/git/trees + */ + gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name GitTreesDetail + * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} + */ + gitTreesDetail: ( + owner: string, + repo: string, + shaCode: string, + query?: { + recursive?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDetail + * @request GET:/repos/{owner}/{repo}/hooks + */ + hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksCreate + * @request POST:/repos/{owner}/{repo}/hooks + */ + hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksDelete + * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name HooksDetail2 + * @request GET:/repos/{owner}/{repo}/hooks/{hookId} + * @originalName hooksDetail + * @duplicate + */ + hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} + */ + hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name HooksTestsCreate + * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests + */ + hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail + * @request GET:/repos/{owner}/{repo}/issues + */ + issuesDetail: ( + owner: string, + repo: string, + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCreate + * @request POST:/repos/{owner}/{repo}/issues + */ + issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + issuesCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + since?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} + */ + issuesCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail2 + * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesDetail2 + * @request GET:/repos/{owner}/{repo}/issues/{number} + * @originalName issuesDetail + * @duplicate + */ + issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/issues/{number} + */ + issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/comments + * @originalName issuesCommentsDetail + * @duplicate + */ + issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesCommentsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/comments + */ + issuesCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/comments`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesEventsDetail3 + * @request GET:/repos/{owner}/{repo}/issues/{number}/events + * @originalName issuesEventsDetail + * @duplicate + */ + issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/events`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDetail + * @request GET:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsCreate + * @request POST:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsUpdate + * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels + */ + issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels`, + method: "PUT", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesLabelsDelete2 + * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels/{name} + * @originalName issuesLabelsDelete + * @duplicate + */ + issuesLabelsDelete2: (owner: string, repo: string, number: number, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/repos/{owner}/{repo}/keys + */ + keysDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/repos/{owner}/{repo}/keys + */ + keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} + */ + keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail2 + * @request GET:/repos/{owner}/{repo}/keys/{keyId} + * @originalName keysDetail + * @duplicate + */ + keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail + * @request GET:/repos/{owner}/{repo}/labels + */ + labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsCreate + * @request POST:/repos/{owner}/{repo}/labels + */ + labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsDelete + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name LabelsDetail2 + * @request GET:/repos/{owner}/{repo}/labels/{name} + * @originalName labelsDetail + * @duplicate + */ + labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name LabelsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/labels/${name}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name LanguagesDetail + * @request GET:/repos/{owner}/{repo}/languages + */ + languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/languages`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MergesCreate + * @request POST:/repos/{owner}/{repo}/merges + */ + mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/merges`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail + * @request GET:/repos/{owner}/{repo}/milestones + */ + milestonesDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + sort?: "due_date" | "completeness"; + state?: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesCreate + * @request POST:/repos/{owner}/{repo}/milestones + */ + milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesDelete + * @request DELETE:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MilestonesDetail2 + * @request GET:/repos/{owner}/{repo}/milestones/{number} + * @originalName milestonesDetail + * @duplicate + */ + milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/milestones/{number} + */ + milestonesPartialUpdate: ( + owner: string, + repo: string, + number: number, + body: MilestoneUpdate, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MilestonesLabelsDetail + * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels + */ + milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsDetail + * @request GET:/repos/{owner}/{repo}/notifications + */ + notificationsDetail: ( + owner: string, + repo: string, + query?: { + all?: boolean; + participating?: boolean; + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name NotificationsUpdate + * @request PUT:/repos/{owner}/{repo}/notifications + */ + notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/notifications`, + method: "PUT", + body: body, + ...params, + }), + + /** + * No description + * + * @name PullsDetail + * @request GET:/repos/{owner}/{repo}/pulls + */ + pullsDetail: ( + owner: string, + repo: string, + query?: { + base?: string; + head?: string; + state?: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCreate + * @request POST:/repos/{owner}/{repo}/pulls + */ + pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + pullsCommentsDetail: ( + owner: string, + repo: string, + query?: { + direction?: string; + since?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDelete + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} + */ + pullsCommentsPartialUpdate: ( + owner: string, + repo: string, + commentId: number, + body: CommentBody, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsDetail2 + * @request GET:/repos/{owner}/{repo}/pulls/{number} + * @originalName pullsDetail + * @duplicate + */ + pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/pulls/{number} + */ + pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsDetail3 + * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments + * @originalName pullsCommentsDetail + * @duplicate + */ + pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommentsCreate + * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments + */ + pullsCommentsCreate: ( + owner: string, + repo: string, + number: number, + body: PullsCommentPost, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsCommitsDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits + */ + pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsFilesDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/files + */ + pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/files`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name PullsMergeDetail + * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name PullsMergeUpdate + * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge + */ + pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReadmeDetail + * @request GET:/repos/{owner}/{repo}/readme + */ + readmeDetail: ( + owner: string, + repo: string, + query?: { + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/readme`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail + * @request GET:/repos/{owner}/{repo}/releases + */ + releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesCreate + * @request POST:/repos/{owner}/{repo}/releases + */ + releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDelete + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail + * @request GET:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} + */ + releasesAssetsPartialUpdate: ( + owner: string, + repo: string, + id: string, + body: AssetPatch, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/releases/assets/${id}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesDelete + * @request DELETE:/repos/{owner}/{repo}/releases/{id} + */ + releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReleasesDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id} + * @originalName releasesDetail + * @duplicate + */ + releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesPartialUpdate + * @request PATCH:/repos/{owner}/{repo}/releases/{id} + */ + releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}`, + method: "PATCH", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReleasesAssetsDetail2 + * @request GET:/repos/{owner}/{repo}/releases/{id}/assets + * @originalName releasesAssetsDetail + * @duplicate + */ + releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/releases/${id}/assets`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StargazersDetail + * @request GET:/repos/{owner}/{repo}/stargazers + */ + stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stargazers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCodeFrequencyDetail + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/code_frequency`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsCommitActivityDetail + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/commit_activity`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsContributorsDetail + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/contributors`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsParticipationDetail + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/participation`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatsPunchCardDetail + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/stats/punch_card`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesDetail + * @request GET:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name StatusesCreate + * @request POST:/repos/{owner}/{repo}/statuses/{ref} + */ + statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/statuses/${ref}`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscribersDetail + * @request GET:/repos/{owner}/{repo}/subscribers + */ + subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscribers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDelete + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionDetail + * @request GET:/repos/{owner}/{repo}/subscription + */ + subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionUpdate + * @request PUT:/repos/{owner}/{repo}/subscription + */ + subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/subscription`, + method: "PUT", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name TagsDetail + * @request GET:/repos/{owner}/{repo}/tags + */ + tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/tags`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/repos/{owner}/{repo}/teams + */ + teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/teams`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name WatchersDetail + * @request GET:/repos/{owner}/{repo}/watchers + */ + watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/repos/${owner}/${repo}/watchers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/repos/{owner}/{repo}/{archive_format}/{path} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: ( + owner: string, + repo: string, + archiveFormat: "tarball" | "zipball", + path: string, + params: RequestParams = {}, + ) => + this.request({ + path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + method: "GET", + ...params, + }), + }; + repositories = { + /** + * No description + * + * @name RepositoriesList + * @request GET:/repositories + */ + repositoriesList: ( + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + search = { + /** + * No description + * + * @name CodeList + * @request GET:/search/code + */ + codeList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "indexed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/code`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/search/issues + */ + issuesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "updated" | "created" | "comments"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name RepositoriesList + * @request GET:/search/repositories + */ + repositoriesList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "stars" | "forks" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/repositories`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersList + * @request GET:/search/users + */ + usersList: ( + query: { + order?: "desc" | "asc"; + q: string; + sort?: "followers" | "repositories" | "joined"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/search/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + teams = { + /** + * No description + * + * @name TeamsDelete + * @request DELETE:/teams/{teamId} + */ + teamsDelete: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name TeamsDetail + * @request GET:/teams/{teamId} + */ + teamsDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name TeamsPartialUpdate + * @request PATCH:/teams/{teamId} + */ + teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDetail + * @request GET:/teams/{teamId}/members + */ + membersDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembersDelete + * @request DELETE:/teams/{teamId}/members/{username} + */ + membersDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembersDetail2 + * @request GET:/teams/{teamId}/members/{username} + * @originalName membersDetail + * @duplicate + */ + membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MembersUpdate + * @request PUT:/teams/{teamId}/members/{username} + */ + membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/members/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name MembershipsDelete + * @request DELETE:/teams/{teamId}/memberships/{username} + */ + membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name MembershipsDetail + * @request GET:/teams/{teamId}/memberships/{username} + */ + membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name MembershipsUpdate + * @request PUT:/teams/{teamId}/memberships/{username} + */ + membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/memberships/${username}`, + method: "PUT", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/teams/{teamId}/repos + */ + reposDetail: (teamId: number, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposDelete + * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} + */ + reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name ReposDetail2 + * @request GET:/teams/{teamId}/repos/{owner}/{repo} + * @originalName reposDetail + * @duplicate + */ + reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposUpdate + * @request PUT:/teams/{teamId}/repos/{owner}/{repo} + */ + reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/teams/${teamId}/repos/${owner}/${repo}`, + method: "PUT", + ...params, + }), + }; + user = { + /** + * No description + * + * @name UserList + * @request GET:/user + */ + userList: (params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name UserPartialUpdate + * @request PATCH:/user + */ + userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => + this.request({ + path: `/user`, + method: "PATCH", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @name EmailsDelete + * @request DELETE:/user/emails + */ + emailsDelete: (body: UserEmails, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "DELETE", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @name EmailsList + * @request GET:/user/emails + */ + emailsList: (params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EmailsCreate + * @request POST:/user/emails + */ + emailsCreate: (body: EmailsPost, params: RequestParams = {}) => + this.request({ + path: `/user/emails`, + method: "POST", + body: body, + ...params, + }), + + /** + * No description + * + * @name FollowersList + * @request GET:/user/followers + */ + followersList: (params: RequestParams = {}) => + this.request({ + path: `/user/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingList + * @request GET:/user/following + */ + followingList: (params: RequestParams = {}) => + this.request({ + path: `/user/following`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDelete + * @request DELETE:/user/following/{username} + */ + followingDelete: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/user/following/{username} + */ + followingDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowingUpdate + * @request PUT:/user/following/{username} + */ + followingUpdate: (username: string, params: RequestParams = {}) => + this.request({ + path: `/user/following/${username}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name IssuesList + * @request GET:/user/issues + */ + issuesList: ( + query: { + direction: "asc" | "desc"; + filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + labels: string; + since?: string; + sort: "created" | "updated" | "comments"; + state: "open" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/issues`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysList + * @request GET:/user/keys + */ + keysList: (params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysCreate + * @request POST:/user/keys + */ + keysCreate: (body: UserKeysPost, params: RequestParams = {}) => + this.request({ + path: `/user/keys`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDelete + * @request DELETE:/user/keys/{keyId} + */ + keysDelete: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/user/keys/{keyId} + */ + keysDetail: (keyId: number, params: RequestParams = {}) => + this.request({ + path: `/user/keys/${keyId}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsList + * @request GET:/user/orgs + */ + orgsList: (params: RequestParams = {}) => + this.request({ + path: `/user/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposList + * @request GET:/user/repos + */ + reposList: ( + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReposCreate + * @request POST:/user/repos + */ + reposCreate: (body: PostRepo, params: RequestParams = {}) => + this.request({ + path: `/user/repos`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredList + * @request GET:/user/starred + */ + starredList: ( + query?: { + direction?: string; + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/user/starred`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDelete + * @request DELETE:/user/starred/{owner}/{repo} + */ + starredDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/user/starred/{owner}/{repo} + */ + starredDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name StarredUpdate + * @request PUT:/user/starred/{owner}/{repo} + */ + starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/starred/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsList + * @request GET:/user/subscriptions + */ + subscriptionsList: (params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDelete + * @request DELETE:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/user/subscriptions/{owner}/{repo} + */ + subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsUpdate + * @request PUT:/user/subscriptions/{owner}/{repo} + */ + subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: `/user/subscriptions/${owner}/${repo}`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @name TeamsList + * @request GET:/user/teams + */ + teamsList: (params: RequestParams = {}) => + this.request({ + path: `/user/teams`, + method: "GET", + format: "json", + ...params, + }), + }; + users = { + /** + * No description + * + * @name UsersList + * @request GET:/users + */ + usersList: ( + query?: { + since?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name UsersDetail + * @request GET:/users/{username} + */ + usersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name EventsDetail + * @request GET:/users/{username}/events + */ + eventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name EventsOrgsDetail + * @request GET:/users/{username}/events/orgs/{org} + */ + eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/events/orgs/${org}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name FollowersDetail + * @request GET:/users/{username}/followers + */ + followersDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/followers`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name FollowingDetail + * @request GET:/users/{username}/following/{targetUser} + */ + followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/following/${targetUser}`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GistsDetail + * @request GET:/users/{username}/gists + */ + gistsDetail: ( + username: string, + query?: { + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/gists`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name KeysDetail + * @request GET:/users/{username}/keys + */ + keysDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/keys`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name OrgsDetail + * @request GET:/users/{username}/orgs + */ + orgsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/orgs`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsDetail + * @request GET:/users/{username}/received_events + */ + receivedEventsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReceivedEventsPublicDetail + * @request GET:/users/{username}/received_events/public + */ + receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/received_events/public`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name ReposDetail + * @request GET:/users/{username}/repos + */ + reposDetail: ( + username: string, + query?: { + type?: "all" | "public" | "private" | "forks" | "sources" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/users/${username}/repos`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @name StarredDetail + * @request GET:/users/{username}/starred + */ + starredDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/starred`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name SubscriptionsDetail + * @request GET:/users/{username}/subscriptions + */ + subscriptionsDetail: (username: string, params: RequestParams = {}) => + this.request({ + path: `/users/${username}/subscriptions`, + method: "GET", + ...params, + }), + }; +} diff --git a/tests/spec/sortTypes/test.js b/tests/spec/sortTypes/test.js new file mode 100644 index 00000000..d3acca01 --- /dev/null +++ b/tests/spec/sortTypes/test.js @@ -0,0 +1,22 @@ +const { generateApiForTest } = require("../../helpers/generateApiForTest"); +const { resolve } = require("path"); +const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); +const createSchemaInfos = require("../../helpers/createSchemaInfos"); +const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); + +const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") }); + +schemas.forEach(({ absolutePath, apiFileName }) => { + generateApiForTest({ + testName: "--sort-types option test", + silent: true, + name: apiFileName, + input: absolutePath, + output: resolve(__dirname, "./"), + generateClient: true, + sortTypes: true, + }).then(() => { + validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); + assertGeneratedModule(resolve(__dirname, `./${apiFileName}`), resolve(__dirname, `./expected.ts`)); + }); +}); diff --git a/tests/spec/templates/expected.ts b/tests/spec/templates/expected.ts index b9567f36..53039a4b 100644 --- a/tests/spec/templates/expected.ts +++ b/tests/spec/templates/expected.ts @@ -2092,7 +2092,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/templates/schema.ts b/tests/spec/templates/schema.ts index b9567f36..53039a4b 100644 --- a/tests/spec/templates/schema.ts +++ b/tests/spec/templates/schema.ts @@ -2092,7 +2092,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/typeSuffixPrefix/expected.ts b/tests/spec/typeSuffixPrefix/expected.ts index e3d0b4fd..5213f846 100644 --- a/tests/spec/typeSuffixPrefix/expected.ts +++ b/tests/spec/typeSuffixPrefix/expected.ts @@ -1943,7 +1943,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/typeSuffixPrefix/schema.ts b/tests/spec/typeSuffixPrefix/schema.ts index e3d0b4fd..5213f846 100644 --- a/tests/spec/typeSuffixPrefix/schema.ts +++ b/tests/spec/typeSuffixPrefix/schema.ts @@ -1943,7 +1943,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/unionEnums/expected.ts b/tests/spec/unionEnums/expected.ts index e6f774c2..1d07ed51 100644 --- a/tests/spec/unionEnums/expected.ts +++ b/tests/spec/unionEnums/expected.ts @@ -198,7 +198,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/spec/unionEnums/schema.ts b/tests/spec/unionEnums/schema.ts index e6f774c2..1d07ed51 100644 --- a/tests/spec/unionEnums/schema.ts +++ b/tests/spec/unionEnums/schema.ts @@ -198,7 +198,7 @@ export class HttpClient { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal, + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response as HttpResponse; diff --git a/tests/validate.js b/tests/validate.js index 31559c3d..3495ec29 100644 --- a/tests/validate.js +++ b/tests/validate.js @@ -1,12 +1,9 @@ const { resolve } = require("path"); -const createGeneratedApiInfos = require("./helpers/createGeneratedApiInfos"); +const allSchemas = require("./allSchemas"); const validateGeneratedModule = require("./helpers/validateGeneratedModule"); -const v2ApiPaths = createGeneratedApiInfos(resolve(__dirname, "./generated/v2.0")); -const v3ApiPaths = createGeneratedApiInfos(resolve(__dirname, "./generated/v3.0")); - -[...v2ApiPaths, ...v3ApiPaths].forEach((pathToFile) => { - validateGeneratedModule(pathToFile); +allSchemas.forEach((schema) => { + validateGeneratedModule(resolve(schema.outputPath, schema.apiFileName)); }); console.log("everything is good:)");